[PATCH v3 0/8] xen/arm: Add support for SMMUv3 driver

Rahul Singh posted 8 patches 3 years, 4 months ago
Test gitlab-ci passed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/cover.1607617848.git.rahul.singh@arm.com
There is a newer version of this series
MAINTAINERS                           |    6 +
SUPPORT.md                            |    1 +
xen/common/device_tree.c              |   27 +
xen/drivers/passthrough/Kconfig       |   11 +
xen/drivers/passthrough/arm/Makefile  |    1 +
xen/drivers/passthrough/arm/smmu-v3.c | 3316 +++++++++++++++++++++++++
xen/include/xen/device_tree.h         |   12 +
7 files changed, 3374 insertions(+)
create mode 100644 xen/drivers/passthrough/arm/smmu-v3.c
[PATCH v3 0/8] xen/arm: Add support for SMMUv3 driver
Posted by Rahul Singh 3 years, 4 months ago
This patch series is v3 of the work to add support for the SMMUv3 driver.

Approach taken is to first merge the Linux copy of the SMMUv3 driver
(tag v5.8.18) and then modify the driver to build on XEN.

MSI and PCI ATS functionality are not supported. Code is not tested and
compiled. Code is guarded by the flag CONFIG_PCI_ATS and CONFIG_MSI to compile
the driver.

Code specific to Linux is removed from the driver to avoid dead code.

Driver is currently supported as tech preview.

Following functionality should be supported before driver is out for tech
preview
1. Investigate the timing analysis of using spin lock in place of mutex when
   attaching a  device to SMMU.
2. Merged the latest Linux SMMUv3 driver code once atomic operation is
   available in XEN.
3. PCI ATS and MSI interrupts should be supported.
4. Investigate side-effect of using tasklet in place of threaded IRQ and fix
   if any.
5. fallthorugh keyword should be supported.
6. Implement the ffsll function in bitops.h file.

Rahul Singh (8):
  xen/arm: Import the SMMUv3 driver from Linux
  xen/arm: revert atomic operation related command-queue insertion patch
  xen/arm: revert patch related to XArray
  xen/arm: Remove support for Stage-1 translation on SMMUv3.
  xen/device-tree: Add dt_property_match_string helper
  xen/arm: Remove Linux specific code that is not usable in XEN
  xen/arm: Add support for SMMUv3 driver
  xen/arm: smmuv3: Remove linux compatibility functions.

 MAINTAINERS                           |    6 +
 SUPPORT.md                            |    1 +
 xen/common/device_tree.c              |   27 +
 xen/drivers/passthrough/Kconfig       |   11 +
 xen/drivers/passthrough/arm/Makefile  |    1 +
 xen/drivers/passthrough/arm/smmu-v3.c | 3316 +++++++++++++++++++++++++
 xen/include/xen/device_tree.h         |   12 +
 7 files changed, 3374 insertions(+)
 create mode 100644 xen/drivers/passthrough/arm/smmu-v3.c

-- 
2.17.1


Re: [PATCH v3 0/8] xen/arm: Add support for SMMUv3 driver
Posted by Julien Grall 3 years, 4 months ago
Hi Rahul,

On 10/12/2020 16:56, Rahul Singh wrote:
> This patch series is v3 of the work to add support for the SMMUv3 driver.
> 
> Approach taken is to first merge the Linux copy of the SMMUv3 driver
> (tag v5.8.18) and then modify the driver to build on XEN.
> 
> MSI and PCI ATS functionality are not supported. Code is not tested and
> compiled. Code is guarded by the flag CONFIG_PCI_ATS and CONFIG_MSI to compile
> the driver.
> 
> Code specific to Linux is removed from the driver to avoid dead code.
> 
> Driver is currently supported as tech preview.
> 
> Following functionality should be supported before driver is out for tech
> preview
> 1. Investigate the timing analysis of using spin lock in place of mutex when
>     attaching a  device to SMMU.
> 2. Merged the latest Linux SMMUv3 driver code once atomic operation is
>     available in XEN.
> 3. PCI ATS and MSI interrupts should be supported.
> 4. Investigate side-effect of using tasklet in place of threaded IRQ and fix
>     if any.
In your last e-mail, you wrote that you would investigate and then come 
back to use. It wasn't clear that this meant you will not deal with it 
in this series.

> 5. fallthorugh keyword should be supported.

This one should really be done now... It is not a complicated one...

> 6. Implement the ffsll function in bitops.h file.

... same here.

Cheers,

-- 
Julien Grall

Re: [PATCH v3 0/8] xen/arm: Add support for SMMUv3 driver
Posted by Rahul Singh 3 years, 4 months ago
Hello Julien,Stefano

