On 09/01/2023 21.53, B wrote:

This made me wonder if a better approach here would be to move the logic that determines 
if LOST_TICK_POLICY_SLEW is available into the "lost_tick_policy" property 
setter defined at 
https://gitlab.com/qemu-project/qemu/-/blob/master/hw/core/qdev-properties-system.c#L558.
If you look at the code directly below the link above you can see how 
set_blocksize() overrides the .set function for qdev_prop_blocksize to provide 
additional validation, which is similar to what we are trying to do here.

I think it may be possible to come up with a similar solution for 
qdev_prop_losttickpolicy which makes use of the logic you suggested before i.e.

      MachineState *ms = MACHINE(qdev_get_machine());

      if (!object_dynamic_cast(OBJECT(ms), TYPE_X86_MACHINE)) {
          ....
      }

which can then emit a suitable warning or return an error accordingly. A quick 
glance at hw/core/qdev-properties-system.c suggests there are a number of 
similar examples showing how this could be done.

Thanks, I like that idea! I'll give it a try!

Does the microvm need consideration as well?

microvm is also derived from TYPE_X86_MACHINE, so I think the check that Mark suggested should be fine.

 Thomas


Reply via email to