From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.7 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796103308; b=LcLmCr90HxnnxiUitNFNHC+afIW8KrEEv6lsozWlN06kEdi7z9Wxh8KUS3L0eJPQSB6l 4tvjx2VYkSnzpt5mkpqB0Y3jYPyzXuCitMzHJWwE7jNxickPNsh71y34dFOKm/1ENP4Zh OjVdxeFSzGEX/6aO+na7yee1jsgFevFmdY9ok1ux6HI6vJ829HjTwhsv4P2wfcKoynQ2D RdDcwC4Y6vv7bOrHcuipQ+GDF+qpjPhtjrr7uq20ZWqE/2H1VaAIpS2esZ/GmNCeUBclo +cDPcWNxyhrdzUmIhj7B7sDrP8npoiijCctQZ9Rr1PS/8IZ4QtdUxBm1rgYNB1Nk0Bw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796103308; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Message-ID:Date: MIME-Version:User-Agent:Cc:Subject:To:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=C4Y9hKXt4u4uMwvpThPiiBSOOvedPA74e9IuKfkcFd4=; b=qbvWxky29uC8ByGbsHoJ0beFFuq7sQAXOikHTkQIHM18IdvtjLYmauJ36571YNxZKzaw JUycOXzhw6oPHWpaSXohPqCB8uJHz/LFoQYJTfOkFCTVwoy7eOTBQAXhEous8D6xL6tDh rX36PYoZYrr3imH4RB630ImLTajxXV9MxQpMg9BMidLeTAGu0xLr8NGAH2tfrKnVNiUJL N/vxjOmP+OnZPRUi1SuCBw0q7559+jpBT3viQ96UID544ukHU756gldD9CsCCQS6DJ/4z up1bXcbDn40AyPaL3puu2dw242it4nJaN42NEydPG0MNFzLoNx7ZZwD/LYDIukCJ4IQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=aSccnuSc; arc=none smtp.remote-ip=192.198.163.7 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20095606A31A; Tue, 1 Dec 2026 05:35:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 20095606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=aSccnuSc DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796103308; x=1827639308; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=C4Y9hKXt4u4uMwvpThPiiBSOOvedPA74e9IuKfkcFd4=; b=aSccnuSc0I5edS2lzXpHSMlhtNWZa0SUU8dnBvJ8Rq84FjT11ilJrO/m IH33CV+oChMgBuBU6gEyF0eZ+mm3EqC51Mc2WMgBXDI8W27DETi8f/Zht l/TCFVT9wQkACdebC/0xcNafGcvp9m6LjV9rRn9Vhwn6FLrVFYfHBBML1 FH34zs08hlEKBfS8Z9MU+6USzfInqyBqyJmbnt2zDGj+h7vnTsN2vPtPA URsdrY3E0YFdRIJx7x1gphRboDkJbO8WnbenC8IfqE1qMWqb/Zg+qZmNV qZTZ3i1KHh96z8A0tZ9I2ZRhvzKl1FnYf81J/RZKLvybfNKBJ0+14Crz3 w==; X-CSE-ConnectionGUID: j1jSAvv3RteXtUi6Ld6zYA== X-CSE-MsgGUID: fSnS/KM7Rl6DhkfFvQTwxw== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4807738" X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="4807738" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 21:35:07 -0800 X-CSE-ConnectionGUID: j9+MeGr3Q8aEskM70fB1BA== X-CSE-MsgGUID: 3HPDmE2UTBqj5MGZDHarCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="13132285" Received: from unknown (HELO [10.238.1.144]) ([10.238.1.144]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 21:34:59 -0800 Message-ID: <1a81c5da-09ec-467d-acf9-25896a1c4a51@linux.intel.com> Date: Tue, 1 Dec 2026 13:34:57 +0800 X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: baolu.lu@linux.intel.com, Alex Williamson , Alexey Kardashevskiy , Bjorn Helgaas , Catalin Marinas , Jacob Pan , Jason Gunthorpe , Joerg Roedel , Jonathan Cameron , Jonathan Hunter , Kevin Tian , Krishna Reddy , Lukas Wunner , Nicolin Chen , Robin Murphy , Samuel Ortiz , Shameer Kolothum , Steven Price , Suravee Suthikulpanit , Suzuki K Poulose , Thierry Reding , Vasant Hegde , Will Deacon , Xu Yilun , Ashish Kalra , Herbert Xu , iommu@lists.linux.dev, Jonathan Cameron , Tom Lendacky , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH v9 11/13] iommufd/viommu: Allow vIOMMUs without a parent HWPT To: "Aneesh Kumar K.V" , linux-coco@lists.linux.dev References: <20261116081935.85372-1-aneesh.kumar@kernel.org> <20261116081935.85372-12-aneesh.kumar@kernel.org> <620712ae-e21e-4daa-9cd3-0c5d06ffb67f@linux.intel.com> Content-Language: en-US From: Baolu Lu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/24/2026 1:23 PM, Aneesh Kumar K.V wrote: > Baolu Lu writes: > >> On 11/16/2026 4:19 PM, Aneesh Kumar K.V (Arm) wrote: >>> VIOMMU_ALLOC currently requires a nesting parent HWPT_PAGING even when >>> the selected vIOMMU implementation has no use for one. This would force >>> implementations such as the following Arm Realm vIOMMU to create an >>> unused parent. >>> >>> Add IOMMUFD_VIOMMU_NO_HWPT so an implementation can opt out. Require >>> hwpt_id to be zero in that case and pass a NULL parent domain to its >>> initialization callback. For implementations that require a HWPT, verify >>> that the parent supports nesting and its domain belongs to the device's >>> physical IOMMU driver before invoking viommu_init(). >>> >>> Reject nested domain and hardware queue allocation for a vIOMMU without >>> a parent, and document the two allocation modes in the UAPI. >>> >>> Cc: Jason Gunthorpe >>> Cc: Kevin Tian >>> Cc: Joerg Roedel >>> Cc: Will Deacon >>> Cc: Robin Murphy >>> Cc:iommu@lists.linux.dev >>> Signed-off-by: Aneesh Kumar K.V (Arm) >>> --- >>> Documentation/userspace-api/iommufd.rst | 44 +++++++++--------- >>> drivers/iommu/iommufd/hw_pagetable.c | 14 ++++-- >>> drivers/iommu/iommufd/viommu.c | 62 +++++++++++++++---------- >>> include/linux/iommufd.h | 13 ++++-- >>> include/uapi/linux/iommufd.h | 3 +- >>> 5 files changed, 81 insertions(+), 55 deletions(-) >>> >> [...] >> >>> diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c >>> index ae62db50885c..52e52ef089a2 100644 >>> --- a/drivers/iommu/iommufd/hw_pagetable.c >>> +++ b/drivers/iommu/iommufd/hw_pagetable.c >>> @@ -306,6 +306,10 @@ iommufd_viommu_alloc_hwpt_nested(struct iommufd_viommu *viommu, u32 flags, >>> return ERR_PTR(-EOPNOTSUPP); >>> if (!user_data->len) >>> return ERR_PTR(-EOPNOTSUPP); >>> + if (!viommu->hwpt) >>> + return ERR_PTR(-EOPNOTSUPP); >>> + if (!viommu->iommu_dev) >>> + return ERR_PTR(-EOPNOTSUPP); >>> if (!viommu->ops || !viommu->ops->alloc_domain_nested) >>> return ERR_PTR(-EOPNOTSUPP); >>> >>> @@ -404,10 +408,12 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd) >>> struct iommufd_viommu *viommu; >>> >>> viommu = container_of(pt_obj, struct iommufd_viommu, obj); >>> - iommu_dev = iommufd_device_get_iommu_dev(idev); >>> - if (!iommu_dev || viommu->iommu_dev != iommu_dev) { >>> - rc = -EINVAL; >>> - goto out_unlock; >>> + if (viommu->iommu_dev) { >>> + iommu_dev = iommufd_device_get_iommu_dev(idev); >>> + if (!iommu_dev || viommu->iommu_dev != iommu_dev) { >>> + rc = -EINVAL; >>> + goto out_unlock; >>> + } >> Is it intended that every tsm-provided viommu has viommu->iommu_dev == >> NULL? >> >> If so, could the tsm-provider patch make provider selection exclusive by >> looking up the physical iommu only on the fallback path? All checks >> against viommu->iommu_dev should be in that patch. This non-parent-hwpt >> viommu support patch should no longer check viommu->iommu_dev. >> > IIUC, you are suggesting moving the iommu_dev check from this patch to > patch 10? Yes.