On Tue, 2024-10-08 at 12:04 +0100, Jonathan Cameron wrote:
> On Mon, 07 Oct 2024 14:53:54 +0100
> David Woodhouse <dw...@infradead.org> wrote:
> 
> > 
> > +    aml_append(dev, aml_name_decl("_HID",
> > aml_string("AMZNC10C")));
> 
> Nice _HID :)

Can't take credit for that; it was mst's idea :)

> > +    aml_append(dev, aml_name_decl("_CID", aml_string("VMCLOCK")));
> > +    aml_append(dev, aml_name_decl("_DDN", aml_string("VMCLOCK")));
> > +
> > +    /* Simple status method */
> > +    method = aml_method("_STA", 0, AML_NOTSERIALIZED);
> > +    addr = aml_local(0);
> > +    aml_append(method, aml_store(aml_int(0xf), addr));
> > +    aml_append(method, aml_return(addr));
> > +    aml_append(dev, method);
> 
> It's static so you should be able to do:
> aml_append(dev, aml_name_decl("_STA", aml_int(0xf)));

Thanks. Tested and pushed to
https://git.infradead.org/users/dwmw2/qemu.git/shortlog/refs/heads/vmclock

> 
> > +static Property vmclock_device_properties[] = {
> > +    DEFINE_PROP_END_OF_LIST(),
> > +};
> > +
> > +static void vmclock_device_class_init(ObjectClass *klass, void *data)
> > +{
> > +    DeviceClass *dc = DEVICE_CLASS(klass);
> > +
> > +    dc->vmsd = &vmstate_vmclock;
> > +    dc->realize = vmclock_realize;
> > +    device_class_set_props(dc, vmclock_device_properties);
> 
> Probably a silly question but why register no properties?
> Is that any different to not registering them?
> + a quick look suggests not all class_init functions
> set them.

They'll be used in the future. Phase 1 of the VMCLOCK device just
signals *disruption* to guests, so they know that their clocks are
wrong immediately after migration and they have to resync before
performing any operations that require accurate time.

Phase 2 will advertise the current time (based on the TSC of the new
host) directly to the guest. That's when it'll need a little more
setup.

So when I copied the boilerplate from vmgenid I just ripped out the
actual UUID property, not the whole setup.

 For now I've just been testing the guest side with this hack, FWIW:

--- a/hw/acpi/vmclock.c
+++ b/hw/acpi/vmclock.c
@@ -151,6 +151,18 @@ static void vmclock_realize(DeviceState *dev,
Error **errp)
 
     qemu_register_reset(vmclock_handle_reset, vms);
 
+    vms->clk->time_type = VMCLOCK_TIME_TAI;
+    vms->clk->flags = VMCLOCK_FLAG_TAI_OFFSET_VALID;
+    vms->clk->tai_offset_sec = -3600;
+    vms->clk->clock_status = VMCLOCK_STATUS_SYNCHRONIZED;
+    vms->clk->counter_value = 0;
+    vms->clk->counter_id = VMCLOCK_COUNTER_X86_TSC;
+    vms->clk->time_sec = 1704067200;
+    vms->clk->time_frac_sec = 0x8000000000000000ULL;
+    vms->clk->counter_period_frac_sec = 0x1a6e39b3e0ULL;
+    vms->clk->counter_period_shift = 4;
+    //vms->clk->counter_period_frac_sec = 0x1934c67f9b2ce6ULL;
+
     vmclock_update_guest(vms);
 }
 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to