From nobody Mon May 6 15:08:18 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 1624639077178234.7513701654932; Fri, 25 Jun 2021 09:37:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.147324.271476 (Exim 4.92) (envelope-from ) id 1lwopq-0005wn-Bu; Fri, 25 Jun 2021 16:37:42 +0000 Received: by outflank-mailman (output) from mailman id 147324.271476; Fri, 25 Jun 2021 16:37:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lwopq-0005wg-8z; Fri, 25 Jun 2021 16:37:42 +0000 Received: by outflank-mailman (input) for mailman id 147324; Fri, 25 Jun 2021 16:37:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lwopp-0005wW-8o for xen-devel@lists.xenproject.org; Fri, 25 Jun 2021 16:37:41 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id ac1ae509-4fba-482a-84ea-ea43ab348c04; Fri, 25 Jun 2021 16:37:39 +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 1EDE31396; Fri, 25 Jun 2021 09:37:39 -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 37B1B3F719; Fri, 25 Jun 2021 09:37:38 -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: ac1ae509-4fba-482a-84ea-ea43ab348c04 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: Fixed stream matching register allocation Date: Fri, 25 Jun 2021 17:37:26 +0100 Message-Id: <612e7f61c19e60019bb7829888342fda95fd36be.1624546532.git.rahul.singh@arm.com> X-Mailer: git-send-email 2.17.1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" SMR allocation should be based on the number of supported stream matching register for each SMMU device. Issue introduced by commit 5e08586afbb90b2e2d56c175c07db77a4afa873c when backported the patches from Linux to XEN to fix the stream match conflict issue when two devices have the same stream-id. Acked-by: Stefano Stabellini Tested-by: Stefano Stabellini Signed-off-by: Rahul Singh --- xen/drivers/passthrough/arm/smmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index d9a3a0cbf6..da2cd457d7 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -149,6 +149,7 @@ typedef enum irqreturn irqreturn_t; #define kzalloc(size, flags) _xzalloc(size, sizeof(void *)) #define devm_kzalloc(dev, size, flags) _xzalloc(size, sizeof(void *)) #define kmalloc_array(size, n, flags) _xmalloc_array(size, sizeof(void *),= n) +#define kzalloc_array(size, n, flags) _xzalloc_array(size, sizeof(void *),= n) =20 static void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res) @@ -2221,7 +2222,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_= device *smmu) smmu->smr_mask_mask =3D smr >> SMR_MASK_SHIFT; =20 /* Zero-initialised to mark as invalid */ - smmu->smrs =3D devm_kzalloc(smmu->dev, sizeof(*smmu->smrs), GFP_KERNEL); + smmu->smrs =3D kzalloc_array(sizeof(*smmu->smrs), size, GFP_KERNEL); if (!smmu->smrs) return -ENOMEM; =20 --=20 2.17.1