[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] pc: Implement -no-hpet as sugar for -machine hpet=off
From: |
Eduardo Habkost |
Subject: |
Re: [PATCH] pc: Implement -no-hpet as sugar for -machine hpet=off |
Date: |
Wed, 21 Oct 2020 10:44:57 -0400 |
On Wed, Oct 21, 2020 at 03:31:30PM +0200, Paolo Bonzini wrote:
> On 21/10/20 14:39, Eduardo Habkost wrote:
> >> Should this be within #ifdef CONFIG_HPET? [...]
> > Oops, I wasn't aware of CONFIG_HPET
>
> That's just a config-devices.h (aka CONFIG_DEVICES) definition.
>
> > , and hadn't noticed that
> > pc_basic_device_init() uses qdev_try_new(). I agree that not
> > failing if hpet=on is explicitly set and CONFIG_HPET=n is wrong.
> >
> > Supporting a "require hpet to be on" use case would be a new
> > feature and out of scope of this work, though. I will just
> > rename the property to "allow-hpet". We can still implement a
> > OnOfAuto "hpet" property in the future, if we think it's useful.
>
> You don't need OnOffAuto; you can just change the qdev_try_new() to
> qdev_new() if you default it to true only if CONFIG_HPET is defined. It
> should work properly, defaulting to on/off depending on CONFIG_HPET and
> failing if hpet=on is explicitly set with CONFIG_HPET=n.
Makes sense, except for the fact that qdev_new(TYPE_HPET) will
abort if CONFIG_HPET=n. But we can just use qdev_try_new() and
error out if it fails.
--
Eduardo