From patchwork Mon Sep 30 14:33:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAB1017E1 for ; Mon, 30 Sep 2019 14:37:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A50721855 for ; Mon, 30 Sep 2019 14:37:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OoMKqGMC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A50721855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=xQmw07YaxfwgLRoCInK7AE+jSJgM/7AYlc678cj8wLM=; b=OoMKqGMCPR0EzA LAOH4Drvea/eqnmC/JMGALV0hkPYUcMyJ2T5ql7UiAMZjoCxrp+18qxYm5VziLGyGiF1FpbMihvMC 72bbLzXcv1nRMUgyFF36e2bl3Rbv+kWXD3PJO6f9KvqlP08DMQtKSIeVDM90JBuTpZck+OX97II30 tG8cIbmYC8OhnvZn0jww78AZkea/iB5gOmCKrbkkffpYHbJJSC2jLa559Q9558/lZI7oYXgqfiK8i CdbgCqxjd5Fnr/hJZ6DKeO4JFpPmDGgM8la52iHwYMVmWtWjEvo34p512k+nkPmy3xXuInsaNGrxd o5RKo7Ce38RCIu01en1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwoC-00086m-En; Mon, 30 Sep 2019 14:37:52 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnT-0007OE-LT for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:09 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2A2F4719A77CE6655499; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:48 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 1/6] ACPI/IORT: Set PMCG device parent Date: Mon, 30 Sep 2019 22:33:46 +0800 Message-ID: <1569854031-237636-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073707_891250_0A83DEAD X-CRM114-Status: GOOD ( 13.52 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.190 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In the IORT, a PMCG node includes a node reference to its associated device. Set the PMCG platform device parent device for future referencing. For now, we only consider setting for when the associated component is an SMMUv3. Signed-off-by: John Garry --- drivers/acpi/arm64/iort.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 8569b79e8b58..0b687520c3e7 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1455,7 +1455,7 @@ static __init const struct iort_dev_config *iort_get_dev_cfg( * Returns: 0 on success, <0 failure */ static int __init iort_add_platform_device(struct acpi_iort_node *node, - const struct iort_dev_config *ops) + const struct iort_dev_config *ops, struct device *parent) { struct fwnode_handle *fwnode; struct platform_device *pdev; @@ -1466,6 +1466,8 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, if (!pdev) return -ENOMEM; + pdev->dev.parent = parent; + if (ops->dev_set_proximity) { ret = ops->dev_set_proximity(&pdev->dev, node); if (ret) @@ -1573,6 +1575,11 @@ static void __init iort_enable_acs(struct acpi_iort_node *iort_node) static inline void iort_enable_acs(struct acpi_iort_node *iort_node) { } #endif +static int iort_fwnode_match(struct device *dev, const void *fwnode) +{ + return dev->fwnode == fwnode; +} + static void __init iort_init_platform_devices(void) { struct acpi_iort_node *iort_node, *iort_end; @@ -1594,11 +1601,34 @@ static void __init iort_init_platform_devices(void) iort_table->length); for (i = 0; i < iort->node_count; i++) { + struct device *parent = NULL; + if (iort_node >= iort_end) { pr_err("iort node pointer overflows, bad table\n"); return; } + /* Fixme: handle parent declared in IORT after PMCG */ + if (iort_node->type == ACPI_IORT_NODE_PMCG) { + struct acpi_iort_node *iort_assoc_node; + struct acpi_iort_pmcg *pmcg; + u32 node_reference; + + pmcg = (struct acpi_iort_pmcg *)iort_node->node_data; + + node_reference = pmcg->node_reference; + iort_assoc_node = ACPI_ADD_PTR(struct acpi_iort_node, iort, + node_reference); + + if (iort_assoc_node->type == ACPI_IORT_NODE_SMMU_V3) { + struct fwnode_handle *assoc_fwnode; + + assoc_fwnode = iort_get_fwnode(iort_assoc_node); + + parent = bus_find_device(&platform_bus_type, NULL, + assoc_fwnode, iort_fwnode_match); + } + } iort_enable_acs(iort_node); ops = iort_get_dev_cfg(iort_node); @@ -1609,7 +1639,7 @@ static void __init iort_init_platform_devices(void) iort_set_fwnode(iort_node, fwnode); - ret = iort_add_platform_device(iort_node, ops); + ret = iort_add_platform_device(iort_node, ops, parent); if (ret) { iort_delete_fwnode(iort_node); acpi_free_fwnode_static(fwnode); From patchwork Mon Sep 30 14:33:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C00B13B1 for ; Mon, 30 Sep 2019 14:37:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4941B2190F for ; Mon, 30 Sep 2019 14:37:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u5/FWxRj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4941B2190F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=Zk60kS/PJ8Eu5qIFcjJ5TE7ncqbH3jZK/mO9jFa5920=; b=u5/FWxRjXOSf9J HIOPe6qT7oMXfyfMcWo4h8vppud/5KMbG9qXQtNRQTxKUtyRyAmBcGbJqREsPr2aoV+lZyns6zym1 p6tV3AcSJbalvNIBVobYAu8eW7rwpFouT0xXXG0nHeq9HafHJAyP/S49Aij3/pBOU1Fw37XL9fe5v lVbUyizkL9KXkhZEl8mCyK2I5XJ3IJ6cTqRd7Q7YEO7sS+Id83LIii9kP7AUVnPlpLMCuMdhspBW0 HnGmR6xftlfVHvk1BypEf/ndgC2+B43sE4Pgz02aPqEJZU+CQd0mNWI3ATrqpOQNx6PoWrwuYGcrl 4ZulOSU9A9C3z6gWYJzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnf-0007co-FR; Mon, 30 Sep 2019 14:37:19 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnR-0007OJ-85 for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:06 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 40F62D0A7B7A024C01A2; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:48 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 2/6] iommu/arm-smmu-v3: Record IIDR in arm_smmu_device structure Date: Mon, 30 Sep 2019 22:33:47 +0800 Message-ID: <1569854031-237636-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073705_454614_45A82CFF X-CRM114-Status: GOOD ( 10.43 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.190 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To allow other devices know the SMMU HW IIDR, record the IIDR contents as the first member of the arm_smmu_device structure. In storing as the first member, it saves exposing SMMU APIs, which are nicely self-contained today. Signed-off-by: John Garry --- drivers/iommu/arm-smmu-v3.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 40f4757096c3..1ed3ef0f1ec3 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -70,6 +70,8 @@ #define IDR1_SSIDSIZE GENMASK(10, 6) #define IDR1_SIDSIZE GENMASK(5, 0) +#define ARM_SMMU_IIDR 0x18 + #define ARM_SMMU_IDR5 0x14 #define IDR5_STALL_MAX GENMASK(31, 16) #define IDR5_GRAN64K (1 << 6) @@ -546,6 +548,7 @@ struct arm_smmu_strtab_cfg { /* An SMMUv3 instance */ struct arm_smmu_device { + u32 iidr; /* must be first member */ struct device *dev; void __iomem *base; @@ -3153,6 +3156,8 @@ static int arm_smmu_device_probe(struct platform_device *pdev) iommu_device_set_ops(&smmu->iommu, &arm_smmu_ops); iommu_device_set_fwnode(&smmu->iommu, dev->fwnode); + smmu->iidr = readl(smmu->base + ARM_SMMU_IIDR); + ret = iommu_device_register(&smmu->iommu); if (ret) { dev_err(dev, "Failed to register iommu\n"); From patchwork Mon Sep 30 14:33:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBFA513B1 for ; Mon, 30 Sep 2019 14:37:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9089221906 for ; Mon, 30 Sep 2019 14:37:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HlSENRPr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9089221906 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=bn/X59uQqFqIf4McKZtU+vJIkhdBmmhf0JbTkXaqNV8=; b=HlSENRPreBT3Bu J7yRjB7/Sksuk2gUQwdCFEUJStGa6S5wpJNWJJ0CbHQdWpeDbNFcVt7v3ktsSZe7KqWsAKJ8VpyOm XfHRjloBIlD5JGOSNT5lPkZgt6jnLQHKe/8VJLOfUP60m8iEdsOfSD9kvVn+bXpy8G8MZK8td1Baa 46tJJtsMr7NTE/ME8grSlSTW3AgI+pb4JIonJSe45FifhXRrpwXJ/5mcOPR50ESHFifqYr0n6a05d 7kwMQe6Wii6qgiFaD7WDPFglgOG4jbcfqwnT1WWcL18JENQ5XwQNfPJ7pGE7FqtbVpwgXA7poRuUZ NXgRgJ2+reMlswTbM9oQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnz-0007uN-8s; Mon, 30 Sep 2019 14:37:39 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnT-0007OC-Ar for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:08 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 63F89242D57370195736; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:49 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 3/6] perf/smmuv3: Retrieve parent SMMUv3 IIDR Date: Mon, 30 Sep 2019 22:33:48 +0800 Message-ID: <1569854031-237636-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073707_540602_5887B73C X-CRM114-Status: GOOD ( 12.56 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To support IMP DEF events per PMCG, retrieve the parent SMMUv3 IIDR. This will be used as a lookup for the IMP DEF events supported, under the assumption that a PMCG implementation has the same uniqueness as the parent SMMUv3. In this, we assume that any PMCG associated with the same SMMUv3 will have the same IMP DEF events - otherwise, some other secondary matching would need to be done. Signed-off-by: John Garry --- drivers/perf/arm_smmuv3_pmu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index da71c741cb46..f702898c695d 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -115,6 +115,7 @@ struct smmu_pmu { bool global_filter; u32 global_filter_span; u32 global_filter_sid; + u32 parent_iidr; }; #define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu)) @@ -551,6 +552,11 @@ static const struct attribute_group *smmu_pmu_attr_grps[] = { NULL }; +static const struct attribute_group **smmu_pmu_lookup_attr_groups(u32 parent_smmu_iidr) +{ + return smmu_pmu_attr_grps; +} + /* * Generic device handlers */ @@ -706,11 +712,21 @@ static int smmu_pmu_probe(struct platform_device *pdev) int irq, err; char *name; struct device *dev = &pdev->dev; + struct device *parent = dev->parent; smmu_pmu = devm_kzalloc(dev, sizeof(*smmu_pmu), GFP_KERNEL); if (!smmu_pmu) return -ENOMEM; + if (parent) { + void *parent_drvdata; + + parent_drvdata = platform_get_drvdata(to_platform_device(parent)); + if (!parent_drvdata) + return -EPROBE_DEFER; + smmu_pmu->parent_iidr = *(u32 *)parent_drvdata; + } + smmu_pmu->dev = dev; platform_set_drvdata(pdev, smmu_pmu); @@ -724,7 +740,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) .start = smmu_pmu_event_start, .stop = smmu_pmu_event_stop, .read = smmu_pmu_event_read, - .attr_groups = smmu_pmu_attr_grps, + .attr_groups = smmu_pmu_lookup_attr_groups(smmu_pmu->parent_iidr), .capabilities = PERF_PMU_CAP_NO_EXCLUDE, }; From patchwork Mon Sep 30 14:33:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3AA413B1 for ; Mon, 30 Sep 2019 14:38:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 820FC21855 for ; Mon, 30 Sep 2019 14:38:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QRnbykKV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 820FC21855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=BJpThHfX1F0GwnpSd3iKmQ253aU64UoDpgBQQceBpJ0=; b=QRnbykKVAOirE1 dwJX2bNVWhVFwhybsaP7AWAuFH8oJCW2pCgYG0yJKKlNAT97PTTzMzG2G2oDq51iHKy7AVO2/i64B CyUlG1vg1rwsGnx4E0lgl3rHLNdxO5wDE76gechXaftPATnH+cnqIYx45b3m2I3H+xp4zyCNVk0zZ mFqO4fmnRBEyiAOl/ajBevzXKGJ3W/s1HAv+vROb4YfCJ5hqdNA/PYE/AjqcKWsrmX6DO7B01/0Ib ImZ1VqptJncjjVnatfGi/K+cEjyzwaujvfMHln3v9tXQqiGqQyztY71tzYeATWiR+LEq+XrlnIdVd aU8/4zGDXx0s2/NH+NEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwoZ-00005k-G1; Mon, 30 Sep 2019 14:38:15 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnT-0007OD-8b for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:10 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3920A100FDCBCDE5F8DC; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:49 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 4/6] perf/smmuv3: Support HiSilicon hip08 (hi1620) IMP DEF events Date: Mon, 30 Sep 2019 22:33:49 +0800 Message-ID: <1569854031-237636-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073707_905139_522B8EC8 X-CRM114-Status: GOOD ( 15.10 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.190 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Now that we can identify an PMCG implementation through the parent SMMUv3 implementation, add support for IMP DEF events. For each new implementation supported, we add a new attr_grps structure for a particular implementation and do lookup matching based on the parent SMMUv3 IIDR. This could maybe be optimised in future to reduce structures required. For now, only the l1_tlb event is added for HiSilicon hip08 platform. This platform supports many more IMP DEF events, but I need something better than the electronically translated description of the event to support. Signed-off-by: John Garry --- drivers/perf/arm_smmuv3_pmu.c | 54 ++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index f702898c695d..11f28ba5fae0 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -132,6 +132,8 @@ SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_stream_id, config1, 0, 31); SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_span, config1, 32, 32); SMMU_PMU_EVENT_ATTR_EXTRACTOR(filter_enable, config1, 33, 33); +#define PARENT_SMMU_IIDR_HISI_HIP08 (0x30736) + static inline void smmu_pmu_enable(struct pmu *pmu) { struct smmu_pmu *smmu_pmu = to_smmu_pmu(pmu); @@ -505,6 +507,21 @@ static struct attribute *smmu_pmu_events[] = { NULL }; +SMMU_EVENT_ATTR(l1_tlb, 0x8a); + +static struct attribute *smmu_pmu_events_hip08[] = { + &smmu_event_attr_cycles.attr.attr, + &smmu_event_attr_transaction.attr.attr, + &smmu_event_attr_tlb_miss.attr.attr, + &smmu_event_attr_config_cache_miss.attr.attr, + &smmu_event_attr_trans_table_walk_access.attr.attr, + &smmu_event_attr_config_struct_access.attr.attr, + &smmu_event_attr_pcie_ats_trans_rq.attr.attr, + &smmu_event_attr_pcie_ats_trans_passed.attr.attr, + &smmu_event_attr_l1_tlb.attr.attr, + NULL +}; + static umode_t smmu_pmu_event_is_visible(struct kobject *kobj, struct attribute *attr, int unused) { @@ -514,7 +531,10 @@ static umode_t smmu_pmu_event_is_visible(struct kobject *kobj, pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr.attr); - if (test_bit(pmu_attr->id, smmu_pmu->supported_events)) + if (pmu_attr->id < SMMU_PMCG_ARCH_MAX_EVENTS && + test_bit(pmu_attr->id, smmu_pmu->supported_events)) + return attr->mode; + else if (pmu_attr->id >= SMMU_PMCG_ARCH_MAX_EVENTS) return attr->mode; return 0; @@ -526,6 +546,12 @@ static struct attribute_group smmu_pmu_events_group = { .is_visible = smmu_pmu_event_is_visible, }; +static struct attribute_group smmu_pmu_events_group_hip08 = { + .name = "events", + .attrs = smmu_pmu_events_hip08, + .is_visible = smmu_pmu_event_is_visible, +}; + /* Formats */ PMU_FORMAT_ATTR(event, "config:0-15"); PMU_FORMAT_ATTR(filter_stream_id, "config1:0-31"); @@ -552,8 +578,34 @@ static const struct attribute_group *smmu_pmu_attr_grps[] = { NULL }; +static const struct attribute_group *smmu_pmu_attr_grps_hip08[] = { + &smmu_pmu_cpumask_group, + &smmu_pmu_events_group_hip08, + &smmu_pmu_format_group, + NULL +}; + +struct smmu_pmu_attr_grps_custom { + u32 parent_smmu_iidr; + const struct attribute_group **attr_grps; +} smmu_pmu_attr_custom_grps[] = { + { + .parent_smmu_iidr = PARENT_SMMU_IIDR_HISI_HIP08, + .attr_grps = smmu_pmu_attr_grps_hip08, + }, +}; + static const struct attribute_group **smmu_pmu_lookup_attr_groups(u32 parent_smmu_iidr) { + int i; + + for (i = 0; i < ARRAY_SIZE(smmu_pmu_attr_custom_grps); i++) { + struct smmu_pmu_attr_grps_custom *c = &smmu_pmu_attr_custom_grps[i]; + + if (c->parent_smmu_iidr == parent_smmu_iidr) + return c->attr_grps; + } + return smmu_pmu_attr_grps; } From patchwork Mon Sep 30 14:33:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4282C13B1 for ; Mon, 30 Sep 2019 14:38:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0630D21855 for ; Mon, 30 Sep 2019 14:38:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Zp8D7D1F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0630D21855 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=VwGbHfzf9+XfEOvkVOZFXIomUMl8E0gVkU+JetT5X4Y=; b=Zp8D7D1FvMV4gJ 5R6BA9ZvUG3kfopWE9G4Ws03q4hmqvM2VZNoVCMJLHQhvIRZWDmoZIR/8XxuYFGcvs2VlcvqG4hsv Dr9iDP/Kdgx2sRrqq9cT0hSjukyt63/57Ik+txdeTR1pKMq60zYjahN6a6SVvR+xGUFTFxq+90DNo MRRQ6opKlben6lvmHUHR5pgGhIAHeHP6UUqorLGayo6vuDAPpSqEB9R7IuZI/0UnHKmtbH/8q+hBz oH+kQn3VbKSDgE9FUHIsyqk1TUzy3YQv5h2mKwvf1doy+hlL6OxfhNLVGAJChVLj5BwPR3cRY4sXg N+fwKWKz49HTW6FvRBPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwoq-0000Mx-5a; Mon, 30 Sep 2019 14:38:32 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnY-0007OH-1U for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:13 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 324169B4856EE48EF227; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:49 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 5/6] perf/smmuv3: Match implementation options based on parent SMMU IIDR Date: Mon, 30 Sep 2019 22:33:50 +0800 Message-ID: <1569854031-237636-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073712_290371_AC7CC237 X-CRM114-Status: GOOD ( 11.43 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.190 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Currently we match the implementation options based on the ACPI PLATFORM OEM ID. Since we can now match based on the parent SMMUv3 IIDR, switch to this method. Signed-off-by: John Garry --- drivers/perf/arm_smmuv3_pmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index 11f28ba5fae0..33d1379ae525 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -739,14 +739,10 @@ static void smmu_pmu_reset(struct smmu_pmu *smmu_pmu) smmu_pmu->reloc_base + SMMU_PMCG_OVSCLR0); } -static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu) +static void smmu_pmu_get_implementation_options(struct smmu_pmu *smmu_pmu) { - u32 model; - - model = *(u32 *)dev_get_platdata(smmu_pmu->dev); - - switch (model) { - case IORT_SMMU_V3_PMCG_HISI_HIP08: + switch (smmu_pmu->parent_iidr) { + case PARENT_SMMU_IIDR_HISI_HIP08: /* HiSilicon Erratum 162001800 */ smmu_pmu->options |= SMMU_PMCG_EVCNTR_RDONLY; break; @@ -844,7 +840,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) return -EINVAL; } - smmu_pmu_get_acpi_options(smmu_pmu); + smmu_pmu_get_implementation_options(smmu_pmu); /* Pick one CPU to be the preferred one to use */ smmu_pmu->on_cpu = raw_smp_processor_id(); From patchwork Mon Sep 30 14:33:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 11166815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8966F15AB for ; Mon, 30 Sep 2019 14:37:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53C57218DE for ; Mon, 30 Sep 2019 14:37:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sF6aDVlj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53C57218DE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=eWL3N4QmXgZz+XFgqIJss+ra6eFEpQhAi+df7ZsjtM8=; b=sF6aDVljkX2VC8 NyTVPzhuoKlh69YhZ2Iekxwwb3Aep/ocxtgZpmvu2tNn2amlPiLlcoMd79yEzw1YBazM+KiSMloeD Ck7NvtZpCO5LrV0E2TtLdCl81P0lXOiI3rivLVt256YsyA3bwhAxtOh3vc7Pk5Fabx9j6RB2Gq2LR v6bCtM8k2ODce23Mlu1maGHTpPgrkm6XUZXJDUq+P7Wb2gBzDCUtB1t9KffJ64wz2vrk3qLFJNmtF NLuSNVK3OSjjKouEkylzvKNq3kgUuRCsOn8qP9AluiZE4ZQDc0uvO3crkHE0FzUFZI/of/fwosm89 ITcTzWBxqjRoIl4uYFOQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnT-0007QZ-Q0; Mon, 30 Sep 2019 14:37:07 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iEwnQ-0007OK-Co for linux-arm-kernel@lists.infradead.org; Mon, 30 Sep 2019 14:37:06 +0000 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5BFA948E40CC6B5FE5AE; Mon, 30 Sep 2019 22:36:58 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 30 Sep 2019 22:36:50 +0800 From: John Garry To: , , , , , Subject: [RFC PATCH 6/6] ACPI/IORT: Drop code to set the PMCG software-defined model Date: Mon, 30 Sep 2019 22:33:51 +0800 Message-ID: <1569854031-237636-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1569854031-237636-1-git-send-email-john.garry@huawei.com> References: <1569854031-237636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190930_073704_604928_216FE01D X-CRM114-Status: GOOD ( 14.94 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nleeder@codeaurora.org, John Garry , rjw@rjwysocki.net, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, linuxarm@huawei.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, lenb@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Now that we can identify a PMCG implementation from the parent SMMUv3 IIDR, drop all the code to match based on the ACPI OEM ID. Signed-off-by: John Garry Acked-by: Hanjun Guo --- drivers/acpi/arm64/iort.c | 35 +---------------------------------- include/linux/acpi_iort.h | 8 -------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 0b687520c3e7..d04888cb8cff 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1377,27 +1377,6 @@ static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res, ACPI_EDGE_SENSITIVE, &res[2]); } -static struct acpi_platform_list pmcg_plat_info[] __initdata = { - /* HiSilicon Hip08 Platform */ - {"HISI ", "HIP08 ", 0, ACPI_SIG_IORT, greater_than_or_equal, - "Erratum #162001800", IORT_SMMU_V3_PMCG_HISI_HIP08}, - { } -}; - -static int __init arm_smmu_v3_pmcg_add_platdata(struct platform_device *pdev) -{ - u32 model; - int idx; - - idx = acpi_match_platform_list(pmcg_plat_info); - if (idx >= 0) - model = pmcg_plat_info[idx].data; - else - model = IORT_SMMU_V3_PMCG_GENERIC; - - return platform_device_add_data(pdev, &model, sizeof(model)); -} - struct iort_dev_config { const char *name; int (*dev_init)(struct acpi_iort_node *node); @@ -1408,7 +1387,6 @@ struct iort_dev_config { struct acpi_iort_node *node); int (*dev_set_proximity)(struct device *dev, struct acpi_iort_node *node); - int (*dev_add_platdata)(struct platform_device *pdev); }; static const struct iort_dev_config iort_arm_smmu_v3_cfg __initconst = { @@ -1430,7 +1408,6 @@ static const struct iort_dev_config iort_arm_smmu_v3_pmcg_cfg __initconst = { .name = "arm-smmu-v3-pmcg", .dev_count_resources = arm_smmu_v3_pmcg_count_resources, .dev_init_resources = arm_smmu_v3_pmcg_init_resources, - .dev_add_platdata = arm_smmu_v3_pmcg_add_platdata, }; static __init const struct iort_dev_config *iort_get_dev_cfg( @@ -1494,17 +1471,7 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, if (ret) goto dev_put; - /* - * Platform devices based on PMCG nodes uses platform_data to - * pass the hardware model info to the driver. For others, add - * a copy of IORT node pointer to platform_data to be used to - * retrieve IORT data information. - */ - if (ops->dev_add_platdata) - ret = ops->dev_add_platdata(pdev); - else - ret = platform_device_add_data(pdev, &node, sizeof(node)); - + ret = platform_device_add_data(pdev, &node, sizeof(node)); if (ret) goto dev_put; diff --git a/include/linux/acpi_iort.h b/include/linux/acpi_iort.h index 8e7e2ec37f1b..7a8961e6a8bb 100644 --- a/include/linux/acpi_iort.h +++ b/include/linux/acpi_iort.h @@ -14,14 +14,6 @@ #define IORT_IRQ_MASK(irq) (irq & 0xffffffffULL) #define IORT_IRQ_TRIGGER_MASK(irq) ((irq >> 32) & 0xffffffffULL) -/* - * PMCG model identifiers for use in smmu pmu driver. Please note - * that this is purely for the use of software and has nothing to - * do with hardware or with IORT specification. - */ -#define IORT_SMMU_V3_PMCG_GENERIC 0x00000000 /* Generic SMMUv3 PMCG */ -#define IORT_SMMU_V3_PMCG_HISI_HIP08 0x00000001 /* HiSilicon HIP08 PMCG */ - int iort_register_domain_token(int trans_id, phys_addr_t base, struct fwnode_handle *fw_node); void iort_deregister_domain_token(int trans_id);