[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/12] hw/arm/virt: Move post cpu realize check into its own funct
From: |
Peter Maydell |
Subject: |
[PULL 08/12] hw/arm/virt: Move post cpu realize check into its own function |
Date: |
Thu, 8 Oct 2020 15:25:53 +0100 |
From: Andrew Jones <drjones@redhat.com>
We'll add more to this new function in coming patches so we also
state the gic must be created and call it below create_gic().
No functional change intended.
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Message-id: 20201001061718.101915-4-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/virt.c | 43 +++++++++++++++++++++++++++----------------
1 file changed, 27 insertions(+), 16 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 1231a197c85..524eafe22df 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1672,6 +1672,31 @@ static void finalize_gic_version(VirtMachineState *vms)
}
}
+/*
+ * virt_cpu_post_init() must be called after the CPUs have
+ * been realized and the GIC has been created.
+ */
+static void virt_cpu_post_init(VirtMachineState *vms)
+{
+ bool aarch64;
+
+ aarch64 = object_property_get_bool(OBJECT(first_cpu), "aarch64", NULL);
+
+ if (!kvm_enabled()) {
+ if (aarch64 && vms->highmem) {
+ int requested_pa_size = 64 - clz64(vms->highest_gpa);
+ int pamax = arm_pamax(ARM_CPU(first_cpu));
+
+ if (pamax < requested_pa_size) {
+ error_report("VCPU supports less PA bits (%d) than "
+ "requested by the memory map (%d)",
+ pamax, requested_pa_size);
+ exit(1);
+ }
+ }
+ }
+}
+
static void machvirt_init(MachineState *machine)
{
VirtMachineState *vms = VIRT_MACHINE(machine);
@@ -1886,22 +1911,6 @@ static void machvirt_init(MachineState *machine)
fdt_add_timer_nodes(vms);
fdt_add_cpu_nodes(vms);
- if (!kvm_enabled()) {
- ARMCPU *cpu = ARM_CPU(first_cpu);
- bool aarch64 = object_property_get_bool(OBJECT(cpu), "aarch64", NULL);
-
- if (aarch64 && vms->highmem) {
- int requested_pa_size, pamax = arm_pamax(cpu);
-
- requested_pa_size = 64 - clz64(vms->highest_gpa);
- if (pamax < requested_pa_size) {
- error_report("VCPU supports less PA bits (%d) than requested "
- "by the memory map (%d)", pamax,
requested_pa_size);
- exit(1);
- }
- }
- }
-
memory_region_add_subregion(sysmem, vms->memmap[VIRT_MEM].base,
machine->ram);
if (machine->device_memory) {
@@ -1913,6 +1922,8 @@ static void machvirt_init(MachineState *machine)
create_gic(vms);
+ virt_cpu_post_init(vms);
+
fdt_add_pmu_nodes(vms);
create_uart(vms, VIRT_UART, sysmem, serial_hd(0));
--
2.20.1
- [PULL 00/12] target-arm queue, Peter Maydell, 2020/10/08
- [PULL 03/12] hw/arm/sbsa-ref : Fix SMMUv3 Initialisation, Peter Maydell, 2020/10/08
- [PULL 01/12] hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer, Peter Maydell, 2020/10/08
- [PULL 06/12] linux headers: sync to 5.9-rc7, Peter Maydell, 2020/10/08
- [PULL 02/12] hw/arm/fsl-imx25: Fix a typo, Peter Maydell, 2020/10/08
- [PULL 04/12] hw/arm/sbsa-ref : allocate IRQs for SMMUv3, Peter Maydell, 2020/10/08
- [PULL 08/12] hw/arm/virt: Move post cpu realize check into its own function,
Peter Maydell <=
- [PULL 07/12] target/arm/kvm: Make uncalled stubs explicitly unreachable, Peter Maydell, 2020/10/08
- [PULL 05/12] hw/char/bcm2835_aux: Allow less than 32-bit accesses, Peter Maydell, 2020/10/08
- [PULL 09/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init, Peter Maydell, 2020/10/08
- [PULL 10/12] tests/qtest: Restore aarch64 arm-cpu-features test, Peter Maydell, 2020/10/08
- [PULL 11/12] hw/arm/virt: Implement kvm-steal-time, Peter Maydell, 2020/10/08
- [PULL 12/12] target/arm: Make '-cpu max' have a 48-bit PA, Peter Maydell, 2020/10/08