- target/i386: Export RFDS bit to guests - target/i386: Add new CPU model SierraForest - target/i386: Introduce Icelake-Server-v7 to enable TSX - hw/isa/vt82c686: Keep track of PIRQ/PINT pins separately - kvm/arm: Fix compatibility of cold-plug CPU with SVE - arm/virt/acpi: Extend cpufreq to support max_cpus - kvm/arm: Fix SVE related logic for vcpu hotplug feature - arm/virt: Don't modify smp.max_cpus when vcpu hotplug disabled - acpi/cpu: Fix detection of present cpu Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
67 lines
2.3 KiB
Diff
67 lines
2.3 KiB
Diff
From fb27704692362d151eb191f0c687ded09b04e04c Mon Sep 17 00:00:00 2001
|
|
From: Keqian Zhu <zhukeqian1@huawei.com>
|
|
Date: Sun, 28 Apr 2024 14:14:07 +0800
|
|
Subject: [PATCH] arm/virt/acpi: Extend cpufreq to support max_cpus
|
|
|
|
We support vcpu hotplug now, so extend memory region size to
|
|
allow hotplugged CPU access cpufreq space.
|
|
|
|
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
|
|
---
|
|
hw/acpi/cpufreq.c | 15 ++++++---------
|
|
1 file changed, 6 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/hw/acpi/cpufreq.c b/hw/acpi/cpufreq.c
|
|
index a84db490b3..a76f7b8fa2 100644
|
|
--- a/hw/acpi/cpufreq.c
|
|
+++ b/hw/acpi/cpufreq.c
|
|
@@ -83,6 +83,7 @@ typedef struct CpuhzState {
|
|
uint32_t PerformanceLimited;
|
|
uint32_t LowestFreq;
|
|
uint32_t NominalFreq;
|
|
+ uint32_t num_cpu;
|
|
uint32_t reg_size;
|
|
} CpuhzState;
|
|
|
|
@@ -93,10 +94,7 @@ static uint64_t cpufreq_read(void *opaque, hwaddr offset, unsigned size)
|
|
uint64_t r;
|
|
uint64_t n;
|
|
|
|
- MachineState *ms = MACHINE(qdev_get_machine());
|
|
- unsigned int smp_cpus = ms->smp.cpus;
|
|
-
|
|
- if (offset >= smp_cpus * CPPC_REG_PER_CPU_STRIDE) {
|
|
+ if (offset >= s->num_cpu * CPPC_REG_PER_CPU_STRIDE) {
|
|
warn_report("cpufreq_read: offset 0x%lx out of range", offset);
|
|
return 0;
|
|
}
|
|
@@ -163,11 +161,10 @@ static uint64_t cpufreq_read(void *opaque, hwaddr offset, unsigned size)
|
|
static void cpufreq_write(void *opaque, hwaddr offset,
|
|
uint64_t value, unsigned size)
|
|
{
|
|
+ CpuhzState *s = CPUFREQ(opaque);
|
|
uint64_t n;
|
|
- MachineState *ms = MACHINE(qdev_get_machine());
|
|
- unsigned int smp_cpus = ms->smp.cpus;
|
|
|
|
- if (offset >= smp_cpus * CPPC_REG_PER_CPU_STRIDE) {
|
|
+ if (offset >= s->num_cpu * CPPC_REG_PER_CPU_STRIDE) {
|
|
error_printf("cpufreq_write: offset 0x%lx out of range", offset);
|
|
return;
|
|
}
|
|
@@ -248,9 +245,9 @@ static void cpufreq_init(Object *obj)
|
|
CpuhzState *s = CPUFREQ(obj);
|
|
|
|
MachineState *ms = MACHINE(qdev_get_machine());
|
|
- unsigned int smp_cpus = ms->smp.cpus;
|
|
+ s->num_cpu = ms->smp.max_cpus;
|
|
|
|
- s->reg_size = smp_cpus * CPPC_REG_PER_CPU_STRIDE;
|
|
+ s->reg_size = s->num_cpu * CPPC_REG_PER_CPU_STRIDE;
|
|
if (s->reg_size > MAX_SUPPORT_SPACE) {
|
|
error_report("Required space 0x%x excesses the max support 0x%x",
|
|
s->reg_size, MAX_SUPPORT_SPACE);
|
|
--
|
|
2.27.0
|
|
|