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, andrew.jones@oss.qualcomm.com,
Palmer Dabbelt <palmer@dabbelt.com>
Subject: Re: [PATCH 1/2] hw/riscv/riscv-iommu.c: check for reserved PTE bits
Date: Tue, 30 Jun 2026 17:51:43 +0800 [thread overview]
Message-ID: <akORpVVQ-C3FeSAH@ChaodeMacBook-Pro.local> (raw)
In-Reply-To: <20260629121334.567587-2-daniel.barboza@oss.qualcomm.com>
On Mon, Jun 29, 2026 at 09:13:33AM +0800, Daniel Henrique Barboza wrote:
> We need to fault if reserved PTE bits (60:54) are set.
>
> Fixes: 0c54acb8243d ("hw/riscv: add RISC-V IOMMU base emulation")
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3554
> 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 | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c
> index c9687e01a8..453601d7a5 100644
> --- a/hw/riscv/riscv-iommu.c
> +++ b/hw/riscv/riscv-iommu.c
> @@ -468,6 +468,8 @@ static int riscv_iommu_spa_fetch(RISCVIOMMUState *s, RISCVIOMMUContext *ctx,
>
> if (!(pte & PTE_V)) {
> break; /* Invalid PTE */
> + } else if (pte & PTE_RESERVED(false)) {
> + break; /* Reserved PTE bits set */
> } else if (!(pte & (PTE_R | PTE_W | PTE_X))) {
> base = PPN_PHYS(ppn); /* Inner PTE, continue walking */
> } else if ((pte & (PTE_R | PTE_W | PTE_X)) == PTE_W) {
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-06-30 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 12:13 [PATCH 0/2] hw/riscv/riscv-iommu.c: additional PTE checks Daniel Henrique Barboza
2026-06-29 12:13 ` [PATCH 1/2] hw/riscv/riscv-iommu.c: check for reserved PTE bits Daniel Henrique Barboza
2026-06-30 7:25 ` Nutty.Liu
2026-06-30 9:51 ` Chao Liu [this message]
2026-06-29 12:13 ` [PATCH 2/2] hw/riscv/riscv-iommu.c: fault when !PTE_U and no priv access Daniel Henrique Barboza
2026-06-30 7:38 ` Nutty.Liu
2026-06-30 9:51 ` Chao Liu
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=akORpVVQ-C3FeSAH@ChaodeMacBook-Pro.local \
--to=chao.liu.zevorn@gmail.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.jones@oss.qualcomm.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=liwei1518@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox