[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 08/11] xen/arm: Enable the existing x86 virtual PCI support for ARM.
- To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 11 Oct 2021 18:43:37 +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=0deLUC8u2RvmRqtUeggx4LBst74D/t8DUDFCiI4AcCs=; b=N7fm8dSztivW0wunJntsWjqKJZWtAM2XxET048Lj3RL654zyy9iXmpO/s/rdnEpo7laX+/mBzN18IK+DcXMtmLHnfZx/Z4lGrmmSqpnb1P+SPo8XNIDhQvM/0BuP59ikyKffjtx77HfKMqtLZJikgup9YDQr2k95/RnxQz+TNSl1k1v5zhZR3wLy2Ljz1Zome3ouFJC3sKZW8vYPodbxTXT4RtgIYPaU42iSYPe8vPvfGb2FxAXp7kohaCHjemB7dKbHDtohJudiH0sJzhzBHenunVczci9bVn99flwC8bLJCVGQqfaL6+4IaRWq5qilxMV3lTjqFoOFZUxBelJ6/w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ux8R6Uei7JwkAhafTcpWgmp6w4ScKoCTT9EUn8N2z1AScJLO9oyaj/CbubasLc58HR5vGHLjUV85vJZsUgRK2Bl1E9Xdi9DAgh0H+MWWlrturFhMPqhyfYlB1q8VN7jXpPq6pAUFSOEmX1kDUuoBrcmW32kmnNVt2cDuHeYGlFLjKocb49B47Zy7O2Cqu3Pt8EeinU2uH0ruFqMSpDQyeTWzn1HS/dP2HC7QeXjVq9YMBTDk4UvU3nfkWwIJ2P769HsRw+Xc1i7O4cd2Jtn7ZsGgZzVSUAeU0LP8QNNsjOF+91eAE+BU3TyaayPpGFBJHy4hx8oQh2bvN3LAM4ox9g==
- Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
- Delivery-date: Mon, 11 Oct 2021 16:44:17 +0000
- Ironport-data: A9a23:tF52N6xstDID7290f9Z6t+cfwCrEfRIJ4+MujC+fZmUNrF6WrkVTm GtLWTqCbKmCZ2Gne4t/bY+ypE9X75/SmoBjQApo+yAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAsLeNYYH1500s6w7dg2tcAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt/xd0 dlNkYezcxp3NKKcsr4ZeDVWEz4raMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 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OlvvaAtICyxGWtcC5HiVpcgK7k/EluwhrkI0tgw2H1o/ 9J94r6D7wTMxC3w4y/Zn5OI9K6S4w2cozm7YKDTyAXUJmEuWQrQiXkE+3kyHJZOUmpZRqR2LtR XY8uKkQej6wnskHuXmKuhkQ21JyB28mnZQBi8BQ/MdnX+7dlYkpYbiaCnZJ5HguSOaIXLdX1gu T+JUZhhfU5ksCVI/5AjIPuGF3tRtZh17hsMlXA2QYiy0S5jFpmIgpLCw4/GJI6McUr9pb9eNIl vpJ342fBIMIoy8PXqhC0jeba
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, Oct 11, 2021 at 04:20:14PM +0000, Oleksandr Andrushchenko wrote:
>
>
> On 11.10.21 19:12, Bertrand Marquis wrote:
> > Hi Roger,
> >
> >> On 11 Oct 2021, at 11:51, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
> >>
> >> On Wed, Oct 06, 2021 at 06:40:34PM +0100, Rahul Singh wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
> >>> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> >>> ---
> >>> Change in v5:
> >>> - Add pci_cleanup_msi(pdev) in cleanup part.
> >>> - Added Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> >>> Change in v4:
> >>> - Move addition of XEN_DOMCTL_CDF_vpci flag to separate patch
> >>> Change in v3:
> >>> - Use is_pci_passthrough_enabled() in place of pci_passthrough_enabled
> >>> variable
> >>> - Reject XEN_DOMCTL_CDF_vpci for x86 in arch_sanitise_domain_config()
> >>> - Remove IS_ENABLED(CONFIG_HAS_VPCI) from has_vpci()
> >>> Change in v2:
> >>> - Add new XEN_DOMCTL_CDF_vpci flag
> >>> - modify has_vpci() to include XEN_DOMCTL_CDF_vpci
> >>> - enable vpci support when pci-passthough option is enabled.
> >>> ---
> >>> ---
> >>> xen/arch/arm/Makefile | 1 +
> >>> xen/arch/arm/domain.c | 4 ++
> >>> xen/arch/arm/domain_build.c | 3 +
> >>> xen/arch/arm/vpci.c | 102 ++++++++++++++++++++++++++++++++++
> >>> xen/arch/arm/vpci.h | 36 ++++++++++++
> >>> xen/drivers/passthrough/pci.c | 18 ++++++
> >>> xen/include/asm-arm/domain.h | 7 ++-
> >>> xen/include/asm-x86/pci.h | 2 -
> >>> xen/include/public/arch-arm.h | 7 +++
> >>> xen/include/xen/pci.h | 2 +
> >>> 10 files changed, 179 insertions(+), 3 deletions(-)
> >>> create mode 100644 xen/arch/arm/vpci.c
> >>> create mode 100644 xen/arch/arm/vpci.h
> >>>
> >>> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> >>> index 44d7cc81fa..fb9c976ea2 100644
> >>> --- a/xen/arch/arm/Makefile
> >>> +++ b/xen/arch/arm/Makefile
> >>> @@ -7,6 +7,7 @@ ifneq ($(CONFIG_NO_PLAT),y)
> >>> obj-y += platforms/
> >>> endif
> >>> obj-$(CONFIG_TEE) += tee/
> >>> +obj-$(CONFIG_HAS_VPCI) += vpci.o
> >>>
> >>> obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
> >>> obj-y += bootfdt.init.o
> >>> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> >>> index 36138c1b2e..fbb52f78f1 100644
> >>> --- a/xen/arch/arm/domain.c
> >>> +++ b/xen/arch/arm/domain.c
> >>> @@ -39,6 +39,7 @@
> >>> #include <asm/vgic.h>
> >>> #include <asm/vtimer.h>
> >>>
> >>> +#include "vpci.h"
> >>> #include "vuart.h"
> >>>
> >>> DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
> >>> @@ -767,6 +768,9 @@ int arch_domain_create(struct domain *d,
> >>> if ( is_hardware_domain(d) && (rc = domain_vuart_init(d)) )
> >>> goto fail;
> >>>
> >>> + if ( (rc = domain_vpci_init(d)) != 0 )
> >>> + goto fail;
> >>> +
> >>> return 0;
> >>>
> >>> fail:
> >>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> >>> index c5afbe2e05..f4c89bde8c 100644
> >>> --- a/xen/arch/arm/domain_build.c
> >>> +++ b/xen/arch/arm/domain_build.c
> >>> @@ -3053,6 +3053,9 @@ void __init create_dom0(void)
> >>> if ( iommu_enabled )
> >>> dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
> >>>
> >>> + if ( is_pci_passthrough_enabled() )
> >>> + dom0_cfg.flags |= XEN_DOMCTL_CDF_vpci;
> >> I think I'm confused with this. You seem to enable vPCI for dom0, but
> >> then domain_vpci_init will setup traps for the guest virtual ECAM
> >> layout, not the native one that dom0 will be using.
> > I think after the last discussions, it was decided to also installed the
> > vpci
> > handler for dom0. I will have to look into this and come back to you.
> > @Oleksandr: Could you comment on this.
> Yes, we do trap Dom0 as well. The Dom0 traps are not in this series, but
> are in mine as it needs more preparatory work for that. Please see [1]
Then I don't think we should set XEN_DOMCTL_CDF_vpci for dom0 here, it
should instead be done in the patch where dom0 support is introduced.
Thanks, Roger.
|