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 818A9606A32C for ; Thu, 3 Dec 2026 08:26:54 +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=K5Me9D+8; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=i2mkEJud 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=HlyGyNJKsYzt77ijDMRz/kwXkq17OV//KU9JKEV8W4U=; b=K5Me9D+8bD+yMGfnT0rKF946bq ZmLSIVP4imCMGnwW3YoHAXjN+CO/8u278dmDq7JL+SxGp/409dvUWFzZbudMm25i8KlUnfoRhWi8g qSb88Kms5Pi73MWDMCmBOboGVX6iFLFMLbIous5zRr61gYaNAezKS2yt9qv1hxMO+8LMWGmBTIy5O fECvSN+oAbqi5ASf7dbOPLTT3jaaMDlc1yhDWPpA87ZWvlVQyyB72wKmzvNUpS6XNmCSPC9IkfPyQ lbXok3G5iAoZ3yZDi52qSfh/o+ImLmzEtca4qV40I9iUaTLE+07fPuGp0A7CWmMw9gvo6T77TrZNH cQB6EHMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ29G-0000000DqHM-3Dht; Thu, 03 Dec 2026 08:26:38 +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 1xZ294-0000000DqE9-1hop for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 08:26:36 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id B57A761FB7; Thu, 3 Dec 2026 08:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8DB91F00893; Thu, 3 Dec 2026 08:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796286385; bh=HlyGyNJKsYzt77ijDMRz/kwXkq17OV//KU9JKEV8W4U=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=i2mkEJudguVFsMbSdHa+cUlDPhWLjoHQtROoMNfIlE4hPUfZJME5XaT9JBqd4R+88 o10kOET4CQqlSGNJxiTx8bTcupLzpX8NM3yoPJB693NOZHfWEc0Z+xwqegWxEGO3NF ruwHPFqu2piE5a/iIjw/1btjDV9xjCPBUk2G3C4K8IfoSnG2tpnEqbBcaN1owybdtv fop6+m7J2jxKxsa/sVwLN5AP5RUCj4vMtR/q1adHOmPMcnfcyblZqAAH9yJk7xboWj d0k8XIl1hj/yGgohtwPb13V8a5O/v+o+R70mLsCKsCoxzPpH/dRrYyv0XOJxOMPtkO GEfWHXoC8BPzg== X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: "Tian, Kevin" , "linux-coco@lists.linux.dev" Cc: Alex Williamson , Alexey Kardashevskiy , Bjorn Helgaas , Catalin Marinas , Jacob Pan , Jason Gunthorpe , 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" Subject: RE: [PATCH v10 10/18] PCI/TSM: Add helpers to prevent disconnect while in use In-Reply-To: References: <20261125081121.379481-1-aneesh.kumar@kernel.org> <20261125081121.379481-11-aneesh.kumar@kernel.org> Date: Thu, 03 Dec 2026 13:56:14 +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 "Tian, Kevin" writes: >> From: Aneesh Kumar K.V (Arm) >> Sent: Wednesday, November 25, 2026 4:11 PM >> >> Add PCI TEE Security Manager (TSM) helpers that prevent PF0 disconnect >> while a function is in use. Validate the function's TSM association and >> increment PF0's dsm_context_users count on get. Find PF0 through the >> same function and decrement the count on put. Reject disconnect with >> -EBUSY until all users have released it. > > 'context' is confusing here. what about 'link_users" as the real purpose > is to reject link disconnect when the count is positive? > > then the related helpers can be renamed: > > pci_tsm_context_get/put() -> pci_tsm_link_get/put() > Sure, I'll update the names. > >> >> The caller must prevent removal of the function between get and put, for >> example by keeping its VFIO device open. No per-call allocation is >> needed. > > closing the VFIO device doesn't remove the pci device. > What I meant is that VFIO prevents the PCI function itself from being removed. -aneesh