From patchwork Fri Oct 13 07:09:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 115701 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp415601qgn; Fri, 13 Oct 2017 00:23:52 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCfcFwRPBbJYPlduj4aJALYbB8ilm2CSsZvEkeRnis1/Wxriso3qT4W3uEGySqHvbLo5fk+ X-Received: by 10.98.32.12 with SMTP id g12mr584105pfg.196.1507879432733; Fri, 13 Oct 2017 00:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507879432; cv=none; d=google.com; s=arc-20160816; b=f2BbZ2R2qQlHMzlfPmHUP4BhEM0WpGl9944dZ3jvjnQX9chmfd43koq0Il/b//z7bX taRy/ptHYgrS0V96DFDAHxZN2gHE1SPRKli8PREmDddW9q/C2j6zyLEfw339pULwvu+D wyk7zjxTUrZ8cRmIQfaViObDDfXoVXhVgPXl1abFpVIJAAkPCrttahQVlopSSN4iq0NU JLq7LGDldixumIhMWYOMrvzLHsrmbugSk6GsSS3bXSybvBtRiafeHRYcFwWz91nn1N6s S+4kcaObcsbhDjy+JXvDOm3vSKMHB8/OxBbgQt7pui3e+4tOQaq68uG/kLHaTummZ+V0 fGHg== 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=RlmUHs1/2x+CSGYqzJ2kgK27zaTk0FWR0Q379fFa+m8=; b=cPOyUCOy9/64tN4S1Zsdwq2lmwaXa/hQF7CCfDZQcvjlqat3mKUbiYPm8ihLj0DgxX 6HtYJ9FNDLziVDx+xAMVVMnAZnVWZQJSY+vt7iBK9887OxyYsyPBQdkmRsAk8jxZzbID 6Y3MZgpHr/UPqQ+xwwsOFoWqNdGiGZcUAgDzxH6QE5VDe9Heu+73w6CbwzgprDLJiGJF 0xXkH6ip29i8m5evD36qgLtzCaHHhwK44te+QPECcOFx6fYHEzpvTvAmFZN45DSQfXwh AF2nSQg7sc2L7z6Z/wkKXQnj2+MKyPpBZLkEylbut8MJzEO4UtRaontQ1vrB7FWBQ+ne XzNg== 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 v7si228476pfd.123.2017.10.13.00.23.52; Fri, 13 Oct 2017 00:23:52 -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 S1750973AbdJMHXv (ORCPT + 7 others); Fri, 13 Oct 2017 03:23:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7996 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbdJMHXu (ORCPT ); Fri, 13 Oct 2017 03:23:50 -0400 Received: from 172.30.72.59 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.59]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DIZ07857; Fri, 13 Oct 2017 15:20:09 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.301.0; Fri, 13 Oct 2017 15:17:50 +0800 From: Hanjun Guo To: Lorenzo Pieralisi , Robin Murphy CC: Marc Zyngier , "Rafael J. Wysocki" , , , , Hanjun Guo Subject: [PATCH v2 3/4] ACPI/IORT: Add SMMUv3 specific special index mapping handling Date: Fri, 13 Oct 2017 15:09:49 +0800 Message-ID: <1507878590-51066-4-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1507878590-51066-1-git-send-email-guohanjun@huawei.com> References: <1507878590-51066-1-git-send-email-guohanjun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.59E06929.00B0, 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: 4a9a6b3cb1fde9e7a4c2d5c49ec21f6c Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Hanjun Guo IORT revision C introduced a mapping entry binding to describe ITS device ID mapping for SMMUv3 MSI interrupts. Enable the single mapping flag (ie that is used by SMMUv3 component for its special index mappings) for the SMMUv3 node in the IORT mapping API and add IORT code to handle special index mapping entry for the SMMUv3 IORT nodes to enable their MSI interrupts. In case the ACPICA for SMMUv3 device ID mapping is not ready, use the ACPICA version as a guard for function iort_get_id_mapping_index(). Signed-off-by: Hanjun Guo [lorenzo.pieralisi@arm.com: split the patch, rewrote the log] Signed-off-by: Lorenzo Pieralisi --- drivers/acpi/arm64/iort.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) -- 1.7.12.4 -- 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/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index c3f3ac3..ca5dd21 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -356,7 +356,8 @@ static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, if (map->flags & ACPI_IORT_ID_SINGLE_MAPPING) { if (node->type == ACPI_IORT_NODE_NAMED_COMPONENT || - node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX) { + node->type == ACPI_IORT_NODE_PCI_ROOT_COMPLEX || + node->type == ACPI_IORT_NODE_SMMU_V3) { *id_out = map->output_base; return parent; } @@ -365,10 +366,46 @@ static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node, return NULL; } +#if (ACPI_CA_VERSION > 0x20170929) +static int iort_get_id_mapping_index(struct acpi_iort_node *node) +{ + struct acpi_iort_smmu_v3 *smmu; + + switch (node->type) { + case ACPI_IORT_NODE_SMMU_V3: + /* + * SMMUv3 dev ID mapping index was introdueced in revision 1 + * table, not available in revision 0 + */ + if (node->revision < 1) + return -EINVAL; + + smmu = (struct acpi_iort_smmu_v3 *)node->node_data; + /* + * ID mapping index is only ignored if all interrupts are + * GSIV based + */ + if (smmu->event_gsiv && smmu->pri_gsiv && smmu->gerr_gsiv + && smmu->sync_gsiv) + return -EINVAL; + + if (smmu->id_mapping_index >= node->mapping_count) { + pr_err(FW_BUG "[node %p type %d] ID mapping index overflows valid mappings\n", + node, node->type); + return -EINVAL; + } + + return smmu->id_mapping_index; + default: + return -EINVAL; + } +} +#else static inline int iort_get_id_mapping_index(struct acpi_iort_node *node) { return -EINVAL; } +#endif static struct acpi_iort_node *iort_node_map_id(struct acpi_iort_node *node, u32 id_in, u32 *id_out,