Kernel KVM virtualization development
 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 09/10] iommu/riscv: Add riscv_iommu_attach_dev_nested
Date: Sat, 21 Nov 2026 16:48:51 +0100	[thread overview]
Message-ID: <awG5Q7pmntSme1A2@orel> (raw)
In-Reply-To: <20261119132744.396426-10-gong.shuai@sanechips.com.cn>

On Thu, Nov 19, 2026 at 09:27:43PM +0800, Gong Shuai wrote:
...
> +	if (riscv_iommu_bond_link(s2_parent, dev, nested_domain->viommu->gscid))
> +		return -ENOMEM;
> +
> +	riscv_iommu_iodir_update(iommu, dev, &dc);
> +	riscv_iommu_bond_unlink(info->domain, dev);
> +	info->domain = s2_parent;
> +

When moving between the S2 parent and a nested domain on it, the parent
briefly has two bonds for dev. bond_link() puts the new bond after the
first bond with the same GSCID, which may come before dev's old bond,
and since it's then dev's first bond, bond_unlink() removes it. dev is
left bonded with its old GSCID, so its new GSCID misses invalidations
once no other device's bond has it.

Passing the old domain to bond_unlink(), like I do in [1] for a
different reason, would let it remove the bond matching both dev and
old's GSCID.

[1] https://lore.kernel.org/all/20260928143113.49838-12-andrew.jones@oss.qualcomm.com/

Thanks,
drew

  reply	other threads:[~2026-11-21 15:49 UTC|newest]

Thread overview: 13+ 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
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-21 15:48   ` Andrew Jones [this message]
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=awG5Q7pmntSme1A2@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