From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 7A42A37CD31 for ; Tue, 16 Jun 2026 20:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781641096; cv=none; b=GrbpfgrnsdLI89A94V5298ZS9pj5zYYzIQY/f58sMJDZ3RikZrv4WN5VetLPnu9poCZek6A73YBjdrw/vGZumtpoVhT7OCFeF0MZvCRv3Ywo3p6I/bpJCn1b/O82s5xwL+hjlEP0qWE2Jsww45Ic9XxY62WhShTwE/J4jwbu/so= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781641096; c=relaxed/simple; bh=Y3MG0dey+WorwLfZ/iABdp39TkDt/9ppHxmDi9BUIAU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IuA6lLEZ0pI3PjdL8dEUzpyIAwvryyOM+1IXdHtsOnTDFUCN43LG2sN2wdUV5zcf2TznFOo1ndE//BKszZlUNYzeQoheGjaP/eJd991VdRKX+LfLdQMLe5P+ZamsydFSFbr6ktxzWE/QoNEYURgHlm4SjHmnG2Fql2xQ+53nDRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uptiF/x5; arc=none smtp.client-ip=209.85.214.169 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uptiF/x5" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2c6a4eccab1so2915ad.1 for ; Tue, 16 Jun 2026 13:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781641095; x=1782245895; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ekeo93H4IkViidGXaNTVyvKiJzNOYNB42Mr4fQp0DLo=; b=uptiF/x5Vhi57cbKHP0pxC029JXlat2Ry9taslzSrkgtMiK0VlGKkttmIf96aTGl5x xlQvkQZPimBgWl//Yl1p/m9ywjPXCWd4BhOJfmviBaG1bz4aXTAvBUgxuzbJVi667ei3 qKN+0nKwkZpoXyyu4kruBPjoDFsmoQOvOitfHpoVLKN1yBK+scR3sKtT4Gr1KeDlWba7 3JsOK6AjbTiHDVkC6aMcKIMs6Ho+ZsiKMxMwnMw4w3D0DvPJI/c0yRuc1Mneja1FcCe0 RgSZJFgDJusODy2ctU0Y/MoImy4sdK/EoxftlDzRSTwVCALAG9aXLG6JvhpyUADjLVAD 9EmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781641095; x=1782245895; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ekeo93H4IkViidGXaNTVyvKiJzNOYNB42Mr4fQp0DLo=; b=rQWifAulH8qC5O3GmhNx8RNERKdrezGBlpkuU0umfWc+OFwODWNPGqZYTevCf7aevy tYo8SeEvCyWxzqWWcE++fvHyJec3OvIAc64dbqPi0AKSsiz7y7Q3NSt2Txvou39p9XAw 4IXk2x/hZyWnqTFvSC1zrJ7IYE1B39J8I6rPvE36Tz24gJv3v+/YtGK5ZTZmmIvCjqAF WiuXZ7mdqZZuA1YMIaQTK0d5MfvMJKqUyouxc5Yw7eSP6QFiaxXvWX6GBuL2w+71TrZM Odqt6Ra/aJ0UsNjyiayc9QMO2mE7d4DeDc+j9eb0Rm1BhHKbjw78kQE8x9D3yFTwPB2l 3sKw== X-Gm-Message-State: AOJu0Yzx4t86G2dRobC+/4eLlyfwz1uXpXCjHRNmAK3H9sYC0TtndPOM JAvjaVapGfVBu5yVDTUiZF99h3JJG95WUYH9t+8bcoIMheKnOO4/BVlTcvqPFTXx/IyuqB/BzuL BD012Kw== X-Gm-Gg: AfdE7cmrTvF9AVvYb9+YUgtxiYjCLP7Y5Rt7ZeOzNxmkbh/Q98vYgfM/13q9uvJNleR IfU6Rt9liIvybnV4/ERBDMfA180h3g+EvWWsZl8DU3dGvgAMiS8ahPkntq4MUZaKGGFFKDqYNfM nQNWsHGc1VGdkmxiAMOq1sV1DB4mEO878GycEGG3pwjljWRgS8UqsVOODu8LDiVUk+k4QovC/8i H4/uE3B38Pxui+yqto1vofgGVaJCq1o/oAVOd79f5mYjAtPGA8OPMDHah9uYlhALO0m/fQFwoFI Ayi0rhjDynnPax2TMzbOgUf63bj/rauB17TcSvUSkzw3hGN9rIeoOk5VL95Gw3bkkXvky5UEoSZ KtnmH3zaeE78diZ8ci2aciDUkVR/yJ4JKzbc6L0GpGZq5JcgoIJWjEFUeGWQEE9Nswb12lUeTr6 jgh2oowf7XTDDrDk3hSxeUjws2OA8Sc+102IRyjGdA+KLBHrOJD41rGHIhIphy X-Received: by 2002:a17:902:da8b:b0:2c0:c14c:bf37 with SMTP id d9443c01a7336-2c6bb8be5a4mr583025ad.16.1781641094236; Tue, 16 Jun 2026 13:18:14 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c86651af0edsm11921031a12.32.2026.06.16.13.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 13:18:13 -0700 (PDT) Date: Tue, 16 Jun 2026 20:18:06 +0000 From: Pranjal Shrivastava To: Jacob Pan Cc: linux-kernel@vger.kernel.org, "iommu@lists.linux.dev" , Jason Gunthorpe , Alex Williamson , Joerg Roedel , Mostafa Saleh , David Matlack , Robin Murphy , Nicolin Chen , "Tian, Kevin" , Yi Liu , Baolu Lu , Saurabh Sengar , skhawaja@google.com, pasha.tatashin@soleen.com, Will Deacon Subject: Re: [PATCH v9 1/6] iommufd: Support a HWPT without an iommu driver for noiommu Message-ID: References: <20260611172658.3421138-1-jacob.pan@linux.microsoft.com> <20260611172658.3421138-2-jacob.pan@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260611172658.3421138-2-jacob.pan@linux.microsoft.com> On Thu, Jun 11, 2026 at 10:26:53AM -0700, Jacob Pan wrote: > From: Jason Gunthorpe > > Create just a little part of a real iommu driver, enough to > slot in under the dev_iommu_ops() and allow iommufd to call > domain_alloc_paging_flags() and fail everything else. > > This allows explicitly creating a HWPT under an IOAS. > > A new Kconfig option IOMMUFD_NOIOMMU is introduced to differentiate > from the VFIO group/container based noiommu mode. > > Reviewed-by: Lu Baolu > Reviewed-by: Samiullah Khawaja > Reviewed-by: Kevin Tian > Signed-off-by: Jason Gunthorpe > Signed-off-by: Jacob Pan > --- > V8: > - Guard vIOMMU and vDevice allocation paths for noiommu (Sashiko) > v7: > - Drain no-IOMMU generic-PT freelist (Sashiko) > - Import generic-PT IOMMU namespace (Sashiko) > v6: (Yi) > - Sort includes alphabetically (iommu.h after generic_pt/iommu.h) > - Fix comment: s/mock page table/SW-only page table/ to avoid confusion > with selftest mock > - Rewrite noiommu_amdv1_ops comment: explain why AMDV1 format is chosen > (multi-page size options), remove references to group-container mode distinction > v5: > - Use the new IOMMUFD_NOIOMMU Kconfig instead of VFIO_NOIOMMU > - Use consistent wording referring to VFIO noiommu mode (Kevin) > - Copyright date fix (Kevin) > v4: > - Make iommufd_noiommu_ops const > v3: > - Add comment to explain the design difference over the > legacy noiommu VFIO code. > --- > drivers/iommu/iommufd/Kconfig | 12 +++ > drivers/iommu/iommufd/Makefile | 1 + > drivers/iommu/iommufd/hw_pagetable.c | 19 ++++- > drivers/iommu/iommufd/hwpt_noiommu.c | 105 ++++++++++++++++++++++++ > drivers/iommu/iommufd/iommufd_private.h | 12 +++ > drivers/iommu/iommufd/main.c | 1 + > drivers/iommu/iommufd/viommu.c | 14 +++- > 7 files changed, 158 insertions(+), 6 deletions(-) > create mode 100644 drivers/iommu/iommufd/hwpt_noiommu.c > > diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig > index 455bac0351f2..6c3bea83631b 100644 > --- a/drivers/iommu/iommufd/Kconfig > +++ b/drivers/iommu/iommufd/Kconfig > @@ -16,6 +16,18 @@ config IOMMUFD > If you don't know what to do here, say N. > > if IOMMUFD > +config IOMMUFD_NOIOMMU > + bool > + depends on !GENERIC_ATOMIC64 # IOMMU_PT_AMDV1 requires cmpxchg64 Nit: Should we explicitly depend on 64BIT here? I see further in the patch we assume 64-bit addresses: + cfg.common.hw_max_vasz_lg2 = 64; + cfg.common.hw_max_oasz_lg2 = 52; > + select GENERIC_PT > + select IOMMU_PT > + select IOMMU_PT_AMDV1 > + help > + Provides a SW-only IO page table for devices without hardware > + IOMMU backing. This uses the AMDV1 page table format for > + IOVA-to-PA lookups only, not for hardware DMA translation. > + To be selected by VFIO_NOIOMMU when VFIO_DEVICE_CDEV is enabled. > + Apart from that, Reviewed-by: Pranjal Shrivastava Thanks, Praan