qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH RFC V2 12/37] hw/acpi: Use qemu_present_cpu() API in ACPI CPU


From: Gavin Shan
Subject: Re: [PATCH RFC V2 12/37] hw/acpi: Use qemu_present_cpu() API in ACPI CPU hotplug init
Date: Thu, 28 Sep 2023 10:40:40 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

Hi Salil,

On 9/26/23 20:04, Salil Mehta wrote:
ACPI CPU Hotplug code assumes a virtual CPU is unplugged if the CPUState object
is absent in the list of ths possible CPUs(CPUArchIdList *possible_cpus)
maintained on per-machine basis. Use the earlier introduced qemu_present_cpu()
API to check this state.

This change should have no bearing on the functionality of any architecture and
is mere a representational change.

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

diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 45defdc0e2..d5ba37b209 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -225,7 +225,10 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
      state->dev_count = id_list->len;
      state->devs = g_new0(typeof(*state->devs), state->dev_count);
      for (i = 0; i < id_list->len; i++) {
-        state->devs[i].cpu =  CPU(id_list->cpus[i].cpu);
+        struct CPUState *cpu = CPU(id_list->cpus[i].cpu);
+        if (qemu_present_cpu(cpu)) {
+            state->devs[i].cpu = cpu;
+        }
          state->devs[i].arch_id = id_list->cpus[i].arch_id;
      }
      memory_region_init_io(&state->ctrl_reg, owner, &cpu_hotplug_ops, state,

I don't think qemu_present_cpu() is needed because all possible vCPUs are 
present
for x86 and arm64 at this point? Besides, we have the assumption all 
hotpluggable
vCPUs are present, looking at James' kernel series where 
ACPI_HOTPLUG_PRESENT_CPU
exists in linux/drivers/acpi/Kconfig :)

Thanks,
Gavin




reply via email to

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