Message ID | 20231009195747.889326-6-stewart.hildebrand@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Kconfig for PCI passthrough on ARM | expand |
On Mon, Oct 09, 2023 at 03:57:44PM -0400, Stewart Hildebrand wrote: > Select HAS_VPCI_GUEST_SUPPORT in Kconfig for enabling vPCI in domUs. > > Set the pci flags in xen_arch_domainconfig to enable vPCI if a pci device has > been specified in the xl domain config file. > > Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com> > --- > As the tag implies, this patch is not intended to be merged (yet). > > Note that CONFIG_HAS_VPCI_GUEST_SUPPORT is not currently used in the upstream > code base. It will be used by the vPCI series [1]. This patch is intended to be > merged as part of the vPCI series. I'll coordinate with Volodymyr to include > this in the vPCI series or resend afterwards. Meanwhile, I'll include it here > until the Kconfig and xen_arch_domainconfig prerequisites have been committed. > > v2->v3: > * set pci flags in toolstack > > v1->v2: > * new patch > > [1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg02361.html > --- > tools/libs/light/libxl_arm.c | 3 +++ > xen/arch/arm/Kconfig | 1 + Can we have two different patch? One for the hypervisor, one for the tools. Or does the both depends on each other, somehow? Is guest creation going to fails if we set XEN_DOMCTL_CONFIG_PCI_VPCI without HAS_VPCI_GUEST_SUPPORT ? Is the guest is going to fail to run, or fail at creation if the hypervisor HAS_VPCI_GUEST_SUPPORT, but we didn't set XEN_DOMCTL_CONFIG_PCI_VPCI? Thanks,
On 10/23/23 06:27, Anthony PERARD wrote: > On Mon, Oct 09, 2023 at 03:57:44PM -0400, Stewart Hildebrand wrote: >> Select HAS_VPCI_GUEST_SUPPORT in Kconfig for enabling vPCI in domUs. >> >> Set the pci flags in xen_arch_domainconfig to enable vPCI if a pci device has >> been specified in the xl domain config file. >> >> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com> >> --- >> As the tag implies, this patch is not intended to be merged (yet). >> >> Note that CONFIG_HAS_VPCI_GUEST_SUPPORT is not currently used in the upstream >> code base. It will be used by the vPCI series [1]. This patch is intended to be >> merged as part of the vPCI series. I'll coordinate with Volodymyr to include >> this in the vPCI series or resend afterwards. Meanwhile, I'll include it here >> until the Kconfig and xen_arch_domainconfig prerequisites have been committed. >> >> v2->v3: >> * set pci flags in toolstack >> >> v1->v2: >> * new patch >> >> [1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg02361.html >> --- >> tools/libs/light/libxl_arm.c | 3 +++ >> xen/arch/arm/Kconfig | 1 + > > Can we have two different patch? One for the hypervisor, one for the > tools. Yes. > Or does the both depends on each other, somehow? They will both be needed for enabling vPCI in a domU on ARM with assigned PCI device(s). > > Is guest creation going to fails if we set XEN_DOMCTL_CONFIG_PCI_VPCI > without HAS_VPCI_GUEST_SUPPORT ? No, currently the guest will still run, it just won't be able to probe any assigned PCI devices. > > Is the guest is going to fail to run, or fail at creation if the > hypervisor HAS_VPCI_GUEST_SUPPORT, but we didn't set > XEN_DOMCTL_CONFIG_PCI_VPCI? Assuming num_pcidevs > 0, the guest will be created but fail to boot as it will try to access the vPCI configuration space, but it will trap and panic. In both cases, I think I can do more on the hypervisor side to check for an invalid configuration and refuse the domain creation with a helpful error message. In either case, if a user does not try to assign a PCI device (i.e. num_pcidevs == 0), then the guest will run fine. > > Thanks, > > -- > Anthony PERARD
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c index 15391917748c..931b2f8852ff 100644 --- a/tools/libs/light/libxl_arm.c +++ b/tools/libs/light/libxl_arm.c @@ -222,6 +222,9 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, config->arch.sve_vl = d_config->b_info.arch_arm.sve_vl / 128U; } + if (d_config->num_pcidevs) + config->arch.pci_flags = XEN_DOMCTL_CONFIG_PCI_VPCI; + return 0; } diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index fcb5a0920c5c..6f33373f9035 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -196,6 +196,7 @@ config PCI_PASSTHROUGH depends on ARM_64 select HAS_PCI select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORT default n help This option enables PCI device passthrough
Select HAS_VPCI_GUEST_SUPPORT in Kconfig for enabling vPCI in domUs. Set the pci flags in xen_arch_domainconfig to enable vPCI if a pci device has been specified in the xl domain config file. Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com> --- As the tag implies, this patch is not intended to be merged (yet). Note that CONFIG_HAS_VPCI_GUEST_SUPPORT is not currently used in the upstream code base. It will be used by the vPCI series [1]. This patch is intended to be merged as part of the vPCI series. I'll coordinate with Volodymyr to include this in the vPCI series or resend afterwards. Meanwhile, I'll include it here until the Kconfig and xen_arch_domainconfig prerequisites have been committed. v2->v3: * set pci flags in toolstack v1->v2: * new patch [1] https://lists.xenproject.org/archives/html/xen-devel/2023-08/msg02361.html --- tools/libs/light/libxl_arm.c | 3 +++ xen/arch/arm/Kconfig | 1 + 2 files changed, 4 insertions(+)