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

Oleksandr Tyshchenko posted 10 patches 3 years ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/1638035505-16931-1-git-send-email-olekstysh@gmail.com
Test gitlab-ci failed
There is a newer version of this series
xen/drivers/passthrough/Kconfig          |   6 +-
xen/drivers/passthrough/arm/iommu.c      |   7 +
xen/drivers/passthrough/arm/ipmmu-vmsa.c | 278 +++++++++++++++++++------------
xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
xen/drivers/passthrough/arm/smmu.c       |  10 --
5 files changed, 178 insertions(+), 133 deletions(-)
[PATCH 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Oleksandr Tyshchenko 3 years ago
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

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 S4 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 4.16.0-rc4 branch and also available at [1].

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

[1] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml1

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 | 278 +++++++++++++++++++------------
 xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
 xen/drivers/passthrough/arm/smmu.c       |  10 --
 5 files changed, 178 insertions(+), 133 deletions(-)

-- 
2.7.4


Re: [PATCH 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Oleksandr 2 years, 11 months ago
On 27.11.21 19:51, Oleksandr Tyshchenko wrote:


Hello all.

Gentle reminder.

> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>
> 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 S4 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 4.16.0-rc4 branch and also available at [1].
>
> Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and Renesas Spider
> board with S4 SoC.
>
> [1] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml1
>
> 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 | 278 +++++++++++++++++++------------
>   xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
>   xen/drivers/passthrough/arm/smmu.c       |  10 --
>   5 files changed, 178 insertions(+), 133 deletions(-)
>
-- 
Regards,

Oleksandr Tyshchenko


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

On 13/12/2021 10:05, Oleksandr wrote:
> 
> On 27.11.21 19:51, Oleksandr Tyshchenko wrote:
> 
> 
> Hello all.
> 
> Gentle reminder.

This is in my queue of 50+ patches to review. EPAM is the main 
contributor for the IPMMU patches, so can one of your colleagues help to 
review it?

Cheers,

-- 
Julien Grall

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


Hi Julien


>
> On 13/12/2021 10:05, Oleksandr wrote:
>>
>> On 27.11.21 19:51, Oleksandr Tyshchenko wrote:
>>
>>
>> Hello all.
>>
>> Gentle reminder.
>
> This is in my queue of 50+ patches to review. EPAM is the main 
> contributor for the IPMMU patches, so can one of your colleagues help 
> to review it?

I think, yes, it is possible.


>
>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


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

On 27/11/2021 17:51, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> 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 S4 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 4.16.0-rc4 branch and also available at [1].
> 
> Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and Renesas Spider
> board with S4 SoC.
> 
> [1] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml1
> 
> 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

Skimming through the series, it looks like patch #1 - #6 are fully 
acked. The rest would need a respin.

Can I commit the first part (i.e. #1 - #6)?

Cheers,

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

-- 
Julien Grall

Re: [PATCH 00/10] Add support for Renesas R-Car S4 IPMMU and other misc changes
Posted by Oleksandr Tyshchenko 2 years, 10 months ago
On Wed, Jan 26, 2022 at 6:20 PM Julien Grall <julien@xen.org> wrote:

> Hi Oleksandr,
>

Hi Julien,

[Sorry for the possible format issues]


>
> On 27/11/2021 17:51, Oleksandr Tyshchenko wrote:
> > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> >
> > 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 S4 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 4.16.0-rc4 branch and also available at [1].
> >
> > Tested on Renesas Salvator-X board with H3 ES3.0 SoC (Gen3) and Renesas
> Spider
> > board with S4 SoC.
> >
> > [1] https://github.com/otyshchenko1/xen/commits/s4_ipmmu_ml1
> >
> > 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
>
> Skimming through the series, it looks like patch #1 - #6 are fully
> acked. The rest would need a respin.
>
> Can I commit the first part (i.e. #1 - #6)?
>

Please note, this is V1. But V2 [1] was pushed a couple of weeks ago and
all patches are already reviewed)

[1]
https://lore.kernel.org/xen-devel/1640034957-19764-1-git-send-email-olekstysh@gmail.com/


> Cheers,
>
> >
> >   xen/drivers/passthrough/Kconfig          |   6 +-
> >   xen/drivers/passthrough/arm/iommu.c      |   7 +
> >   xen/drivers/passthrough/arm/ipmmu-vmsa.c | 278
> +++++++++++++++++++------------
> >   xen/drivers/passthrough/arm/smmu-v3.c    |  10 --
> >   xen/drivers/passthrough/arm/smmu.c       |  10 --
> >   5 files changed, 178 insertions(+), 133 deletions(-)
> >
>
> --
> Julien Grall
>


-- 
Regards,

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

On 26/01/2022 16:28, Oleksandr Tyshchenko wrote:
> Please note, this is V1. But V2 [1] was pushed a couple of weeks ago and 
> all patches are already reviewed)
> [1] 
> https://lore.kernel.org/xen-devel/1640034957-19764-1-git-send-email-olekstysh@gmail.com/ 
> <https://lore.kernel.org/xen-devel/1640034957-19764-1-git-send-email-olekstysh@gmail.com/>

Ah! I was looking at the bottom of my inbox and didn't notice the next 
version. I will have a look at v2.

Sorry for the noise.

Cheers,

-- 
Julien Grall