From: Chao Liu <chao.liu.zevorn@gmail.com>
To: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
alistair.francis@wdc.com, liwei1518@gmail.com,
zhiwei_liu@linux.alibaba.com, nutty.liu@hotmail.com,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH v2 1/1] hw/riscv/riscv-iommu.c: check for misaligned IOHGATP_PPN
Date: Fri, 3 Jul 2026 08:26:00 +0800 [thread overview]
Message-ID: <akcBjAdIs4KGhEA5@ChaodeMacBook-Pro.local> (raw)
In-Reply-To: <20260702203616.1795588-2-daniel.barboza@oss.qualcomm.com>
On Thu, Jul 02, 2026 at 05:36:16PM +0800, Daniel Henrique Barboza wrote:
> We must check if IOHGATP_PPN is 16kb aligned for non-bare GATP modes.
>
> Fixes: 69a9ae4836 ("hw/riscv/riscv-iommu: add ATS support")
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3550
> Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
> ---
> hw/riscv/riscv-iommu.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
> index 974042d017..ad8e108a23 100644
> --- a/hw/riscv/riscv-iommu.c
> +++ b/hw/riscv/riscv-iommu.c
> @@ -813,6 +813,21 @@ static bool riscv_iommu_validate_device_ctx(RISCVIOMMUState *s,
> return false;
> }
>
> + if (gatp != RISCV_IOMMU_DC_IOHGATP_MODE_BARE) {
> + uint64_t iohgatp_ppn = get_field(ctx->gatp,
> + RISCV_IOMMU_DC_IOHGATP_PPN);
> +
> + /*
> + * One of the conditions for a misconfigured DDT entry
> + * according to the riscv-spec: "DC.iohgatp.MODE is not
> + * Bare and the root page table (address) determined by
> + * DC.iohgatp.PPN is not aligned to a 16-KiB boundary."
> + */
> + if (PPN_PHYS(iohgatp_ppn) & ((1ULL << 14) - 1)) {
> + return false;
> + }
> + }
> +
> fsc_mode = get_field(ctx->satp, RISCV_IOMMU_DC_FSC_MODE);
>
> if (ctx->tc & RISCV_IOMMU_DC_TC_PDTV) {
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-07-03 0:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 20:36 [PATCH v2 0/1] hw/riscv/riscv-iommu.c: check for misaligned IOHGATP_PPN Daniel Henrique Barboza
2026-07-02 20:36 ` [PATCH v2 1/1] " Daniel Henrique Barboza
2026-07-03 0:26 ` Chao Liu [this message]
2026-07-03 4:16 ` Nutty.Liu
2026-07-06 2:03 ` [PATCH v2 0/1] " Alistair Francis
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=akcBjAdIs4KGhEA5@ChaodeMacBook-Pro.local \
--to=chao.liu.zevorn@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=nutty.liu@hotmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/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.