From patchwork Sat May 13 09:47:29 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: 9725117 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 3566C601E7 for ; Sat, 13 May 2017 10:09:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EDE228828 for ; Sat, 13 May 2017 10:09:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11506288D0; Sat, 13 May 2017 10:09:21 +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=unavailable 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 C3EF228851 for ; Sat, 13 May 2017 10:09:20 +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=PJ7ESMrcy3jcZV0bVeQ7rJTi2LqrvOBjV1YQogO2V8U=; b=dfIu4P9qOVe5bU kwSiMtrup2CDuTTTzwHnubLJWjmjeS+Xl7rp9BqWBZgXtCoRTvmy9C4vzQ6psFZ78bNl3eNyS0Okv U7rN9D2blb7cHfmKkFXJ40Qq8NNtTTuyVXAdFIXSgdumRejDLFXQXlvoszzLLed8jEbXXJAoUusJl 8wKMllFWbimH8p+VLSiu6t/Jax0eKpWGEa6Bv9mkrxcHt6RUM78DY34CP7h5OthGBJH4BTEawgwHj RSBAlA6NE6cCb7YbcF0/eti4heeYT29Wzyf1e+tVDy0rZqr4Y6feJslO+Yq9jVnrhnh7zzYU3N8iZ jpaL4s3/x8WVyBNMVWEQ==; 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 1d9TzC-00079l-Rq; Sat, 13 May 2017 10:09:18 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d9TkA-0001qF-PL for linux-arm-kernel@bombadil.infradead.org; Sat, 13 May 2017 09:53:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mz/w5rzY/5dqYEOeSzS7nP86svYo+jWp4VtWCmvh8dw=; b=m2ubt+KXcXe1oAe238rAsHXa3 iAvcB5vlV5WBl6npf3EuKY2UoJG4Wr3PkPesZ5BCTtfHd9MBnsr2uJ1Kc1aNmwRlxbJ8AQl6S+6/5 kDgnaiimXBw6eCY7NUexK03i8QjxhFVaex5mMbdFPu0Vc58qnpsYidq+RYdw94CVb1X1QqfzuHYTn ADv7lmuKZgdGs+7ol405B8TGY/4vCl063GgzoOG+RZdVGpzV8LtcQQ3KdiFFQz5/Ld93SWvgJDCvb 7ghI/fk7bMIs0Qmhq/kYR7rv4SbEVm7DUZp3RQB7aTmraf/kiVfVtD9iFlqBeU8wxSqf1eLsmgwtz sFS+VUhmQ==; Received: from szxga01-in.huawei.com ([45.249.212.187]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d9Tk8-0007rj-7q for linux-arm-kernel@lists.infradead.org; Sat, 13 May 2017 09:53:45 +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 AOL14085; 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:11 +0800 From: shameer To: , , , , Subject: [RFC v1 5/7] iommu/arm-smmu-v3: Enable ACPI based HiSilicon erratum 161010701 Date: Sat, 13 May 2017 10:47:29 +0100 Message-ID: <20170513094731.3676-6-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.0A090202.5916D782.00E7, 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: 2249c3c04c0b13ae77a256d479371668 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170513_055345_418568_10C1AF38 X-CRM114-Status: UNSURE ( 8.98 ) X-CRM114-Notice: Please train this message. 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 uses the ACPI IORT model number to enable the erratum. Signed-off-by: shameer --- drivers/iommu/arm-smmu-v3.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 14538cb..770cc9e 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -652,6 +652,7 @@ struct arm_smmu_domain { enum smmu_erratum_match_type { se_match_dt, + se_match_acpi_iort_model, }; void erratum_skip_prefetch_cmd(struct arm_smmu_device *smmu, void *arg) @@ -674,6 +675,13 @@ static const struct smmu_erratum_workaround smmu_workarounds[] = { .desc_str = "HiSilicon erratum 161010701", .enable = erratum_skip_prefetch_cmd, }, + { + .match_type = se_match_acpi_iort_model, + .id = (void *)ACPI_IORT_SMMU_HISILICON_HI161X, + .desc_str = "HiSilicon erratum 161010701", + .enable = erratum_skip_prefetch_cmd, + }, + #endif { @@ -691,6 +699,15 @@ bool smmu_check_dt_erratum(const struct smmu_erratum_workaround *wa, return of_property_read_bool(np, wa->id); } +static +bool smmu_check_acpi_iort_erratum(const struct smmu_erratum_workaround *wa, + const void *arg) +{ + const struct acpi_iort_smmu_v3 *iort_smmu = arg; + + return (iort_smmu->model == *(u32 *)(&wa->id)) ? true : false; +} + static void smmu_enable_errata(struct arm_smmu_device *smmu, enum smmu_erratum_match_type type, se_match_fn_t match_fn, @@ -724,6 +741,9 @@ static void smmu_check_workarounds(struct arm_smmu_device *smmu, case se_match_dt: match_fn = smmu_check_dt_erratum; break; + case se_match_acpi_iort_model: + match_fn = smmu_check_acpi_iort_erratum; + break; } smmu_enable_errata(smmu, type, match_fn, arg); @@ -2654,6 +2674,8 @@ static int arm_smmu_device_acpi_probe(struct platform_device *pdev, /* Retrieve SMMUv3 specific data */ iort_smmu = (struct acpi_iort_smmu_v3 *)node->node_data; + smmu_check_workarounds(smmu, se_match_acpi_iort_model, iort_smmu); + if (iort_smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE) smmu->features |= ARM_SMMU_FEAT_COHERENCY;