All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
@ 2024-11-08 19:59 Ayan Kumar Halder
  2024-11-11 11:08 ` Luca Fancellu
  2024-11-11 11:12 ` Julien Grall
  0 siblings, 2 replies; 8+ messages in thread
From: Ayan Kumar Halder @ 2024-11-08 19:59 UTC (permalink / raw)
  To: xen-devel
  Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Michal Orzel, Volodymyr Babchuk, Jan Beulich,
	Roger Pau Monné, Rahul Singh, Ayan Kumar Halder

From: Penny Zheng <Penny.Zheng@arm.com>

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.

Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/Kconfig            | 2 +-
 xen/drivers/passthrough/Kconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 15b2e4a227..3699e148e9 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -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
diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
index 78edd80536..75ad403dd3 100644
--- a/xen/drivers/passthrough/Kconfig
+++ b/xen/drivers/passthrough/Kconfig
@@ -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
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-08 19:59 [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU Ayan Kumar Halder
@ 2024-11-11 11:08 ` Luca Fancellu
  2024-11-11 11:12 ` Julien Grall
  1 sibling, 0 replies; 8+ messages in thread
From: Luca Fancellu @ 2024-11-11 11:08 UTC (permalink / raw)
  To: Ayan Kumar Halder
  Cc: xen-devel@lists.xenproject.org, Penny Zheng, Stefano Stabellini,
	Julien Grall, Bertrand Marquis, Michal Orzel, Volodymyr Babchuk,
	Jan Beulich, Roger Pau Monné, Rahul Singh



> On 8 Nov 2024, at 19:59, Ayan Kumar Halder <ayan.kumar.halder@amd.com> wrote:
> 
> From: Penny Zheng <Penny.Zheng@arm.com>
> 
> 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.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> —

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-08 19:59 [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU Ayan Kumar Halder
  2024-11-11 11:08 ` Luca Fancellu
@ 2024-11-11 11:12 ` Julien Grall
  2024-11-11 13:24   ` Ayan Kumar Halder
  1 sibling, 1 reply; 8+ messages in thread
From: Julien Grall @ 2024-11-11 11:12 UTC (permalink / raw)
  To: Ayan Kumar Halder, xen-devel
  Cc: Penny Zheng, Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh

Hi,

On 08/11/2024 19:59, Ayan Kumar Halder wrote:
> From: Penny Zheng <Penny.Zheng@arm.com>
> 
> 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.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> ---
>   xen/arch/arm/Kconfig            | 2 +-
>   xen/drivers/passthrough/Kconfig | 3 ++-
>   2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 15b2e4a227..3699e148e9 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -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?

>   
>   config ARCH_DEFCONFIG
>   	string
> diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
> index 78edd80536..75ad403dd3 100644
> --- a/xen/drivers/passthrough/Kconfig
> +++ b/xen/drivers/passthrough/Kconfig
> @@ -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

Cheers,

-- 
Julien Grall



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-11 11:12 ` Julien Grall
@ 2024-11-11 13:24   ` Ayan Kumar Halder
  2024-11-11 13:45     ` Julien Grall
  0 siblings, 1 reply; 8+ messages in thread
From: Ayan Kumar Halder @ 2024-11-11 13:24 UTC (permalink / raw)
  To: Julien Grall, Ayan Kumar Halder, xen-devel
  Cc: Penny Zheng, Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh


On 11/11/2024 11:12, Julien Grall wrote:
> Hi,
Hi Julien,
>
> On 08/11/2024 19:59, Ayan Kumar Halder wrote:
>> From: Penny Zheng <Penny.Zheng@arm.com>
>>
>> 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.
>>
>> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>> ---
>>   xen/arch/arm/Kconfig            | 2 +-
>>   xen/drivers/passthrough/Kconfig | 3 ++-
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>> index 15b2e4a227..3699e148e9 100644
>> --- a/xen/arch/arm/Kconfig
>> +++ b/xen/arch/arm/Kconfig
>> @@ -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?

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

>
>>     config ARCH_DEFCONFIG
>>       string
>> diff --git a/xen/drivers/passthrough/Kconfig 
>> b/xen/drivers/passthrough/Kconfig
>> index 78edd80536..75ad403dd3 100644
>> --- a/xen/drivers/passthrough/Kconfig
>> +++ b/xen/drivers/passthrough/Kconfig
>> @@ -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
>
> Cheers,
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-11 13:24   ` Ayan Kumar Halder
@ 2024-11-11 13:45     ` Julien Grall
  2024-11-11 16:00       ` Ayan Kumar Halder
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Grall @ 2024-11-11 13:45 UTC (permalink / raw)
  To: Ayan Kumar Halder, Ayan Kumar Halder, xen-devel
  Cc: Penny Zheng, Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh

Hi Ayan,

On 11/11/2024 13:24, Ayan Kumar Halder wrote:
> On 11/11/2024 11:12, Julien Grall wrote:
>> Hi,
> Hi Julien,
>>
>> On 08/11/2024 19:59, Ayan Kumar Halder wrote:
>>> From: Penny Zheng <Penny.Zheng@arm.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>> ---
>>>   xen/arch/arm/Kconfig            | 2 +-
>>>   xen/drivers/passthrough/Kconfig | 3 ++-
>>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>>> index 15b2e4a227..3699e148e9 100644
>>> --- a/xen/arch/arm/Kconfig
>>> +++ b/xen/arch/arm/Kconfig
>>> @@ -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?
> 
> 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 how devices will be protected on an MPU systems?

 >          };> So, should we still disable HAS_PASSTHROUGH for 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,

-- 
Julien Grall



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-11 13:45     ` Julien Grall
@ 2024-11-11 16:00       ` Ayan Kumar Halder
  2024-11-11 16:33         ` Luca Fancellu
  0 siblings, 1 reply; 8+ messages in thread
From: Ayan Kumar Halder @ 2024-11-11 16:00 UTC (permalink / raw)
  To: Julien Grall, Ayan Kumar Halder, xen-devel
  Cc: Penny Zheng, Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh,
	Luca Fancellu


On 11/11/2024 13:45, Julien Grall wrote:
> Hi Ayan,
Hi Julien,
>
> On 11/11/2024 13:24, Ayan Kumar Halder wrote:
>> On 11/11/2024 11:12, Julien Grall wrote:
>>> Hi,
>> Hi Julien,
>>>
>>> On 08/11/2024 19:59, Ayan Kumar Halder wrote:
>>>> From: Penny Zheng <Penny.Zheng@arm.com>
>>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
>>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>>> ---
>>>>   xen/arch/arm/Kconfig            | 2 +-
>>>>   xen/drivers/passthrough/Kconfig | 3 ++-
>>>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>>>> index 15b2e4a227..3699e148e9 100644
>>>> --- a/xen/arch/arm/Kconfig
>>>> +++ b/xen/arch/arm/Kconfig
>>>> @@ -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?
>>
>> 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 how devices will be protected on an MPU systems?
>
> >          };> So, should we still disable HAS_PASSTHROUGH for 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.
Yes, this makes sense. I will wait for Luca to confirm as well.
>
> BTW, I think it should be move under the Kconfig MMU rather than using 
> "if MMU".

Yes. So for now this should be sufficient.

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 15b2e4a227..adebf8d5ca 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -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


>
> Cheers,
>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-11 16:00       ` Ayan Kumar Halder
@ 2024-11-11 16:33         ` Luca Fancellu
  2024-11-11 18:10           ` Ayan Kumar Halder
  0 siblings, 1 reply; 8+ messages in thread
From: Luca Fancellu @ 2024-11-11 16:33 UTC (permalink / raw)
  To: Ayan Kumar Halder
  Cc: Julien Grall, Ayan Kumar Halder, xen-devel@lists.xenproject.org,
	Penny Zheng, Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh

Hi Ayan,


> On 11 Nov 2024, at 16:00, Ayan Kumar Halder <ayankuma@amd.com> wrote:
> 
> 
> On 11/11/2024 13:45, Julien Grall wrote:
>> Hi Ayan,
> Hi Julien,
>> 
>> On 11/11/2024 13:24, Ayan Kumar Halder wrote:
>>> On 11/11/2024 11:12, Julien Grall wrote:
>>>> Hi,
>>> Hi Julien,
>>>> 
>>>> On 08/11/2024 19:59, Ayan Kumar Halder wrote:
>>>>> From: Penny Zheng <Penny.Zheng@arm.com>
>>>>> 
>>>>> 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.
>>>>> 
>>>>> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
>>>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>>>> ---
>>>>>   xen/arch/arm/Kconfig            | 2 +-
>>>>>   xen/drivers/passthrough/Kconfig | 3 ++-
>>>>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>>>> 
>>>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>>>>> index 15b2e4a227..3699e148e9 100644
>>>>> --- a/xen/arch/arm/Kconfig
>>>>> +++ b/xen/arch/arm/Kconfig
>>>>> @@ -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?
>>> 
>>> 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 how devices will be protected on an MPU systems?
>> 
>> >          };> So, should we still disable HAS_PASSTHROUGH for 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.
> 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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU
  2024-11-11 16:33         ` Luca Fancellu
@ 2024-11-11 18:10           ` Ayan Kumar Halder
  0 siblings, 0 replies; 8+ messages in thread
From: Ayan Kumar Halder @ 2024-11-11 18:10 UTC (permalink / raw)
  To: Luca Fancellu, Julien Grall
  Cc: Ayan Kumar Halder, xen-devel@lists.xenproject.org, Penny Zheng,
	Stefano Stabellini, Bertrand Marquis, Michal Orzel,
	Volodymyr Babchuk, Jan Beulich, Roger Pau Monné, Rahul Singh

Hi Luca/Julien,

On 11/11/2024 16:33, Luca Fancellu wrote:
> Hi Ayan,
>
>
>> On 11 Nov 2024, at 16:00, Ayan Kumar Halder <ayankuma@amd.com> wrote:
>>
>>
>> On 11/11/2024 13:45, Julien Grall wrote:
>>> Hi Ayan,
>> Hi Julien,
>>> On 11/11/2024 13:24, Ayan Kumar Halder wrote:
>>>> On 11/11/2024 11:12, Julien Grall wrote:
>>>>> Hi,
>>>> Hi Julien,
>>>>> On 08/11/2024 19:59, Ayan Kumar Halder wrote:
>>>>>> From: Penny Zheng <Penny.Zheng@arm.com>
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>> Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
>>>>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>>>>> ---
>>>>>>    xen/arch/arm/Kconfig            | 2 +-
>>>>>>    xen/drivers/passthrough/Kconfig | 3 ++-
>>>>>>    2 files changed, 3 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>>>>>> index 15b2e4a227..3699e148e9 100644
>>>>>> --- a/xen/arch/arm/Kconfig
>>>>>> +++ b/xen/arch/arm/Kconfig
>>>>>> @@ -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?
>>>> 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 how devices will be protected on an MPU systems?
>>>
>>>>           };> So, should we still disable HAS_PASSTHROUGH for 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.
>> 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.

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-11-11 18:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 19:59 [PATCH v1 2/2] xen/mmu: enable SMMU subsystem only in MMU Ayan Kumar Halder
2024-11-11 11:08 ` Luca Fancellu
2024-11-11 11:12 ` Julien Grall
2024-11-11 13:24   ` Ayan Kumar Halder
2024-11-11 13:45     ` Julien Grall
2024-11-11 16:00       ` Ayan Kumar Halder
2024-11-11 16:33         ` Luca Fancellu
2024-11-11 18:10           ` Ayan Kumar Halder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.