[RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU

Daniel Henrique Barboza posted 1 patch 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240503124244.8804-1-dbarboza@ventanamicro.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
docs/specs/pci-ids.rst | 2 ++
include/hw/pci/pci.h   | 1 +
2 files changed, 3 insertions(+)
[RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Daniel Henrique Barboza 2 weeks ago
Hi,

In this RFC I want to check with Gerd and others if it's ok to add a PCI
id for the RISC-V IOMMU device. It's currently under review in [1]. The
idea is to fold this patch into the RISC-V IOMMU series if we're all ok
with this change.

Gerd, we picked the ID right after the PCI UFS device. Let me know if
you want another ID instead. 


Daniel Henrique Barboza (1):
  pci-ids.rst: add Red Hat pci-id for generic IOMMU device

 docs/specs/pci-ids.rst | 2 ++
 include/hw/pci/pci.h   | 1 +
 2 files changed, 3 insertions(+)

-- 
2.44.0
Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Peter Maydell 1 week, 3 days ago
On Fri, 3 May 2024 at 13:43, Daniel Henrique Barboza
<dbarboza@ventanamicro.com> wrote:
>
> Hi,
>
> In this RFC I want to check with Gerd and others if it's ok to add a PCI
> id for the RISC-V IOMMU device. It's currently under review in [1]. The
> idea is to fold this patch into the RISC-V IOMMU series if we're all ok
> with this change.

My question here would be "why is this risc-v specific?" (and more
generally "what is this for?" -- the cover letter and patch and
documentation page provide almost no information about what this
device is and why it needs to exist rather than using either
virtio-iommu or else a model of a real hardware IOMMU.)

thanks
-- PMM
Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Daniel Henrique Barboza 1 week, 2 days ago

On 5/7/24 12:44, Peter Maydell wrote:
> On Fri, 3 May 2024 at 13:43, Daniel Henrique Barboza
> <dbarboza@ventanamicro.com> wrote:
>>
>> Hi,
>>
>> In this RFC I want to check with Gerd and others if it's ok to add a PCI
>> id for the RISC-V IOMMU device. It's currently under review in [1]. The
>> idea is to fold this patch into the RISC-V IOMMU series if we're all ok
>> with this change.
> 
> My question here would be "why is this risc-v specific?" (and more
> generally "what is this for?" -- the cover letter and patch and
> documentation page provide almost no information about what this
> device is and why it needs to exist rather than using either
> virtio-iommu or else a model of a real hardware IOMMU.)

The RISC-V IOMMU device emulation under review ([1]) is a reference implementation of
the riscv-iommu spec [2]. AFAIK it is similar to what we already have with aarch64 'smmuv3'
'virt' bus, i.e. an impl of ARM's SMMUv3 that isn't tied to a specific vendor.

The difference here is that the riscv-iommu spec, ratified by RISC-V International (RVI),
predicts that the device could be implemented as a PCIe device. But RVI didn't bother
assigning a PCI ID for their reference IOMMU. The existing implementation in [1] is using
a Rivos PCI ID that we're treating as a placeholder only. We need an ID that reflects that
this is a device that adheres to the riscv-iommu spec, not to an IOMMU of any particular
vendor.

Since RVI doesn't provide a PCI ID for it we went to Red Hat, and they were kind enough
to give us a PCI ID for the RISC-V IOMMU reference device.

I'll do a proper job this time and add all this context in the commit msg. Including a
proper shout-out to Gerd and Red Hat.



Thanks,


Daniel


[1] https://lore.kernel.org/qemu-riscv/20240307160319.675044-1-dbarboza@ventanamicro.com/
[2] https://github.com/riscv-non-isa/riscv-iommu/releases/tag/v1.0.0

> 
> thanks
> -- PMM
Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Frank Chang 1 week ago
Hi Daniel,

Daniel Henrique Barboza <dbarboza@ventanamicro.com> 於 2024年5月8日 週三 下午8:42寫道:
>
>
>
> On 5/7/24 12:44, Peter Maydell wrote:
> > On Fri, 3 May 2024 at 13:43, Daniel Henrique Barboza
> > <dbarboza@ventanamicro.com> wrote:
> >>
> >> Hi,
> >>
> >> In this RFC I want to check with Gerd and others if it's ok to add a PCI
> >> id for the RISC-V IOMMU device. It's currently under review in [1]. The
> >> idea is to fold this patch into the RISC-V IOMMU series if we're all ok
> >> with this change.
> >
> > My question here would be "why is this risc-v specific?" (and more
> > generally "what is this for?" -- the cover letter and patch and
> > documentation page provide almost no information about what this
> > device is and why it needs to exist rather than using either
> > virtio-iommu or else a model of a real hardware IOMMU.)
>
> The RISC-V IOMMU device emulation under review ([1]) is a reference implementation of
> the riscv-iommu spec [2]. AFAIK it is similar to what we already have with aarch64 'smmuv3'
> 'virt' bus, i.e. an impl of ARM's SMMUv3 that isn't tied to a specific vendor.
>
> The difference here is that the riscv-iommu spec, ratified by RISC-V International (RVI),
> predicts that the device could be implemented as a PCIe device. But RVI didn't bother
> assigning a PCI ID for their reference IOMMU. The existing implementation in [1] is using
> a Rivos PCI ID that we're treating as a placeholder only. We need an ID that reflects that
> this is a device that adheres to the riscv-iommu spec, not to an IOMMU of any particular
> vendor.
>
> Since RVI doesn't provide a PCI ID for it we went to Red Hat, and they were kind enough
> to give us a PCI ID for the RISC-V IOMMU reference device.

That's great. Thanks to Red Hat.
I'm wondering do we have the plan to document the new PCI ID to the IOMMU spec
or somewhere else that's publicly accessible?

Regards,
Frank Chang

>
> I'll do a proper job this time and add all this context in the commit msg. Including a
> proper shout-out to Gerd and Red Hat.
>
>
>
> Thanks,
>
>
> Daniel
>
>
> [1] https://lore.kernel.org/qemu-riscv/20240307160319.675044-1-dbarboza@ventanamicro.com/
> [2] https://github.com/riscv-non-isa/riscv-iommu/releases/tag/v1.0.0
>
> >
> > thanks
> > -- PMM
>
Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Frank Chang 1 week, 3 days ago
Hi Daniel,

Daniel Henrique Barboza <dbarboza@ventanamicro.com> 於 2024年5月3日 週五 下午8:43寫道:
>
> Hi,
>
> In this RFC I want to check with Gerd and others if it's ok to add a PCI
> id for the RISC-V IOMMU device. It's currently under review in [1]. The

Is the link [1] missing?

Regards,
Frank Chang

> idea is to fold this patch into the RISC-V IOMMU series if we're all ok
> with this change.
>
> Gerd, we picked the ID right after the PCI UFS device. Let me know if
> you want another ID instead.
>
>
> Daniel Henrique Barboza (1):
>   pci-ids.rst: add Red Hat pci-id for generic IOMMU device
>
>  docs/specs/pci-ids.rst | 2 ++
>  include/hw/pci/pci.h   | 1 +
>  2 files changed, 3 insertions(+)
>
> --
> 2.44.0
>
>
Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Daniel Henrique Barboza 1 week, 2 days ago

On 5/7/24 12:37, Frank Chang wrote:
> Hi Daniel,
> 
> Daniel Henrique Barboza <dbarboza@ventanamicro.com> 於 2024年5月3日 週五 下午8:43寫道:
>>
>> Hi,
>>
>> In this RFC I want to check with Gerd and others if it's ok to add a PCI
>> id for the RISC-V IOMMU device. It's currently under review in [1]. The
> 
> Is the link [1] missing?

Ooops. Here's the link:


[1] https://lore.kernel.org/qemu-riscv/20240307160319.675044-1-dbarboza@ventanamicro.com/


Thanks,

Daniel

> 
> Regards,
> Frank Chang
> 
>> idea is to fold this patch into the RISC-V IOMMU series if we're all ok
>> with this change.
>>
>> Gerd, we picked the ID right after the PCI UFS device. Let me know if
>> you want another ID instead.
>>
>>
>> Daniel Henrique Barboza (1):
>>    pci-ids.rst: add Red Hat pci-id for generic IOMMU device
>>
>>   docs/specs/pci-ids.rst | 2 ++
>>   include/hw/pci/pci.h   | 1 +
>>   2 files changed, 3 insertions(+)
>>
>> --
>> 2.44.0
>>
>>

Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Gerd Hoffmann 1 week, 3 days ago
On Tue, May 07, 2024 at 11:37:05PM GMT, Frank Chang wrote:
> Hi Daniel,
> 
> Daniel Henrique Barboza <dbarboza@ventanamicro.com> 於 2024年5月3日 週五 下午8:43寫道:
> >
> > Hi,
> >
> > In this RFC I want to check with Gerd and others if it's ok to add a PCI
> > id for the RISC-V IOMMU device. It's currently under review in [1]. The
> 
> Is the link [1] missing?

Yes ;)

Also:  A bit more background on the iommu would be great, for example a
pointer to the specification.

take care,
  Gerd


Re: [RFC PATCH 0/1] pci: allocate a PCI ID for RISC-V IOMMU
Posted by Daniel Henrique Barboza 1 week, 2 days ago

On 5/7/24 12:53, Gerd Hoffmann wrote:
> On Tue, May 07, 2024 at 11:37:05PM GMT, Frank Chang wrote:
>> Hi Daniel,
>>
>> Daniel Henrique Barboza <dbarboza@ventanamicro.com> 於 2024年5月3日 週五 下午8:43寫道:
>>>
>>> Hi,
>>>
>>> In this RFC I want to check with Gerd and others if it's ok to add a PCI
>>> id for the RISC-V IOMMU device. It's currently under review in [1]. The
>>
>> Is the link [1] missing?
> 
> Yes ;)
> 
> Also:  A bit more background on the iommu would be great, for example a
> pointer to the specification.

Fair enough. I'll add a pointer to the latest version of the spec:


https://github.com/riscv-non-isa/riscv-iommu/releases/tag/v1.0.0



Thanks,

Daniel

> 
> take care,
>    Gerd
>