All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Alexander Gryanko <xpahos@gmail.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [PATCH] hw/arm: add pvpanic mmio device for arm
Date: Tue, 7 Oct 2025 15:11:57 +0200	[thread overview]
Message-ID: <20251007151157.5a601c3e@fedora> (raw)
In-Reply-To: <CC5A0011-CD14-40F9-8023-8BF5F989BCCF@gmail.com>

On Sat, 4 Oct 2025 23:19:09 +0300
Alexander Gryanko <xpahos@gmail.com> wrote:

> Currently, pvpanic is available in three device types: ISA,
> MMIO, and PCI. For early stages of system initialisation
> before PCI enumeration, only ISA and MMIO are suitable.
> ISA is specific to the x86 platform; only MMIO devices
> can be used for ARM. It is not possible to specify a
> device as on the x86 platform (-device pvpanic); the

perhaps ARM folsk know better, don't we have some
user create-able sysbus devices? Can it be implemented
as such, so we would avoid creating built-in device?

> only possible way is to add an MMIO device to the dtb,
> which can be implemented by manually adding new functions
> to the QEMU code, as was done in the VMApple implementation.
> 
> Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
> ---
> hw/arm/virt.c         | 25 +++++++++++++++++++++++++
> include/hw/arm/virt.h |  1 +
> 2 files changed, 26 insertions(+)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 02209fadcf..1059584b67 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -39,6 +39,7 @@
> #include "hw/arm/virt.h"
> #include "hw/block/flash.h"
> #include "hw/display/ramfb.h"
> +#include "hw/misc/pvpanic.h"
> #include "net/net.h"
> #include "system/device_tree.h"
> #include "system/numa.h"
> @@ -182,6 +183,7 @@ static const MemMapEntry base_memmap[] = {
>     [VIRT_UART0] =              { 0x09000000, 0x00001000 },
>     [VIRT_RTC] =                { 0x09010000, 0x00001000 },
>     [VIRT_FW_CFG] =             { 0x09020000, 0x00000018 },
> +    [VIRT_PVPANIC] =            { 0x09021000, 0x00000002 },
>     [VIRT_GPIO] =               { 0x09030000, 0x00001000 },
>     [VIRT_UART1] =              { 0x09040000, 0x00001000 },
>     [VIRT_SMMU] =               { 0x09050000, SMMU_IO_LEN },
> @@ -276,6 +278,27 @@ static bool ns_el2_virt_timer_present(void)
>         arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu);
> }
> 
> +static void create_pvpanic(VirtMachineState *vms)
> +{
> +    char *nodename;
> +    MachineState *ms = MACHINE(vms);
> +    DeviceState *dev = qdev_new(TYPE_PVPANIC_MMIO_DEVICE);
> +    SysBusDevice *s = SYS_BUS_DEVICE(dev);
> +
> +    hwaddr base = vms->memmap[VIRT_PVPANIC].base;
> +    hwaddr size = vms->memmap[VIRT_PVPANIC].size;
> +
> +    sysbus_realize_and_unref(s, &error_fatal);
> +    sysbus_mmio_map(s, 0, base);
> +
> +    nodename = g_strdup_printf("/pvpanic@%" PRIx64, base);
> +    qemu_fdt_add_subnode(ms->fdt, nodename);
> +    qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
> +                            "qemu,pvpanic-mmio");
> +    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
> +                                 2, base, 2, size);
> +}
> +
> static void create_fdt(VirtMachineState *vms)
> {
>     MachineState *ms = MACHINE(vms);
> @@ -2498,6 +2521,8 @@ static void machvirt_init(MachineState *machine)
>     create_pcie(vms);
>     create_cxl_host_reg_region(vms);
> 
> +    create_pvpanic(vms);

given that virt is versioned machine type,
we probably need a compat knob to disable it's creation on old machine types

> +
>     if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) {
>         vms->acpi_dev = create_acpi_ged(vms);
>     } else {
> diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
> index ea2cff05b0..39bf07c9c1 100644
> --- a/include/hw/arm/virt.h
> +++ b/include/hw/arm/virt.h
> @@ -81,6 +81,7 @@ enum {
>     VIRT_NVDIMM_ACPI,
>     VIRT_PVTIME,
>     VIRT_ACPI_PCIHP,
> +    VIRT_PVPANIC,
>     VIRT_LOWMEMMAP_LAST,
> };
> 
> 
> ---
> base-commit: bd6aa0d1e59d71218c3eee055bc8d222c6e1a628
> change-id: 20251004-arm-pvpanic-84a7d7b67d8d
> 
> Best regards,



  parent reply	other threads:[~2025-10-07 13:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-04 20:19 [PATCH] hw/arm: add pvpanic mmio device for arm Alexander Gryanko
2025-10-05 20:16 ` [PATCH v2] " xpahos
2025-10-05 22:50 ` xpahos
2025-10-06 10:41 ` [PATCH] " Peter Maydell
2025-10-06 11:52   ` Alexander Gryanko
2025-10-06 12:03     ` Peter Maydell
2025-10-07 13:11 ` Igor Mammedov [this message]
2025-10-09 13:25   ` Alexander Gryanko
2025-10-09 13:29     ` Peter Maydell
2025-10-09 16:30       ` Alexander Gryanko
2025-10-09 16:36         ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2025-10-04 17:47 [PATCH] system/runstate.c: Add a newline character to correctly log guest errors Alexander Gryanko
2025-10-05 18:58 ` [PATCH v2] " Alexander Gryanko
2025-10-05 22:21 ` xpahos
2025-10-05 22:27   ` [PATCH v2] hw/arm: add pvpanic mmio device for arm xpahos

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=20251007151157.5a601c3e@fedora \
    --to=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=xpahos@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.