From patchwork Mon May 24 11:02:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 446437 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp3238200jac; Mon, 24 May 2021 04:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwakOs+aNJHeaOR3PLqctRWQVVRN4qf4PFWFvimzQSbzHFbl0xsQPQ/d/X91NWh9oeviqcZ X-Received: by 2002:a6b:f60e:: with SMTP id n14mr15656930ioh.179.1621854242441; Mon, 24 May 2021 04:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621854242; cv=none; d=google.com; s=arc-20160816; b=n6NXGSltZLXoJhofSZ/GtrCcaNJuNJ8xEKwcF9QagvQjbREE77x76ONVP0VQlW2HIh nKKlIvgSOioWlI+7KKWgWRAv+hRa4I04++wv/L99S7DADoLHZtZlGbYoq4wFonCyDD3a yVz1/XbH4DNoRiarbgvk7BahoLFnb/UiqdPKMf+adR06D3/3lKS8gHUiJZIJTMdEPUzo 98iIQOQ/gwHpFjyXw5cS1mNtYglA6oXf2YQX1P+R58K3SjEk+z7vzOMefJAx7XDTh/nx +wGn1zRGQ6xLrjiVf46aVGXFbEE5Oap0zrupWvlbD/he4CzcyR39EMoDydRPNpbJpA8m xvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dLcifpRbpGOOo5l2uyzsGI7847e1bclNUfLumTjbuCo=; b=IXxvrxcSNCZ+urds7MUChh6ZYk9K0zv1D0jqRSJpdyxFVuD8Z+DBVzYxnAtNcv+o6N 5TSU9UYsdJ8OTf9chWx5db3UKvA/70p846TSOpulUd/nZGpgy/RNQGlWeZDrTQAjfZwc bmZ6k+w986iAkxh02ShWBIXWw7eFnOy+AZ4PSc1rMfE/2TFR0gko2N9X6rALzwB+GRaL KDvT7fg8TzcqSzuD4Ig7+z0hu7Y2avjCdMG7npTInyiXFGc5IrWs9ph0a198K+1kutKW QimZMR3hK+weZhxpXffh0YVLoIaxrKhHxbLAnyG7y7DUhAKamUdpo99Jtgtdxb3Sr9T5 mm/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f14si12766626ilj.120.2021.05.24.04.04.02; Mon, 24 May 2021 04:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-acpi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232516AbhEXLF3 (ORCPT + 4 others); Mon, 24 May 2021 07:05:29 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5533 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232636AbhEXLF2 (ORCPT ); Mon, 24 May 2021 07:05:28 -0400 Received: from dggems702-chm.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FpZ5K1rWszkYvj; Mon, 24 May 2021 19:01:09 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggems702-chm.china.huawei.com (10.3.19.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 24 May 2021 19:03:58 +0800 Received: from A2006125610.china.huawei.com (10.47.80.77) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 24 May 2021 12:03:49 +0100 From: Shameer Kolothum To: , , CC: , , , , , , , , , , Subject: [PATCH v5 5/8] =?utf-8?q?iommu/arm-smmu-v3=3A_Add_bypass_flag_to?= =?utf-8?b?wqBhcm1fc21tdV93cml0ZV9zdHJ0YWJfZW50KCk=?= Date: Mon, 24 May 2021 12:02:19 +0100 Message-ID: <20210524110222.2212-6-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20210524110222.2212-1-shameerali.kolothum.thodi@huawei.com> References: <20210524110222.2212-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.80.77] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org By default, disable_bypass is set and any dev without an iommu domain installs STE with CFG_ABORT during arm_smmu_init_bypass_stes(). Introduce a "bypass" flag to arm_smmu_write_strtab_ent() so that we can force it to install CFG_BYPASS STE for specific SIDs. This will be useful in follow up patch to install bypass for IORT RMR SIDs. Signed-off-by: Shameer Kolothum --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 754bad6092c1..f9195b740f48 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -1174,7 +1174,7 @@ static void arm_smmu_sync_ste_for_sid(struct arm_smmu_device *smmu, u32 sid) } static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, - __le64 *dst) + __le64 *dst, bool bypass) { /* * This is hideously complicated, but we only really care about @@ -1245,7 +1245,7 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, /* Bypass/fault */ if (!smmu_domain || !(s1_cfg || s2_cfg)) { - if (!smmu_domain && disable_bypass) + if (!smmu_domain && disable_bypass && !bypass) val |= FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_ABORT); else val |= FIELD_PREP(STRTAB_STE_0_CFG, STRTAB_STE_0_CFG_BYPASS); @@ -1320,7 +1320,7 @@ static void arm_smmu_init_bypass_stes(__le64 *strtab, unsigned int nent) unsigned int i; for (i = 0; i < nent; ++i) { - arm_smmu_write_strtab_ent(NULL, -1, strtab); + arm_smmu_write_strtab_ent(NULL, -1, strtab, false); strtab += STRTAB_STE_DWORDS; } } @@ -2097,7 +2097,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master) if (j < i) continue; - arm_smmu_write_strtab_ent(master, sid, step); + arm_smmu_write_strtab_ent(master, sid, step, false); } }