> On 11 Dec 2020, at 2:29 pm, Julien Grall <julien@xen.org> wrote:
> 
> Hi Rahul,
> 
> On 10/12/2020 16:56, Rahul Singh wrote:
>> This patch series is v3 of the work to add support for the SMMUv3 driver.
>> Approach taken is to first merge the Linux copy of the SMMUv3 driver
>> (tag v5.8.18) and then modify the driver to build on XEN.
>> MSI and PCI ATS functionality are not supported. Code is not tested and
>> compiled. Code is guarded by the flag CONFIG_PCI_ATS and CONFIG_MSI to compile
>> the driver.
>> Code specific to Linux is removed from the driver to avoid dead code.
>> Driver is currently supported as tech preview.
>> Following functionality should be supported before driver is out for tech
>> preview
>> 1. Investigate the timing analysis of using spin lock in place of mutex when
>>    attaching a  device to SMMU.
>> 2. Merged the latest Linux SMMUv3 driver code once atomic operation is
>>    available in XEN.
>> 3. PCI ATS and MSI interrupts should be supported.
>> 4. Investigate side-effect of using tasklet in place of threaded IRQ and fix
>>    if any.
> In your last e-mail, you wrote that you would investigate and then come back to use. It wasn't clear that this meant you will not deal with it in this series.
> 

Yes, I will investigate the side-effect of using tasklet but not part of this patch series. It will be great if we proceed on this patch series as it is (using tasklet in place of threaded-IRQ).

>> 5. fallthorugh keyword should be supported.
> 
> This one should really be done now... It is not a complicated one...

Ok. I will implement in next version.
 
> 
>> 6. Implement the ffsll function in bitops.h file.

While implementing the code I found out that Linux is using the built-in function “__builtin_ffsll() “ for ffsll and there is no implementation available in Linux for ffsll.
If we implement the ffsll in XEN we will diverge from Linux. I am thinking of adding the below code in "xen/include/asm-arm/bitops.h”. 
Please suggest if it is okay?

static always_inline int ffsll(long long x)                                           
{                                                                               
    return __builtin_ffsll(x);                                                    
}

Regards,
Rahul

> 
> ... same here.
> 
> Cheers,
> 
> -- 
> Julien Grall

Re: [PATCH v3 0/8] xen/arm: Add support for SMMUv3 driver
Posted by Stefano Stabellini 3 years, 4 months ago
On Mon, 14 Dec 2020, Rahul Singh wrote:
> Hello Julien,Stefano
> 
> > On 11 Dec 2020, at 2:29 pm, Julien Grall <julien@xen.org> wrote:
> > 
> > Hi Rahul,
> > 
> > On 10/12/2020 16:56, Rahul Singh wrote:
> >> This patch series is v3 of the work to add support for the SMMUv3 driver.
> >> Approach taken is to first merge the Linux copy of the SMMUv3 driver
> >> (tag v5.8.18) and then modify the driver to build on XEN.
> >> MSI and PCI ATS functionality are not supported. Code is not tested and
> >> compiled. Code is guarded by the flag CONFIG_PCI_ATS and CONFIG_MSI to compile
> >> the driver.
> >> Code specific to Linux is removed from the driver to avoid dead code.
> >> Driver is currently supported as tech preview.
> >> Following functionality should be supported before driver is out for tech
> >> preview
> >> 1. Investigate the timing analysis of using spin lock in place of mutex when
> >>    attaching a  device to SMMU.
> >> 2. Merged the latest Linux SMMUv3 driver code once atomic operation is
> >>    available in XEN.
> >> 3. PCI ATS and MSI interrupts should be supported.
> >> 4. Investigate side-effect of using tasklet in place of threaded IRQ and fix
> >>    if any.
> > In your last e-mail, you wrote that you would investigate and then come back to use. It wasn't clear that this meant you will not deal with it in this series.
> > 
> 
> Yes, I will investigate the side-effect of using tasklet but not part of this patch series. It will be great if we proceed on this patch series as it is (using tasklet in place of threaded-IRQ).
> 
> >> 5. fallthorugh keyword should be supported.
> > 
> > This one should really be done now... It is not a complicated one...
> 
> Ok. I will implement in next version.
>  
> > 
> >> 6. Implement the ffsll function in bitops.h file.
> 
> While implementing the code I found out that Linux is using the built-in function “__builtin_ffsll() “ for ffsll and there is no implementation available in Linux for ffsll.
> If we implement the ffsll in XEN we will diverge from Linux. I am thinking of adding the below code in "xen/include/asm-arm/bitops.h”. 
> Please suggest if it is okay?
> 
> static always_inline int ffsll(long long x)                                           
> {                                                                               
>     return __builtin_ffsll(x);                                                    
> }

I think that's OK if it builds with clang too.