xen/mmu: enable SMMU subsystem only in MMU
PATCH 2/2 xen/mmu: enable SMMU subsystem only in MMU
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent on CONFIG_MMU.
--- xen/arch/arm/Kconfig | 2 +- xen/drivers/passthrough/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/Kconfig +1 -1
@@ -16,7 +16,7 @@ config ARM select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN - select IOMMU_FORCE_PT_SHARE + select IOMMU_FORCE_PT_SHARE if MMU config ARCH_DEFCONFIG string
xen/drivers/passthrough/Kconfig +2 -1
@@ -5,6 +5,7 @@ config HAS_PASSTHROUGH if ARM config ARM_SMMU bool "ARM SMMUv1 and v2 driver" + depends on MMU default y help Support for implementations of the ARM System MMU architecture
@@ -15,7 +16,7 @@ config ARM_SMMU config ARM_SMMU_V3 bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" if EXPERT - depends on ARM_64 && (!ACPI || BROKEN) + depends on ARM_64 && (!ACPI || BROKEN) && MMU help Support for implementations of the ARM System MMU architecture version 3. Driver is in experimental stage and should not be used in
Signature · 1 line
2.25.1
Quoted 13 lines · Ayan Kumar Halder
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>—
Hi,
Quoted 18 lines · Ayan Kumar Halder
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/Kconfig | 2 +- xen/drivers/passthrough/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)xen/arch/arm/Kconfig +0
-0
xen/arch/arm/Kconfig config ARM · line 19
Quoted 5 lines
xen/arch/arm/Kconfig +1
-1@@ -16,7 +16,7 @@ config ARM select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN - select IOMMU_FORCE_PT_SHARE + select IOMMU_FORCE_PT_SHARE if MMU
Realistically, everything under drivers/passthrough is MMU specific. So does it actually make any sense to select HAS_PASSTHROUGH right now?
Quoted 16 lines
xen/arch/arm/Kconfig +0
-0config ARCH_DEFCONFIG stringxen/drivers/passthrough/Kconfig +1
-0@@ -5,6 +5,7 @@ config HAS_PASSTHROUGH if ARM config ARM_SMMU bool "ARM SMMUv1 and v2 driver" + depends on MMU default y help Support for implementations of the ARM System MMU architecture
xen/drivers/passthrough/Kconfig config ARM_SMMU · line 22
Quoted 8 lines
xen/drivers/passthrough/Kconfig +1
-1@@ -15,7 +16,7 @@ config ARM_SMMU config ARM_SMMU_V3 bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" if EXPERT - depends on ARM_64 && (!ACPI || BROKEN) + depends on ARM_64 && (!ACPI || BROKEN) && MMU help Support for implementations of the ARM System MMU architecture version 3. Driver is in experimental stage and should not be used in
Cheers,
Signature · 1 line
Julien Grall
Quoted 1 line · Julien Grall
Hi,
Hi Julien,
Quoted 15 lines · Ayan Kumar Halder
Quoted 13 lines
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>---
xen/arch/arm/Kconfig | 2 +-
xen/drivers/passthrough/Kconfig | 3 ++-2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 12 lines
Quoted 10 lines
xen/arch/arm/Kconfig +0
-0@@ -16,7 +16,7 @@ config ARMselect
HAS_DEVICE_TREE
selectHAS_PASSTHROUGH
selectHAS_UBSAN
- selectIOMMU_FORCE_PT_SHARE
+ selectIOMMU_FORCE_PT_SHAREif MMURealistically, everything under
drivers/passthroughis MMU specific. So does it actually make any sense to selectHAS_PASSTHROUGHright now?
Actually we are able to assign devices to different DomUs (eg UART1 to domU1) as long as the device isn't behind an IOMMU. So in our case, the passthrough device tree has this node
uart@9c0b0000 {
compatible = "arm,pl011\0arm,primecell";
reg = <0x00 0x9c0b0000 0x00 0x10000>; interrupt-parent = <0x01>;
interrupts = <0x00 0x07 0x04>;
clock-names = "uartclk\0apb_pclk";
clocks = <0x06 0x07>;
xen,path = "/uart@9c0b0000";
xen,reg = <0x00 0x9c0b0000 0x00 0x10000 0x00 0x9c0b0000>; xen,force-assign-without-iommu;
};
So, should we still disable HAS_PASSTHROUGH for MPU ?
- Ayan
Quoted 26 lines
Quoted 18 lines
config
ARCH_DEFCONFIG
stringxen/drivers/passthrough/Kconfig +0
-0@@ -5,6 +5,7 @@ config HAS_PASSTHROUGHif ARM
configARM_SMMU
bool "ARM SMMUv1 and v2 driver"
+ depends on MMU
default y
help
Support for implementations of the ARM System MMU architecturexen/drivers/passthrough/Kconfig +0
-0@@ -15,7 +16,7 @@ config ARM_SMMUconfig
ARM_SMMU_V3
bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" if EXPERTQuoted 5 lines
- depends on ARM_64 && (!ACPI || BROKEN) + depends on ARM_64 && (!ACPI || BROKEN) && MMUhelp
Support for implementations of the ARM System MMU architecture version 3. Driver is in experimental stage and should not be used inCheers,
Hi Ayan,
Quoted 33 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall
Hi,
Hi Julien,
Quoted 15 lines · Ayan Kumar Halder
Quoted 13 lines
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>---
xen/arch/arm/Kconfig | 2 +-
xen/drivers/passthrough/Kconfig | 3 ++-2 files changed, 3 insertions(+), 2 deletions(-)Quoted 12 lines
Quoted 10 lines
xen/arch/arm/Kconfig +0
-0@@ -16,7 +16,7 @@ config ARMselect
HAS_DEVICE_TREE
selectHAS_PASSTHROUGH
selectHAS_UBSAN
- selectIOMMU_FORCE_PT_SHARE
+ selectIOMMU_FORCE_PT_SHAREif MMURealistically, everything under
drivers/passthroughis MMU specific. So does it actually make any sense to selectHAS_PASSTHROUGHright now?Actually we are able to assign devices to different DomUs (eg UART1 to domU1) as long as the device isn't behind an IOMMU. So in our case, the passthrough device tree has this node
Quoted 10 lines
uart@9c0b0000 {
compatible = "arm,pl011\0arm,primecell";
reg = <0x000x9c0b00000x000x10000>; interrupt-parent = <0x01>;
interrupts = <0x000x070x04>;
clock-names = "uartclk\0apb_pclk";
clocks = <0x060x07>;
xen,path = "/uart@9c0b0000";
xen,reg = <0x000x9c0b00000x000x100000x000x9c0b0000>; xen,force-assign-without-iommu;
So how devices will be protected on an MPU systems?
Quoted 1 line
};> So, should we still disable
HAS_PASSTHROUGHfor MPU ?
While it may work, a lot of code in drivers/passthrough is IOMMU specific (see all the function named iommu_*). So I find really odd that you disable IOMMU_FORCE_PT_SHARE but all the rest is still present...
I think we need some consistency. If you are planning to do device passthrough without any protection, then I don't think you need any code within drivers/passthrough/ (at least for platform devices).
Overall, for this patch, I think it would be better to simply select HAS_PASSTHROUGH when MMU is enabled. We can revisit device passthrough once we have the patches on the ML.
BTW, I think it should be move under the Kconfig MMU rather than using "if MMU".
Cheers,
Signature · 1 line
Julien Grall
Quoted 1 line · Julien Grall
Hi Ayan,
Hi Julien,
Quoted 48 lines · Ayan Kumar Halder
Quoted 33 lines · Julien Grall
Quoted 1 line
Hi,
Hi Julien,
Quoted 15 lines · Ayan Kumar Halder
Quoted 13 lines
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>---
xen/arch/arm/Kconfig | 2 +-
xen/drivers/passthrough/Kconfig | 3 ++-2 files changed, 3 insertions(+), 2 deletions(-)Quoted 12 lines
Quoted 10 lines
xen/arch/arm/Kconfig +0
-0@@ -16,7 +16,7 @@ config ARMselect
HAS_DEVICE_TREE
selectHAS_PASSTHROUGH
selectHAS_UBSAN
- selectIOMMU_FORCE_PT_SHARE
+ selectIOMMU_FORCE_PT_SHAREif MMURealistically, everything under
drivers/passthroughis MMU specific. So does it actually make any sense to selectHAS_PASSTHROUGHright now?Actually we are able to assign devices to different DomUs (eg UART1 to domU1) as long as the device isn't behind an IOMMU. So in our case, the passthrough device tree has this node
Quoted 10 lines
uart@9c0b0000 {
compatible = "arm,pl011\0arm,primecell";
reg = <0x000x9c0b00000x000x10000>; interrupt-parent = <0x01>;
interrupts = <0x000x070x04>;
clock-names = "uartclk\0apb_pclk";
clocks = <0x060x07>;
xen,path = "/uart@9c0b0000";
xen,reg = <0x000x9c0b00000x000x100000x000x9c0b0000>; xen,force-assign-without-iommu;So how devices will be protected on an MPU systems?
Quoted 7 lines
Quoted 1 line
};> So, should we still disable
HAS_PASSTHROUGHfor MPU ?While it may work, a lot of code in
drivers/passthroughis IOMMU specific (see all the function named iommu_*). So I find really odd that you disableIOMMU_FORCE_PT_SHAREbut all the rest is still present...I think we need some consistency. If you are planning to do device passthrough without any protection, then I don't think you need any code within
drivers/passthrough/(at least for platform devices).Overall, for this patch, I think it would be better to simply select
HAS_PASSTHROUGHwhen MMU is enabled. We can revisit device passthrough once we have the patches on the ML.
Yes, this makes sense. I will wait for Luca to confirm as well.
Quoted 2 lines
BTW, I think it should be move under the
KconfigMMU rather than using "if MMU".
Yes. So for now this should be sufficient.
xen/arch/arm/Kconfig +0 -0
@@ -14,9 +14,7 @@ config ARM
select FUNCTION_ALIGNMENT_4B
select HAS_ALTERNATIVE if HAS_VMAP
select HAS_DEVICE_TREE
- select HAS_PASSTHROUGH
select HAS_UBSAN
- select IOMMU_FORCE_PT_SHARE
config ARCH_DEFCONFIG
string
@@ -78,6 +76,8 @@ config MMU
bool "MMU"
select HAS_PMAP
select HAS_VMAP
+ select HAS_PASSTHROUGH
+ select IOMMU_FORCE_PT_SHARE
help
Select it if you plan to run Xen on A-profile Armv7+
- Ayan
Quoted 3 lines
Cheers,
Hi Ayan,
Quoted 54 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall
Hi Ayan,
Hi Julien,
Quoted 48 lines · Ayan Kumar Halder
Quoted 33 lines · Julien Grall
Quoted 1 line
Hi,
Hi Julien,
Quoted 15 lines · Ayan Kumar Halder
Quoted 13 lines
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/Kconfig | 2 +- xen/drivers/passthrough/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 12 lines
xen/arch/arm/Kconfig config ARM · line 19
Quoted 10 lines
xen/arch/arm/Kconfig +1
-1@@ -16,7 +16,7 @@ config ARM select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN - select IOMMU_FORCE_PT_SHARE + select IOMMU_FORCE_PT_SHARE if MMURealistically, everything under
drivers/passthroughis MMU specific. So does it actually make any sense to selectHAS_PASSTHROUGHright now?Actually we are able to assign devices to different DomUs (eg UART1 to domU1) as long as the device isn't behind an IOMMU. So in our case, the passthrough device tree has this node
Quoted 10 lines
uart@9c0b0000 { compatible = "arm,pl011\0arm,primecell"; reg = <0x00 0x9c0b0000 0x00 0x10000>; interrupt-parent = <0x01>; interrupts = <0x00 0x07 0x04>; clock-names = "uartclk\0apb_pclk"; clocks = <0x06 0x07>; xen,path = "/uart@9c0b0000"; xen,reg = <0x00 0x9c0b0000 0x00 0x10000 0x00 0x9c0b0000>; xen,force-assign-without-iommu;So how devices will be protected on an MPU systems?
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
};> So, should we still disable HAS_PASSTHROUGH for MPU ?While it may work, a lot of code in
drivers/passthroughis IOMMU specific (see all the function named iommu_*). So I find really odd that you disableIOMMU_FORCE_PT_SHAREbut all the rest is still present...I think we need some consistency. If you are planning to do device passthrough without any protection, then I don't think you need any code within
drivers/passthrough/(at least for platform devices).Overall, for this patch, I think it would be better to simply select
HAS_PASSTHROUGHwhen MMU is enabled. We can revisit device passthrough once we have the patches on the ML.Yes, this makes sense. I will wait for Luca to confirm as well.
It makes sense to don’t compile all that stuff, anyway we are using some functions from drivers/passthrough/device_tree.c to pass the pl011 to the guests, we will try to handle them later in the series then.
Cheers,
Luca
Hi Luca/Julien,
Quoted 52 lines · Luca Fancellu
Hi Ayan,
Quoted 49 lines · Ayan Kumar Halder
Quoted 1 line · Julien Grall
Hi Ayan,
Hi Julien,
Quoted 43 lines · Ayan Kumar Halder
Quoted 30 lines · Julien Grall
Quoted 1 line
Hi,
Hi Julien,
Quoted 14 lines · Ayan Kumar Halder
Quoted 13 lines
From: Penny Zheng <[email protected]>
In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU driver uses the same page tables as MMU.
Thus, we make it dependent onCONFIG_MMU.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Ayan Kumar Halder <[email protected]>--- xen/arch/arm/Kconfig | 2 +- xen/drivers/passthrough/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)Quoted 11 lines
xen/arch/arm/Kconfig config ARM · line 19
Quoted 10 lines
xen/arch/arm/Kconfig +1
-1@@ -16,7 +16,7 @@ config ARM select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN - select IOMMU_FORCE_PT_SHARE + select IOMMU_FORCE_PT_SHARE if MMURealistically, everything under
drivers/passthroughis MMU specific. So does it actually make any sense to selectHAS_PASSTHROUGHright now?Actually we are able to assign devices to different DomUs (eg UART1 to domU1) as long as the device isn't behind an IOMMU. So in our case, the passthrough device tree has this node
Quoted 10 lines
uart@9c0b0000 { compatible = "arm,pl011\0arm,primecell"; reg = <0x00 0x9c0b0000 0x00 0x10000>; interrupt-parent = <0x01>; interrupts = <0x00 0x07 0x04>; clock-names = "uartclk\0apb_pclk"; clocks = <0x06 0x07>; xen,path = "/uart@9c0b0000"; xen,reg = <0x00 0x9c0b0000 0x00 0x10000 0x00 0x9c0b0000>; xen,force-assign-without-iommu;So how devices will be protected on an MPU systems?
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
};> So, should we still disable HAS_PASSTHROUGH for MPU ?While it may work, a lot of code in
drivers/passthroughis IOMMU specific (see all the function named iommu_*). So I find really odd that you disableIOMMU_FORCE_PT_SHAREbut all the rest is still present...I think we need some consistency. If you are planning to do device passthrough without any protection, then I don't think you need any code within
drivers/passthrough/(at least for platform devices).Overall, for this patch, I think it would be better to simply select
HAS_PASSTHROUGHwhen MMU is enabled. We can revisit device passthrough once we have the patches on the ML.Yes, this makes sense. I will wait for Luca to confirm as well.
It makes sense to don’t compile all that stuff, anyway we are using some functions from
drivers/passthrough/device_tree.cto pass the pl011 to the guests, we will try to handle them later in the series then.
Agreed.
Actually, MPU does not use much from drivers/passthrough. However, if you disable CONFIG_HAS_PASSTHROUGH for MPU, then we need to add a bunch of #if-def in the arm specific common code.
Please have a look at "xen/arm: Enclose all iommu related access within CONFIG_HAS_PASSTHROUGH" and let me know if you still prefer to disable it.
- Ayan