qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/6] hw/rtc/mc146818rtc: Add a property for the availability


From: Thomas Huth
Subject: Re: [PATCH 4/6] hw/rtc/mc146818rtc: Add a property for the availability of the slew tick policy
Date: Tue, 10 Jan 2023 08:52:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

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

[Prev in Thread] Current Thread [Next in Thread]