Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3092419ybt; Sat, 4 Jul 2020 06:10:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmv7QOn60Ya1MoPhvsrsA9fX0gx9r/tYA7vJU3i0iYf3b/gJrva9i+Pe8hIOJD9ksjsthx X-Received: by 2002:a17:907:94cf:: with SMTP id dn15mr39150474ejc.457.1593868234981; Sat, 04 Jul 2020 06:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593868234; cv=none; d=google.com; s=arc-20160816; b=Zojy8fv6MimG5lIUyExpymv5hIobE4IF4GDYoJGXyrhCrbqnTBR/EX5AvSyEAY9rqi ZRdohSX3MEAgz6rY4pSOn8ePN9+McbWw6M1dVs448yqV9HIIuM2bSdhLBSVRYnMGRZqx 4Numkex5phhahLZMFLbkSiWQCCqJVaWL7Kz5nd8CLqRcXqqvFGWzwroNRYGfNYr2HaGP EUtodA4kTwNz4qgIAUTFZPYzy0Q0i/THRxgwdLfNC4NUPMw8zTh/lafTG6/awW6cBAuT tzYRoyHyjvZemsonyFSCt7oJbvpAnKvnApPZrCRps+auG/O8uMEeZJkFfjLsmB4QhZR6 ZThQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=V6Nzx3aquCsZjcKuxmdqVbDJp7lw5WcdQH8FPoZEpP0=; b=q3xdapOe/lwL+T17jq2NtqERiYh2PCJvii9OC1UeGH6T90DGWMr2p2B1/ihb4Bn4b3 SnN1/7JmgpvdFz5aZjHA/DBLuMKAOuDe0i9pEQewZtUi1A/Hn0ozWQ6Y7IIpRi12x6qu AwnfAZhzgFES/ENPZPdX2sdB35Xpluwnw2eO14/7h/jXUxcQ+RHXB7rKsHGYVHJ/li9x COH86NDgxhJrDcE4bzWrVy+gsdaPmg1sug8viJ55iQ01jQjibmzTTb2UCjGTakOcSRpi HKb1uNDOcFNdRmy6ERydWzEpK6XvIu4zIrSymMgiI2JMb4kZsM/QMp2VgdDlsbHjq3+l YPDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UQGCEihc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si9621319edr.390.2020.07.04.06.10.09; Sat, 04 Jul 2020 06:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UQGCEihc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgGDNJ3 (ORCPT + 99 others); Sat, 4 Jul 2020 09:09:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:38716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgGDNJ2 (ORCPT ); Sat, 4 Jul 2020 09:09:28 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0E48F2075D; Sat, 4 Jul 2020 13:09:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593868168; bh=XKkYUna+C06YzYOPFLvRPSDNzCZHTcnnHceCSplfaDo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UQGCEihcRR8O+4v1S89+qf+2jJkRhmrnWFknwJYLWkBg5Z/dQ75ffTq12DsnOKMiA gg5x/N0JSgmAq656qlHecV6niqLIryBTuDHAFrCPSMiuDMtV75akZowtq8QyvEWLze zxMxUuXexGPuai9UV2WwDb6idRHJqhw3KHGUJgN8= Date: Sat, 4 Jul 2020 14:09:23 +0100 From: Will Deacon To: Konrad Dybcio Cc: skrzynka@konradybcio.pl, Robin Murphy , Joerg Roedel , Rob Herring , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, jcrouse@codeaurora.org, john.stultz@linaro.org Subject: Re: [PATCH 1/1] iommu/arm-smmu: Implement qcom,skip-init Message-ID: <20200704130922.GB21333@willie-the-truck> References: <20200704122809.73794-1-konradybcio@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200704122809.73794-1-konradybcio@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Adding Bjorn, Jordan and John because I really don't want a bunch of different ways to tell the driver that the firmware is screwing things up] On Sat, Jul 04, 2020 at 02:28:09PM +0200, Konrad Dybcio wrote: > This adds the downstream property required to support > SMMUs on SDM630 and other platforms (the need for it > most likely depends on firmware configuration). > > Signed-off-by: Konrad Dybcio > --- > .../devicetree/bindings/iommu/arm,smmu.yaml | 10 ++++++++++ > drivers/iommu/arm-smmu.c | 15 +++++++++------ > 2 files changed, 19 insertions(+), 6 deletions(-) > > diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > index d7ceb4c34423..9abd6d41a32c 100644 > --- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml > @@ -102,6 +102,16 @@ properties: > access to SMMU configuration registers. In this case non-secure aliases of > secure registers have to be used during SMMU configuration. > > + qcom,skip-init: > + description: | > + Disable resetting configuration for all context banks > + during device reset. This is useful for targets where > + some context banks are dedicated to other execution > + environments outside of Linux and those other EEs are > + programming their own stream match tables, SCTLR, etc. > + Without setting this option we will trample on their > + configuration. It would probably be better to know _which_ context banks we shouldn't touch, no? Otherwise what happens to the others? > + > stream-match-mask: > $ref: /schemas/types.yaml#/definitions/uint32 > description: | > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index 243bc4cb2705..a5c623d4caf9 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -1655,13 +1655,16 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) > * Reset stream mapping groups: Initial values mark all SMRn as > * invalid and all S2CRn as bypass unless overridden. > */ > - for (i = 0; i < smmu->num_mapping_groups; ++i) > - arm_smmu_write_sme(smmu, i); > > - /* Make sure all context banks are disabled and clear CB_FSR */ > - for (i = 0; i < smmu->num_context_banks; ++i) { > - arm_smmu_write_context_bank(smmu, i); > - arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT); > + if (!of_find_property(smmu->dev->of_node, "qcom,skip-init", NULL)) { > + for (i = 0; i < smmu->num_mapping_groups; ++i) > + arm_smmu_write_sme(smmu, i); > + > + /* Make sure all context banks are disabled and clear CB_FSR */ > + for (i = 0; i < smmu->num_context_banks; ++i) { > + arm_smmu_write_context_bank(smmu, i); > + arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT); > + } > } Do we not need to worry about the SMRs as well? Will