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: 174760 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7216569ill; Mon, 30 Sep 2019 07:37:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZnGuBcrY6iMPxMy+yBkD0wRbFKHNLCUjpSsRnYciMKUBYhz71gOjipuDZunSQiSXKba6i X-Received: by 2002:a50:a939:: with SMTP id l54mr20163080edc.214.1569854238094; Mon, 30 Sep 2019 07:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569854238; cv=none; d=google.com; s=arc-20160816; b=wtvzp3BbGGOGKYNav8cEdec32m1gZVtSrMLYStz4ZAmWNZz3Pd+fuX/6gDRB0nH4qi /6f6pUDo4+yJ4hqUNfHMmG82qSvyExPhOLMDpMIdtHl9PN7mhbnrwRf4j+a4uVzZd0FL JVapALFNUjVXKmqrK+wbOsSuVJlnatAgWferHLAYQKagSgmPW9Bqi6QYuWFbq4X2eoSl 0D/RBmFQz8+xcdpL0FIhQXvc943oCK9llyly8kpTnBVIb5yxnMy/j+IGpwllRnd9sCc5 PfgPc288ptiFhQK7HBhuTQmEAKFI9VMiQ1UUGOaicOHhKlNeeyNOntNk7/AzBZPYTAaH ERuw== 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; bh=DqOthaNwGsxZvvm5afnxhod1pGggSLORYZdIo5Zk4ZI=; b=RRKjQIQG19MrNXv8f4q/pLJSPAlf/O2LWn5H2TABgWk1kYqaOct0r1C2fIK5B5tCM1 HtukkeuFxxkrC3P8AObUt3XxWK9nSFBwAFOKP7D1kWNo+X66SMYOOQaVxIaWSGVDZ8id jz/rmKJkohim5vcg3IchLOeyzDQvy9agEh8vCGecX4//uZbmOmyS57ZJIE/XQW9nU2Im Jn9KOaZ19GqetBMie2T4fgCp73rw3O6FT1QJhFXycQIkCc5nj0blOA59/A0kj3GCC7lE K5SbWp8wtRAy9woRQ3uQGV92S6XjPEtmRukzFq9KG0SktaI1URDEum1i6VMMBSMvO5Yz a7Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 r5si6689636edo.14.2019.09.30.07.37.17; Mon, 30 Sep 2019 07:37:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731841AbfI3OhO (ORCPT + 27 others); Mon, 30 Sep 2019 10:37:14 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3192 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731702AbfI3OhC (ORCPT ); Mon, 30 Sep 2019 10:37:02 -0400 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: , , , , , CC: , , , , , , , , John Garry 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.17.1 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);