[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V5 3/6] libxl: arm: Create alloc_virtio_mmio_params()


  • To: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 6 Sep 2022 17:29:31 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxx>, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, <stratos-dev@xxxxxxxxxxxxxxxxxxx>, Alex Bennée <alex.bennee@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>, Mike Holmes <mike.holmes@xxxxxxxxxx>, Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
  • Delivery-date: Tue, 06 Sep 2022 21:37:11 +0000
  • Ironport-data: A9a23:/4G4RawJIhQ3HtDeT5d6t+dWwSrEfRIJ4+MujC+fZmUNrF6WrkVTz 2EeDWuGOvePYjehKNonYInkpkxQu5TSmNFhQQM/qCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv676yEUOZigHtLUEPTDNj16WThqQSIgjQMLs+Mii8tjjMPR7zml4 LsemOWCfg7+s9JIGjhMsfjb+Usx5K6aVA4w5TTSW9ga5DcyqFFNZH4vDfnZB2f1RIBSAtm7S 47rpF1u1jqEl/uFIorNfofTKiXmcJaLVeS9oiM+t5yZqgpDvkQPPpMTb5LwX6v1ZwKhxLidw P0V3XC5pJxA0qfkwIzxWDEAe81y0DEvFBYq7hFTvOTKp3AqfUcAzN1qVmUXBa8j+9xeAFF/6 uY/MnM8Qz6M0rfeLLKTEoGAh+wmJcj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tOkO4s1NSZLWvbUQmTTL2KhLGKq1aLJ8S9zJ8/6U 4JSdkZNDSaNzlHZKjBjzWFLw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Aug 22, 2022 at 02:45:15PM +0530, Viresh Kumar wrote:
> Create a separate routine to allocate base and irq for a device as the
> same code will be required for each device type.
> 
> Suggested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
>  tools/libs/light/libxl_arm.c | 46 +++++++++++++++++++++++++-----------
>  1 file changed, 32 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
> index 1a3ac1646e94..0e3051bac5e4 100644
> --- a/tools/libs/light/libxl_arm.c
> +++ b/tools/libs/light/libxl_arm.c
> @@ -85,20 +103,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>          libxl_device_disk *disk = &d_config->disks[i];
>  
>          if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
> -            disk->base = alloc_virtio_mmio_base(gc, &virtio_mmio_base);
> -            if (!disk->base)
> -                return ERROR_FAIL;
> -
> -            disk->irq = alloc_virtio_mmio_irq(gc, &virtio_mmio_irq);
> -            if (!disk->irq)
> -                return ERROR_FAIL;
> +            int rc = alloc_virtio_mmio_params(gc, &disk->base, &disk->irq,
> +                                              &virtio_mmio_base,
> +                                              &virtio_mmio_irq);
>  
> -            if (virtio_irq < disk->irq)
> -                virtio_irq = disk->irq;
> -            virtio_enabled = true;

This change to virtio_irq and virtio_enabled, as well as the chunck
below, isn't explained in the patch description.

> -
> -            LOG(DEBUG, "Allocate Virtio MMIO params for Vdev %s: IRQ %u BASE 
> 0x%"PRIx64,
> -                disk->vdev, disk->irq, disk->base);
> +            if (rc)
> +                return rc;
>          }
>      }
>  
> @@ -107,8 +117,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>       * present, make sure that we allocate enough SPIs for them.
>       * The resulting "nr_spis" needs to cover the highest possible SPI.
>       */
> -    if (virtio_enabled)
> +    if (virtio_mmio_irq != GUEST_VIRTIO_MMIO_SPI_FIRST) {
> +        virtio_enabled = true;
> +
> +        /*
> +         * Assumes that "virtio_mmio_irq" is the highest allocated irq, 
> which is
> +         * updated from alloc_virtio_mmio_irq() currently.
> +         */
> +        virtio_irq = virtio_mmio_irq - 1;
>          nr_spis = max(nr_spis, virtio_irq - 32 + 1);
> +    }
>  
>      for (i = 0; i < d_config->b_info.num_irqs; i++) {
>          uint32_t irq = d_config->b_info.irqs[i];

Thanks,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.