From patchwork Fri Jun 25 16:37:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Singh X-Patchwork-Id: 12345601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D0EAC2B9F4 for ; Fri, 25 Jun 2021 16:37:48 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 51DB061987 for ; Fri, 25 Jun 2021 16:37:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51DB061987 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org 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 X-Outflank-Mailman: Message body and most headers restored to incoming version 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-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 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/arm/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) 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 = smr >> SMR_MASK_SHIFT; /* Zero-initialised to mark as invalid */ - smmu->smrs = devm_kzalloc(smmu->dev, sizeof(*smmu->smrs), GFP_KERNEL); + smmu->smrs = kzalloc_array(sizeof(*smmu->smrs), size, GFP_KERNEL); if (!smmu->smrs) return -ENOMEM;