diff mbox series

[3/9] hw/acpi: Add ACPI CPU hotplug init stub

Message ID 20230929124304.13672-4-salil.mehta@huawei.com (mailing list archive)
State New, archived
Headers show
Series Add architecture agnostic code to support vCPU Hotplug | expand

Commit Message

Salil Mehta Sept. 29, 2023, 12:42 p.m. UTC
ACPI CPU hotplug related initialization should only happen if ACPI_CPU_HOTPLUG
support has been enabled for particular architecture. Add cpu_hotplug_hw_init()
stub to avoid compilation break.

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
 hw/acpi/acpi-cpu-hotplug-stub.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alex Bennée Sept. 29, 2023, 2:27 p.m. UTC | #1
Salil Mehta <salil.mehta@huawei.com> writes:

> ACPI CPU hotplug related initialization should only happen if ACPI_CPU_HOTPLUG
> support has been enabled for particular architecture. Add cpu_hotplug_hw_init()
> stub to avoid compilation break.

When does the compilation break? It's usually ok to include stubs with
that commit.

>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>  hw/acpi/acpi-cpu-hotplug-stub.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/hw/acpi/acpi-cpu-hotplug-stub.c b/hw/acpi/acpi-cpu-hotplug-stub.c
> index 3fc4b14c26..c6c61bb9cd 100644
> --- a/hw/acpi/acpi-cpu-hotplug-stub.c
> +++ b/hw/acpi/acpi-cpu-hotplug-stub.c
> @@ -19,6 +19,12 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
>      return;
>  }
>  
> +void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
> +                         CPUHotplugState *state, hwaddr base_addr)
> +{
> +    return;
> +}
> +
>  void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list)
>  {
>      return;
Salil Mehta Sept. 29, 2023, 3:47 p.m. UTC | #2
> From: Alex Bennée <alex.bennee@linaro.org>
> Sent: Friday, September 29, 2023 3:27 PM
> To: Salil Mehta <salil.mehta@huawei.com>
> Cc: qemu-devel@nongnu.org; qemu-arm@nongnu.org; maz@kernel.org; jean-
> philippe@linaro.org; Jonathan Cameron <jonathan.cameron@huawei.com>;
> lpieralisi@kernel.org; peter.maydell@linaro.org;
> richard.henderson@linaro.org; imammedo@redhat.com; andrew.jones@linux.dev;
> david@redhat.com; philmd@linaro.org; eric.auger@redhat.com;
> oliver.upton@linux.dev; pbonzini@redhat.com; mst@redhat.com;
> will@kernel.org; gshan@redhat.com; rafael@kernel.org;
> linux@armlinux.org.uk; darren@os.amperecomputing.com;
> ilkka@os.amperecomputing.com; vishnu@os.amperecomputing.com;
> karl.heubaum@oracle.com; miguel.luis@oracle.com; salil.mehta@opnsrc.net;
> zhukeqian <zhukeqian1@huawei.com>; wangxiongfeng (C)
> <wangxiongfeng2@huawei.com>; wangyanan (Y) <wangyanan55@huawei.com>;
> jiakernel2@gmail.com; maobibo@loongson.cn; lixianglai@loongson.cn; Linuxarm
> <linuxarm@huawei.com>
> Subject: Re: [PATCH 3/9] hw/acpi: Add ACPI CPU hotplug init stub
> 
> 
> Salil Mehta <salil.mehta@huawei.com> writes:
> 
> > ACPI CPU hotplug related initialization should only happen if ACPI_CPU_HOTPLUG
> > support has been enabled for particular architecture. Add cpu_hotplug_hw_init()
> > stub to avoid compilation break.
> 
> When does the compilation break? It's usually ok to include stubs with
> that commit.


To be specific. it is not a compilation break but linking error.

Support of ACPI_CPU_HOTPLUG is optional. This flag is defined in architecture
specific Kconfig. Function cpu_hotplug_hw_init() is part of the hw/acpi/cpu.c
which gets compiled only when a particular architecture defines ACPI_CPU_HOTPLUG
flag. 

ACPI GED framework support for CPU Hotplug is not specific to any architecture.
acpi_ged_initfn() calls cpu_hotplug_hw_init() when GED device gets created.
This functions gets called irrespective of the fact CPU Hotplug is supported or
not. If ACPI_CPU_HOTPLUG is not enabled then presence of cpu_hotplug_hw_init()
will cause linking error without the presence of stub.


Thanks
Salil.

> > Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> > ---
> >  hw/acpi/acpi-cpu-hotplug-stub.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/hw/acpi/acpi-cpu-hotplug-stub.c b/hw/acpi/acpi-cpu-hotplug-
> stub.c
> > index 3fc4b14c26..c6c61bb9cd 100644
> > --- a/hw/acpi/acpi-cpu-hotplug-stub.c
> > +++ b/hw/acpi/acpi-cpu-hotplug-stub.c
> > @@ -19,6 +19,12 @@ void legacy_acpi_cpu_hotplug_init(MemoryRegion
> *parent, Object *owner,
> >      return;
> >  }
> >
> > +void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
> > +                         CPUHotplugState *state, hwaddr base_addr)
> > +{
> > +    return;
> > +}
> > +
> >  void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList
> ***list)
> >  {
> >      return;
> 
> 
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
Philippe Mathieu-Daudé Oct. 2, 2023, 6:11 a.m. UTC | #3
Hi Salil,

On 29/9/23 17:47, Salil Mehta wrote:
>> From: Alex Bennée <alex.bennee@linaro.org>
>> Sent: Friday, September 29, 2023 3:27 PM
>> To: Salil Mehta <salil.mehta@huawei.com>
>> Cc: qemu-devel@nongnu.org; qemu-arm@nongnu.org; maz@kernel.org; jean-
>> philippe@linaro.org; Jonathan Cameron <jonathan.cameron@huawei.com>;
>> lpieralisi@kernel.org; peter.maydell@linaro.org;
>> richard.henderson@linaro.org; imammedo@redhat.com; andrew.jones@linux.dev;
>> david@redhat.com; philmd@linaro.org; eric.auger@redhat.com;
>> oliver.upton@linux.dev; pbonzini@redhat.com; mst@redhat.com;
>> will@kernel.org; gshan@redhat.com; rafael@kernel.org;
>> linux@armlinux.org.uk; darren@os.amperecomputing.com;
>> ilkka@os.amperecomputing.com; vishnu@os.amperecomputing.com;
>> karl.heubaum@oracle.com; miguel.luis@oracle.com; salil.mehta@opnsrc.net;
>> zhukeqian <zhukeqian1@huawei.com>; wangxiongfeng (C)
>> <wangxiongfeng2@huawei.com>; wangyanan (Y) <wangyanan55@huawei.com>;
>> jiakernel2@gmail.com; maobibo@loongson.cn; lixianglai@loongson.cn; Linuxarm
>> <linuxarm@huawei.com>
>> Subject: Re: [PATCH 3/9] hw/acpi: Add ACPI CPU hotplug init stub
>>
>>
>> Salil Mehta <salil.mehta@huawei.com> writes:
>>
>>> ACPI CPU hotplug related initialization should only happen if ACPI_CPU_HOTPLUG
>>> support has been enabled for particular architecture. Add cpu_hotplug_hw_init()
>>> stub to avoid compilation break.
>>
>> When does the compilation break? It's usually ok to include stubs with
>> that commit.
> 
> 
> To be specific. it is not a compilation break but linking error.
> 
> Support of ACPI_CPU_HOTPLUG is optional. This flag is defined in architecture
> specific Kconfig. Function cpu_hotplug_hw_init() is part of the hw/acpi/cpu.c
> which gets compiled only when a particular architecture defines ACPI_CPU_HOTPLUG
> flag.
> 
> ACPI GED framework support for CPU Hotplug is not specific to any architecture.
> acpi_ged_initfn() calls cpu_hotplug_hw_init() when GED device gets created.
> This functions gets called irrespective of the fact CPU Hotplug is supported or
> not. If ACPI_CPU_HOTPLUG is not enabled then presence of cpu_hotplug_hw_init()
> will cause linking error without the presence of stub.

We can extract the common pattern in both
- ich9_pm_set_cpu_hotplug_legacy()
- piix4_set_cpu_hotplug_legacy()
to take (AcpiCpuHotplug, CPUHotplugState) params,
then guard the cpu_hotplug_hw_init() call within
CONFIG_ACPI_CPU_HOTPLUG ifdef'ry. Doing so we can
also remove the acpi_switch_to_modern_cphp() stub.

Regards,

Phil.

>>> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
>>> ---
>>>   hw/acpi/acpi-cpu-hotplug-stub.c | 6 ++++++
>>>   1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/hw/acpi/acpi-cpu-hotplug-stub.c b/hw/acpi/acpi-cpu-hotplug-stub.c
index 3fc4b14c26..c6c61bb9cd 100644
--- a/hw/acpi/acpi-cpu-hotplug-stub.c
+++ b/hw/acpi/acpi-cpu-hotplug-stub.c
@@ -19,6 +19,12 @@  void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
     return;
 }
 
+void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
+                         CPUHotplugState *state, hwaddr base_addr)
+{
+    return;
+}
+
 void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list)
 {
     return;