From patchwork Tue Feb 19 07:54:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 158694 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3377743jaa; Mon, 18 Feb 2019 23:57:28 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibm6aah36UchD1J4XpYdWgyCvXG0AMjAaM8uRESR2Dk0SvFmrqF7qbCKp0Q5KRSunJYLYJt X-Received: by 2002:a62:4754:: with SMTP id u81mr11716371pfa.66.1550563048708; Mon, 18 Feb 2019 23:57:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550563048; cv=none; d=google.com; s=arc-20160816; b=OKOWibDqGbszcuN71OwWhs72UcWCekI78jkXuUMn+Pf9R9orm2ILFMk8exkBFZnt+s vjzyjkcGdHcxY5BEIEMn7xDDzD2KvObcJ2FcT2om/hWHa8okrBlp0QLSmGNEfrpn4e62 HI0Wj0Bk0aeDU0d8jyJktdUvzB+5uIJ6Y2HxBvpkd34Uemd7ccYVcGWCOTGx81PZxz/C AeQ7EgjIHs2P/9jjq8qRp6Umwa1Gj9qMuqu2BwKBFkpdLZvSPwLiCPS+4VKIJl9rAdyw 92hTdmEdC3uLH2YXu4nrIGnGAnP7WgjqFYRSe0SOJCO7AW8MihtpkuE2mP2BoidOiLdD 0q8w== 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; bh=XnMsyeW+OzPD+PGeYjVhm2LrHnKsqi+vpIguDJN7AFA=; b=jY6204juw6V+kiFzSrZXeDLXfgzjSG+EE7HFojQ8GEHIo1KJEaki5mL+J4DwMOXVRj DtK3KuIpwPmuAk83vsk9si61ZR9dDJBsqn5kyWFwKSjGtpcoxVqHDZ4gMAutuAjfeY2i YUCrYbp7Vs7NMqBD7FoD+5zQyBKZlKjondiwo5JpOiNaL24Wq+Ggt41UeuhEb6kw1/3G xvJ8TPaZsd9WywPhJ2bWl6OI63X9Il7hVdab3tAyGIoLnFKvhhCNfLjYVU20l5SA8CG+ YkbFKdQ4W+XbGdapOwmLQ5z+1U87wcgzczoWycguLvlMfYn45lF6n8bZkR+Rxwixrhhz krJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si14470355pfi.176.2019.02.18.23.57.28; Mon, 18 Feb 2019 23:57:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727513AbfBSH5I (ORCPT + 32 others); Tue, 19 Feb 2019 02:57:08 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:3779 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727438AbfBSH5H (ORCPT ); Tue, 19 Feb 2019 02:57:07 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B5739DA62C566277D21B; Tue, 19 Feb 2019 15:57:05 +0800 (CST) Received: from HGHY1l002753561.china.huawei.com (10.177.23.164) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.408.0; Tue, 19 Feb 2019 15:56:57 +0800 From: Zhen Lei To: Jean-Philippe Brucker , Robin Murphy , Will Deacon , Joerg Roedel , linux-arm-kernel , iommu , linux-kernel CC: Zhen Lei Subject: [PATCH 4/5] iommu/arm-smmu-v3: move arm_smmu_get_step_for_sid() a little ahead Date: Tue, 19 Feb 2019 15:54:42 +0800 Message-ID: <20190219075443.17732-5-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20190219075443.17732-1-thunder.leizhen@huawei.com> References: <20190219075443.17732-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change, just prepare for the next patch. Signed-off-by: Zhen Lei --- drivers/iommu/arm-smmu-v3.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) -- 1.8.3 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 5bb5dcd..84adecc 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1273,6 +1273,28 @@ static int arm_smmu_init_dummy_l2_strtab(struct arm_smmu_device *smmu, u32 sid) return __arm_smmu_init_l2_strtab(smmu, sid, &dummy_desc); } +static __le64 *arm_smmu_get_step_for_sid(struct arm_smmu_device *smmu, u32 sid) +{ + __le64 *step; + struct arm_smmu_strtab_cfg *cfg = &smmu->strtab_cfg; + + if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) { + struct arm_smmu_strtab_l1_desc *l1_desc; + int idx; + + /* Two-level walk */ + idx = (sid >> STRTAB_SPLIT) * STRTAB_L1_DESC_DWORDS; + l1_desc = &cfg->l1_desc[idx]; + idx = (sid & ((1 << STRTAB_SPLIT) - 1)) * STRTAB_STE_DWORDS; + step = &l1_desc->l2ptr[idx]; + } else { + /* Simple linear lookup */ + step = &cfg->strtab[sid * STRTAB_STE_DWORDS]; + } + + return step; +} + /* IRQ and event handlers */ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev) { @@ -1704,28 +1726,6 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain) return 0; } -static __le64 *arm_smmu_get_step_for_sid(struct arm_smmu_device *smmu, u32 sid) -{ - __le64 *step; - struct arm_smmu_strtab_cfg *cfg = &smmu->strtab_cfg; - - if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) { - struct arm_smmu_strtab_l1_desc *l1_desc; - int idx; - - /* Two-level walk */ - idx = (sid >> STRTAB_SPLIT) * STRTAB_L1_DESC_DWORDS; - l1_desc = &cfg->l1_desc[idx]; - idx = (sid & ((1 << STRTAB_SPLIT) - 1)) * STRTAB_STE_DWORDS; - step = &l1_desc->l2ptr[idx]; - } else { - /* Simple linear lookup */ - step = &cfg->strtab[sid * STRTAB_STE_DWORDS]; - } - - return step; -} - static void arm_smmu_install_ste_for_dev(struct iommu_fwspec *fwspec) { int i, j;