[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 5/7] DO NOT MERGE: acpi: cpuhp: add option to AML genrator to opt-i
From: |
Igor Mammedov |
Subject: |
[RFC 5/7] DO NOT MERGE: acpi: cpuhp: add option to AML genrator to opt-in to always present vCPUs |
Date: |
Tue, 12 Nov 2024 18:02:56 +0100 |
Looking at [1] what 'present' bit would do, it's no necessary as it's
statically defined for VM instance. So instead of introducing new ABI
in cpuhp flags register, add CPUHotplugFeatures::always_present_cpus
config option, that when set change _STA default return value to always
present but not enabled. And the interpose 'enabled' check on top of it,
which would set 'enabled' bit in return value if vCPU is enabled.
Platforms that need the feature can opt in by setting
CPUHotplugFeatures::always_present_cpus = true
for other plaforms _STA will revert to the behavior before [1]
1)
bf1ecc8dad606 (w/acpi: Update ACPI `_STA` method with QOM vCPU ACPI Hotplug
states)
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
include/hw/acpi/cpu.h | 1 +
hw/acpi/cpu.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
index 32654dc274..e9e9c28359 100644
--- a/include/hw/acpi/cpu.h
+++ b/include/hw/acpi/cpu.h
@@ -56,6 +56,7 @@ typedef struct CPUHotplugFeatures {
bool acpi_1_compatible;
bool has_legacy_cphp;
bool fw_unplugs_cpu;
+ bool always_present_cpus;
const char *smi_path;
} CPUHotplugFeatures;
diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
index 5cb60ca8bc..67513450f9 100644
--- a/hw/acpi/cpu.c
+++ b/hw/acpi/cpu.c
@@ -452,15 +452,20 @@ void build_cpus_aml(Aml *table, MachineState *machine,
CPUHotplugFeatures opts,
method = aml_method(CPU_STS_METHOD, 1, AML_SERIALIZED);
{
+ /*
+ * For always present CPUs set all bits except of 'enabled'
+ * ACPI 1.0b: chapter '6.3.5 _STA'
+ */
+ uint8_t default_sta = opts.always_present_cpus ? 0xd : 0;
Aml *idx = aml_arg(0);
- Aml *sta = aml_local(0);
+ Aml *sta = aml_local(default_sta);
aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
aml_append(method, aml_store(idx, cpu_selector));
aml_append(method, aml_store(zero, sta));
ifctx = aml_if(aml_equal(is_enabled, one));
{
- aml_append(ifctx, aml_store(aml_int(0xF), sta));
+ aml_append(ifctx, aml_or(aml_int(0xF), sta, sta));
}
aml_append(method, ifctx);
aml_append(method, aml_release(ctrl_lock));
--
2.43.0
- [PATCH 0/7 for-9.2] Fix broken cpu hotplug after migration, Igor Mammedov, 2024/11/12
- [RFC 6/7] DO NOT MERGE: acpi: cpuhp: use 'realized' status of vCPU to check if CPU is enabled, Igor Mammedov, 2024/11/12
- [PATCH 4/7 for-9.2] tests/acpi: update expected blobs, Igor Mammedov, 2024/11/12
- [RFC 7/7] DO NOT MERGE: acpi: cpuhp: preserve always present vCPUs on unplug, Igor Mammedov, 2024/11/12
- [PATCH 3/7 for-9.2] Revert "hw/acpi: Make CPUs ACPI `presence` conditional during vCPU hot-unplug", Igor Mammedov, 2024/11/12
- [PATCH 1/7 for-9.2] qtest: allow ACPI DSDT Table changes, Igor Mammedov, 2024/11/12
- [PATCH 2/7 for-9.2] Revert "hw/acpi: Update ACPI `_STA` method with QOM vCPU ACPI Hotplug states", Igor Mammedov, 2024/11/12
- [RFC 5/7] DO NOT MERGE: acpi: cpuhp: add option to AML genrator to opt-in to always present vCPUs,
Igor Mammedov <=
- Re: [PATCH 0/7 for-9.2] Fix broken cpu hotplug after migration, Igor Mammedov, 2024/11/27