|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v5 16/22] xen/arm: vsmmuv3: Insert vIRQ properties into vIOMMU device tree node
Hi Milan,
> Insert vIRQ properties for event queue and GERROR handling into the
> emulated IOMMU device tree node for dom0less and libxl guests.
>
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
> Signed-off-by: Milan Djokic <milan_djokic@xxxxxxxx>
>
> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
> index bbcc989284df..72b19d68af10 100644
> --- a/tools/libs/light/libxl_arm.c
> +++ b/tools/libs/light/libxl_arm.c
> @@ -86,8 +86,8 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
> {
> uint32_t nr_spis = 0, cfg_nr_spis = d_config->b_info.arch_arm.nr_spis;
> unsigned int i;
> - uint32_t vuart_irq, virtio_irq = 0;
> - bool vuart_enabled = false, virtio_enabled = false;
> + uint32_t vuart_irq, virtio_irq = 0, vsmmu_irq = 0;
> + bool vuart_enabled = false, virtio_enabled = false, vsmmu_enabled =
> false;
Could you add the new variable on a new line instead?
Having many variable defined on the same line is just hard to read, and
even more when some are initialized and not other.
> uint64_t virtio_mmio_base = GUEST_VIRTIO_MMIO_BASE;
> uint32_t virtio_mmio_irq = GUEST_VIRTIO_MMIO_SPI_FIRST;
> int rc;
> @@ -97,11 +97,21 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
> * of SPI VIRQ for pl011.
> */
> if (d_config->b_info.arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) {
> - nr_spis += (GUEST_VPL011_SPI - 32) + 1;
> vuart_irq = GUEST_VPL011_SPI;
> + nr_spis = max(nr_spis, vuart_irq - 32 + 1);
Why is this changed? The comment say to "increment" the number of SPI,
but with max() the value isn't increased anymore. The fact that
`nr_spis` is currently `0` is irrelevant.
> vuart_enabled = true;
> }
>
> + /*
> + * If smmuv3 viommu is enabled then increment the nr_spis to allow
> + * allocation of SPI VIRQ for VSMMU.
> + */
> + if (d_config->b_info.arch_arm.viommu_type == LIBXL_VIOMMU_TYPE_SMMUV3) {
> + vsmmu_irq = GUEST_VSMMU_SPI;
> + nr_spis = max(nr_spis, vsmmu_irq - 32 + 1);
Here again, the code say `max()` the comment say `+=`.
> + vsmmu_enabled = true;
> + }
> +
> for (i = 0; i < d_config->num_disks; i++) {
> libxl_device_disk *disk = &d_config->disks[i];
>
> @@ -170,6 +180,11 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
> return ERROR_FAIL;
> }
>
> + if (vsmmu_enabled && irq == vsmmu_irq) {
> + LOG(ERROR, "Physical IRQ %u conflicting with vSMMUv3 SPI\n",
> irq);
No need for newline "\n" with `LOG()`.
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 6bd705102f09..9e519ff3da94 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -256,6 +257,22 @@ static int __init make_vsmmuv3_node(const struct
> kernel_info *kinfo)
> if ( res )
> return res;
>
> + res = fdt_property_string(fdt, "interrupt-names", "combined");
> + if ( res )
> + return res;
> +
> + set_interrupt(intr, GUEST_VSMMU_SPI, 0xf, DT_IRQ_TYPE_LEVEL_HIGH);
> +
> + res = fdt_property(kinfo->fdt, "interrupts",
There's `fdt` local variable that you can use instead of `kinfo->fdt`,
like every other call in the function.
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |