From nobody Mon Apr 29 00:14:42 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 ARC-Seal: i=1; a=rsa-sha256; t=1618572351; cv=none; d=zohomail.com; s=zohoarc; b=Rol+/5nULf6lO1MoeXFp8UDdXRB5JKHJzqoRwkrBdMJ4ZFt9umaZ31kRxGNAjuFyjVBbm1fF7X02dl3pU1SgfegVV2kmIGNbNquScDxOWR+irt7cj6rZmxXtsQhjZcYm74wuRVph8XjwBdPo5eiDnZ2hsrHYMbc+pVEP5eM1lzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618572351; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Q/EP1E79SMIZq/nf/mHfPCR84bwfkDPBYCbVtDNmdBE=; b=X3dX8VlINB/vR+1jcRSSZdjdTIBjV/Zcyv72CZp9RoTyXYWpyb0UPhjODboYEuHK3PRsPWcdOIqQDHQPcNZxgUD0anexzDf/n4IMMxbE+7OZGK7HC126CUSdCAbqkhLK2hs2NlDLqOZl/YM1mE6MKN46czQ9ux2A5t1vKKGGjf0= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1618572351666432.188626056716; Fri, 16 Apr 2021 04:25:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.111660.213538 (Exim 4.92) (envelope-from ) id 1lXMb6-000511-73; Fri, 16 Apr 2021 11:25:16 +0000 Received: by outflank-mailman (output) from mailman id 111660.213538; Fri, 16 Apr 2021 11:25:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lXMb6-00050u-46; Fri, 16 Apr 2021 11:25:16 +0000 Received: by outflank-mailman (input) for mailman id 111660; Fri, 16 Apr 2021 11:25:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lXMb4-00050o-Un for xen-devel@lists.xenproject.org; Fri, 16 Apr 2021 11:25:14 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 77247f3f-4bec-4f82-8c00-71fb2616c192; Fri, 16 Apr 2021 11:25:13 +0000 (UTC) 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 EDF50106F; Fri, 16 Apr 2021 04:25:12 -0700 (PDT) Received: from e109506.cambridge.arm.com (e109506.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1083D3F85F; Fri, 16 Apr 2021 04:25:11 -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: 77247f3f-4bec-4f82-8c00-71fb2616c192 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: Revert associating the group pointer with the S2CR Date: Fri, 16 Apr 2021 12:25:02 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Revert the code that associates the group pointer with the S2CR as this code causing an issue when the SMMU device has more than one master device. This code is merged with the commit "xen/arm: smmuv1: Intelligent SMR allocation=E2=80=9D. Signed-off-by: Rahul Singh Reviewed-by: Bertrand Marquis --- xen/drivers/passthrough/arm/smmu.c | 44 +++--------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index 24ac4f3a80..1a68c2ab3b 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -597,7 +597,6 @@ enum arm_smmu_arch_version { }; =20 struct arm_smmu_s2cr { - struct iommu_group *group; int count; enum arm_smmu_s2cr_type type; enum arm_smmu_s2cr_privcfg privcfg; @@ -1498,7 +1497,6 @@ static int arm_smmu_master_alloc_smes(struct device *= dev) struct arm_smmu_master_cfg *cfg =3D find_smmu_master_cfg(dev); struct arm_smmu_device *smmu =3D cfg->smmu; struct arm_smmu_smr *smrs =3D smmu->smrs; - struct iommu_group *group; int i, idx, ret; =20 spin_lock(&smmu->stream_map_lock); @@ -1523,19 +1521,9 @@ static int arm_smmu_master_alloc_smes(struct device = *dev) cfg->smendx[i] =3D (s16)idx; } =20 - group =3D iommu_group_get(dev); - if (!group) - group =3D ERR_PTR(-ENOMEM); - if (IS_ERR(group)) { - ret =3D PTR_ERR(group); - goto out_err; - } - iommu_group_put(group); - /* It worked! Now, poke the actual hardware */ for_each_cfg_sme(cfg, i, idx) { arm_smmu_write_sme(smmu, idx); - smmu->s2crs[idx].group =3D group; } =20 spin_unlock(&smmu->stream_map_lock); @@ -1966,27 +1954,6 @@ static void __arm_smmu_release_pci_iommudata(void *d= ata) kfree(data); } =20 -static struct iommu_group *arm_smmu_device_group(struct - arm_smmu_master_cfg *cfg) -{ - struct arm_smmu_device *smmu =3D cfg->smmu; - struct iommu_group *group =3D NULL; - int i, idx; - - for_each_cfg_sme(cfg, i, idx) { - if (group && smmu->s2crs[idx].group && - group !=3D smmu->s2crs[idx].group) - return ERR_PTR(-EINVAL); - - group =3D smmu->s2crs[idx].group; - } - - if (group) - return group; - - return NULL; -} - static int arm_smmu_add_device(struct device *dev) { struct arm_smmu_device *smmu; @@ -2027,13 +1994,10 @@ static int arm_smmu_add_device(struct device *dev) cfg->smmu =3D smmu; } =20 - group =3D arm_smmu_device_group(cfg); - if (!group) { - group =3D iommu_group_alloc(); - if (IS_ERR(group)) { - dev_err(dev, "Failed to allocate IOMMU group\n"); - return PTR_ERR(group); - } + group =3D iommu_group_alloc(); + if (IS_ERR(group)) { + dev_err(dev, "Failed to allocate IOMMU group\n"); + return PTR_ERR(group); } =20 iommu_group_set_iommudata(group, cfg, releasefn); --=20 2.17.1