From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 333C53E5A25 for ; Mon, 1 Jun 2026 18:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780337786; cv=none; b=jhu53GXSjh5VM3Zd29rEZxcyI0B89SHHXfVASdj/D5T05VgQfNPtL02MAAgX3ToCty1c91aaD20ZIHHdeBuE5XYetviacVBaZKPqU929mDlFu9xo7ZuaunmDm8V8zyPjniUqrbOznC2NY2RiAMgaAXN4tFDXO3YE7MwgP9vsue4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780337786; c=relaxed/simple; bh=O8gk8Oab/8Yh/UbOhxGmRmYe8r7hS31rff/s5CMCyew=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=n9LtlxgdWNYPduRR8k8vbEh6dH7l97deOPFlHC+jRBQuiLdKkIL2SlmqyHTmnXm8D6xMPcaST65fcWWb5fjLThfcgCa8pr5+pWQtb8ykTlQqg3pqfR0NqBADK3vwm9bL1IQIC78r6LJX1UlkfkKez3WoYABKL3nldBdoPhbiYjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wnliu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YhE3fTh2; arc=none smtp.client-ip=74.125.82.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wnliu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YhE3fTh2" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-304e4636205so9935780eec.1 for ; Mon, 01 Jun 2026 11:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780337780; x=1780942580; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=xTQ3ch2eeCj8LQYYitehSqnw/gDN7HGabo3htxsM7cw=; b=YhE3fTh2qDKCojkyAbyc8wt8aLw5BvMi4lUOSWlidt8tdWoEfBB66dkFA6dQk+9HQ9 ZhFLhBgblV/L7mr0NV1zX94aZLID0dK8sd5VRH6s7ZfEpoONAHRNrpUcWLqlm/A6kcqY 8qKtLrnKnrfZXJckb3DnvcE+sbIdeUCo0KEWsPTJxFF5PyYoUK6teRplU61jAH6PVtb1 qnW6542D0ZZ2f9id4sV6Dn7jBN9Q1zOnZd59qUM3M7qlfik07E4GTqxjY4gv6o71S0Y8 zgHtK/o9gjD076DPOSyzSV6X091QSfk7Vfx3lnFZ1Iv/C6rlHCvSBMeMCU87w8O/NAiG PJkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780337780; x=1780942580; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=xTQ3ch2eeCj8LQYYitehSqnw/gDN7HGabo3htxsM7cw=; b=JfXg52ZBX77hnVVXVbvyja3Rv7XU9zFxJXh/yYop7epTVzwuqVfvEdFEVjwX5jeilm ReiEiwV+cLS5WHnFwfIbOVJKu80pquLdZI2/pO0OYZk3Um5FPMBCnqusvfbiLEol8REh EiGfxoH2Pji5mV7vBelPjjFRsFIOMOLmiznkT94hGUwX6g2i/JhutMha170PU3xQpMVH Znoxjf+7/SLzWVK3fvoQhaApCw0r8ZWIPJ+S3JcZgQ3VAQMAxTmQCPjIjsvfatEdNr4F mYHtX7LHj9L+LulBzfBim1MgzSynJWrDBUKr7CSvZWqqhOdxNymbmnPbW6B4+Mashep/ lZ1w== X-Forwarded-Encrypted: i=1; AFNElJ//pI0aURrVVZ4fog/HbxBtC8BYBjb8w1MLZkql8J39Mx4oN3q6LYabfL39fx6ylr6mqrsCv3e0u/ShZ3Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwGMUWF2TqkOI2qXm7lwT6J3BKp9f2qJVg2Lw9qC2DsDHqYA2Fw cxfkJHVutXXNHzBYw7haJr28HsH7H4QHzHMClI6uHey2XdOvCv915NGoG1o57lQmfuAW/KAD9xW 74g== X-Received: from dybvi11.prod.google.com ([2002:a05:7301:530b:b0:2ed:d9c:cdae]) (user=wnliu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:3b05:b0:2d8:df01:d9f7 with SMTP id 5a478bee46e88-304fa5f5380mr5959267eec.15.1780337779712; Mon, 01 Jun 2026 11:16:19 -0700 (PDT) Date: Mon, 1 Jun 2026 18:16:18 +0000 In-Reply-To: <20260528051738.596013-13-suravee.suthikulpanit@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260528051738.596013-13-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 2.54.0.929.g9b7fa37559-goog Message-ID: <20260601181619.721505-1-wnliu@google.com> Subject: Re: [PATCH v2 12/26] iommu/amd: Add per-VM private IPA alloc/map helpers From: Weinan Liu To: suravee.suthikulpanit@amd.com Cc: chriscli@google.com, dantuluris@google.com, iommu@lists.linux.dev, jay.chen@amd.com, jgg@nvidia.com, jon.grimm@amd.com, joro@8bytes.org, kevin.tian@intel.com, kpsingh@google.com, linux-kernel@vger.kernel.org, nicolinc@nvidia.com, sairaj.arunkodilkar@amd.com, santosh.shukla@amd.com, vasant.hegde@amd.com, wnliu@google.com, wvw@google.com, yi.l.liu@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 1, 2026 at 6:11=E2=80=AFAM Jason Gunthorpe wro= te: > > On Thu, May 28, 2026 at 05:17:24AM +0000, Suravee Suthikulpanit wrote: > > Export amd_iommu_iotlb_sync() and use it for nested domain > > iotlb_sync so nested attach paths can flush gathered IOTLB state. > > [ ..] > > > --- a/drivers/iommu/amd/nested.c > > +++ b/drivers/iommu/amd/nested.c > > @@ -291,4 +291,5 @@ static void nested_domain_free(struct iommu_domain = *dom) > > static const struct iommu_domain_ops nested_domain_ops =3D { > > .attach_dev =3D nested_attach_device, > > .free =3D nested_domain_free, > > + .iotlb_sync =3D amd_iommu_iotlb_sync, > > }; > > > I don't get it, what is all of this for? > > iotlb_sync should never be called on an IOMMU_DOMAIN_NESTED. > > "nested attach paths" should never have gathered IOTLB state. > > Jason BTW, amd_iommu_iotlb_sync() is designed to flush a protection_domain and ca= nnot be used for a nested_domain. Specifically, the current implementation explicitly casts the domain to a p= rotection_domain: ``` void amd_iommu_iotlb_sync(struct iommu_domain *domain, struct iommu_iotlb_gather *gather) { struct protection_domain *dom =3D to_pdomain(domain); ```