From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4474A606A31E for ; Tue, 24 Nov 2026 04:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hGmNb/y+; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TacI6VBy DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=TOPyh86e0J/wqM6iyFTSqLXbZQLp2s74/uc/F4v5k2k=; b=hGmNb/y+6+cACJUAwxnIDYvzD9 ZJ7U3sU0gkL/CD7zgfFWDpM+oPGQeW21QDrMtj8LBi4CkGW3DIQxxztGGonMFVAqqqUQv7WaTdYRL 6CF6mNIHwpCBwvJjgWsLCX4tEjyifRH9PeBrCS/R464tHNMMj5MEiLl90sWX4uPCcCGPR90pNiaTz zCH9hwJxreDUp5Il35gUH6a3hGrysxTuZ/8LZiItycAZRco/sfwBBRM02B1WIqiPXR/esqVQmJgb4 WDhdvhWBsG38rUU/MEXOJmgXAS0NevfWucjJHxOAG8PT44rC6l6jgM3MJ54fCBYVSFmEi18LA0t48 5sHUeieQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVhtO-00000005VGU-2ii5; Tue, 24 Nov 2026 04:12:30 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xVhtN-00000005VGM-0wdW for linux-arm-kernel@lists.infradead.org; Tue, 24 Nov 2026 04:12:29 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 6E4F46116F; Tue, 24 Nov 2026 04:12:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03F6F1F000D4; Tue, 24 Nov 2026 04:12:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795493548; bh=TOPyh86e0J/wqM6iyFTSqLXbZQLp2s74/uc/F4v5k2k=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=TacI6VByHmOlrNMYSCRpaldILoRzjvB7MBWa7eaMuyWG/LfquQTS7/HAwYu9490pe XQ2F8WyNFlP6ZRGn3e6cLQsHNlim7ClGQmqalBH5tr2THZ2VixKCIswPPTBu+Ezszn gMMUpSrPneTOQh4Ad8nB4h/DPqDEewrvZ8CBE0c0CFM1aPs7BSu0j77dIR9LrU1I6E NwO7weBpkdOlqKdKe7Q0BdLDX1hJflxxZT/NzzdL9ixUyP/DKAXhYiR0OJWrX1u2sq Gdj9K9g33VNSw8R1+0e5cJecESdB63deRy19Ht+5ShIxR6iGfgeVcjEZVujvuZB75J LFDjnVJuqj/Gg== X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Jacob Pan Cc: linux-coco@lists.linux.dev, Alex Williamson , Alexey Kardashevskiy , Bjorn Helgaas , Catalin Marinas , 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, jacob.pan@linux.microsoft.com Subject: Re: [PATCH v9 09/13] iommufd/viommu: Select vIOMMU operations before allocation In-Reply-To: <20261120094207.00002e89@linux.microsoft.com> References: <20261116081935.85372-1-aneesh.kumar@kernel.org> <20261116081935.85372-10-aneesh.kumar@kernel.org> <20261120094207.00002e89@linux.microsoft.com> Date: Tue, 24 Nov 2026 09:42:12 +0530 Message-ID: X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Jacob Pan writes: > Hi Aneesh, > > On Mon, 16 Nov 2026 13:49:31 +0530 > "Aneesh Kumar K.V (Arm)" wrote: > >> Physical IOMMU drivers currently provide the vIOMMU size and >> initialization callbacks through iommu_ops. The initialization >> callback then selects and installs the corresponding >> iommufd_viommu_ops. >> >> Add iommu_ops::get_viommu_ops() to select the operations from the >> physical device and requested vIOMMU type before allocation. Move the >> size and initialization callbacks into iommufd_viommu_ops. The core >> can then validate the selected operations, allocate the driver >> structure, initialize it, and install the operations. > The patch title is slightly misleading since it does not change the > order between setting viommu_ops and allocation. IMHO, it is more like: > "Move vIOMMU ops selection into the core" > previously we did ops = iommu_dev->ops; viommu_size = ops->get_viommu_size(idev->dev, cmd->type); viommu = (struct iommufd_viommu *)_iommufd_object_alloc_ucmd( ucmd, viommu_size, IOMMUFD_OBJ_VIOMMU); rc = ops->viommu_init(viommu, hwpt_paging->common.domain, user_data.len ? &user_data : NULL); if (rc) and viommu_ini did things like viommu->ops = &arm_vsmmu_ops; With this patch it becomes ops = iommu_dev->ops->get_viommu_ops(idev->dev, cmd->type); viommu_size = ops->get_viommu_size(idev->dev, cmd->type); viommu = (struct iommufd_viommu *)_iommufd_object_alloc_ucmd( ucmd, viommu_size, IOMMUFD_OBJ_VIOMMU); rc = ops->viommu_init(viommu, idev->dev, That is, we now select the vIOMMU ops before allocation. -aneesh