qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mihai Carabas <mihai.carabas@oracle.com>
To: peter.maydell@linaro.org, shannon.zhaosl@gmail.com,
	mst@redhat.com, imammedo@redhat.com
Cc: Mihai Carabas <mihai.carabas@oracle.com>,
	Peng Hao <peng.hao2@zte.com.cn>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 4/8] hw/arm/virt: Use the pvpanic device
Date: Thu, 22 Oct 2020 10:42:52 +0300	[thread overview]
Message-ID: <1603352576-21671-5-git-send-email-mihai.carabas@oracle.com> (raw)
In-Reply-To: <1603352576-21671-1-git-send-email-mihai.carabas@oracle.com>

From: Peng Hao <peng.hao2@zte.com.cn>

Add pvpanic device in arm virt machine.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 hw/arm/virt.c         | 25 +++++++++++++++++++++++++
 include/hw/arm/virt.h |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index e465a98..63f09a6 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -78,6 +78,7 @@
 #include "hw/virtio/virtio-iommu.h"
 #include "hw/char/pl011.h"
 #include "qemu/guest-random.h"
+#include "hw/misc/pvpanic.h"
 
 #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
     static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
@@ -152,6 +153,7 @@ static const MemMapEntry base_memmap[] = {
     [VIRT_ACPI_GED] =           { 0x09080000, ACPI_GED_EVT_SEL_LEN },
     [VIRT_NVDIMM_ACPI] =        { 0x09090000, NVDIMM_ACPI_IO_LEN},
     [VIRT_PVTIME] =             { 0x090a0000, 0x00010000 },
+    [VIRT_PVPANIC] =            { 0x090b0000, 0x00000002 },
     [VIRT_MMIO] =               { 0x0a000000, 0x00000200 },
     /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
     [VIRT_PLATFORM_BUS] =       { 0x0c000000, 0x02000000 },
@@ -226,6 +228,27 @@ static void create_kaslr_seed(VirtMachineState *vms, const char *node)
     qemu_fdt_setprop_u64(vms->fdt, node, "kaslr-seed", seed);
 }
 
+static void create_pvpanic_device(const VirtMachineState *vms)
+{
+    char *nodename;
+    hwaddr base = vms->memmap[VIRT_PVPANIC].base;
+    hwaddr size = vms->memmap[VIRT_PVPANIC].size;
+
+    if (!vms->pvpanic) {
+        return;
+    }
+    sysbus_create_simple(TYPE_PVPANIC_MMIO, base, NULL);
+
+    nodename = g_strdup_printf("/pvpanic-mmio@%" PRIx64, base);
+    qemu_fdt_add_subnode(vms->fdt, nodename);
+    qemu_fdt_setprop_string(vms->fdt, nodename,
+                            "compatible", "qemu,pvpanic-mmio");
+    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+                                 2, base, 2, size);
+
+    g_free(nodename);
+}
+
 static void create_fdt(VirtMachineState *vms)
 {
     MachineState *ms = MACHINE(vms);
@@ -1957,6 +1980,8 @@ static void machvirt_init(MachineState *machine)
 
     virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem);
 
+    create_pvpanic_device(vms);
+
     create_gic(vms);
 
     virt_cpu_post_init(vms, possible_cpus->len, sysmem);
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index aad6d69..e6410c3 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -69,6 +69,7 @@ enum {
     VIRT_GIC_ITS,
     VIRT_GIC_REDIST,
     VIRT_SMMU,
+    VIRT_PVPANIC,
     VIRT_UART,
     VIRT_MMIO,
     VIRT_RTC,
@@ -139,6 +140,7 @@ struct VirtMachineState {
     bool highmem;
     bool highmem_ecam;
     bool its;
+    bool pvpanic;
     bool virt;
     bool ras;
     bool mte;
-- 
1.8.3.1



  parent reply	other threads:[~2020-10-22  8:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22  7:42 [PATCH 0/8] Add support for pvpanic mmio device Mihai Carabas
2020-10-22  7:42 ` [PATCH 1/8] hw/misc/pvpanic: Build the pvpanic device for any machine Mihai Carabas
2020-10-22  7:42 ` [PATCH 2/8] hw/misc/pvpanic: Cosmetic renaming Mihai Carabas
2020-10-22  7:42 ` [PATCH 3/8] hw/misc/pvpanic: Add the MMIO interface Mihai Carabas
2020-10-22  7:42 ` Mihai Carabas [this message]
2020-10-22  7:42 ` [PATCH 5/8] hw/arm/virt: add pvpanic device in virt acpi table Mihai Carabas
2020-10-22  7:42 ` [PATCH 6/8] hw/arm/virt: add configure interface for pvpanic-mmio Mihai Carabas
2020-10-22  7:42 ` [PATCH 7/8] pvpanic : update pvpanic document Mihai Carabas
2020-10-22  7:42 ` [PATCH 8/8] pvpanic: break dependency on ISA_BUS Mihai Carabas
2020-10-22 10:17 ` [PATCH 0/8] Add support for pvpanic mmio device Peter Maydell
2020-10-26 13:50   ` Mihai Carabas
2020-10-26 14:32     ` 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=1603352576-21671-5-git-send-email-mihai.carabas@oracle.com \
    --to=mihai.carabas@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=peng.hao2@zte.com.cn \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.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).