From nobody Sat May 18 23:14:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1651076186832939.2970430057991; Wed, 27 Apr 2022 09:16:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.315273.533739 (Exim 4.92) (envelope-from ) id 1njkKj-0007EV-QS; Wed, 27 Apr 2022 16:16:05 +0000 Received: by outflank-mailman (output) from mailman id 315273.533739; Wed, 27 Apr 2022 16:16:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1njkKj-0007EO-NH; Wed, 27 Apr 2022 16:16:05 +0000 Received: by outflank-mailman (input) for mailman id 315273; Wed, 27 Apr 2022 16:16:04 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1njkKi-0007EC-9I for xen-devel@lists.xenproject.org; Wed, 27 Apr 2022 16:16:04 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 556acb42-c645-11ec-a405-831a346695d4; Wed, 27 Apr 2022 18:16:03 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 827F8ED1; Wed, 27 Apr 2022 09:16:02 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9DBD83F5A1; Wed, 27 Apr 2022 09:16:01 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 556acb42-c645-11ec-a405-831a346695d4 From: Rahul Singh To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, rahul.singh@arm.com, Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH] xen/arm: smmuv1: remove iommu group when deassign a device Date: Wed, 27 Apr 2022 17:15:51 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1651076187353100001 When a device is deassigned from the domain it is required to remove the iommu group. If we don't remove the group, the next time when we assign a device, SME and=C2=A0S2CR will not be setup correctly for the device because of that SMMU=C2=A0fault will be observed. Signed-off-by: Rahul Singh --- xen/drivers/passthrough/arm/smmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index 5cacb2dd99..9a31c332d0 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -1690,6 +1690,8 @@ static void arm_smmu_detach_dev(struct iommu_domain *= domain, struct device *dev) if (cfg) arm_smmu_master_free_smes(cfg); =20 + iommu_group_put(dev_iommu_group(dev)); + dev_iommu_group(dev) =3D NULL; } =20 #if 0 /* --=20 2.25.1