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=-13.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 CD6B0C433E2 for ; Fri, 11 Sep 2020 17:14:36 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 332F7214F1 for ; Fri, 11 Sep 2020 17:14:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y6ulkgs3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 332F7214F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ywbLS0ULJPYjqf8py/pGQ+eDcH70eDPckfHhkXdmnNE=; b=Y6ulkgs3MsK5SB/Vehxly6hhB QjmVNKv5I3gJPt8YQxyW+qvMdp3xlCidQeICFGHX2bo8AvRGUWrFeP6TJhiBMxx6Bew2lZZT8gho3 A459GYjerOPN0u4X0l+QSLpj+oINjrMKnI5KeT6Clmx/HhICvlQZDDrkku9mUg7Q+ZBCgnsslguZo cAiA/6bljRT48PxdroTH/lgpEFPVHcrCebgCII6DAoq1+JkAkE19QMkQ2F+nPjg0XCFtIQrHLr+6R VJMbnVH31BFIJtBJUWMEzLNC1Ee5VIltWKcUI6SA3Vq2dvr+Luw1/H0WIVdGwHXQdIAWM7MykWb73 KtZf48kbQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGmbt-0008KD-GJ; Fri, 11 Sep 2020 17:13:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGmbq-0008Jg-Ti for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 17:13:15 +0000 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 80D80106F; Fri, 11 Sep 2020 10:13:10 -0700 (PDT) Received: from [10.57.40.122] (unknown [10.57.40.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C6733F68F; Fri, 11 Sep 2020 10:13:06 -0700 (PDT) Subject: Re: [PATCH v3 6/8] iommu/arm-smmu: Add impl hook for inherit boot mappings To: Bjorn Andersson , Will Deacon , Joerg Roedel , Sai Prakash Ranjan , Jordan Crouse , Rob Clark References: <20200904155513.282067-1-bjorn.andersson@linaro.org> <20200904155513.282067-7-bjorn.andersson@linaro.org> From: Robin Murphy Message-ID: <0bfcc8f7-d054-616b-834b-319461b1ecb9@arm.com> Date: Fri, 11 Sep 2020 18:13:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200904155513.282067-7-bjorn.andersson@linaro.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200911_131315_070220_C93D9FC4 X-CRM114-Status: GOOD ( 25.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-09-04 16:55, Bjorn Andersson wrote: > Add a new operation to allow platform implementations to inherit any > stream mappings from the boot loader. Is there a reason we need an explicit step for this? The aim of the cfg_probe hook is that the SMMU software state should all be set up by then, and you can mess about with it however you like before arm_smmu_reset() actually commits anything to hardware. I would have thought you could permanently steal a context bank, configure it as your bypass hole, read out the previous SME configuration and tweak smmu->smrs and smmu->s2crs appropriately all together "invisibly" at that point. If that can't work, I'm very curious as to what I've overlooked. Robin. > Signed-off-by: Bjorn Andersson > --- > > Changes since v2: > - New patch/interface > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 11 ++++++----- > drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 ++++++ > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index eb5c6ca5c138..4c4d302cd747 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -85,11 +85,6 @@ static inline void arm_smmu_rpm_put(struct arm_smmu_device *smmu) > pm_runtime_put_autosuspend(smmu->dev); > } > > -static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) > -{ > - return container_of(dom, struct arm_smmu_domain, domain); > -} > - > static struct platform_driver arm_smmu_driver; > static struct iommu_ops arm_smmu_ops; > > @@ -2188,6 +2183,12 @@ static int arm_smmu_device_probe(struct platform_device *pdev) > if (err) > return err; > > + if (smmu->impl->inherit_mappings) { > + err = smmu->impl->inherit_mappings(smmu); > + if (err) > + return err; > + } > + > if (smmu->version == ARM_SMMU_V2) { > if (smmu->num_context_banks > smmu->num_context_irqs) { > dev_err(dev, > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h > index 235d9a3a6ab6..f58164976e74 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h > @@ -378,6 +378,11 @@ struct arm_smmu_domain { > struct iommu_domain domain; > }; > > +static inline struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) > +{ > + return container_of(dom, struct arm_smmu_domain, domain); > +} > + > struct arm_smmu_master_cfg { > struct arm_smmu_device *smmu; > s16 smendx[]; > @@ -442,6 +447,7 @@ struct arm_smmu_impl { > int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain, > struct arm_smmu_device *smmu, > struct device *dev, int start); > + int (*inherit_mappings)(struct arm_smmu_device *smmu); > }; > > #define INVALID_SMENDX -1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel