[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/5] qdev: add user_creatable_requires_machine_allowance c
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 1/5] qdev: add user_creatable_requires_machine_allowance class flag |
Date: |
Thu, 21 Apr 2022 16:59:24 +0100 |
On Thu, 31 Mar 2022 at 13:19, Damien Hedde <damien.hedde@greensocs.com> wrote:
>
> This flag will be used in device_add to check if
> the device needs special allowance from the machine
> model.
>
> It will replace the current check based only on the
> device being a TYPE_SYB_BUS_DEVICE.
>
> Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
> ---
>
> v2:
> + change the flag name and put it just below user_creatable
> ---
> include/hw/qdev-core.h | 9 +++++++++
> hw/core/qdev.c | 1 +
> hw/core/sysbus.c | 1 +
> 3 files changed, 11 insertions(+)
>
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index 92c3d65208..6a040fcd3b 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -122,6 +122,15 @@ struct DeviceClass {
> * TODO remove once we're there
> */
> bool user_creatable;
> + /*
> + * Some devices can be user created under certain conditions (eg:
> + * specific machine support for sysbus devices), but it is
> + * preferable to prevent global allowance for the reasons
> + * described above.
> + * This flag is an additional constraint over user_creatable:
> + * user_creatable still needs to be set to true.
> + */
> + bool user_creatable_requires_machine_allowance;
"allowance" doesn't have the meaning you seem to be trying to give it here.
(It means "the amount of something you're allowed to have", like
a baggage allowance, or "an amount of money you're given for something",
like a travel allowance.)
Do you mean "user creatable only if the machine permits it" ?
More generally, the pluggable-sysbus stuff is an awful hack
that I wish we didn't have to have. I'm not sure I want to see
us expanding the use of it to other device types...
thanks
-- PMM