[RFC PATCH 02/12] iommufd: Add RISC-V IOMMU hwpt and vIOMMU types

Gong Shuai gong.shuai at sanechips.com.cn
Fri Oct 16 00:30:20 PDT 2026


Hi Jason,

Thank you for your review.

> > +/**
> > + * struct iommu_hwpt_riscv - RISC-V IOMMU stage-1 page table data
> > + *			     (IOMMU_HWPT_DATA_RISCV_S1)
> > + * @tc: Guest device context translation control
> > + * @iosatp: Guest device context stage-1 root page table pointer
> > + */
> > +struct iommu_hwpt_riscv {
> > +	__aligned_u64 tc;
> > +	__aligned_u64 iosatp;
> > +};
>
> Like the others you need a spec reference explaining exactly what
> these fields are.

I'll add references to the device-context sections of the RISC-V IOMMU
specification ("Leaf DDT entry", "Device-context fields", "Translation
control (tc)", and "First-Stage context (fsc)"), and I'll also include
detailed field information, as ARM does.

Also, I'll rename the field from iosatp to fsc. It holds iosatp when
PDTV=0 and process-directory-table pointer (pdtp) when PDTV=1, and the
two share the same layout, so the name should cover both interpretations
and the uAPI won't need to change when Process-Directory-Table (PDT)
support is added.

>
> Usually it should be the entire guest structure, is it only 16 bytes?

The RISC-V device-context is 32 bytes in base format and 64 bytes in
extended format, but it is not entirely guest-owned in a nested setup:
iohgatp, ta and the extended-format MSI fields are configured by the host.

The guest-owned part is therefore exactly tc and fsc fields, so 16 bytes
is all we take.

Thanks,
Shuai

>
> But this looks broadly right otherwise
>
> Jason



More information about the linux-riscv mailing list