Skip to contentSkip to conversation

xen/arm: pci: introduce PCI_PASSTHROUGH Kconfig option

PATCH Superseded Stewart Hildebrand 2 participants 6 messages Jun 20, 2023 – Jul 7, 2023

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xen/arm: pci: introduce PCI_PASSTHROUGH Kconfig option

From: Rahul Singh <[email protected]>

Setting CONFIG_PCI_PASSTHROUGH=y will enable PCI passthrough on ARM, even though the feature is not yet complete in the current upstream codebase. The purpose of this is to make it easier to enable the necessary configs (HAS_PCI, HAS_VPCI) for testing and development of PCI passthrough on ARM.

Since PCI passthrough on ARM is still work in progress at this time, make it depend on UNSUPPORTED.

---
(cherry picked from commit 9a08f1f7ce28ec619640ba9ce11018bf443e9a0e from the
downstream branch [1])

Changes from downstream to v1:
* depends on ARM_64 (Stefano)
* Don't select HAS_VPCI_GUEST_SUPPORT since this config option is not currently used in the upstream codebase. This will want to be re-added here once the vpci series [2] is merged.
* Don't select ARM_SMMU_V3 since this option can already be selected independently. While PCI passthrough on ARM depends on an SMMU, it does not depend on a particular version or variant of an SMMU.
* Don't select HAS_ITS since this option can already be selected independently. HAS_ITS may want to be added here once the MSI series [1] is merged.
* Don't select LATE_HWDOM since this option is unrelated to PCI passthrough.

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commits/poc/pci-passthrough
[2] https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg00863.html

---
 xen/arch/arm/Kconfig | 9 +++++++++
 1 file changed, 9 insertions(+)
xen/arch/arm/Kconfig +9 -0
index 61e581b8c2b0..3d22cd26a68c 100644
@@ -184,6 +184,15 @@ config STATIC_SHM
 	help
 	  This option enables statically shared memory on a dom0less system.
 
+config PCI_PASSTHROUGH
+	bool "PCI passthrough on ARM (UNSUPPORTED)" if UNSUPPORTED
+	depends on ARM_64
+	select HAS_PCI
+	select HAS_VPCI
+	default n
+	help
+	  PCI device passthrough on ARM (UNSUPPORTED)
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
Signature · 1 line
2.41.0
#1 lore raw

PATCH 2/2 xen/arm: Make has_vpci depend on CONFIG_HAS_VPCI

From: Oleksandr Andrushchenko <[email protected]>

VPCI is disabled on ARM. Make it depend on CONFIG_HAS_VPCI to test the PCI passthrough support.

While here, remove the comment on the preceding line.

---
There are two downstreams [1] [2] that have independently made a version this change, each with different Signed-off-by's. I simply picked one at random for the Author: field, and added both Signed-off-by lines. Please let me know if there are any objections.

downstream->v1:
* change to IS_ENABLED(CONFIG_HAS_VPCI) instead of hardcoded to true
* remove the comment on the preceding line

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commit/27be1729ce8128dbe37275ce7946b2fbd2e5a382
[2] https://github.com/xen-troops/xen/commit/bf12185e6fb2e31db0d8e6ea9ccd8a02abadec17

---
 xen/arch/arm/include/asm/domain.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/include/asm/domain.h +1 -2
index 99e798ffff68..6e016b00bae1 100644
@@ -298,8 +298,7 @@ static inline void arch_vcpu_block(struct vcpu *v) {}
 
 #define arch_vm_assist_valid_mask(d) (1UL << VMASST_TYPE_runstate_update_flag)
 
-/* vPCI is not available on Arm */
-#define has_vpci(d)    ({ (void)(d); false; })
+#define has_vpci(d)    ({ (void)(d); IS_ENABLED(CONFIG_HAS_VPCI); })
 
 struct arch_vcpu_io {
     struct instr_details dabt_instr; /* when the instruction is decoded */
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH v1 2/2] xen/arm: Make has_vpci depend on CONFIG_HAS_VPCI

Hi,

Quoted 31 lines · Stewart Hildebrand

From: Oleksandr Andrushchenko <[email protected]>

VPCI is disabled on ARM. Make it depend on CONFIG_HAS_VPCI to test the PCI passthrough support.

While here, remove the comment on the preceding line.

---
There are two downstreams [1] [2] that have independently made a version this change, each with different Signed-off-by's. I simply picked one at random for the Author: field, and added both Signed-off-by lines. Please let me know if there are any objections.

