From patchwork Wed Dec 13 11:58: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: 121732 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5373044qgn; Wed, 13 Dec 2017 04:00:39 -0800 (PST) X-Google-Smtp-Source: ACJfBosCyKftn0SsiaU2cHQa+l82sh6RZGANjDL8vSmchkdEXr5sIVnM1hDEk52XdCrZNTLe8c35 X-Received: by 10.159.216.141 with SMTP id s13mr5866710plp.310.1513166439407; Wed, 13 Dec 2017 04:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513166439; cv=none; d=google.com; s=arc-20160816; b=kS3Bbr9kwMN2zsXWxPvD8QsZiNK5GTzk4OyuQXUXIxmMncRMl6yURUIH2vAYHBIEWK bbx3Wa969sXAfHrd35tS7x2bJP7+finVSG3TdH53a0ox7Ybnw/6ipNsU2Z4C+XhDAp0J POLDYdpAzxZAOL6yQyWmMEsxbaJFM1HU36yODYftqbHoUykQT5IgAAfUDwiPqR3ul/Eb B5O/3Cb5Qsek+ftFAiFmJcAulCvNgfhiqxuRWsKy/gI4/wigyPplk7wS3Y0aO5fZOo/D i9tQhlMV4f0fcYzr9SB5dqgLpVs7lW+3u6dabgt6f4qA9mvfJ85e86vi5IkCJcIjZuWE 67Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=pXfbt3aR226YV3Xm9wXflBGxGjUvxv5ZuXUgzb5uiTY=; b=ohNl3Pxmj5s97C0pohbKXVL4GiY+7qPyaTQgtWz9+6t/fgxx6Rw3ELvy2QYDKHS8GU ITPjcTV1SNDv4Z8C6+CQXyMV/BhNyDDyfqG2ex4ib+SjVis9u26VaXDemL8lb+jeyoyB K8384D/unaKLtJrnmffH2OXMdCgBsorjvofQ+pJ3eEBsAulXRCoslhPOBAekYpOFd6QD YRUBDCmiBv5HIGHuHDXffYEYWDmHUfS/+t8+17vhnrY5nLCSA2a1tuOPmQKPfkh9yKK5 oHDWnFviKX+6k+vAZrT5xrkz5+ZfD5Kc/k1BPPczUGa20HhiNxpuyN++s3hl4eoZR3TT 864A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 t8si1285240pfh.310.2017.12.13.04.00.39; Wed, 13 Dec 2017 04:00:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752102AbdLMMAi (ORCPT + 6 others); Wed, 13 Dec 2017 07:00:38 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:41174 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751853AbdLMMAh (ORCPT ); Wed, 13 Dec 2017 07:00:37 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 4B5AFCB0EC4E0; Wed, 13 Dec 2017 20:00:33 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.361.1; Wed, 13 Dec 2017 20:00:28 +0800 From: Shameer Kolothum To: , , , CC: , , , , , , , , , Shameer Kolothum Subject: [PATCH v11 0/3] iommu/smmu-v3: Workaround for hisilicon 161010801 erratum(reserve HW MSI) Date: Wed, 13 Dec 2017 11:58:27 +0000 Message-ID: <20171213115830.61872-1-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] X-CFilter-Loop: Reflected Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On certain HiSilicon platforms (hip06/hip07) the GIC ITS and PCIe RC deviates from the standard implementation and this breaks PCIe MSI functionality when SMMU is enabled. The HiSilicon erratum 161010801 describes this limitation of certain HiSilicon platforms to support the SMMU mappings for MSI transactions. On these platforms GICv3 ITS translator is presented with the deviceID by extending the MSI payload data to 64 bits to include the deviceID. Hence, the PCIe controller on this platforms has to differentiate the MSI payload against other DMA payload and has to modify the MSI payload. This basically makes it difficult for this platforms to have a SMMU translation for MSI. This patch implements an ACPI based quirk to reserve the hw msi regions in the smmu-v3 driver which means these address regions will not be translated and will be excluded from iova allocations. To implement this quirk, the following changes are incorporated: 1. Added a generic helper function to IORT code to retrieve and reserve the associated ITS base address from a device IORT node. The function has a check for smmu model to determine whether the platform requires the HW MSI reservation or not. 2. Added smmu node entries and explicitly disabled them in hip06/hip07 dts files so that users are warned about the non-DT support for this erratum. Changelog: v10 --> v11 -Addressed comments from Lorenzo(patch#1) -Added Robin's Reviewed-by to patch #2 v9 --> v10 Addressed comments: -Moved smmu model check to iort helper function to selectively apply the msi reservation which will make the fn call generic from iommu-dma. -Removed PCI blacklisting patch, instead added smmu nodes(disabled) with comments to hip06/hip07 dts file. v8 --> v9 -Thanks to Marc, fixed IORT helper function to reserve the ITS translater region only. -Removed the DT support for MSI reservation and blacklisted HiSilicon PCIe controllers on DT based systems when SMMUv3 is enabled. v7 --> v8 Addressed comments from Rob and Lorenzo: -Modified to use DT compatible string for errata. -Changed logic to retrieve the msi-parent for DT case. v6 --> v7 Addressed request from Will to add DT support for the erratum: - added bt binding - add of_iommu_msi_get_resv_regions() New arm64 silicon errata entry Rename iort_iommu_{its->msi}_get_resv_regions v5 --> v6 Addressed comments from Robin and Lorenzo: -No change to patch#1 . -Reverted v5 patch#2 as this might break the platforms where this quirk is not applicable. Provided a generic function in iommu code and added back the quirk implementation in SMMU v3 driver(patch#3) v4 --> v5 Addressed comments from Robin and Lorenzo: -Added a comment to make it clear that, for now, only straightforward HW topologies are handled while reserving ITS regions(patch #1). v3 --> v4 Rebased on 4.13-rc1. Addressed comments from Robin, Will and Lorenzo: -As suggested by Robin, moved the ITS msi reservation into iommu_dma_get_resv_regions(). -Added its_count != resv region failure case(patch #1). v2 --> v3 Addressed comments from Lorenzo and Robin: -Removed dev_is_pci() check in smmuV3 driver. -Don't treat device not having an ITS mapping as an error in iort helper function. v1 --> v2 -patch 2/2: Invoke iort helper fn based on fwnode type(acpi). RFCv2 -->PATCH -Incorporated Lorenzo's review comments. RFC v1 --> RFC v2 Based on Robin's review comments, -Removed the generic erratum framework. -Using IORT/MADT tables to retrieve the ITS base addr instead of vendor specific CSRT table. Shameer Kolothum (3): ACPI/IORT: Add msi address regions reservation helper iommu/dma: Add HW MSI(GICv3 ITS) address regions reservation arm64:dts:hisilicon Disable hisilicon smmu node on hip06/hip07 arch/arm64/boot/dts/hisilicon/hip06.dtsi | 55 +++++++++++++++ arch/arm64/boot/dts/hisilicon/hip07.dtsi | 24 +++++++ drivers/acpi/arm64/iort.c | 112 ++++++++++++++++++++++++++++++- drivers/iommu/dma-iommu.c | 8 ++- drivers/irqchip/irq-gic-v3-its.c | 3 +- include/linux/acpi_iort.h | 7 +- 6 files changed, 203 insertions(+), 6 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html