qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xu Yandong <xuyandong2@huawei.com>
To: <peter.maydell@linaro.org>
Cc: zhang.zhanghailiang@huawei.com, slp@redhat.com,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Xu Yandong <xuyandong2@huawei.com>,
	qemu-devel@nongnu.org, Shannon Zhao <shannon.zhaosl@gmail.com>,
	qemu-arm@nongnu.org, Igor Mammedov <imammedo@redhat.com>,
	wu.wubin@huawei.com
Subject: [PATCH RFC 11/16] hw/arm: move shared psci_enable and claim_edge_triggered_timers member to ArmMachine
Date: Mon, 17 Feb 2020 02:51:23 -0500	[thread overview]
Message-ID: <1581925888-103620-12-git-send-email-xuyandong2@huawei.com> (raw)
In-Reply-To: <1581925888-103620-1-git-send-email-xuyandong2@huawei.com>

Move psci_enable member from VirtMachineState to ArmMachineState.
Move claim_edge_triggered_timers member from VirtMachineClass to
ArmMachineClass.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Shannon Zhao <shannon.zhaosl@gmail.com>
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
 hw/arm/virt-acpi-build.c |  7 ++++---
 hw/arm/virt.c            | 14 +++++++-------
 include/hw/arm/arm.h     |  2 ++
 include/hw/arm/virt.h    |  2 --
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 770c53f5d0..f2de897694 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -570,12 +570,12 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 static void
 build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 {
-    VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
+    ArmMachineClass *amc = ARM_MACHINE_GET_CLASS(ARM_MACHINE(vms));
     int gtdt_start = table_data->len;
     AcpiGenericTimerTable *gtdt;
     uint32_t irqflags;
 
-    if (vmc->claim_edge_triggered_timers) {
+    if (amc->claim_edge_triggered_timers) {
         irqflags = ACPI_GTDT_INTERRUPT_MODE_EDGE;
     } else {
         irqflags = ACPI_GTDT_INTERRUPT_MODE_LEVEL;
@@ -696,6 +696,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
 static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker,
                             VirtMachineState *vms, unsigned dsdt_tbl_offset)
 {
+    ArmMachineState *ams = ARM_MACHINE(vms);
     /* ACPI v5.1 */
     AcpiFadtData fadt = {
         .rev = 5,
@@ -704,7 +705,7 @@ static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker,
         .xdsdt_tbl_offset = &dsdt_tbl_offset,
     };
 
-    switch (vms->psci_conduit) {
+    switch (ams->psci_conduit) {
     case QEMU_PSCI_CONDUIT_DISABLED:
         fadt.arm_boot_arch = 0;
         break;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index f971f49bcf..2c0dfb2695 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1576,11 +1576,11 @@ static void machvirt_init(MachineState *machine)
      * because if we're using KVM then we must use HVC).
      */
     if (vms->secure && firmware_loaded) {
-        vms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
+        ams->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
     } else if (vms->virt) {
-        vms->psci_conduit = QEMU_PSCI_CONDUIT_SMC;
+        ams->psci_conduit = QEMU_PSCI_CONDUIT_SMC;
     } else {
-        vms->psci_conduit = QEMU_PSCI_CONDUIT_HVC;
+        ams->psci_conduit = QEMU_PSCI_CONDUIT_HVC;
     }
 
     /* The maximum number of CPUs depends on the GIC version, or on how
@@ -1641,8 +1641,8 @@ static void machvirt_init(MachineState *machine)
             object_property_set_bool(cpuobj, false, "has_el2", NULL);
         }
 
-        if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
-            object_property_set_int(cpuobj, vms->psci_conduit,
+        if (ams->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
+            object_property_set_int(cpuobj, ams->psci_conduit,
                                     "psci-conduit", NULL);
 
             /* Secondary CPUs start in PSCI powered-down state */
@@ -2186,14 +2186,14 @@ DEFINE_VIRT_MACHINE(2, 9)
 
 static void virt_machine_2_8_options(MachineClass *mc)
 {
-    VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
+    ArmMachineClass *amc = ARM_MACHINE_CLASS(OBJECT_CLASS(mc));
 
     virt_machine_2_9_options(mc);
     compat_props_add(mc->compat_props, hw_compat_2_8, hw_compat_2_8_len);
     /* For 2.8 and earlier we falsely claimed in the DT that
      * our timers were edge-triggered, not level-triggered.
      */
-    vmc->claim_edge_triggered_timers = true;
+    amc->claim_edge_triggered_timers = true;
 }
 DEFINE_VIRT_MACHINE(2, 8)
 
diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
index 9ba51c4882..bb3680e583 100644
--- a/include/hw/arm/arm.h
+++ b/include/hw/arm/arm.h
@@ -86,6 +86,7 @@ typedef struct MemMapEntry {
 
 typedef struct {
     MachineClass parent;
+    bool claim_edge_triggered_timers;
 } ArmMachineClass;
 
 typedef struct {
@@ -97,6 +98,7 @@ typedef struct {
     void *fdt;
     int fdt_size;
     uint32_t gic_phandle;
+    int psci_conduit;
     DeviceState *gic;
 } ArmMachineState;
 
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 393afb7faf..ad94634038 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -50,7 +50,6 @@ typedef struct {
     bool disallow_affinity_adjustment;
     bool no_its;
     bool no_pmu;
-    bool claim_edge_triggered_timers;
     bool smbios_old_sys_ver;
     bool no_highmem_ecam;
     bool no_ged;   /* Machines < 4.2 has no support for ACPI GED device */
@@ -73,7 +72,6 @@ typedef struct {
     uint32_t clock_phandle;
     uint32_t msi_phandle;
     uint32_t iommu_phandle;
-    int psci_conduit;
     hwaddr highest_gpa;
     DeviceState *acpi_dev;
     Notifier powerdown_notifier;
-- 
2.18.1



  parent reply	other threads:[~2020-02-17  7:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-17  7:51 [PATCH RFC 00/16] Implement Microvm for aarch64 architecture Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 01/16] hw/arm/arm: Introduce ArmMachineState and ArmMachineClass Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 02/16] hw/arm: move shared fdt member to ArmMachine Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 03/16] hw/arm: move shared memmap " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 04/16] hw/arm: move shared irqmap " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 05/16] hw/arm: move shared smp_cpus " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 06/16] hw/arm/virt: split MSI related codes from create_gic Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 07/16] hw/arm/virt: split virt extension " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 08/16] hw/arm/virt: split secure " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 09/16] hw/arm: move shared gic member to ArmMachine Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 10/16] hw/arm: split create_gic function Xu Yandong
2020-02-17  7:51 ` Xu Yandong [this message]
2020-02-17  7:51 ` [PATCH RFC 12/16] hw/arm: move shared devices related functions to arm.c and export them Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 13/16] hw/arm: move shared fdt " Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 14/16] hw/arm: move shared bootinfo member to ArmMachine Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 15/16] hw/arm: move shared cpu related functions to arm.c and export them Xu Yandong
2020-02-17  7:51 ` [PATCH RFC 16/16] hw/arm: Introduce the microvm machine type Xu Yandong
2020-02-17  8:19 ` [PATCH RFC 00/16] Implement Microvm for aarch64 architecture no-reply
2020-02-17  9:56 ` Peter Maydell

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=1581925888-103620-12-git-send-email-xuyandong2@huawei.com \
    --to=xuyandong2@huawei.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=slp@redhat.com \
    --cc=wu.wubin@huawei.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /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).