The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Jones <andrew.jones@linux.dev>
To: Gong Shuai <gong.shuai@sanechips.com.cn>
Cc: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux.dev,  Anup Patel <anup@brainfault.org>,
	Atish Patra <atish.patra@linux.dev>,
	 Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	 Tomasz Jeznach <tomasz.jeznach@linux.dev>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	 Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	 Jason Gunthorpe <jgg@ziepe.ca>,
	Kevin Tian <kevin.tian@intel.com>,
	 Andrew Jones <andrew.jones@oss.qualcomm.com>,
	Fangyu Yu <fangyu.yu@linux.alibaba.com>,
	 Tan Chi <tanchi25@mails.ucas.ac.cn>,
	Wu Fei <wu.fei9@sanechips.com.cn>,
	 Zhao Qingye <zhao.qingye@sanechips.com.cn>
Subject: Re: [RFC PATCH v3 05/10] iommu/riscv: Add nested domain allocation
Date: Sat, 21 Nov 2026 13:37:29 +0100	[thread overview]
Message-ID: <awGP5H2JdjxW8WXG@orel> (raw)
In-Reply-To: <20261119132744.396426-6-gong.shuai@sanechips.com.cn>

On Thu, Nov 19, 2026 at 09:27:39PM +0800, Gong Shuai wrote:
> From: Wu Fei <wu.fei9@sanechips.com.cn>
> 
> A nested domain describes two-stage translation through guest and
> host page tables. Iommufd exposes this domain as a nested hwpt.
> 
> User space needs to provide the guest stage 1 configuration when
> allocating a nested hwpt. Validate the configuration before storing
> it for use in a physical device context.
> 
> Signed-off-by: Wu Fei <wu.fei9@sanechips.com.cn>
> Co-developed-by: Gong Shuai <gong.shuai@sanechips.com.cn>
> Signed-off-by: Gong Shuai <gong.shuai@sanechips.com.cn>
> ---
>  drivers/iommu/riscv/iommu.c | 153 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 153 insertions(+)
> 
> diff --git a/drivers/iommu/riscv/iommu.c b/drivers/iommu/riscv/iommu.c
> index f2305b953f71..4f8ce579ef08 100644
> --- a/drivers/iommu/riscv/iommu.c
> +++ b/drivers/iommu/riscv/iommu.c
> @@ -1698,8 +1698,161 @@ static void riscv_viommu_destroy(struct iommufd_viommu *viommu)
>  	ida_free(&riscv_iommu_gscids, rv_viommu->gscid);
>  }
>  
> +struct riscv_iommu_nested_domain {
> +	struct iommu_domain domain;
> +	struct riscv_viommu *viommu;
> +
> +	u64 tc;
> +	u64 ta;
> +	u64 iosatp;
> +};
> +
> +#define to_riscv_iommu_nested_domain(domain) \
> +	container_of(domain, struct riscv_iommu_nested_domain, domain)
> +

Please rename the macro parameter so it doesn't collide with the domain
member name, otherwise macro expansion replaces the member name too.

Thanks,
drew

  reply	other threads:[~2026-11-21 12:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 13:27 [RFC PATCH v3 00/10] iommu/riscv: Add nested translation (vIOMMU) support Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 01/10] iommu/riscv: Use DC.tc.V as the device context valid bit Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 02/10] iommufd: Add RISC-V IOMMU hwpt and vIOMMU types Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 03/10] iommufd: Add RISC-V IOMMU cache invalidation data type Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 04/10] iommu/riscv: Add vIOMMU object support Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 05/10] iommu/riscv: Add nested domain allocation Gong Shuai
2026-11-21 12:37   ` Andrew Jones [this message]
2026-11-19 13:27 ` [RFC PATCH v3 06/10] iommu/riscv: Add vIOMMU cache invalidation Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 07/10] iommufd: Add RISC-V IOMMU hardware info type Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 08/10] iommu/riscv: Add riscv_iommu_hw_info Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 09/10] iommu/riscv: Add riscv_iommu_attach_dev_nested Gong Shuai
2026-11-19 13:27 ` [RFC PATCH v3 10/10] iommu/riscv: Flush the right address space on bond unlink Gong Shuai

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=awGP5H2JdjxW8WXG@orel \
    --to=andrew.jones@linux.dev \
    --cc=alex@ghiti.fr \
    --cc=andrew.jones@oss.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@linux.dev \
    --cc=fangyu.yu@linux.alibaba.com \
    --cc=gong.shuai@sanechips.com.cn \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=pjw@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=seanjc@google.com \
    --cc=tanchi25@mails.ucas.ac.cn \
    --cc=tomasz.jeznach@linux.dev \
    --cc=will@kernel.org \
    --cc=wu.fei9@sanechips.com.cn \
    --cc=zhao.qingye@sanechips.com.cn \
    /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