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

Re: [PATCH v7 2/5] xen/arm: Enable the existing x86 virtual PCI support for ARM


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 15 Oct 2021 16:30:03 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I0+3qYUb+Q1FysRGZgGkC50CSStj0qWL5rTTMaQox/Y=; b=itAKvrUOnUdt/wWfE4kZLhdVENmozIqD+49i1GlzpGyuRaeJAGUgI7E0m0NI0vMsVHLgaUPZYSDKGKMDDGti+yrzmndkqTWII9Kx6ZOWMd4cDhnjfgfItb0LHMwhOUCGDk1dLlFm2gf+2w+O0/KPQhIzQcIT+XzkH+SeTh8DCOBt9fg5kt6SRRveJVUUY1r+FD9lW03QwRBBAyguf8FAReYWHz+aam1gC0e8n8Hscj/bURhMzzPfdiiFjYG7/LSJgy38r31Pfq2POG51/uSt6p5RQcbg+7CL6PVJB50o0hjh+DVE+UdHd5LwBF1VxMayCMJEqz8Q0QYGLDoUBQIrYw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvHEzPrQyw6JF7wUNCzYHU7w0lViJld65BtkdUubTYvIeJurS80WK7RRHREbgBzVQDMDH3LZRjMNPGjdIgVbKdtyHb9i8ngWLuqpD/z2wXpEOVDY5D+z6QqZbzHEwDs1kgkqawYyK7lJrh97p20EEjZECCHLaHk5xFZQyQ5iOQNbmCk8nrZh32vaLxAxSXbGOyRTRguXWXi7P7Jm2bSpPdNmyahrcBN3wRYx1Qn6yYow/OkshvuMYL+nzYyaChgjWAt+9IYnJTJPH34chs03xOzqQL7nmu2O+IlwEc+4NiknSWpiyRuu0zTaQhdSrGXIC+Zla+rFtQnV/x/8A64s/w==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <iwj@xxxxxxxxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Fri, 15 Oct 2021 14:30:32 +0000
  • Ironport-data: A9a23:JZrEt6M9L4sk7NDvrR3TkcFynXyQoLVcMsEvi/4bfWQNrUoi02YGy WMcWW2GaK7bazahKYp2Ptm+pEJVvZDdnN4xGgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdpJYz/uUGuCJQUNUjMlkfZKhTr6ZUsxNbVU8En540Us+w7dRbrNA2rBVPSvc4 bsenOWHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKk3N6CpR0YUd6EPdgKMq 0Qv+5nilo/R109F5tpICd8XeGVSKlLZFVDmZna7x8FOK/WNz8A/+v9TCRYSVatYoxuYlfwp0 stHiZ+Pdj8FfYKLv/8ifRYNRkmSPYUekFPGCX22sMjVxEzaaXr8hf5pCSnaP6VBpLwxWzsXs 6VFdnZdNXhvhMrvqF6/YvNrick5atHiIasUu216zCGfBvEjKXzGa/iXv48Agmxr7ixINfTXe MlFdhRFVUXBXB52B2s8Npc0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bzoeqok8M9rNW6+DoszIJ5A8OkrExOQ rtEoaKCcQlOaVeb5Cyn3CcII/IfNArJd492wT4VUdZ7c1y5RE9m+mLht7sjgfMdXJCqRXdlxT4 oYUaIr8vsz3I4qWqevna+atz
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Oct 15, 2021 at 02:59:19PM +0100, Bertrand Marquis wrote:
> From: Rahul Singh <rahul.singh@xxxxxxx>
> 
> The existing VPCI support available for X86 is adapted for Arm.
> When the device is added to XEN via the hyper call
> “PHYSDEVOP_pci_device_add”, VPCI handler for the config space
> access is added to the Xen to emulate the PCI devices config space.
> 
> A MMIO trap handler for the PCI ECAM space is registered in XEN
> so that when guest is trying to access the PCI config space,XEN
> will trap the access and emulate read/write using the VPCI and
> not the real PCI hardware.
> 
> For Dom0less systems scan_pci_devices() would be used to discover the
> PCI device in XEN and VPCI handler will be added during XEN boots.
> 
> This patch is also doing some small fixes to fix compilation errors on
> arm32 of vpci and prevent 64bit accesses on 32bit:
> - use %zu instead of lu in header.c for print
> - prevent 64bit accesses in vpci_access_allowed
> - ifdef out using CONFIG_64BIT handling of len 8 in
> vpci_ecam_{read/write}
> 
> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

The vpci bits looks fine to me, so:

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

I have one question however related to the placement of the vpci setup
call in pci_add_device.

> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
> index 3aa8c3175f..082892c8a2 100644
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -766,7 +766,21 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
>          list_add(&pdev->domain_list, &hardware_domain->pdev_list);
>      }
>      else
> +    {
> +#ifdef CONFIG_ARM
> +        /*
> +         * On ARM PCI devices discovery will be done by Dom0. Add vpci 
> handler
> +         * when Dom0 inform XEN to add the PCI devices in XEN.
> +         */
> +        ret = vpci_add_handlers(pdev);
> +        if ( ret )
> +        {
> +            printk(XENLOG_ERR "Setup of vPCI failed: %d\n", ret);
> +            goto out;
> +        }

I'm likely lost here, but shouldn't this also be done for devices that
belong to the hardware domain and are assigned to it in the first
branch of this conditional?

Or else you will end up with devices assigned to the hardware domain
that don't have vPCI setup for them.

Thanks, Roger.



 


Rackspace

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