From patchwork Sat May 13 09:47:25 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: 99741 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp700115qge; Sat, 13 May 2017 02:52:02 -0700 (PDT) X-Received: by 10.84.218.142 with SMTP id r14mr11294451pli.69.1494669122026; Sat, 13 May 2017 02:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494669122; cv=none; d=google.com; s=arc-20160816; b=nIsTMlbSlOObov62c/ZbRIM/ZhGKN+Fbrb3HHvVDWD+/nR2Enu4CHipK5rbxt2/NRz mH38MaMksmVyEXoisETI/mS5qBzlN8JUWcxjjEE3XqYOsJmrlcuy0HQKNVNmjkeG1Z84 GMm8iHr0SVskrD62CyQnLu/YMOfb24GQsLWSbSoCeP1osGD2ORHNGBX12jPpwjy5B3sh u/6liXpec2ikUlR6OBCZU8BFmDt8p4/n0nNkamC00Atfx+Up4rcxQ1h4Xdceid5La2iu qfyFUq1eO+N7ox84O/Kpd0MnQUuQzdjSVd/3d+4GtekoJ6fEUPd5oDaRq1Sruksd01+3 DLQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=5TfyYPs9jHgOQnozKW6oE6K3m2T+hQXZGtXKHA4i8bc=; b=fDS7w3paQe7Q0j3ah8AnY2RcNGUe033Z4jMKrujQIsd4xIBV6oKw6DaHJBNORaTkXp LnNaKYAlvTm/pHlpYpVJInyR8/JenrJZLlezA122g52kU3Tme5WRsIxSpQ8Fwr5Tyujp UZlT65rEK8n73Fwc0jueiC44NB/2JoOmZ/VTYfhZA6jmzRSP+IsbIJBW9525OaKZgw7b RZS9i17Iy/i76naCs1/EzzEvL3psMQqNjEeqvjAA2pb+XTc3FZR/u+BC9QZ1OAsQG7pu bwEAkhMwxz1vgRnjdCuN1zSBrl1YKLv+7ulIjaTdDCfQABPuAHqA5ue3OSBFuFql4Yub /ACg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 h124si5469766pgc.306.2017.05.13.02.52.01; Sat, 13 May 2017 02:52:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750935AbdEMJv7 (ORCPT + 8 others); Sat, 13 May 2017 05:51:59 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5943 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbdEMJv6 (ORCPT ); Sat, 13 May 2017 05:51:58 -0400 Received: from 172.30.72.54 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.54]) by dggrg03-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ANM88404; Sat, 13 May 2017 17:51:24 +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:50:50 +0800 From: shameer To: , , , , CC: , , , , , , , , , , shameer Subject: [RFC v1 1/7] iommu/arm-smmu-v3: Add erratum framework structures Date: Sat, 13 May 2017 10:47:25 +0100 Message-ID: <20170513094731.3676-2-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.0A090204.5916D71C.00C1, 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: dbfd88f445e4ab76c6cdf856346cc25a Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org This is to introduce an erratum framework to smmu driver similar to the one in arm_arch_timer code. Signed-off-by: shameer --- drivers/iommu/arm-smmu-v3.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index bbd46ef..a166590 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -660,6 +660,20 @@ static struct arm_smmu_option_prop arm_smmu_options[] = { { 0, NULL}, }; +enum smmu_erratum_match_type { + se_match_dt, +}; + +struct smmu_erratum_workaround { + enum smmu_erratum_match_type match_type; + const void *id; /* Indicate the Erratum ID */ + const char *desc_str; +}; + +static const struct smmu_erratum_workaround smmu_workarounds[] = { + +}; + static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) { return container_of(dom, struct arm_smmu_domain, domain); From patchwork Sat May 13 09:47:27 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: 99744 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp700146qge; Sat, 13 May 2017 02:52:07 -0700 (PDT) X-Received: by 10.84.231.199 with SMTP id g7mr11644603pln.70.1494669127234; Sat, 13 May 2017 02:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494669127; cv=none; d=google.com; s=arc-20160816; b=OIGHwEu+Bx495S8CXt6/8XmKVmATF830rAw6bHWcymKwyJ/5CB8FAZJHC3VQn6ITcs VuF4VYvccYdifUtgXml1N25laM/QgTXGw0ZDIU92KZluI3b+ZhOYnMkUiEi4kbGr+jfQ C9o5XMsz4rhSNw+itNKTsRyxN0+lEUrL29BBXQvx9jdulSSAVRLaXGj5fXhuy6ZUwKT8 107G5zhtUSpOef4k+b2/MnFZj493RyKSAm9M+jxJEVh8NMD9mks0zyqbvQLbLDvAHvJ+ mOYcxqm6BvnuR5vriVor/ScBiHTdpGncUFQo/Owz+HbW2JDuym+66eX0HGiOYhuNeBPG Z1Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=hLuoVVNU/gH24ysnllDfrgN0UoDAixJW+1hMzGVwjQ0=; b=j9SMjt+hrE3ElIXxJlrl8Q9la+ibNFc7GXQrB5HSltdiuO+O2TES4YNk7hXmpuvomk Y+ATKJyJ6YsVazjFtFYUyQUSVOR9wIILQ1jwXZXjBhtB8tdLhdKHmoO+B4de2FBi77k9 bwrk/2cJS1F01p7NxUGuS4m6G2sBlmnKq/lHTYJG/275HXL3bQEuj2068r6yM2y/ikVQ KBNInAx1m+meEF9nQYYvHKmdZfdEux/VKexQn9WIQ6zEEQro/mN+xN2idsLE5BbnrtXL rni7nJ4I1l9H+/TR9dhsi9UX9eYpGXvrJpoJQ1D5qEk6E41A3tznGEK5coW5qyjT07vy BCiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 c25si5605922pfl.274.2017.05.13.02.52.07; Sat, 13 May 2017 02:52:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752028AbdEMJwF (ORCPT + 8 others); Sat, 13 May 2017 05:52:05 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:5946 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbdEMJwE (ORCPT ); Sat, 13 May 2017 05:52:04 -0400 Received: from 172.30.72.54 (EHLO DGGEML404-HUB.china.huawei.com) ([172.30.72.54]) by dggrg03-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ANM88407; Sat, 13 May 2017 17:51:25 +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:01 +0800 From: shameer To: , , , , CC: , , , , , , , , , , shameer Subject: [RFC v1 3/7] iommu/arm-smmu-v3: Replace the device tree binding for hisilicon broken prefetch cmd with erratum id Date: Sat, 13 May 2017 10:47:27 +0100 Message-ID: <20170513094731.3676-4-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.5916D71D.0029, 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: 9229a08825027d3c4b968186a6e07114 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Signed-off-by: shameer --- Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt index be57550..bf48e92 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt @@ -46,7 +46,7 @@ the PCIe specification. devicetree/bindings/interrupt-controller/msi.txt for a description of the msi-parent property. -- hisilicon,broken-prefetch-cmd +- hisilicon,erratum-161010701 : Avoid sending CMD_PREFETCH_* commands to the SMMU. ** Example From patchwork Sat May 13 09:47:30 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: 99746 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp700526qge; Sat, 13 May 2017 02:53:50 -0700 (PDT) X-Received: by 10.99.154.18 with SMTP id o18mr8616185pge.59.1494669230194; Sat, 13 May 2017 02:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494669230; cv=none; d=google.com; s=arc-20160816; b=TFLwusmddQ00L5g/I59Ne25CYX8UFbbH20mBcE9DiTAnSs3+ls7q1koyjKqLv6V3wb 0Czvfjds8O03XP2STTKmQVgqFG1RsBQtWnIlbkuq7vo3zIJ1KwK/RPU0IT3T4caNQ5YB JXPCKtqwvmRAHG5npCLv0YX70bgfnPFQkJVzlOvt9/BXYDsZNIBAkEWLSU6KiLJMA4O+ fwspvGWu6ZaZ7s/bMW0acav0vNTKpsEsMYY+zmYrg5lQOhQK8iAhqvayQhU4fSC1DrnY W0MPIMAQ54RtO5sb+Y5JrBb9nnapI3rkrZuFW/+vlfz3Xxwkqz/2y9PWZcTltHKlbsqz YS0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=/n4iPQ9j+B9WRCD5so8+Ov+RKRmLxhg4eiDg86Ly4eI=; b=ypwXL4ANsKCYdDdHc+9ZxIySQ6CYpRdUEAwxZxNvutUdsoFTmOrBvZpYQWqNVFVzuo TiwftxLp7UCeSl/nY/WLILOV9ArC1vpHPOxW84OKxlNMF56VHqwEAWVg9u6T1mWF/DhG V4KUEkbnJ/g6n/8xfUT68UgqGpmtevLVOzoS7heqfTyoDgLVPMZFzKiWa9eDDmeOOTrX ZsyGoKS9kDOaMmnz2RNTkHPNCpCKVsTTy4+oFJ1MAMj0Ml8nV12D0rByJec8729AYdTk 6YBBgIaFxPNqCk1F+coz/BosQl77kU6nqZUV/mrSJ+2OwLmHyVIZHSU5YJDNeUG8iYMN 0Vsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 c26si5622017pfl.163.2017.05.13.02.53.49; Sat, 13 May 2017 02:53:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752718AbdEMJxs (ORCPT + 8 others); Sat, 13 May 2017 05:53:48 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6287 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbdEMJxr (ORCPT ); Sat, 13 May 2017 05:53:47 -0400 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 AOL14086; 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:17 +0800 From: shameer To: , , , , CC: , , , , , , , , , , shameer Subject: [RFC v1 6/7] iommu/arm-smmu-v3: Rearrange msi resv alloc functions Date: Sat, 13 May 2017 10:47:30 +0100 Message-ID: <20170513094731.3676-7-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.0A090205.5916D782.00E5, 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: b1ecc8ad0eb9e58693c849ebc2e7782d Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org This moves the SW MSI reserve region allocation to probe fn. Signed-off-by: shameer --- drivers/iommu/arm-smmu-v3.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 770cc9e..e7a8a50 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -619,6 +619,9 @@ struct arm_smmu_device { /* IOMMU core code handle */ struct iommu_device iommu; + + /* MSI Reserve region */ + struct iommu_resv_region *msi_region; }; /* SMMU private data for each master */ @@ -1960,15 +1963,12 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) static void arm_smmu_get_resv_regions(struct device *dev, struct list_head *head) { - struct iommu_resv_region *region; - int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; - - region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, - prot, IOMMU_RESV_SW_MSI); - if (!region) - return; + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); + struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); + struct arm_smmu_device *smmu = smmu_domain->smmu; - list_add_tail(®ion->list, head); + if (smmu && smmu->msi_region) + list_add_tail(&smmu->msi_region->list, head); iommu_dma_get_resv_regions(dev, head); } @@ -1978,8 +1978,13 @@ static void arm_smmu_put_resv_regions(struct device *dev, { struct iommu_resv_region *entry, *next; - list_for_each_entry_safe(entry, next, head, list) + list_for_each_entry_safe(entry, next, head, list) { + if (entry->type == IOMMU_RESV_SW_MSI || + entry->type == IOMMU_RESV_MSI) + continue; + kfree(entry); + } } static struct iommu_ops arm_smmu_ops = { @@ -2711,6 +2716,17 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, return ret; } +static struct iommu_resv_region *arm_smmu_alloc_msi_region( + struct arm_smmu_device *smmu) +{ + struct iommu_resv_region *region; + int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; + + region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, + prot, IOMMU_RESV_SW_MSI); + return region; +} + static int arm_smmu_device_probe(struct platform_device *pdev) { int irq, ret; @@ -2756,6 +2772,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (irq > 0) smmu->gerr_irq = irq; + smmu->msi_region = arm_smmu_alloc_msi_region(smmu); + if (dev->of_node) { ret = arm_smmu_device_dt_probe(pdev, smmu); } else {