[PATCH v1 4/4] hw/arm: xenpvh: Enable PCI for ARM PVH

Edgar E. Iglesias posted 4 patches 2 months, 1 week ago
There is a newer version of this series
[PATCH v1 4/4] hw/arm: xenpvh: Enable PCI for ARM PVH
Posted by Edgar E. Iglesias 2 months, 1 week ago
From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>

Enable PCI support for the ARM Xen PVH machine.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
---
 hw/arm/xen-pvh.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c
index 28af3910ea..33f0dd5982 100644
--- a/hw/arm/xen-pvh.c
+++ b/hw/arm/xen-pvh.c
@@ -39,6 +39,16 @@ static void xen_arm_instance_init(Object *obj)
                                          VIRTIO_MMIO_DEV_SIZE };
 }
 
+static void xen_pvh_set_pci_intx_irq(void *opaque, int intx_irq, int level)
+{
+    XenPVHMachineState *s = XEN_PVH_MACHINE(opaque);
+    int irq = s->cfg.pci_intx_irq_base + intx_irq;
+
+    if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) {
+        error_report("xendevicemodel_set_pci_intx_level failed");
+    }
+}
+
 static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
 {
     XenPVHMachineClass *xpc = XEN_PVH_MACHINE_CLASS(oc);
@@ -69,7 +79,11 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
     /* Xen/ARM does not use buffered IOREQs.  */
     xpc->handle_bufioreq = HVM_IOREQSRV_BUFIOREQ_OFF;
 
+    /* PCI INTX delivery.  */
+    xpc->set_pci_intx_irq = xen_pvh_set_pci_intx_irq;
+
     /* List of supported features known to work on PVH ARM.  */
+    xpc->has_pci = true;
     xpc->has_tpm = true;
     xpc->has_virtio_mmio = true;
 
-- 
2.43.0
Re: [PATCH v1 4/4] hw/arm: xenpvh: Enable PCI for ARM PVH
Posted by Stefano Stabellini 2 months, 1 week ago
On Mon, 16 Sep 2024, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
> 
> Enable PCI support for the ARM Xen PVH machine.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  hw/arm/xen-pvh.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/hw/arm/xen-pvh.c b/hw/arm/xen-pvh.c
> index 28af3910ea..33f0dd5982 100644
> --- a/hw/arm/xen-pvh.c
> +++ b/hw/arm/xen-pvh.c
> @@ -39,6 +39,16 @@ static void xen_arm_instance_init(Object *obj)
>                                           VIRTIO_MMIO_DEV_SIZE };
>  }
>  
> +static void xen_pvh_set_pci_intx_irq(void *opaque, int intx_irq, int level)
> +{
> +    XenPVHMachineState *s = XEN_PVH_MACHINE(opaque);
> +    int irq = s->cfg.pci_intx_irq_base + intx_irq;
> +
> +    if (xendevicemodel_set_irq_level(xen_dmod, xen_domid, irq, level)) {
> +        error_report("xendevicemodel_set_pci_intx_level failed");
> +    }
> +}
> +
>  static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
>  {
>      XenPVHMachineClass *xpc = XEN_PVH_MACHINE_CLASS(oc);
> @@ -69,7 +79,11 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
>      /* Xen/ARM does not use buffered IOREQs.  */
>      xpc->handle_bufioreq = HVM_IOREQSRV_BUFIOREQ_OFF;
>  
> +    /* PCI INTX delivery.  */
> +    xpc->set_pci_intx_irq = xen_pvh_set_pci_intx_irq;
> +
>      /* List of supported features known to work on PVH ARM.  */
> +    xpc->has_pci = true;
>      xpc->has_tpm = true;
>      xpc->has_virtio_mmio = true;
>  
> -- 
> 2.43.0
>