diff mbox series

[v3,4/5] xen/arm: enable vPCI for dom0

Message ID 20231009195747.889326-5-stewart.hildebrand@amd.com (mailing list archive)
State Superseded
Headers show
Series Kconfig for PCI passthrough on ARM | expand

Commit Message

Stewart Hildebrand Oct. 9, 2023, 7:57 p.m. UTC
Set the pci flags in xen_arch_domainconfig to enable vPCI for dom0.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
Julien had a suggestion to make this conditional on pci_passthrough_enabled [1].
However, in v5 of the PCI ARM SMMU series [2], we propose removing the
pci_passthrough_enabled flag. If pci_passthrough_enabled is gone, the conditions
under which vPCI should be enabled for dom0 aren't entirely clear to me (other
than CONFIG_HAS_VPCI=y).

v2->v3:
* new patch

[1] https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg00475.html
[2] https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg00210.html
---
 xen/arch/arm/domain_build.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Julien Grall Oct. 20, 2023, 5:33 p.m. UTC | #1
Hi Stewart,

On 09/10/2023 20:57, Stewart Hildebrand wrote:
> Set the pci flags in xen_arch_domainconfig to enable vPCI for dom0.
> 
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
> ---
> Julien had a suggestion to make this conditional on pci_passthrough_enabled [1].
> However, in v5 of the PCI ARM SMMU series [2], we propose removing the
> pci_passthrough_enabled flag. If pci_passthrough_enabled is gone, the conditions
> under which vPCI should be enabled for dom0 aren't entirely clear to me (other
> than CONFIG_HAS_VPCI=y).

I think it should be based on whether Xen detected a PCI hostbridge in 
system. I haven't looked which variable/function could be used in Xen 
for this purpose.

Cheers,
Stewart Hildebrand Oct. 25, 2023, 7:32 p.m. UTC | #2
On 10/20/23 13:33, Julien Grall wrote:
> Hi Stewart,
> 
> On 09/10/2023 20:57, Stewart Hildebrand wrote:
>> Set the pci flags in xen_arch_domainconfig to enable vPCI for dom0.
>>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
>> ---
>> Julien had a suggestion to make this conditional on pci_passthrough_enabled [1].
>> However, in v5 of the PCI ARM SMMU series [2], we propose removing the
>> pci_passthrough_enabled flag. If pci_passthrough_enabled is gone, the conditions
>> under which vPCI should be enabled for dom0 aren't entirely clear to me (other
>> than CONFIG_HAS_VPCI=y).
> 
> I think it should be based on whether Xen detected a PCI hostbridge in
> system. I haven't looked which variable/function could be used in Xen
> for this purpose.

We can slightly tweak pci_host_iterate_bridges_and_count() and use that.
Also, a full revert of the pci_passthrough_enabled flag over in the SMMU series probably wasn't the best approach, so I'll add pci_passthrough_enabled into the mix too.

> 
> Cheers,
> 
> -- 
> Julien Grall
diff mbox series

Patch

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 24c9019cc43c..c1174535f430 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3912,6 +3912,9 @@  void __init create_dom0(void)
             panic("SVE vector length error\n");
     }
 
+    if ( IS_ENABLED(CONFIG_HAS_VPCI) )
+        dom0_cfg.arch.pci_flags = XEN_DOMCTL_CONFIG_PCI_VPCI;
+
     dom0 = domain_create(0, &dom0_cfg, CDF_privileged | CDF_directmap);
     if ( IS_ERR(dom0) )
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));