qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Haibo Xu <haibo.xu@linaro.org>
To: drjones@redhat.com, richard.henderson@linaro.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, philmd@redhat.com,
	qemu-devel@nongnu.org, Haibo Xu <haibo.xu@linaro.org>
Subject: [PATCH v3 07/12] hw/arm/virt: Move post cpu realize check into its own function
Date: Tue, 15 Sep 2020 03:11:43 +0000	[thread overview]
Message-ID: <20eedb95441ecec7b23527cde78aa5b63c67b400.1600135462.git.haibo.xu@linaro.org> (raw)
In-Reply-To: <cover.1600135462.git.haibo.xu@linaro.org>

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.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/virt.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 3f6d26c531..2ffcb073af 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1672,6 +1672,26 @@ static void finalize_gic_version(VirtMachineState *vms)
     }
 }
 
+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);
@@ -1890,22 +1910,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) {
@@ -1917,6 +1921,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.17.1



  parent reply	other threads:[~2020-09-15  3:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15  3:11 [PATCH v3 00/12] target/arm: Add vSPE support to KVM guest Haibo Xu
2020-09-15  3:11 ` [PATCH v3 01/12] update Linux headers with new vSPE macros Haibo Xu
2020-09-15  3:11 ` [PATCH v3 02/12] target/arm/kvm: spe: Add helper to detect SPE when using KVM Haibo Xu
2020-09-15  3:11 ` [PATCH v3 03/12] target/arm/cpu: spe: Add an option to turn on/off vSPE support Haibo Xu
2020-09-15  6:10   ` Andrew Jones
2020-09-15  7:33     ` Haibo Xu
2020-09-15  3:11 ` [PATCH v3 04/12] target/arm: spe: Only enable SPE from 5.2 compat machines Haibo Xu
2020-09-15  3:11 ` [PATCH v3 05/12] target/arm/kvm: spe: Unify device attr operation helper Haibo Xu
2020-09-15  3:11 ` [PATCH v3 06/12] target/arm/kvm: spe: Add device init and set_irq operations Haibo Xu
2020-09-15  3:11 ` Haibo Xu [this message]
2020-09-15  6:22   ` [PATCH v3 07/12] hw/arm/virt: Move post cpu realize check into its own function Andrew Jones
2020-09-15  7:03     ` Haibo Xu
2020-09-15  7:31       ` Andrew Jones
2020-09-15  7:34         ` Haibo Xu
2020-09-15  3:11 ` [PATCH v3 08/12] hw/arm/virt: Move kvm pmu setup to virt_cpu_post_init Haibo Xu
2020-09-15  3:11 ` [PATCH v3 09/12] hw/arm/virt: spe: Add vSPE device and corresponding interrupt support Haibo Xu
2020-09-15  3:11 ` [PATCH v3 10/12] target/arm/cpu: spe: Enable spe to work with host cpu Haibo Xu
2020-09-15  6:30   ` Andrew Jones
2020-09-15  3:11 ` [PATCH v3 11/12] target/arm/kvm: spe: Enable userspace irqchip support Haibo Xu
2020-09-15  3:11 ` [PATCH v3 12/12] target/arm: spe: Add corresponding test Haibo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20eedb95441ecec7b23527cde78aa5b63c67b400.1600135462.git.haibo.xu@linaro.org \
    --to=haibo.xu@linaro.org \
    --cc=drjones@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).