From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.8bytes.org (mail.8bytes.org [85.214.250.239]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBAF61C29; Fri, 3 Feb 2023 09:56:24 +0000 (UTC) Received: from 8bytes.org (p200300c27714bc0086ad4f9d2505dd0d.dip0.t-ipconnect.de [IPv6:2003:c2:7714:bc00:86ad:4f9d:2505:dd0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.8bytes.org (Postfix) with ESMTPSA id BB7B9223E73; Fri, 3 Feb 2023 10:56:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=8bytes.org; s=default; t=1675418183; bh=3XqqievITw2t2QG1VwV+Emtnj2p5q/klm0HM7CYydoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rQ55Ae8f6qZltkzapqlC1R0Lsz+kmr+C4OjHZQeHmTNOPC0ANU2Ue1neqVWMl99eY +nbBi7pqTcUEeR8p4kRpdwUa+TKdzLtsisMb1ASTyKTU8XdMFceaPpmN6h8HnTHN0N 2zciLEBxdMu/Otln2qCwjHJYnkV4L2nbFxGtzaNUHo6axcZr/XcSbarmgMYo0JkUeR FT3X5dZlrf07UMoxhBd/dote/Coksgxge11kLbgbFh1z69xQm/agecUV85ZA6io1Jt Eh/65jFF83cZ9nTC2WWJ4Qsdkb0vT5Svd9SM5KZ3QuN+rSYPsj+tqm4QVgI+HRp+Sa JqS/VmTTB+zfQ== Date: Fri, 3 Feb 2023 10:56:22 +0100 From: Joerg Roedel To: Sven Peter Cc: Hector Martin , Will Deacon , Alyssa Rosenzweig , Robin Murphy , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/dart: Fix apple_dart_device_group for PCI groups Message-ID: References: <20230128113532.94651-1-sven@svenpeter.dev> Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230128113532.94651-1-sven@svenpeter.dev> On Sat, Jan 28, 2023 at 12:35:32PM +0100, Sven Peter wrote: > pci_device_group() can return an already existing IOMMU group if the PCI > device's pagetables have to be shared with another one due to bus > toplogy, isolation features and/or DMA alias quirks. > apple_dart_device_group() however assumes that the group has just been > created and overwrites its iommudata which will eventually lead to > apple_dart_release_group leaving stale entries in sid2group. > Fix that by merging the iommudata if the returned group already exists. > > Fixes: f0b636804c7c ("iommu/dart: Clear sid2group entry when a group is freed") > Signed-off-by: Sven Peter > --- > drivers/iommu/apple-dart.c | 51 ++++++++++++++++++++++++++++++++------ > 1 file changed, 44 insertions(+), 7 deletions(-) Applied, thanks. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AEB7C61DA4 for ; Fri, 3 Feb 2023 09:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PsXVSItZRZwD0VyfmzKT1wik8OV61hIua8dFmbpGs1w=; b=X87oiasHK/dHdt BHYvyfEudZQJcyHVn8rVCT/KdsrGv9HCNl54bnndPaJ9c7MjPR4FGaw1HP+LVRX14osYlZopIp1dc 6qSfsTx49G/8tRXlwvA1wHjUAQxZGHHT1PX/lLSVJxiODKiA5xqCeFWxIS8MvL6/F3n37JTYqPAGe BlU3V3e/wOZV6nX8AbEmXCkT1LUwhe5qOlat7QohFS0eFk20XQYv1Eb2nNNx7i3who4ON2+aDe3yA njXjYStBtx+MFXyRtHGnqnu7ixCoq2rqB4TTzDpu8u1t1rA6QnO+fjWYuga2ZK13cX/J2zZzswoyX STG+aabekxBFp58acFyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNso5-001GZC-9o; Fri, 03 Feb 2023 09:56:33 +0000 Received: from mail.8bytes.org ([85.214.250.239]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNso2-001GWA-7C for linux-arm-kernel@lists.infradead.org; Fri, 03 Feb 2023 09:56:31 +0000 Received: from 8bytes.org (p200300c27714bc0086ad4f9d2505dd0d.dip0.t-ipconnect.de [IPv6:2003:c2:7714:bc00:86ad:4f9d:2505:dd0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.8bytes.org (Postfix) with ESMTPSA id BB7B9223E73; Fri, 3 Feb 2023 10:56:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=8bytes.org; s=default; t=1675418183; bh=3XqqievITw2t2QG1VwV+Emtnj2p5q/klm0HM7CYydoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rQ55Ae8f6qZltkzapqlC1R0Lsz+kmr+C4OjHZQeHmTNOPC0ANU2Ue1neqVWMl99eY +nbBi7pqTcUEeR8p4kRpdwUa+TKdzLtsisMb1ASTyKTU8XdMFceaPpmN6h8HnTHN0N 2zciLEBxdMu/Otln2qCwjHJYnkV4L2nbFxGtzaNUHo6axcZr/XcSbarmgMYo0JkUeR FT3X5dZlrf07UMoxhBd/dote/Coksgxge11kLbgbFh1z69xQm/agecUV85ZA6io1Jt Eh/65jFF83cZ9nTC2WWJ4Qsdkb0vT5Svd9SM5KZ3QuN+rSYPsj+tqm4QVgI+HRp+Sa JqS/VmTTB+zfQ== Date: Fri, 3 Feb 2023 10:56:22 +0100 From: Joerg Roedel To: Sven Peter Cc: Hector Martin , Will Deacon , Alyssa Rosenzweig , Robin Murphy , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/dart: Fix apple_dart_device_group for PCI groups Message-ID: References: <20230128113532.94651-1-sven@svenpeter.dev> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230128113532.94651-1-sven@svenpeter.dev> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230203_015630_447690_646B3F5E X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Jan 28, 2023 at 12:35:32PM +0100, Sven Peter wrote: > pci_device_group() can return an already existing IOMMU group if the PCI > device's pagetables have to be shared with another one due to bus > toplogy, isolation features and/or DMA alias quirks. > apple_dart_device_group() however assumes that the group has just been > created and overwrites its iommudata which will eventually lead to > apple_dart_release_group leaving stale entries in sid2group. > Fix that by merging the iommudata if the returned group already exists. > > Fixes: f0b636804c7c ("iommu/dart: Clear sid2group entry when a group is freed") > Signed-off-by: Sven Peter > --- > drivers/iommu/apple-dart.c | 51 ++++++++++++++++++++++++++++++++------ > 1 file changed, 44 insertions(+), 7 deletions(-) Applied, thanks. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel