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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 29B19C3815B for ; Mon, 20 Apr 2020 16:57:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D17120782 for ; Mon, 20 Apr 2020 16:57:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgDTQ5Z (ORCPT ); Mon, 20 Apr 2020 12:57:25 -0400 Received: from foss.arm.com ([217.140.110.172]:52234 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbgDTQ5Z (ORCPT ); Mon, 20 Apr 2020 12:57:25 -0400 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 D0A1C31B; Mon, 20 Apr 2020 09:57:24 -0700 (PDT) Received: from [10.57.33.63] (unknown [10.57.33.63]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 79EF63F73D; Mon, 20 Apr 2020 09:57:22 -0700 (PDT) Subject: Re: [PATCHv3 2/6] iommu/arm-smmu: Allow client devices to select direct mapping To: Sai Prakash Ranjan , Will Deacon , Joerg Roedel , Sibi Sankar , Bjorn Andersson , Jordan Crouse , Rob Clark Cc: Stephen Boyd , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Matthias Kaehlcke , Evan Green References: From: Robin Murphy Message-ID: Date: Mon, 20 Apr 2020 17:57:19 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 2020-04-20 5:42 pm, Sai Prakash Ranjan wrote: > From: Jordan Crouse > > Some client devices want to directly map the IOMMU themselves instead > of using the DMA domain. Allow those devices to opt in to direct > mapping by way of a list of compatible strings. Neat and tidy :) Reviewed-by: Robin Murphy Strictly, I think patch #3/6 should really have come before this one (with the header change moved accordingly), but don't bother resending just for that. Thanks, Robin. > Signed-off-by: Jordan Crouse > Co-developed-by: Sai Prakash Ranjan > Signed-off-by: Sai Prakash Ranjan > --- > drivers/iommu/arm-smmu-qcom.c | 19 +++++++++++++++++++ > drivers/iommu/arm-smmu.h | 1 + > 2 files changed, 20 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-qcom.c b/drivers/iommu/arm-smmu-qcom.c > index 64a4ab270ab7..5bedf21587a5 100644 > --- a/drivers/iommu/arm-smmu-qcom.c > +++ b/drivers/iommu/arm-smmu-qcom.c > @@ -3,6 +3,7 @@ > * Copyright (c) 2019, The Linux Foundation. All rights reserved. > */ > > +#include > #include > > #include "arm-smmu.h" > @@ -11,6 +12,23 @@ struct qcom_smmu { > struct arm_smmu_device smmu; > }; > > +static const struct of_device_id qcom_smmu_client_of_match[] = { > + { .compatible = "qcom,adreno" }, > + { .compatible = "qcom,mdp4" }, > + { .compatible = "qcom,mdss" }, > + { .compatible = "qcom,sc7180-mdss" }, > + { .compatible = "qcom,sdm845-mdss" }, > + { } > +}; > + > +static int qcom_smmu_def_domain_type(struct device *dev) > +{ > + const struct of_device_id *match = > + of_match_device(qcom_smmu_client_of_match, dev); > + > + return match ? IOMMU_DOMAIN_IDENTITY : 0; > +} > + > static int qcom_sdm845_smmu500_reset(struct arm_smmu_device *smmu) > { > int ret; > @@ -41,6 +59,7 @@ static int qcom_smmu500_reset(struct arm_smmu_device *smmu) > } > > static const struct arm_smmu_impl qcom_smmu_impl = { > + .def_domain_type = qcom_smmu_def_domain_type, > .reset = qcom_smmu500_reset, > }; > > diff --git a/drivers/iommu/arm-smmu.h b/drivers/iommu/arm-smmu.h > index 8d1cd54d82a6..d172c024be61 100644 > --- a/drivers/iommu/arm-smmu.h > +++ b/drivers/iommu/arm-smmu.h > @@ -386,6 +386,7 @@ struct arm_smmu_impl { > int (*init_context)(struct arm_smmu_domain *smmu_domain); > void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync, > int status); > + int (*def_domain_type)(struct device *dev); > }; > > static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n) >