From patchwork Fri Jul 17 00:16:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 235658 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1243212ilg; Thu, 16 Jul 2020 17:16:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsWSULRgrXHHRUtbnXJDtd6MtlLN+hNCOlg7s/4+/4wDjUg1VT9FmHsDiaXVUcJCcpcwFc X-Received: by 2002:aa7:db4b:: with SMTP id n11mr6953165edt.137.1594944986983; Thu, 16 Jul 2020 17:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594944986; cv=none; d=google.com; s=arc-20160816; b=eyoXVYA7Mj0mTfeGOs0Kzw/9bKoeBnf2K6jfqCopMQ2+bdyCOFL6YDIDRXq08XVNsv /U5oESmUVpW5vwmV1FTUmeSfAKr1xfW3DD1W4Ax0XAUhXnVHRvAE5SyXxQRYe/tBOgJ2 0YnQlrBRXbjscf0TJIMdW/SLD6e2Ip7iMLlmNrTcX8zSslX+V2DuUlKrH6RY7Jjv8Dd4 oGgkaCoQKaSzJOcaWzjHyJSUcbZERDjVJkBSpBnXdhkOTpjc6e/7reMfZCAPG1Q4LCUR hVQgMTowJRELf0523BCjME8gpUpeAodwzOlWjKfhoQlY9qSEyHOG1DQHIXqaDi4YhqpE xJuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gz5Zo50XaaYCZ/NxMlikYXYKHZLd81NtOvGkTA8cH8o=; b=kvT/zFdmbId/Wu7zh7tIkW7wpqZXyF3lvfLnFCO2TxC1bil/i1PWLQtL+UcFGccdO7 wNIX2ZYkZYjDFR8vFa68zJml7spOlHNJjXyxwo9iybona7NEn3TxVZhoNssnJUdX/2YG NUNctX09W5eyY8dsRvIU99KgrBF7ptHuE+W2PROO+tkRAmns5UK6gHu1dxdoyOjRSp1m 7YUSTlXL7moD/WtH7MpSxhN7gdsBk1Djnfc9KSihOYD8Edq5k4VS3PCrlKYTLgZfX+lp WL8bz24gWVHAPFATttIzVpEWOulMAllzBbbp9LzM0CJ/rhCEdB5gICkO9hOE0IV+mrZ/ 3ptg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hR7K/50Y"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si3744219ejf.411.2020.07.16.17.16.26; Thu, 16 Jul 2020 17:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b="hR7K/50Y"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbgGQAQZ (ORCPT + 15 others); Thu, 16 Jul 2020 20:16:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbgGQAQX (ORCPT ); Thu, 16 Jul 2020 20:16:23 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF01DC061755 for ; Thu, 16 Jul 2020 17:16:23 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id k27so5783076pgm.2 for ; Thu, 16 Jul 2020 17:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gz5Zo50XaaYCZ/NxMlikYXYKHZLd81NtOvGkTA8cH8o=; b=hR7K/50YBRAiYbzC5YEsIbA8rrB/9x+7sISP+RCiE+PEZ4V1DcU4bLgQSvldNsZ0c8 DlWjm7LoKVY9Rz8e9IgppsSankyzITQqSY5b/cGexfVASMUQP3opQJ1PjW8bqK6geipV zSVYGSqXW0FVUmM3/qy2HG22nBoC6cvLoqstJ0bhcsawn5tbuBgigq9soHAc1TbbbrXI ygJEnHbepx4gjwD2rGloW4NabRJXyVxcmxqAPB5n1cfQloJRJi4jmiqmPJbLGPeOQVO1 zKZqZBmmmRchgEeyycJ7FTZbWWgOm7MNjc4uGjYm6V4G7tYor5UqiYvFokYU6C0EjdDM C8TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gz5Zo50XaaYCZ/NxMlikYXYKHZLd81NtOvGkTA8cH8o=; b=C0/UixmwbGwAXjWrBytmpAcFTDo6K3aOfxo+qNQ54S4CXPZowvS4/zRuaXC6MNIehz aMBgwJGHfuAjlprnTWqaBEWJxEh2lTFNzVmMwQzij3gdIR7T8dUnCHwQID0U8kJVBoFP EjDXZjFFwFWS4E2NhhRN8Ws6iCRESqcjjKQL5pDB389ciMfSP+Q62ayHkFoqn/Xhfc5M UbIIAtsKmrvvtZqedVe95W1k2jT5VdZVm8U6D1PdRwdHAXbZ7PkXXWNBh5D8ZCIYuvVL IBT58/5HtgPztWc6Sbf+wZmGtq2rYUtPiX38F2l0kiYSzYrBG/x6yPC/oApqzulwayNj QbZQ== X-Gm-Message-State: AOAM533QjrWRE9mvTOHWS7g5sIlbU5l9T4zn0XwLqnmvBIjH4UZ+L18D cHTgdCHNeOOKtyvW21GPt98p2A== X-Received: by 2002:a63:e00c:: with SMTP id e12mr6451848pgh.413.1594944983134; Thu, 16 Jul 2020 17:16:23 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id r7sm6211950pgu.51.2020.07.16.17.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 17:16:22 -0700 (PDT) From: Bjorn Andersson To: Will Deacon , Robin Murphy , Joerg Roedel , Thierry Reding , Laurentiu Tudor Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jonathan Marek , linux-arm-msm@vger.kernel.org, John Stultz , Vinod Koul Subject: [PATCH v2 1/5] iommu/arm-smmu: Make all valid stream mappings BYPASS Date: Thu, 16 Jul 2020 17:16:15 -0700 Message-Id: <20200717001619.325317-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200717001619.325317-1-bjorn.andersson@linaro.org> References: <20200717001619.325317-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Turn all stream mappings marked as valid into BYPASS. This allows the platform specific implementation to configure stream mappings to match the boot loader's configuration for e.g. display to continue to function through the reset of the SMMU. Tested-by: John Stultz Tested-by: Vinod Koul Suggested-by: Robin Murphy Signed-off-by: Bjorn Andersson --- Changes since v1: - Mark arm_smmu_setup_identity() static - Picked up tested-by tags drivers/iommu/arm-smmu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.26.2 diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 243bc4cb2705..fb85e716ae9a 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1924,6 +1924,22 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) return 0; } +static int arm_smmu_setup_identity(struct arm_smmu_device *smmu) +{ + int i; + + for (i = 0; i < smmu->num_mapping_groups; i++) { + if (smmu->smrs[i].valid) { + smmu->s2crs[i].type = S2CR_TYPE_BYPASS; + smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT; + smmu->s2crs[i].cbndx = 0xff; + smmu->s2crs[i].count++; + } + } + + return 0; +} + struct arm_smmu_match_data { enum arm_smmu_arch_version version; enum arm_smmu_implementation model; @@ -2181,6 +2197,10 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (err) return err; + err = arm_smmu_setup_identity(smmu); + if (err) + return err; + if (smmu->version == ARM_SMMU_V2) { if (smmu->num_context_banks > smmu->num_context_irqs) { dev_err(dev,