[PATCH V2 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes

Oleksandr Tyshchenko posted 10 patches 2 years, 4 months ago
Test gitlab-ci passed
Failed in applying to current master (apply log)
xen/drivers/passthrough/Kconfig          |   6 +-
xen/drivers/passthrough/arm/iommu.c      |   7 +
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 267 ++++++++++++++++++-------------
xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
xen/drivers/passthrough/arm/smmu.c       |  10 --
5 files changed, 167 insertions(+), 133 deletions(-)
[PATCH V2 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Oleksandr Tyshchenko 2 years, 4 months ago
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Hello all.

You can find the V1 patch series at [1].

The R-Car S4 is an automotive System-on-Chip (SoC) for Car Server/Communication
Gateway and is one of the first products in Renesas’ 4th-generation R-Car Family.

The integrated IOMMU HW is also VMSA-compatible and supports stage 2 translation
table format, therefore can be used with current R-Car Gen3 driver with slight
modifications.

In the context of Xen driver the main differences between Gen3 and Gen4 are
the following:
 - HW capacity was enlarged to support up to 16 IPMMU contexts (sets of page table)
   and up to 64 micro-TLBs per IPMMU device
 - the memory mapped registers have different bases and offset

The first part (commits #1-6) is a non-verbatim port of Linux upstream commits
needed to add support for S4 series easily (prereq work).
The second part (commits #7-8) is based on the code from the Renesas BSP and
actually introduces support for R-Car S4 IPMMU.
The third part (commits #9-10) is misc changes I have locally.

The patch series is based on the latest staging branch 
"f3999bc2e099 arm/efi: Handle Xen bootargs from both xen.cfg and DT"
and also available at [2].

Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and Renesas Spider
board with S4 SoC (Gen4).

[1] https://lore.kernel.org/all/1638035505-16931-1-git-send-email-olekstysh@gmail.com/
[2] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml2


Oleksandr Tyshchenko (10):
  iommu/ipmmu-vmsa: Remove all unused register definitions
  iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
  iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
  iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
  iommu/ipmmu-vmsa: Calculate context registers' offset instead of a
    macro
  iommu/ipmmu-vmsa: Add utlb_offset_base
  iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
  iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
  iommu/ipmmu-vmsa: Use refcount for the micro-TLBs
  iommu/arm: Remove code duplication in all IOMMU drivers

 xen/drivers/passthrough/Kconfig          |   6 +-
 xen/drivers/passthrough/arm/iommu.c      |   7 +
 xen/drivers/passthrough/arm/ipmmu-vmsa.c | 267 ++++++++++++++++++-------------
 xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
 xen/drivers/passthrough/arm/smmu.c       |  10 --
 5 files changed, 167 insertions(+), 133 deletions(-)

-- 
2.7.4


Re: [PATCH V2 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Julien Grall 2 years, 3 months ago
Hi,

On 20/12/2021 21:15, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> Hello all.
> 
> You can find the V1 patch series at [1].
> 
> The R-Car S4 is an automotive System-on-Chip (SoC) for Car Server/Communication
> Gateway and is one of the first products in Renesas’ 4th-generation R-Car Family.
> 
> The integrated IOMMU HW is also VMSA-compatible and supports stage 2 translation
> table format, therefore can be used with current R-Car Gen3 driver with slight
> modifications.
> 
> In the context of Xen driver the main differences between Gen3 and Gen4 are
> the following:
>   - HW capacity was enlarged to support up to 16 IPMMU contexts (sets of page table)
>     and up to 64 micro-TLBs per IPMMU device
>   - the memory mapped registers have different bases and offset
> 
> The first part (commits #1-6) is a non-verbatim port of Linux upstream commits
> needed to add support for S4 series easily (prereq work).
> The second part (commits #7-8) is based on the code from the Renesas BSP and
> actually introduces support for R-Car S4 IPMMU.
> The third part (commits #9-10) is misc changes I have locally.
> 
> The patch series is based on the latest staging branch
> "f3999bc2e099 arm/efi: Handle Xen bootargs from both xen.cfg and DT"
> and also available at [2].
> 
> Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and Renesas Spider
> board with S4 SoC (Gen4).
> 
> [1] https://lore.kernel.org/all/1638035505-16931-1-git-send-email-olekstysh@gmail.com/
> [2] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml2
> 
> 
> Oleksandr Tyshchenko (10):
>    iommu/ipmmu-vmsa: Remove all unused register definitions
>    iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
>    iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
>    iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
>    iommu/ipmmu-vmsa: Calculate context registers' offset instead of a
>      macro
>    iommu/ipmmu-vmsa: Add utlb_offset_base
>    iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
>    iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0

For the first 8 patches:

Acked-by: Julien Grall <jgrall@amazon.com>

I have also committed them. The last..

>    iommu/ipmmu-vmsa: Use refcount for the micro-TLBs
>    iommu/arm: Remove code duplication in all IOMMU drivers

... 2 patches have some comments. So I have committed them yet.

Cheers,

-- 
Julien Grall

Re: [PATCH V2 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Oleksandr 2 years, 3 months ago
On 27.01.22 14:36, Julien Grall wrote:
> Hi,


Hi Julien


>
> On 20/12/2021 21:15, Oleksandr Tyshchenko wrote:
>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>
>> Hello all.
>>
>> You can find the V1 patch series at [1].
>>
>> The R-Car S4 is an automotive System-on-Chip (SoC) for Car 
>> Server/Communication
>> Gateway and is one of the first products in Renesas’ 4th-generation 
>> R-Car Family.
>>
>> The integrated IOMMU HW is also VMSA-compatible and supports stage 2 
>> translation
>> table format, therefore can be used with current R-Car Gen3 driver 
>> with slight
>> modifications.
>>
>> In the context of Xen driver the main differences between Gen3 and 
>> Gen4 are
>> the following:
>>   - HW capacity was enlarged to support up to 16 IPMMU contexts (sets 
>> of page table)
>>     and up to 64 micro-TLBs per IPMMU device
>>   - the memory mapped registers have different bases and offset
>>
>> The first part (commits #1-6) is a non-verbatim port of Linux 
>> upstream commits
>> needed to add support for S4 series easily (prereq work).
>> The second part (commits #7-8) is based on the code from the Renesas 
>> BSP and
>> actually introduces support for R-Car S4 IPMMU.
>> The third part (commits #9-10) is misc changes I have locally.
>>
>> The patch series is based on the latest staging branch
>> "f3999bc2e099 arm/efi: Handle Xen bootargs from both xen.cfg and DT"
>> and also available at [2].
>>
>> Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and 
>> Renesas Spider
>> board with S4 SoC (Gen4).
>>
>> [1] 
>> https://lore.kernel.org/all/1638035505-16931-1-git-send-email-olekstysh@gmail.com/
>> [2] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml2
>>
>>
>> Oleksandr Tyshchenko (10):
>>    iommu/ipmmu-vmsa: Remove all unused register definitions
>>    iommu/ipmmu-vmsa: Add helper functions for MMU "context" registers
>>    iommu/ipmmu-vmsa: Add helper functions for "uTLB" registers
>>    iommu/ipmmu-vmsa: Add light version of Linux's ipmmu_features
>>    iommu/ipmmu-vmsa: Calculate context registers' offset instead of a
>>      macro
>>    iommu/ipmmu-vmsa: Add utlb_offset_base
>>    iommu/ipmmu-vmsa: Add Renesas R8A779F0 (R-Car S4) support
>>    iommu/ipmmu-vmsa: Set IPMMU bit IMSCTLR_USE_SECGRP to 0
>
> For the first 8 patches:
>
> Acked-by: Julien Grall <jgrall@amazon.com>

Thank you!


>
> I have also committed them. The last..
>
>>    iommu/ipmmu-vmsa: Use refcount for the micro-TLBs
>>    iommu/arm: Remove code duplication in all IOMMU drivers
>
> ... 2 patches have some comments. So I have committed them yet.

ok, I will update them and re-push probably today.


>
>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko