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.hildebr...@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(+)

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
-- 
2.42.0


Reply via email to