downstream->v1:
* change to IS_ENABLED(CONFIG_HAS_VPCI) instead of hardcoded to true
* remove the comment on the preceding line

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commit/27be1729ce8128dbe37275ce7946b2fbd2e5a382
[2] https://github.com/xen-troops/xen/commit/bf12185e6fb2e31db0d8e6ea9ccd8a02abadec17

---
  xen/arch/arm/include/asm/domain.h | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/include/asm/domain.h +0 -0
index 99e798ffff68..6e016b00bae1 100644

xen/arch/arm/include/asm/domain.h static inline void arch_vcpu_block(struct vcpu *v) {} · line 301

Quoted 6 lines
xen/arch/arm/include/asm/domain.h +1 -2
@@ -298,8 +298,7 @@ static inline void arch_vcpu_block(struct vcpu *v) {}
 
  #define arch_vm_assist_valid_mask(d) (1UL << VMASST_TYPE_runstate_update_flag)
 
-/* vPCI is not available on Arm */
-#define has_vpci(d)    ({ (void)(d); false; })
+#define has_vpci(d)    ({ (void)(d); IS_ENABLED(CONFIG_HAS_VPCI); })

This will enable vPCI for all the domains. However, in the cover letter, you seemed to suggest that guest support is not there. So shouldn't this be "is_harware_domain(d)"? Or d->arch.has_vcpi?

Cheers,

Signature · 1 line
Julien Grall
#3 lore raw

Re: [PATCH v1 2/2] xen/arm: Make has_vpci depend on CONFIG_HAS_VPCI

Quoted 37 lines · Julien Grall

Hi,

Quoted 34 lines · Stewart Hildebrand

From: Oleksandr Andrushchenko <[email protected]>

VPCI is disabled on ARM. Make it depend on CONFIG_HAS_VPCI to test the PCI passthrough support.

While here, remove the comment on the preceding line.

---
There are two downstreams [1] [2] that have independently made a version this change, each with different Signed-off-by's. I simply picked one at random for the Author: field, and added both Signed-off-by lines. Please let me know if there are any objections.

downstream->v1:
* change to IS_ENABLED(CONFIG_HAS_VPCI) instead of hardcoded to true
* remove the comment on the preceding line

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commit/27be1729ce8128dbe37275ce7946b2fbd2e5a382
[2] https://github.com/xen-troops/xen/commit/bf12185e6fb2e31db0d8e6ea9ccd8a02abadec17
---
  xen/arch/arm/include/asm/domain.h | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/include/asm/domain.h +0 -0
index 99e798ffff68..6e016b00bae1 100644
@@ -298,8 +298,7 @@ static inline void arch_vcpu_block(struct vcpu *v) {}
 
   #define arch_vm_assist_valid_mask(d) (1UL << VMASST_TYPE_runstate_update_flag)
 
Quoted 7 lines

xen/arch/arm/include/asm/domain.h static inline void arch_vcpu_block(struct vcpu *v) {} · line 301

Quoted 3 lines
xen/arch/arm/include/asm/domain.h +1 -2
-/* vPCI is not available on Arm */
-#define has_vpci(d)    ({ (void)(d); false; })
+#define has_vpci(d)    ({ (void)(d); IS_ENABLED(CONFIG_HAS_VPCI); })

This will enable vPCI for all the domains. However, in the cover letter, you seemed to suggest that guest support is not there. So shouldn't this be "is_harware_domain(d)"? Or d->arch.has_vcpi?

Right, I mentioned in the SMMU series discussion [3] that it will only work in dom0 / hardware domain (unless additional vPCI series [4] is applied).

So, making it depend on is_hardware_domain makes sense for now:

#define has_vpci(d) ({ IS_ENABLED(CONFIG_HAS_VPCI) && is_hardware_domain(d); })

However, the is_hardware_domain check should be removed when the vPCI series [4] is merged.

[3] https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg01135.html
[4] https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg00863.html

#4 lore raw
In reply to Stewart Hildebrand

Hi,

Quoted 40 lines · Stewart Hildebrand

From: Rahul Singh <[email protected]>

Setting CONFIG_PCI_PASSTHROUGH=y will enable PCI passthrough on ARM, even though the feature is not yet complete in the current upstream codebase. The purpose of this is to make it easier to enable the necessary configs (HAS_PCI, HAS_VPCI) for testing and development of PCI passthrough on ARM.

Since PCI passthrough on ARM is still work in progress at this time, make it depend on UNSUPPORTED.

---
(cherry picked from commit 9a08f1f7ce28ec619640ba9ce11018bf443e9a0e from the
downstream branch [1])

