From: Sunil V L <sunilvl@ventanamicro.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-acpi@vger.kernel.org, iommu@lists.linux.dev,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
Tomasz Jeznach <tjeznach@rivosinc.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Anup Patel <apatel@ventanamicro.com>,
Atish Patra <atishp@rivosinc.com>
Subject: Re: [PATCH v3 1/3] ACPI: RISC-V: Add support for RIMT
Date: Tue, 1 Jul 2025 09:17:33 +0530 [thread overview]
Message-ID: <aGNaVQEsZX7vmrFv@sunil-laptop> (raw)
In-Reply-To: <20250630-4a94187c794980bb830c539a@orel>
Hi Drew,
Thank you very much for the review!.
On Mon, Jun 30, 2025 at 09:55:09AM +0200, Andrew Jones wrote:
> Hi Sunil,
>
> I found a few nits while skimming this.
>
> On Mon, Jun 30, 2025 at 09:18:01AM +0530, Sunil V L wrote:
> > RISC-V IO Mapping Table (RIMT) is a static ACPI table to communicate
> > IOMMU information to the OS. The spec is available at [1].
> >
> > The changes at high level are,
> > a) Initialize data structures required for IOMMU/device
> > configuration using the data from RIMT. Provide APIs required
> > for device configuration.
> > b) Provide an API for IOMMU drivers to register the
> > fwnode with RIMT data structures. This API will create a
> > fwnode for PCIe IOMMU.
> >
> > [1] - https://github.com/riscv-non-isa/riscv-acpi-rimt
> >
> > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> > ---
> > MAINTAINERS | 1 +
> > arch/riscv/Kconfig | 1 +
> > drivers/acpi/Kconfig | 4 +
> > drivers/acpi/riscv/Kconfig | 7 +
> > drivers/acpi/riscv/Makefile | 1 +
> > drivers/acpi/riscv/init.c | 2 +
> > drivers/acpi/riscv/init.h | 1 +
> > drivers/acpi/riscv/rimt.c | 523 ++++++++++++++++++++++++++++++++++++
> > include/linux/acpi_rimt.h | 26 ++
> > 9 files changed, 566 insertions(+)
> > create mode 100644 drivers/acpi/riscv/Kconfig
> > create mode 100644 drivers/acpi/riscv/rimt.c
> > create mode 100644 include/linux/acpi_rimt.h
> >
[...]
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 36061f4732b7..96d64e0a7b97 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -16,6 +16,7 @@ config RISCV
> > select ACPI_MCFG if (ACPI && PCI)
> > select ACPI_PPTT if ACPI
> > select ACPI_REDUCED_HARDWARE_ONLY if ACPI
> > + select ACPI_RIMT if ACPI
>
> Should use tab here.
>
Okay.
> > select ACPI_SPCR_TABLE if ACPI
> > select ARCH_DMA_DEFAULT_COHERENT
> > select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
[...]
> > +static inline int rimt_set_fwnode(struct acpi_rimt_node *rimt_node,
> > + struct fwnode_handle *fwnode)
>
> I see this is a faithful port of arm's iort functions, but using
> 'inline' in source files is pretty pointless, so we could drop
> that.
>
Sure.
> > +{
> > + struct rimt_fwnode *np;
> > +
> > + np = kzalloc(sizeof(*np), GFP_ATOMIC);
>
[...]
> > + map = ACPI_ADD_PTR(struct acpi_rimt_id_mapping, node,
> > + id_mapping_offset + index * sizeof(*map));
> > +
> > + /* Firmware bug! */
> > + if (!map->dest_offset) {
> > + pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n",
> > + node, node->type);
>
> Should we have a pr_fmt() definition at the top of this source file for
> this pr_err?
>
Oh yeah. Will add.
> > + return NULL;
> > + }
> > +
>
[...]
> > + return err;
> > +}
> > +
> > +#else
> > +int rimt_iommu_configure_id(struct device *dev, const u32 *id_in)
> > +{
> > + return -ENODEV;
> > +}
>
> This is unnecessary since we have the stub in the header file.
>
Right.
> > +#endif
> > +
>
[...]
> > +int rimt_iommu_configure_id(struct device *dev, const u32 *id_in);
> > +
>
> ubernit: no need for this blank line
>
Sure.
Thanks!
Sunil
WARNING: multiple messages have this Message-ID (diff)
From: Sunil V L <sunilvl@ventanamicro.com>
To: Andrew Jones <ajones@ventanamicro.com>
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-acpi@vger.kernel.org, iommu@lists.linux.dev,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
Tomasz Jeznach <tjeznach@rivosinc.com>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Anup Patel <apatel@ventanamicro.com>,
Atish Patra <atishp@rivosinc.com>
Subject: Re: [PATCH v3 1/3] ACPI: RISC-V: Add support for RIMT
Date: Tue, 1 Jul 2025 09:17:33 +0530 [thread overview]
Message-ID: <aGNaVQEsZX7vmrFv@sunil-laptop> (raw)
In-Reply-To: <20250630-4a94187c794980bb830c539a@orel>
Hi Drew,
Thank you very much for the review!.
On Mon, Jun 30, 2025 at 09:55:09AM +0200, Andrew Jones wrote:
> Hi Sunil,
>
> I found a few nits while skimming this.
>
> On Mon, Jun 30, 2025 at 09:18:01AM +0530, Sunil V L wrote:
> > RISC-V IO Mapping Table (RIMT) is a static ACPI table to communicate
> > IOMMU information to the OS. The spec is available at [1].
> >
> > The changes at high level are,
> > a) Initialize data structures required for IOMMU/device
> > configuration using the data from RIMT. Provide APIs required
> > for device configuration.
> > b) Provide an API for IOMMU drivers to register the
> > fwnode with RIMT data structures. This API will create a
> > fwnode for PCIe IOMMU.
> >
> > [1] - https://github.com/riscv-non-isa/riscv-acpi-rimt
> >
> > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
> > ---
> > MAINTAINERS | 1 +
> > arch/riscv/Kconfig | 1 +
> > drivers/acpi/Kconfig | 4 +
> > drivers/acpi/riscv/Kconfig | 7 +
> > drivers/acpi/riscv/Makefile | 1 +
> > drivers/acpi/riscv/init.c | 2 +
> > drivers/acpi/riscv/init.h | 1 +
> > drivers/acpi/riscv/rimt.c | 523 ++++++++++++++++++++++++++++++++++++
> > include/linux/acpi_rimt.h | 26 ++
> > 9 files changed, 566 insertions(+)
> > create mode 100644 drivers/acpi/riscv/Kconfig
> > create mode 100644 drivers/acpi/riscv/rimt.c
> > create mode 100644 include/linux/acpi_rimt.h
> >
[...]
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 36061f4732b7..96d64e0a7b97 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -16,6 +16,7 @@ config RISCV
> > select ACPI_MCFG if (ACPI && PCI)
> > select ACPI_PPTT if ACPI
> > select ACPI_REDUCED_HARDWARE_ONLY if ACPI
> > + select ACPI_RIMT if ACPI
>
> Should use tab here.
>
Okay.
> > select ACPI_SPCR_TABLE if ACPI
> > select ARCH_DMA_DEFAULT_COHERENT
> > select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
[...]
> > +static inline int rimt_set_fwnode(struct acpi_rimt_node *rimt_node,
> > + struct fwnode_handle *fwnode)
>
> I see this is a faithful port of arm's iort functions, but using
> 'inline' in source files is pretty pointless, so we could drop
> that.
>
Sure.
> > +{
> > + struct rimt_fwnode *np;
> > +
> > + np = kzalloc(sizeof(*np), GFP_ATOMIC);
>
[...]
> > + map = ACPI_ADD_PTR(struct acpi_rimt_id_mapping, node,
> > + id_mapping_offset + index * sizeof(*map));
> > +
> > + /* Firmware bug! */
> > + if (!map->dest_offset) {
> > + pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n",
> > + node, node->type);
>
> Should we have a pr_fmt() definition at the top of this source file for
> this pr_err?
>
Oh yeah. Will add.
> > + return NULL;
> > + }
> > +
>
[...]
> > + return err;
> > +}
> > +
> > +#else
> > +int rimt_iommu_configure_id(struct device *dev, const u32 *id_in)
> > +{
> > + return -ENODEV;
> > +}
>
> This is unnecessary since we have the stub in the header file.
>
Right.
> > +#endif
> > +
>
[...]
> > +int rimt_iommu_configure_id(struct device *dev, const u32 *id_in);
> > +
>
> ubernit: no need for this blank line
>
Sure.
Thanks!
Sunil
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2025-07-01 3:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 3:48 [PATCH v3 0/3] RISC-V: Add ACPI support for IOMMU Sunil V L
2025-06-30 3:48 ` Sunil V L
2025-06-30 3:48 ` [PATCH v3 1/3] ACPI: RISC-V: Add support for RIMT Sunil V L
2025-06-30 3:48 ` Sunil V L
2025-06-30 7:55 ` Andrew Jones
2025-06-30 7:55 ` Andrew Jones
2025-07-01 3:47 ` Sunil V L [this message]
2025-07-01 3:47 ` Sunil V L
2025-06-30 3:48 ` [PATCH v3 2/3] ACPI: scan: Add support for RISC-V in acpi_iommu_configure_id() Sunil V L
2025-06-30 3:48 ` Sunil V L
2025-06-30 8:02 ` Andrew Jones
2025-06-30 8:02 ` Andrew Jones
2025-07-01 3:33 ` Sunil V L
2025-07-01 3:33 ` Sunil V L
2025-06-30 3:48 ` [PATCH v3 3/3] iommu/riscv: Add ACPI support Sunil V L
2025-06-30 3:48 ` Sunil V L
2025-06-30 8:48 ` Andrew Jones
2025-06-30 8:48 ` Andrew Jones
2025-07-13 11:47 ` Will Deacon
2025-07-13 11:47 ` Will Deacon
2025-06-30 3:51 ` [PATCH v3 0/3] RISC-V: Add ACPI support for IOMMU Sunil V L
2025-06-30 3:51 ` Sunil V L
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aGNaVQEsZX7vmrFv@sunil-laptop \
--to=sunilvl@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=apatel@ventanamicro.com \
--cc=atishp@rivosinc.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rafael@kernel.org \
--cc=robin.murphy@arm.com \
--cc=tjeznach@rivosinc.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.