[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/4] arm: Create the cpufreq device
From: |
fangying1 |
Subject: |
[PATCH 4/4] arm: Create the cpufreq device |
Date: |
Thu, 13 Feb 2020 10:07:12 +0800 |
From: Ying Fang <address@hidden>
Signed-off-by: Heyi Guo <address@hidden>
Signed-off-by: Ying Fang <address@hidden>
---
default-configs/aarch64-softmmu.mak | 1 +
hw/acpi/Kconfig | 4 ++++
hw/arm/virt.c | 13 +++++++++++++
3 files changed, 18 insertions(+)
diff --git a/default-configs/aarch64-softmmu.mak
b/default-configs/aarch64-softmmu.mak
index 958b1e08e4..0a030e853f 100644
--- a/default-configs/aarch64-softmmu.mak
+++ b/default-configs/aarch64-softmmu.mak
@@ -6,3 +6,4 @@ include arm-softmmu.mak
CONFIG_XLNX_ZYNQMP_ARM=y
CONFIG_XLNX_VERSAL=y
CONFIG_SBSA_REF=y
+CONFIG_CPUFREQ=y
diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index 54209c6f2f..7d8aa58492 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -38,3 +38,7 @@ config ACPI_VMGENID
depends on PC
config ACPI_HW_REDUCED
+
+config CPUFREQ
+ bool
+ default y
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index ed9dc38b60..53638f9557 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -764,6 +764,17 @@ static void create_uart(const VirtMachineState *vms, int
uart,
g_free(nodename);
}
+static void create_cpufreq(const VirtMachineState *vms, MemoryRegion *mem)
+{
+ hwaddr base = vms->memmap[VIRT_CPUFREQ].base;
+ DeviceState *dev = qdev_create(NULL, "cpufreq");
+ SysBusDevice *s = SYS_BUS_DEVICE(dev);
+
+ qdev_init_nofail(dev);
+ memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0));
+}
+
+
static void create_rtc(const VirtMachineState *vms)
{
char *nodename;
@@ -1723,6 +1734,8 @@ static void machvirt_init(MachineState *machine)
create_uart(vms, VIRT_UART, sysmem, serial_hd(0));
+ create_cpufreq(vms, sysmem);
+
if (vms->secure) {
create_secure_ram(vms, secure_sysmem);
create_uart(vms, VIRT_SECURE_UART, secure_sysmem, serial_hd(1));
--
2.19.1
- [PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest, fangying1, 2020/02/12
- [PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest, Ying Fang, 2020/02/12
- Re: [PATCH 0/4] arm64: Add the cpufreq device to show cpufreq info to guest, no-reply, 2020/02/12
- [PATCH 1/4] acpi: Add aml_generic_register, Ying Fang, 2020/02/12
- [PATCH 2/4] acpi/cppc: Add ACPI CPPC registers, Ying Fang, 2020/02/12
- [PATCH 3/4] arm: Add the cpufreq device model, Ying Fang, 2020/02/12
- [PATCH 4/4] arm: Create the cpufreq device, Ying Fang, 2020/02/12