From patchwork Sat Sep 26 13:00:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 11801395 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 782DC16BC for ; Sat, 26 Sep 2020 13:01:59 +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 49250206D4 for ; Sat, 26 Sep 2020 13:01:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ww5UcCma"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PMlg9ZK3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49250206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TYnSb91+GbgRiCJJfspyLxWNDGFl8TV7uacV+8uFZIg=; b=Ww5UcCma2/ixehyx5obxYhJ5F 7s57Pi0pHhr2hbzDZnEMLcYPASqjg91RszPM9K+kx8TlCXo3QilCjbrRxz56iUEQ1iOtWsj/LCs0V mh1kmSGqbn10Tk69AHQ2v08S22RjoCdfH4q3QYjrTkyqXQDlTu79py8lQxqyQuhfkCfn7YegjqF7r eFsCPzIVsd112wmvpmmYxpfZuOkDyNEzmk2OPrniglldkJ4/iHkycEmGIvSa9n6T4SECYnEnGabbt KQq1VTtVFfcwPzVXOkQH6pO+wAIj15pxVXZfgObs1nPzdJSBkKrcVTmLv1NpLGNzPrSFgOFFvIASy qiEMv97Gw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM9oZ-0008TD-Kx; Sat, 26 Sep 2020 13:00:35 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM9oG-0008MY-9N for linux-arm-kernel@lists.infradead.org; Sat, 26 Sep 2020 13:00:18 +0000 Received: by mail-wr1-x444.google.com with SMTP id g4so6867605wrs.5 for ; Sat, 26 Sep 2020 06:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=70iPHflSEGgCFhe7eol4g0//LPxM9Uw4CZ8Bcxeu3u8=; b=PMlg9ZK3JuN7Y6fqEN8tuT9ELtastIFo61T1CCaYeRV+bqqTB6DqjIJKqHwQ2cXt3V s5MyRrRF/S8xe3R0jrqCx60Sjm34FSgQjy/KbYNAeD4FhyGNs+vSszskn6IVw8EsiBD+ YSpPIpStoZK2QiMM9FJ/qLLRyjzM1noqesSS3yLbm379G9sXx2HUC5+OuFNLZTCGqdeZ +tah/3wCH2xYYFfVEVS0jIG3AvQKtI+ECFC7JPa0YAGr6gms231zW2ZwfUv4ZOgtJpDO Cqvn7XhmDD6Zx23kdcY2hOSbVLnUPA1WXS0oNoSMIjUdYN0BZZQaabuRDad9Y9/hMcK0 4jQQ== 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=70iPHflSEGgCFhe7eol4g0//LPxM9Uw4CZ8Bcxeu3u8=; b=U3Edk73u9GQTNd19YeSDyg/HWeloeuNezXmNrW2E1WXZYVxFx/MkvtLSjrTGY7P4nK /YTgZX5YSUfo058uAifjRmd4zknT2aNFkMrqiDwiGbEwjcv90+4ATG/GxhOuXgmrXcPU Lb8GWRrm/zOmyca58jl+lKMuKk3sVSHDPaaWdbo0WoOXDPn6zeCM9IOGMCJ/LSB+HmWi hfDGWGwrFQiQXImIR2VGbgkaEl6C3qyB5LacU0v0WkCsG1iteqzaSam/WAPKLaV7HDTQ WEbJM2KyUWqlx9NXgpp4k92n13d1/uzvARiiD4XA5pajwROa5ub+7VvLlzNjs0xQjRmS wrcw== X-Gm-Message-State: AOAM5306JLC4O8QY5285BBirDSNPVfwvH1gzNmrXZP0MYCEaLcSlDGwe 57P6jbOdETnGj2JlHulL7F4= X-Google-Smtp-Source: ABdhPJzuLf5KNnk1jEMc1alD8vO2sG/Pon0y40jQ0yj4ie8CDb8avchUdJHdJd04Wubyb10gAyaHGQ== X-Received: by 2002:adf:f24f:: with SMTP id b15mr10117061wrp.301.1601125215004; Sat, 26 Sep 2020 06:00:15 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu ([2.237.20.237]) by smtp.gmail.com with ESMTPSA id b11sm6462896wrt.38.2020.09.26.06.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 06:00:14 -0700 (PDT) From: kholk11@gmail.com To: will@kernel.org Subject: [PATCH 6/8] iommu/arm-smmu: Move stream mapping reset to separate function Date: Sat, 26 Sep 2020 15:00:02 +0200 Message-Id: <20200926130004.13528-7-kholk11@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926130004.13528-1-kholk11@gmail.com> References: <20200926130004.13528-1-kholk11@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200926_090017_484520_AF999968 X-CRM114-Status: GOOD ( 14.30 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [kholk11[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [kholk11[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: devicetree@vger.kernel.org, marijns95@gmail.com, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, joro@8bytes.org, konradybcio@gmail.com, bjorn.andersson@linaro.org, martin.botka1@gmail.com, kholk11@gmail.com, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: AngeloGioacchino Del Regno Move the stream mapping reset logic from arm_smmu_device_reset into a separate arm_smmu_stream_mapping_reset function, in preparation for implementing an implementation detail. This commit brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 446a78dde9cd..8c070c493315 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -1652,14 +1652,9 @@ static struct iommu_ops arm_smmu_ops = { .pgsize_bitmap = -1UL, /* Restricted during device attach */ }; -static void arm_smmu_device_reset(struct arm_smmu_device *smmu) +static void arm_smmu_stream_mapping_reset(struct arm_smmu_device *smmu) { int i; - u32 reg; - - /* clear global FSR */ - reg = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); - arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sGFSR, reg); /* * Reset stream mapping groups: Initial values mark all SMRn as @@ -1673,6 +1668,18 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) arm_smmu_write_context_bank(smmu, i); arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT); } +} + +static void arm_smmu_device_reset(struct arm_smmu_device *smmu) +{ + u32 reg; + + /* clear global FSR */ + reg = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sGFSR); + arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sGFSR, reg); + + /* Reset stream mapping */ + arm_smmu_stream_mapping_reset(smmu); /* Invalidate the TLB, just in case */ arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_TLBIALLH, QCOM_DUMMY_VAL);