Changes from downstream to v1:
* depends on ARM_64 (Stefano)
* Don't select HAS_VPCI_GUEST_SUPPORT since this config option is not currently used in the upstream codebase. This will want to be re-added here once the vpci series [2] is merged.
* Don't select ARM_SMMU_V3 since this option can already be selected independently. While PCI passthrough on ARM depends on an SMMU, it does not depend on a particular version or variant of an SMMU.
* Don't select HAS_ITS since this option can already be selected independently. HAS_ITS may want to be added here once the MSI series [1] is merged.
* Don't select LATE_HWDOM since this option is unrelated to PCI passthrough.

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commits/poc/pci-passthrough
[2] https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg00863.html

---
  xen/arch/arm/Kconfig | 9 +++++++++
  1 file changed, 9 insertions(+)
xen/arch/arm/Kconfig +0 -0
index 61e581b8c2b0..3d22cd26a68c 100644

xen/arch/arm/Kconfig config STATIC_SHM · line 188

Quoted 5 lines
xen/arch/arm/Kconfig +2 -0
@@ -184,6 +184,15 @@ config STATIC_SHM
  	help
  	  This option enables statically shared memory on a dom0less system.
 
+config PCI_PASSTHROUGH
+	bool "PCI passthrough on ARM (UNSUPPORTED)" if UNSUPPORTED

The series is already under an Arm category. So I would drop "ARM" here.

NIT: Also, I think it should be EXPERT rather than UNSUPPORTED. I view the former as in more "experimental" than the latter.

xen/arch/arm/Kconfig config STATIC_SHM · line 194

Quoted 6 lines
xen/arch/arm/Kconfig +6 -0
+	depends on ARM_64
+	select HAS_PCI
+	select HAS_VPCI
+	default n
+	help
+	  PCI device passthrough on ARM (UNSUPPORTED)

Same.

xen/arch/arm/Kconfig config STATIC_SHM · line 198

Quoted 4 lines
xen/arch/arm/Kconfig +1 -0
+
  endmenu
 
  menu "ARM errata workaround via the alternative framework"

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 46 lines · Julien Grall

Hi,

Quoted 43 lines · Stewart Hildebrand

From: Rahul Singh <[email protected]>

Setting CONFIG_PCI_PASSTHROUGH=y will enable PCI passthrough on ARM, even though the feature is not yet complete in the current upstream codebase. The purpose of this is to make it easier to enable the necessary configs (HAS_PCI, HAS_VPCI) for testing and development of PCI passthrough on ARM.

Since PCI passthrough on ARM is still work in progress at this time, make it depend on UNSUPPORTED.

---
(cherry picked from commit 9a08f1f7ce28ec619640ba9ce11018bf443e9a0e from the downstream branch [1])

Changes from downstream to v1:
* depends on ARM_64 (Stefano)
* Don't select HAS_VPCI_GUEST_SUPPORT since this config option is not currently used in the upstream codebase. This will want to be re-added here once the vpci series [2] is merged.
* Don't select ARM_SMMU_V3 since this option can already be selected independently. While PCI passthrough on ARM depends on an SMMU, it does not depend on a particular version or variant of an SMMU.
* Don't select HAS_ITS since this option can already be selected independently. HAS_ITS may want to be added here once the MSI series [1] is merged.
* Don't select LATE_HWDOM since this option is unrelated to PCI passthrough.

[1] https://gitlab.com/xen-project/people/bmarquis/xen-arm-poc/-/commits/poc/pci-passthrough
[2] https://lists.xenproject.org/archives/html/xen-devel/2023-06/msg00863.html
---
  xen/arch/arm/Kconfig | 9 +++++++++

  1 file changed, 9 insertions(+)
xen/arch/arm/Kconfig +0 -0
index 61e581b8c2b0..3d22cd26a68c 100644
@@ -184,6 +184,15 @@ config STATIC_SHM

      help
        This option enables statically shared memory on a dom0less system.

Quoted 4 lines
Quoted 2 lines

+config PCI_PASSTHROUGH
+     bool "PCI passthrough on ARM (UNSUPPORTED)" if UNSUPPORTED

The series is already under an Arm category. So I would drop "ARM" here.

OK

Quoted 2 lines

NIT: Also, I think it should be EXPERT rather than UNSUPPORTED. I view the former as in more "experimental" than the latter.

OK

Quoted 8 lines
Quoted 6 lines

+     depends on ARM_64
+     select HAS_PCI
+     select HAS_VPCI
+     default n
+     help
+       PCI device passthrough on ARM (UNSUPPORTED)

Same.

OK