From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=13.77.154.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796430554; b=BtHpkcrrYZexwC+zXRm55uQE32eKXXmfAFP5lpdbSuuih+WnbqIxzMIz89vIuAujk5Nu rQGptuiZO65bBTuswq8IPtUZzVsEOHiJR0xnGU5ilY3+fLv+2b7OUNNzpmsWbjD329hIA SViybSAeWsOPapYxJiCaquNbsXRIoL1XH4IVRVcbVbMYh9O8ccJv3NkwIQMPFG01d8mCF pJj8/khAFsoIrMzr/BF+F+UID7IIHMQ/6nF9Z8mksanXf3fiCtMRgNbglHTl1UuCoaOgm ssfxNvPYXgahdSZIJu5x1HODBpewTYZmMB9tbXbOcCe7kwW/kspuGxE6h4iDqwu70Xg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796430554; h=DMARC-Filter:Received:DKIM-Filter:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:In-Reply-To:References:Organization:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding:X-Spam-Status: X-Spam-Checker-Version; bh=bZ+dfe5DAalpGB9NCHuBmwiRNm13yzKfNXhG3m6pwOw=; b=eZERz04tafqmJnTH6L0uGa4yuaUYAt0a0tRFrqLCUvpqmTCNYY5B5ceDEVWIxPfo8MUy aPAmqgt474kNjJwd71F1SL/Sa8Src3/rCty1ep9St4N+ou9WV2KyWRes4N/w/YFaFed7S 2sGx0mxajT19FeXAiwclkqPEw4BTICqPsgUO2Nf1UuTdvrjuzeQphkQrBRFstonEwOy6L PYUgsjN5uYRluNzVVUiFlwDRwn5oAHDidhxdfje/wQWVW5WGBVfzBtoRYAh/7qej3v60p gCpezcARkKmgcPKhWlz6MLMmEzrtm5bbQbaPQnW6vh1YTCCNNRY1gSK+c0nc3/mL2KQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=SDuTOV3y; arc=none smtp.remote-ip=13.77.154.182 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 166DF606A322; Sat, 5 Dec 2026 00:29:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 166DF606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.a=rsa-sha256 header.s=default header.b=SDuTOV3y Received: from localhost (unknown [4.194.122.162]) by linux.microsoft.com (Postfix) with ESMTPSA id 19D4920B7178; Fri, 4 Dec 2026 16:28:59 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 19D4920B7178 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1796430552; bh=bZ+dfe5DAalpGB9NCHuBmwiRNm13yzKfNXhG3m6pwOw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SDuTOV3y9tyXJEgNy4iS39UeenCHzah8/oM17nxpYle44HwfmApmYbPcFSkBq0OtI tD5dxcTZ4ipu2KirFrY5Dm6OSpjbAPWv7K8PsaFjoF///T7kiQHOwYkXj/ZlP6hkaj lO/amItJlW1B/9cJ0JuFAfQqZZX6bRia3yrhYt+Y= Date: Fri, 4 Dec 2026 16:28:55 -0800 From: Jacob Pan To: "Tian, Kevin" Cc: Jason Gunthorpe , "Aneesh Kumar K.V (Arm)" , "linux-coco@lists.linux.dev" , Alex Williamson , Alexey Kardashevskiy , Bjorn Helgaas , Catalin Marinas , Joerg Roedel , "Jonathan Cameron" , Jonathan Hunter , "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 , Jonathan Cameron , Tom Lendacky , "kvm@vger.kernel.org" , "iommu@lists.linux.dev" , "linux-arm-kernel@lists.infradead.org" , "linux-pci@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "patches@lists.linux.dev" , jacob.pan@linux.microsoft.com Subject: Re: [PATCH v10 14/18] iommufd/viommu: Identify physical IOMMU backing with a tag Message-ID: <20261204162855.00002cfc@linux.microsoft.com> In-Reply-To: References: <20261125081121.379481-1-aneesh.kumar@kernel.org> <20261125081121.379481-15-aneesh.kumar@kernel.org> <20261203155422.GE1074888@ziepe.ca> Organization: LSG X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi Kevin, On Fri, 4 Dec 2026 02:49:22 +0000 "Tian, Kevin" wrote: > > From: Jason Gunthorpe > > Sent: Thursday, December 3, 2026 11:54 PM > > > > On Thu, Dec 03, 2026 at 06:42:51AM +0000, Tian, Kevin wrote: > > > > > this patch and next intend to put that constraint only on the > > > legacy usage, probably based on the observation that there is > > > only one tsm in a platform so one tsm viommu can support all > > > kinds of devices behind different > > physical > > > IOMMUs. > > > > That won't be true for ARM or AMD. Any viommu that has a direct > > bypass command queue to the guest must have viommu 1:1 with piommu. > > > > For these tsm cases the viommu driver should be selecting if it is > > compatible > > > > And maybe that is the proper generalization, make all the drivers > > work that way and the physical drivers simple always require 1:1 > > yes, that way we keep the current semantics. No need of various > backing tags as done here. > > > > > > We have two options here. One is to inherit the current uapi > > > definition for tsm then abandon this patch. otherwise to not > > > break the existing uapi we'd better introduce a new viommu_alloc > > > flag to explicitly mark the viommu as CC type which then can be > > > defined with a different semantics from legacy. > > > > Not sure I see the uAPI issue? The VMM basically needs to know the > > rules for the viommu it selected when it selects it. If it is a 1:1 > > with physical or not is baked into the selection, I Think, or should > > be returned by one of the driver's GET_INFOs ? > > > > the 1:1 restriction is written in current uAPI description, while > this patch seems to violate it for tsm viommu in iommufd core. > > I'd opt for inheriting the 1:1 restriction for all tsm viommus. It's > simpler. I think mshv/pkvm use case of viommu may present a subtle exception here. In case of attaching device to a VM with hypervisor owned S2, it is mshv or pkvm that owns the pIOMMU, so host IOMMUFD has no visibility into the mapping of 1:1 mapping. As we discussed earlier [1], we could fish the viommu ops from partition vm file. viommu is per VM[2]. So in this case, the iommu_dev is synthetic, does not represent a physical slice of the hw iommu. I think this restriction "device->iommu_dev == viommu->iommu_dev" still works for mshv but just wanted to see if there are things I missed. [1] https://lore.kernel.org/all/20261109184901.GQ663069@ziepe.ca/ [2] https://lore.kernel.org/all/20260925190742.1575380-3-jacob.pan@linux.microsoft.com/