xen/arm: pci: introduce PCI_PASSTHROUGH Kconfig option
PATCH v7 1/1 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 EXPERT.
---
This requires ("xen/arm: fix build with HAS_PCI") [4] to be merged first
The alpine-3.18-gcc-arm64-randconfig CI job should pick up the new config option, but if we wanted it to be built more consistently in CI we could add CONFIG_PCI_PASSTHROUGH=y to one of the arm jobs in automation/gitlab-ci/build.yaml, e.g. alpine-3.18-gcc-debug-arm64.
v6->v7:
* rebase
* send patch separately from series [3]
* add HAS_VPCI_GUEST_SUPPORT since it's upstream now
* drop Julien's A-b due to changes and was given several releases ago
v5->v6:
* no change
v4->v5:
* no change
v3->v4:
* no change
v2->v3:
* add Julien's A-b
v1->v2:
* drop "ARM" naming since it is already in an ARM category
* depend on EXPERT instead of UNSUPPORTED
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-10/msg00660.html
[3] https://lore.kernel.org/xen-devel/[email protected]/T/#t
[4] https://lore.kernel.org/xen-devel/[email protected]/T/#t
(cherry picked from commit 9a08f1f7ce28ec619640ba9ce11018bf443e9a0e from the
downstream branch [1])
--- xen/arch/arm/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
xen/arch/arm/Kconfig +10 -0
@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig" +config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORT + default n + help + This option enables PCI device passthrough + endmenu menu "ARM errata workaround via the alternative framework"
base-commit: 86a12671c5d33063b6f958bdcca7c9d14cd5aac8
Signature · 1 line
2.49.0
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 266
Quoted 12 lines · Stewart Hildebrand
xen/arch/arm/Kconfig +6
-0@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig" +config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORT
What about HAS_PASSTHROUGH? Seeing that being selected by MMU, what about that connection here?
Selecting HAS_VPCI shouldn't really be necessary; HAS_VPCI_GUEST_SUPPORT does that for you already. (I further wonder whether HAS_VPCI wouldn't in turn better select HAS_PCI.)
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 267
Quoted 1 line
xen/arch/arm/Kconfig +1
-0+ default n
This is unnecessary (redundant) and would hence better be omitted.
Jan
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Stewart Hildebrand
xen/arch/arm/Kconfig +0
-0@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig"
Quoted 9 lines
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 266
Quoted 6 lines
xen/arch/arm/Kconfig +6
-0+config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORTWhat about
HAS_PASSTHROUGH? Seeing that being selected by MMU, what about that connection here?
Hm, yes. I'm not sure if depends or select would be better?
depends on ARM_64 && HAS_PASSTHROUGH
or
select HAS_PASSTHROUGH
Quoted 3 lines
Selecting
HAS_VPCIshouldn't really be necessary;HAS_VPCI_GUEST_SUPPORTdoes that for you already. (I further wonder whetherHAS_VPCIwouldn't in turn better selectHAS_PCI.)
I'd be happy to make these changes.
Quoted 3 lines
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 267
Quoted 1 line
xen/arch/arm/Kconfig +1
-0+ default nThis is unnecessary (redundant) and would hence better be omitted.
OK, I'll remove it.
Quoted 18 lines · Stewart Hildebrand
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Stewart Hildebrand
xen/arch/arm/Kconfig +0
-0@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig"Quoted 9 lines
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 266
Quoted 6 lines
xen/arch/arm/Kconfig +6
-0+config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORTWhat about
HAS_PASSTHROUGH? Seeing that being selected by MMU, what about that connection here?
Quoted 7 lines
Hm, yes. I'm not sure if depends or select would be better?
depends on ARM_64 && HAS_PASSTHROUGHor
select
HAS_PASSTHROUGH
Actually, thinking of it: HAS_* shouldn't be selected based on user choices, imo. Perhaps unless the HAS_* is a sub-feature of the dependent (as in e.g. "select HAS_VPCI if HVM" as we have it for x86). In which case all the select-s here might be wrong to use.
Jan
Jan
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Stewart Hildebrand
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Stewart Hildebrand
xen/arch/arm/Kconfig +0
-0@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig"Quoted 9 lines
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 266
Quoted 6 lines
xen/arch/arm/Kconfig +6
-0+config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORTWhat about
HAS_PASSTHROUGH? Seeing that being selected by MMU, what about that connection here?Hm, yes. I'm not sure if depends or select would be better?
depends on ARM_64 && HAS_PASSTHROUGH
Quoted 8 lines
Quoted 3 lines
or
select
HAS_PASSTHROUGHActually, thinking of it: HAS_* shouldn't be selected based on user choices, imo. Perhaps unless the HAS_* is a sub-feature of the dependent (as in e.g. "select
HAS_VPCIif HVM" as we have it for x86). In which case all the select-s here might be wrong to use.
How about something like this:
xen/arch/arm/Kconfig +8 -0
@@ -8,6 +8,8 @@ config ARM_64 depends on !ARM_32 select 64BIT select HAS_FAST_MULTIPLY + select HAS_VPCI_GUEST_SUPPORT if PCI_PASSTHROUGH + select HAS_PASSTHROUGH if PCI_PASSTHROUGH config ARM def_bool y
@@ -258,6 +260,12 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig" +config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + help + This option enables PCI device passthrough + endmenu menu "ARM errata workaround via the alternative framework"
xen/drivers/Kconfig +1 -0
@@ -13,6 +13,7 @@ source "drivers/pci/Kconfig" source "drivers/video/Kconfig" config HAS_VPCI + select HAS_PCI bool config HAS_VPCI_GUEST_SUPPORT
Quoted 40 lines · Stewart Hildebrand
Quoted 23 lines · Jan Beulich
Quoted 22 lines · Stewart Hildebrand
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Stewart Hildebrand
xen/arch/arm/Kconfig +0
-0@@ -258,6 +258,16 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig"Quoted 9 lines
xen/arch/arm/Kconfig config PARTIAL_EMULATION
Quoted 6 lines
xen/arch/arm/Kconfig +6
-0+config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + select HAS_PCI + select HAS_VPCI + select HAS_VPCI_GUEST_SUPPORTWhat about
HAS_PASSTHROUGH? Seeing that being selected by MMU, what about that connection here?Hm, yes. I'm not sure if depends or select would be better?
depends on ARM_64 && HAS_PASSTHROUGHQuoted 8 lines
Quoted 3 lines
or
select
HAS_PASSTHROUGHActually, thinking of it: HAS_* shouldn't be selected based on user choices, imo. Perhaps unless the HAS_* is a sub-feature of the dependent (as in e.g. "select
HAS_VPCIif HVM" as we have it for x86). In which case all the select-s here might be wrong to use.How about something like this:
xen/arch/arm/Kconfig +0
-0
xen/arch/arm/Kconfig config ARM_64 · line 11
Quoted 4 lines
xen/arch/arm/Kconfig +1
-0@@ -8,6 +8,8 @@ config ARM_64 depends on !ARM_32 select 64BIT select HAS_FAST_MULTIPLY + select HAS_VPCI_GUEST_SUPPORT if PCI_PASSTHROUGH
This one may be okay, subject to the Arm maintainers' views.
xen/arch/arm/Kconfig config ARM_64 · line 12
Quoted 1 line
xen/arch/arm/Kconfig +1
-0+ select HAS_PASSTHROUGH if PCI_PASSTHROUGH
At the first glance this one instead should be ...
xen/arch/arm/Kconfig config PARTIAL_EMULATION · line 267
Quoted 9 lines
xen/arch/arm/Kconfig +5
-0@@ -258,6 +260,12 @@ config PARTIAL_EMULATION source "arch/arm/firmware/Kconfig" +config PCI_PASSTHROUGH + bool "PCI passthrough" if EXPERT + depends on ARM_64 + help + This option enables PCI device passthrough
... a "depends on" here, imo. Yet that would go against your intentions, I think, so doing it the way you have it may be okay, subject to how you justify it.
xen/drivers/Kconfig source "drivers/pci/Kconfig" · line 17
Quoted 8 lines
xen/drivers/Kconfig +1
-0@@ -13,6 +13,7 @@ source "drivers/pci/Kconfig" source "drivers/video/Kconfig" config HAS_VPCI + select HAS_PCI bool
Please can the "bool" remain first?
Jan