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 X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 0F1A0C4363D for ; Wed, 23 Sep 2020 15:25:02 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 8F0472220D for ; Wed, 23 Sep 2020 15:25:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F0472220D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 386CF868D6; Wed, 23 Sep 2020 15:25:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7QodTzynbpHH; Wed, 23 Sep 2020 15:25:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 6C58C86749; Wed, 23 Sep 2020 15:25:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 497DCC0889; Wed, 23 Sep 2020 15:25:00 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 025CDC0051 for ; Wed, 23 Sep 2020 15:24:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id F1FB88734C for ; Wed, 23 Sep 2020 15:24:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SFLjtTy5Fcwv for ; Wed, 23 Sep 2020 15:24:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by hemlock.osuosl.org (Postfix) with ESMTP id 116068734B for ; Wed, 23 Sep 2020 15:24:58 +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 75450113E; Wed, 23 Sep 2020 08:24:57 -0700 (PDT) Received: from [10.57.48.76] (unknown [10.57.48.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 739473F718; Wed, 23 Sep 2020 08:24:55 -0700 (PDT) Subject: Re: [PATCHv5 5/6] iommu: arm-smmu-impl: Use table to list QCOM implementations To: Sai Prakash Ranjan , Will Deacon , Joerg Roedel , Jordan Crouse , Rob Clark References: From: Robin Murphy Message-ID: Date: Wed, 23 Sep 2020 16:24:53 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, Akhil P Oommen , "Kristian H . Kristensen" , freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2020-09-22 07:18, Sai Prakash Ranjan wrote: > Use table and of_match_node() to match qcom implementation > instead of multiple of_device_compatible() calls for each > QCOM SMMU implementation. > > Signed-off-by: Sai Prakash Ranjan > --- > drivers/iommu/arm/arm-smmu/arm-smmu-impl.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c > index d199b4bff15d..ce78295cfa78 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c > @@ -9,6 +9,13 @@ > > #include "arm-smmu.h" > > +static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = { > + { .compatible = "qcom,sc7180-smmu-500" }, > + { .compatible = "qcom,sdm845-smmu-500" }, > + { .compatible = "qcom,sm8150-smmu-500" }, > + { .compatible = "qcom,sm8250-smmu-500" }, > + { } > +}; Can you push the table itself into arm-smmu-qcom? That way you'll be free to add new SoCs willy-nilly without any possibility of conflicting with anything else. Bonus points if you can fold in the Adreno variant and keep everything together ;) Robin. > static int arm_smmu_gr0_ns(int offset) > { > @@ -217,10 +224,7 @@ struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu) > if (of_device_is_compatible(np, "nvidia,tegra194-smmu")) > return nvidia_smmu_impl_init(smmu); > > - if (of_device_is_compatible(np, "qcom,sdm845-smmu-500") || > - of_device_is_compatible(np, "qcom,sc7180-smmu-500") || > - of_device_is_compatible(np, "qcom,sm8150-smmu-500") || > - of_device_is_compatible(np, "qcom,sm8250-smmu-500")) > + if (of_match_node(qcom_smmu_impl_of_match, np)) > return qcom_smmu_impl_init(smmu); > > if (of_device_is_compatible(smmu->dev->of_node, "qcom,adreno-smmu")) > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu