From patchwork Sat May 13 09:47:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 9725103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9D7A60146 for ; Sat, 13 May 2017 09:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBC82288CF for ; Sat, 13 May 2017 09:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0362288D7; Sat, 13 May 2017 09:53:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34970288D4 for ; Sat, 13 May 2017 09:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.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=y0nAGk1YoitenGBQiMCSWDx+fLSMm3iVWg9daP/dVIU=; b=Sa2oD5dUFf4LMm jgUpebTGpBL76K5kg8DY+/z80Gkg7O8BMdJBsbLvwTI2Xe3sqQBc0NvZSjXWkAxKN+8kc/lxcUk9B nezLIh9wWKt+KF59vtc69cwFhN/iKt+sweGmdcmmqqr2RVak2+oatdevlXB7lVXFChrNuvR9a+tT7 9MLorG+A+58wz/3+ftnXioLOX0ulTQmYhHrwG3YUDRDY7TPBBWI8R6RJ3auelZBruvBTvw+CU8h5y wyGStyjQte3e01/RnQdEBZiaetrPUN006//n+J3g8m37cmLfa52YTqd76gH9f1zZ8Xr5r1CIhNTS9 7mM3Os2iNXrZTFozTV7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d9Tk0-0001dz-Cn; Sat, 13 May 2017 09:53:36 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d9Tjw-0001Wn-5P for linux-arm-kernel@lists.infradead.org; Sat, 13 May 2017 09:53:34 +0000 Received: from 172.30.72.55 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.55]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AOL14083; Sat, 13 May 2017 17:53:04 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.47.91.84) by DGGEML404-HUB.china.huawei.com (10.3.17.39) with Microsoft SMTP Server id 14.3.301.0; Sat, 13 May 2017 17:51:06 +0800 From: shameer To: , , , , Subject: [RFC v1 4/7] iommu/arm-smmu-v3: Enable HiSilicon erratum 161010701 Date: Sat, 13 May 2017 10:47:28 +0100 Message-ID: <20170513094731.3676-5-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20170513094731.3676-1-shameerali.kolothum.thodi@huawei.com> References: <20170513094731.3676-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.91.84] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5916D783.003A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9a45a414b2a43475240e69b4981d090d X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170513_025332_564957_DEF9E09C X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, gabriele.paoloni@huawei.com, john.garry@huawei.com, linuxarm@huawei.com, shameer , linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, wangzhou1@hisilicon.com, guohanjun@huawei.com, linux-arm-kernel@lists.infradead.org, devel@acpica.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This replaces the existing broken_prefetch_cmd quirk using the new erratum framework. Signed-off-by: shameer --- arch/arm64/Kconfig | 10 +++++++++- drivers/iommu/arm-smmu-v3.c | 36 ++++++++++-------------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a39029b..21d61ff 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -508,8 +508,16 @@ config QCOM_FALKOR_ERRATUM_1009 If unsure, say Y. -endmenu +config HISILICON_ERRATUM_161010701 + bool "HiSilicon erratum 161010701: Skip SMMU Prefetch Cmd" + default y + help + On HiSilicon Hip06/Hip07 platforms, the SMMU v3 doesn't support the + CMD_PREFETCH_CFG. This will skip the prefetch cmd usage. + If unsure, say Y. + +endmenu choice prompt "Page size" diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index f20d5d5..14538cb 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -650,16 +650,6 @@ struct arm_smmu_domain { struct iommu_domain domain; }; -struct arm_smmu_option_prop { - u32 opt; - const char *prop; -}; - -static struct arm_smmu_option_prop arm_smmu_options[] = { - { ARM_SMMU_OPT_SKIP_PREFETCH, "hisilicon,broken-prefetch-cmd" }, - { 0, NULL}, -}; - enum smmu_erratum_match_type { se_match_dt, }; @@ -677,7 +667,17 @@ struct smmu_erratum_workaround { }; static const struct smmu_erratum_workaround smmu_workarounds[] = { +#ifdef CONFIG_HISILICON_ERRATUM_161010701 + { + .match_type = se_match_dt, + .id = "hisilicon,erratum-161010701", + .desc_str = "HiSilicon erratum 161010701", + .enable = erratum_skip_prefetch_cmd, + }, +#endif + { + }, }; typedef bool (*se_match_fn_t)(const struct smmu_erratum_workaround *, @@ -735,20 +735,6 @@ static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) return container_of(dom, struct arm_smmu_domain, domain); } -static void parse_driver_options(struct arm_smmu_device *smmu) -{ - int i = 0; - - do { - if (of_property_read_bool(smmu->dev->of_node, - arm_smmu_options[i].prop)) { - smmu->options |= arm_smmu_options[i].opt; - dev_notice(smmu->dev, "option %s\n", - arm_smmu_options[i].prop); - } - } while (arm_smmu_options[++i].opt); -} - /* Low-level queue manipulation functions */ static bool queue_full(struct arm_smmu_queue *q) { @@ -2695,8 +2681,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, else ret = 0; - parse_driver_options(smmu); - smmu_check_workarounds(smmu, se_match_dt, dev->of_node); if (of_dma_is_coherent(dev->of_node))