From patchwork Tue Aug 1 10:49:11 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: 109137 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1341679qge; Tue, 1 Aug 2017 03:54:55 -0700 (PDT) X-Received: by 10.84.231.203 with SMTP id g11mr6095036pln.199.1501584895172; Tue, 01 Aug 2017 03:54:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501584895; cv=none; d=google.com; s=arc-20160816; b=D/yugr72p1OthZcRWbXWELhWa/OmxmNWzccCynyQoWU1gds3t1+I06mEQyjEj0ldR8 fjno63KtsHN6PWXlWDSlogQJu7+YFZjFJ9EUAhT4dGhytKGxU/LbP+SjC0+O9uM+9ked t5jnlPEDUlkat17zHzvCXdyCKKWA5hsrY/nebnw+fc0jksYuzbqI7A6sLwS9jYUJwQ87 iFH3jrlly1m7iN14C14QE37XLzJ/RV3ggH+whtuEDhyI7Y7PWLPr3KJCZw047cpa7ngr zZRkJVl9A2VdQcwFllkbpmE2gFv7k0Rrlr8SgqoEdPNhuGCQzPt3T80jumFzPX5u33pX K8AA== 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=SiWRA54nyoi420t5XoXq+OXM6wHz/FC88D6V8wGxj+w=; b=skhQolOxEzEjQiDiaA1BkPGNKUOqRP9HdL3naclF2Rz68s4pY+I4Ad4wiXfWOatQyR SG2LoH+2qMynSQ3Rv726fuptzMJZ3i3+8w6KokGhQGeGAeXX48c7MYPebOsG0RgnLG1G XsUlrP3NIOCZ2kl6cRayHX3WjIHNLnbur0x89AVUJk5AEXcWRa30u8S2d8XOsUTcVrsJ GrQuVofbrbSDpc6rfdWe2DlqznQERi/nWjPjv1/kF4cP8b0hCvCz+LXaKgTY4w/scUPD l5wwRz32OJ/KOuDgZaMsHG73gpOJOGy3EqyINNkQXw+zmpFu6xJVA3pd12dGGezKxvsv /alw== 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 i63si4290626pgc.373.2017.08.01.03.54.55; Tue, 01 Aug 2017 03:54:55 -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 S1751778AbdHAKwz (ORCPT + 7 others); Tue, 1 Aug 2017 06:52:55 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:10742 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368AbdHAKvo (ORCPT ); Tue, 1 Aug 2017 06:51:44 -0400 Received: from 172.30.72.54 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.54]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ATO11003; Tue, 01 Aug 2017 18:51:39 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.203.177.212) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Tue, 1 Aug 2017 18:51:29 +0800 From: Shameer Kolothum To: , , , , , CC: , , , , , , , , , Shameer Kolothum Subject: [PATCH v5 0/2] iommu/smmu-v3: Workaround for hisilicon 161010801 erratum(reserve HW MSI) Date: Tue, 1 Aug 2017 11:49:11 +0100 Message-ID: <20170801104913.71912-1-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.203.177.212] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.59805D3B.03A0, 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: 1a60a73ed48d40284ab7622f951b4a79 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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. To implement this quirk, the following changes are incorporated: 1. Added a generic helper function to IORT code to retrieve and reserve the HW ITS address regions. 2. Modified iommu_dma_get_resv_regions() to reserve the hw msi regions which means these address regions will not be translated and will be excluded from iova allocations. Note: This requires patches [1] and [2] for vfio pass-through support on these platforms. Thanks, Shameer [1]: https://lkml.org/lkml/2017/7/27/388 [2]: https://lkml.org/lkml/2017/7/27/386 Changelog: 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 (2): ACPI/IORT: Add ITS address regions reservation helper iommu/dma: Add HW MSI address regions reservation drivers/acpi/arm64/iort.c | 95 ++++++++++++++++++++++++++++++++++++++-- drivers/iommu/dma-iommu.c | 8 +++- drivers/irqchip/irq-gic-v3-its.c | 3 +- include/linux/acpi_iort.h | 7 ++- 4 files changed, 107 insertions(+), 6 deletions(-) -- 1.9.1 -- 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