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 953D8606A320 for ; Thu, 19 Nov 2026 08:20:51 +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=XYBrVE2O; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=MhCpE6IV 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-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:Cc:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=PMrsBwYkwF4lRQixoD6GmLUuDmMJwcXbQNklWixiPYY=; b=XYBrVE2Owryvqb uDGEE/CVv/gfR+1W52DbTSUhUIAxEOEGac8hBkidLnOYNnwk4Gak/vIG58c2/Ve2gz7ADASRudnI7 CF5vzEGbknCrqpd9OFX3utOuAAhGuVf5JXlMkJAVf1e078drhNH5GMbgZNa+DOuqdcrggfYspSOzZ IofYuJ5GnQwOxKRG8mKljz3NpZbqEI/TrILdGKD6eEuVkdm4SjqK2rPUb+DcwbbhnbVZ3MqTREAzj mxuAZKVHejVy/F/tHd2qYQrbALwxKV4ujgq0SYt6bkdpOWQrtB5UacBdQN3ulOYkn+g7tXrOidyTX 4UNhLskm0E8dgvS1Bp6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTxNs-0000000BARw-24Bo; Thu, 19 Nov 2026 08:20:44 +0000 Received: from mgamail.intel.com ([192.198.163.11]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTxNm-0000000BARB-2E9A for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2026 08:20:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1795076438; x=1826612438; h=message-id:date:mime-version:cc:subject:to:references: from:in-reply-to:content-transfer-encoding; bh=9KLe5HS8+v0UjG8/agQdaNXieDfCo4rAsBW39hUTfiw=; b=MhCpE6IVUQi453qtqdRyrSXG/26Sft4QobWAG1Zj34Ob+FWfs6Mw3dXT BO4DEotisnX0HyF0S+BxMBMARKTkjvTvel5bUWy4beOPL1kpIkC1OCh1g xie9jcNdxKxV+NU/P1QMaRY1bsDR4K1bj7ABcDI74b7MnQQcEVbX32oxU k4Jy+hHtBhl89P5VnOey/KQxbcZ4n1gEcl5tAwuYkxcJVSWDEvqpscyQ1 FPMEiqQDLnFAk8bSRAMmOciZglc7rym7PXYpecHnmsh/oIOH9SDfxrPdL C6ta+TuoGL0hRxT9BRAvfnzJbl4BqYBAcBFrxbRZVwpPT+L+zlUhIH5YT g==; X-CSE-ConnectionGUID: 9bQF8fjoTPu/qU4a/TFrsg== X-CSE-MsgGUID: xk+hHnSBSZCWPWKQ/ylbQQ== X-IronPort-AV: E=McAfee;i="6800,10657,11970"; a="3835424" X-IronPort-AV: E=Sophos;i="6.27,220,1787036400"; d="scan'208";a="3835424" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2026 00:20:37 -0800 X-CSE-ConnectionGUID: IzMi4v08SVeQv6CuN/UB0w== X-CSE-MsgGUID: OTFciINxRMykl5tNJdMoKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,220,1787036400"; d="scan'208";a="10732774" Received: from unknown (HELO [10.238.1.144]) ([10.238.1.144]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2026 00:20:29 -0800 Message-ID: <46da9589-3243-4cc0-bb59-7ac40116165a@linux.intel.com> Date: Thu, 19 Nov 2026 16:20:27 +0800 X-Archived-By: 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, Jason Gunthorpe Subject: Re: [PATCH v9 05/13] iommufd/viommu: Keep a reference to the KVM file To: "Aneesh Kumar K.V (Arm)" , linux-coco@lists.linux.dev References: <20261116081935.85372-1-aneesh.kumar@kernel.org> <20261116081935.85372-6-aneesh.kumar@kernel.org> Content-Language: en-US From: Baolu Lu In-Reply-To: <20261116081935.85372-6-aneesh.kumar@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261119_002038_613382_87F523AD X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -4.2 (----) 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=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 On 11/16/2026 4:19 PM, Aneesh Kumar K.V (Arm) wrote: > From: Nicolin Chen > > The TSM vDevice operations need access to the KVM associated with the > device's vIOMMU. Save the device's KVM file in the iommufd_viommu when the > vIOMMU is allocated, and take a file reference so it remains valid for the > lifetime of the vIOMMU. > > Release the reference when the vIOMMU is destroyed. > > Reject vdevice allocation when the device's KVM association differs from > the vIOMMU's, including when only one has a KVM association. Allow > allocation when both associations are NULL. > > Based on an original patch by > Shameer Kolothum > > Reviewed-by: Kevin Tian > Reviewed-by: Jacob Pan > [nicolinc: hold kvm's users_count] > Signed-off-by: Nicolin Chen > [aneesh.kumar: Switch to use kvm_file] > Cc: Jason Gunthorpe > Cc: Kevin Tian > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc:iommu@lists.linux.dev > Reviewed-by: Jason Gunthorpe > Signed-off-by: Aneesh Kumar K.V (Arm) > --- > drivers/iommu/iommufd/viommu.c | 10 ++++++++++ > include/linux/iommufd.h | 1 + > 2 files changed, 11 insertions(+) Reviewed-by: Lu Baolu