From patchwork Tue Mar 24 11:30:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 11455223 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 0598A159A for ; Tue, 24 Mar 2020 11:30:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0329208D5 for ; Tue, 24 Mar 2020 11:30:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cvRSU7PW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727323AbgCXLai (ORCPT ); Tue, 24 Mar 2020 07:30:38 -0400 Received: from mail-eopbgr30076.outbound.protection.outlook.com ([40.107.3.76]:5238 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727095AbgCXLah (ORCPT ); Tue, 24 Mar 2020 07:30:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IE7mAxVlBdUGb8hfPnFbq4m+A+RedqiOgaiIGMhDPjlxxgeSJgx8081EgxJVx2aF+DIpoWhlMSQHkGGMvLbIqp90seOvlv2hbwcep759niOyI/OKFGylGQuRyvmteOqXPHu0k7eNDbF2B2MBea+204SlhWTndYvCvv61tkAJVLGEImJNkb9HkuUmMVuFAp9DRs8Fl9QYvJVK3AaYfTNsI9KbNIEXQzDYSngjGqs0yzJYVCHxELauBTFoIKl1DNf+Iy2LXc+HpGi5FAftFZOlZbBQA8vqJ5pX1+pwQULUJbNAup2ip5rYrRQVbPtFjCWcJfkQjUzUHxMa6UJeBNjF3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+UMe0Y7q2irq0c9yix5N5BFbGRWfXjPgXaDnCYKX2CU=; b=cDHjijyJTW20i15m6tfrgv+zzJ2ROIiPlU+B+ZktyrZ/dsf5Uy/WQRJK/kQ9qeE3GGdqohhppb/eQFTWz6X6EzwODMbYoeM1GjWX8hhA7v3K6YYo1mH0DO5QHrS+SGS12xa7678WUVYwYFMfVdy64Xz4FiwLoc/nth3HMxwSOa/RCHnf13g6zVTQZivN0ZdvHdqqhDhaUMQA3AxT1gj4szrJ4d5H5Jo68QNg2TBthW5OsW6+/4ibRAUZq/u4rwG8Afbsj97TWpQYSfmYM1rAeIdggdv5N6B0fTQzLQwJK8Y53EkoDV9ed97aKBgubuz/LnVupLSmbhjkD8AN0TD0nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+UMe0Y7q2irq0c9yix5N5BFbGRWfXjPgXaDnCYKX2CU=; b=cvRSU7PWX5/olLd0BRK9yYCNgw6/nBmfxS2tfq09/85l1eXVAmLOq4hcpDLTuOAue1dRr1oOfdnXWT1itbDeMqalviQXiFVuxjyEHqzmgEYzAlfFBAFUh91ZpeUeD5k1387ZVMheKugIAEo/IabmhV9uMekl8esxcZCPktIPa0k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; Received: from AM6PR04MB5925.eurprd04.prod.outlook.com (20.179.2.147) by AM6PR04MB6504.eurprd04.prod.outlook.com (20.179.246.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Tue, 24 Mar 2020 11:30:34 +0000 Received: from AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e]) by AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e%5]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 11:30:34 +0000 From: laurentiu.tudor@nxp.com To: robin.murphy@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Cc: ard.biesheuvel@linaro.org, ioana.ciornei@nxp.com, diana.craciun@oss.nxp.com, maz@kernel.org, jon@solid-run.com, pankaj.bansal@nxp.com, makarand.pawagi@nxp.com, calvin.johnson@nxp.com, V.Sethi@nxp.com, cristian.sovaiala@nxp.com, Stuart.Yoder@arm.com, jeremy.linton@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, Laurentiu Tudor Subject: [RFC PATCH v2 1/4] bus: fsl-mc: add custom .dma_configure implementation Date: Tue, 24 Mar 2020 13:30:20 +0200 Message-Id: <20200324113023.322-2-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324113023.322-1-laurentiu.tudor@nxp.com> References: <20200324113023.322-1-laurentiu.tudor@nxp.com> X-ClientProxiedBy: AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) To AM6PR04MB5925.eurprd04.prod.outlook.com (2603:10a6:20b:ab::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-101.ea.freescale.net (89.37.124.34) by AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Tue, 24 Mar 2020 11:30:33 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [89.37.124.34] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 113c6542-ca49-4ff0-3693-08d7cfe6c47d X-MS-TrafficTypeDiagnostic: AM6PR04MB6504:|AM6PR04MB6504: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(396003)(376002)(346002)(366004)(136003)(1076003)(86362001)(6666004)(6512007)(9686003)(6486002)(52116002)(5660300002)(66946007)(66476007)(478600001)(7416002)(66556008)(6506007)(8936002)(8676002)(81156014)(316002)(4326008)(26005)(36756003)(81166006)(956004)(2616005)(2906002)(16526019)(186003)(142923001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB6504;H:AM6PR04MB5925.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zuO7TC1tbRyfgPzk2Lz4b7MJAjg308r5MDAHrEnezRH/NMRAWREUn71daz5CTN88JZmkB+C2r3uH4MQuleZo5pV+iCnyCvrRP2QNPh9D8QxNwp3Ds/x6+XUZYZycwM4lsrbPQ9mXITHpN1Z4LXEUP/LXRkw4iYKqy3F1EWVQEQlxsoiysNudRPFIyvU0DcsvyaXXIyux7R8gQwfizXSKIiB+1uZPVBiMTsBgqKhUkDF1gUTdSIiUFIJQb80Ew8U4C9+tiBkr1BNaBu1b/U4sO7TtRy8CybNCNcWW4U8KT5ptk0eWVmXliKMTq5GOkmwvCh5lHicE83vW1kdjoEB7cJjN80P61As/y+cOpKflQLwxfsvG/qT7pCzaEMqjYCONzPsA0uQNERBw406m/ep8oIdrd3apisHOJEbY027RK2eQp54zd1SufVWWmqYZpHpN/UEBPVv+RzM69/lkmn0FuJ1V+ANDQnjupyonl+faQ9E= X-MS-Exchange-AntiSpam-MessageData: ZYAUvX0tGYgY8Ye6QjBMglNR4IKPyV8H0o4kU8kdSz5IzswdpmHvPi11kFmcJDG8m9iTY2Uc9q3oM3D1Rqn0+qOefY8ygzmFfza/gwIwaTQpx6QyCBBSGtwgjgScXBo7iCq3HmvzHKUI0uujRqjsPw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 113c6542-ca49-4ff0-3693-08d7cfe6c47d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 11:30:34.4011 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QVuxQYJF+VQrGme9eKX5AhkfJh1o2Niqv1jcCefaH5sIb713gJjmf0JJ/SNTsKlHZ6m6lxXIP7lTaRQaxcEHUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6504 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Laurentiu Tudor The devices on this bus are not discovered by way of device tree but by queries to the firmware. It makes little sense to trick the generic of layer into thinking that these devices are of related so that we can get our dma configuration. Instead of doing that, add our custom dma configuration implementation. Signed-off-by: Laurentiu Tudor --- drivers/bus/fsl-mc/fsl-mc-bus.c | 50 ++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index a0f8854acb3a..a3d25c1d4ff8 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "fsl-mc-private.h" @@ -130,11 +131,58 @@ static int fsl_mc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) static int fsl_mc_dma_configure(struct device *dev) { struct device *dma_dev = dev; + struct iommu_fwspec *fwspec; + const struct iommu_ops *iommu_ops; + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev); + int ret; + u32 icid; + + /* Skip DMA setup for devices that are not DMA masters */ + if (dev->type == &fsl_mc_bus_dpmcp_type || + dev->type == &fsl_mc_bus_dpbp_type || + dev->type == &fsl_mc_bus_dpcon_type || + dev->type == &fsl_mc_bus_dpio_type) + return 0; while (dev_is_fsl_mc(dma_dev)) dma_dev = dma_dev->parent; - return of_dma_configure(dev, dma_dev->of_node, 0); + fwspec = dev_iommu_fwspec_get(dma_dev); + if (!fwspec) + return -ENODEV; + iommu_ops = iommu_ops_from_fwnode(fwspec->iommu_fwnode); + if (!iommu_ops) + return -ENODEV; + + ret = iommu_fwspec_init(dev, fwspec->iommu_fwnode, iommu_ops); + if (ret) + return ret; + + if (iommu_ops->of_xlate) { + struct of_phandle_args iommu_spec = { + .np = fwspec->iommu_fwnode->dev->of_node, + .args[0] = mc_dev->icid, + .args_count = 1 + }; + + ret = iommu_ops->of_xlate(dev, &iommu_spec); + if (ret) { + iommu_fwspec_free(dev); + return ret; + } + } + + if (!device_iommu_mapped(dev)) { + ret = iommu_probe_device(dev); + if (ret) { + iommu_fwspec_free(dev); + return ret; + } + } + + arch_setup_dma_ops(dev, 0, *dma_dev->dma_mask + 1, iommu_ops, true); + + return 0; } static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, From patchwork Tue Mar 24 11:30:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 11455221 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 507C5913 for ; Tue, 24 Mar 2020 11:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25FD42070A for ; Tue, 24 Mar 2020 11:30:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="aSCul+BB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbgCXLaj (ORCPT ); Tue, 24 Mar 2020 07:30:39 -0400 Received: from mail-vi1eur05on2076.outbound.protection.outlook.com ([40.107.21.76]:6104 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727148AbgCXLaj (ORCPT ); Tue, 24 Mar 2020 07:30:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lafBX4jNGaJsTFcztBUX0QBSIbD/0GvauIuEaIjzTTCZQE3hyPT/SdNoUhqQmpurmCBhVRRMvuKgonGdcOLlx4aRAJp4ELdTs6/E5iF26CmuU8SBDerLI/BRKb5Iw1PbHvH4LbNIeGlwUTdi6iWClGm8lw1c+mNE7qcWk9SM6BD/UB9znJGCA4yZ/lVCnUi/FitQvS5cQgu5kMKeKFAqaBTCcBX3G2doJogrMV1Z829umt4xGKF2Fr24C3n/eH9ybq7xtQjoYItI7idaA3kpa3RMwLKslDRHwvvfvzDTVcvW3/X/kcRfPNldg7KeV2OeQZF3VAFpPEqTMJq0S1RmaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MrAsPuYmzomTw/I6ERXcbfE6GbcnkxdExla3dKaOzEA=; b=AmURlWGi0QFsSCNyWAI1Hx7KxVQGRKyQ6EG/XFmss79oGLmksFRACzwjnURFVI/XiQoqxhWPGerMECRvO23KmsTedaZ1C/FHY486K6hq1QHAAFp4OqBwBkSIQYElxICKNOQFe9PUPOL6qyDWtUjPux7SKqigDmrBE+MUDj9DvSEAluRz0LUrPILzjOR3/sNZzhgELNXIS9EMQOjdYfzI7ReLw8c/jqTNTwA9x0jmdoHFaAscYF64BJBSNRBZr4jEsZq4IG1GE+dLCaYUNVeaZaixAwzOOZcb4+ye9JczvUmoTGCTtlIxL8SncEkSDhGjd+n1jCRDx2AUBULnz+cX4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MrAsPuYmzomTw/I6ERXcbfE6GbcnkxdExla3dKaOzEA=; b=aSCul+BBlRQEsUILCRhRfiRNHYbAhNdQWEHB6ShYvTdRB8m+4RjfakpFC39D62WzLXJeBb1mMu5KY+m8xbLNkUuf4OQkR3BfId+VG2jxxbwHJKNl4yP6XGZIGxUT3LaBAoPjNKY1uSp07WJlmt7Fz8/3GTvVl3ZidrS+hWyNITk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; Received: from AM6PR04MB5925.eurprd04.prod.outlook.com (20.179.2.147) by AM6PR04MB5960.eurprd04.prod.outlook.com (20.178.92.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Tue, 24 Mar 2020 11:30:35 +0000 Received: from AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e]) by AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e%5]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 11:30:35 +0000 From: laurentiu.tudor@nxp.com To: robin.murphy@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Cc: ard.biesheuvel@linaro.org, ioana.ciornei@nxp.com, diana.craciun@oss.nxp.com, maz@kernel.org, jon@solid-run.com, pankaj.bansal@nxp.com, makarand.pawagi@nxp.com, calvin.johnson@nxp.com, V.Sethi@nxp.com, cristian.sovaiala@nxp.com, Stuart.Yoder@arm.com, jeremy.linton@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net Subject: [RFC PATCH v2 2/4] irqchip/fsl-mc: Change the way the IRQ domain is set for MC devices Date: Tue, 24 Mar 2020 13:30:21 +0200 Message-Id: <20200324113023.322-3-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324113023.322-1-laurentiu.tudor@nxp.com> References: <20200324113023.322-1-laurentiu.tudor@nxp.com> X-ClientProxiedBy: AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) To AM6PR04MB5925.eurprd04.prod.outlook.com (2603:10a6:20b:ab::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-101.ea.freescale.net (89.37.124.34) by AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Tue, 24 Mar 2020 11:30:34 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [89.37.124.34] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 577bc46c-18b4-48dd-7fb4-08d7cfe6c53f X-MS-TrafficTypeDiagnostic: AM6PR04MB5960:|AM6PR04MB5960: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(39860400002)(346002)(396003)(366004)(66476007)(6486002)(66556008)(66946007)(6512007)(2906002)(9686003)(478600001)(81166006)(8676002)(186003)(16526019)(81156014)(26005)(52116002)(8936002)(6506007)(1076003)(7416002)(2616005)(5660300002)(956004)(4326008)(6666004)(36756003)(86362001)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB5960;H:AM6PR04MB5925.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OERkQ7HtHAfQxhonHKHm4Y5Gfthd3eiypd48WInDiBAtE4M1UMLnRBPtGMUq9FZak4h7jQQGTapQZoDh5J3uIVRt7hN07l9FwD6EB67Dl7/RicJszhJP5pHb1f4JsxuVThVbSTwEe1cG9BdN/9GuPvVkk/RfMDc9uW+08wC3pi3++UMkft0qp5ZH227/z0B9n1coR3PmO+IWZkiP737WBZzRPeT8YeMXhbJXUFWTH3g81VIhj8TAYFCFwS96gJobUpzispYKxM8y7dHpMWXte5ct2aEO1RiKS5iujweNGMyaDAr4F8yKy+XZpJSMTMr3n/MkCAYfYrXF0XrJ1JrLIqNVu7Rl78UrTAihTp6aPmtaL484YnmgGKqa3OXqDSB+JkVIrw0ez+fACekqirD/pvz6UEcxtxRZ9asKiT8PIUyhlCmWxSDgB6B+9d0Dhf+b X-MS-Exchange-AntiSpam-MessageData: Jm/A0HUqw3ODNthJdHsYHKzuAIJ9TjuYp8PYjQ4xwGkjKRlHGNIYF4p3u4XmW/7vGbT9jpfBQ+0/S2R0n/3fhsLkHcQj6vTojtf2N7Ip8ua6R71AOzfyWRUvTklkDuMtf4qNvgorqDUO3k1DkqSORA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 577bc46c-18b4-48dd-7fb4-08d7cfe6c53f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 11:30:35.6944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zb2j1MEL2CoQkh3DBCQ/Dnv3kC0wtJYMFFrkYUh8Ieh+trAOkYJxx2BGdRbeJPVlz++Ppw4UiUtWM1KCcts4qw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5960 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Diana Craciun In ACPI the MC bus is represented as a platform device and a named component in the IORT table. The mc-bus devices are discovered dynamically at runtime but they share the same fwnode with the parent platfom device. This patch changes the way the IRQ domain is searched for the MC devices: it takes the fwnode reference from the parent and uses the fwnode reference to find the MC IRQ domain. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/fsl-mc-msi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c index 8b9c66d7c4ff..1e2e97329781 100644 --- a/drivers/bus/fsl-mc/fsl-mc-msi.c +++ b/drivers/bus/fsl-mc/fsl-mc-msi.c @@ -182,16 +182,23 @@ int fsl_mc_find_msi_domain(struct device *mc_platform_dev, { struct irq_domain *msi_domain; struct device_node *mc_of_node = mc_platform_dev->of_node; + struct fwnode_handle *fwnode; - msi_domain = of_msi_get_domain(mc_platform_dev, mc_of_node, - DOMAIN_BUS_FSL_MC_MSI); + msi_domain = dev_get_msi_domain(mc_platform_dev); if (!msi_domain) { pr_err("Unable to find fsl-mc MSI domain for %pOF\n", mc_of_node); return -ENOENT; } + fwnode = msi_domain->fwnode; + msi_domain = irq_find_matching_fwnode(fwnode, DOMAIN_BUS_FSL_MC_MSI); + if (!msi_domain) { + pr_err("Unable to find fsl-mc MSI domain for %pOF\n", + mc_of_node); + return -ENOENT; + } *mc_msi_domain = msi_domain; return 0; } From patchwork Tue Mar 24 11:30:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 11455227 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 397EB913 for ; Tue, 24 Mar 2020 11:30:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 072F5208D5 for ; Tue, 24 Mar 2020 11:30:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="FimIDg9z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727405AbgCXLao (ORCPT ); Tue, 24 Mar 2020 07:30:44 -0400 Received: from mail-vi1eur05on2076.outbound.protection.outlook.com ([40.107.21.76]:6104 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727148AbgCXLan (ORCPT ); Tue, 24 Mar 2020 07:30:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SSYrxq+UcAxQ3EAWRZwsuSSdLF7VjlVtsCttnCE6RyxsvMG2V6U8PjjQAElc6uorVhWcGKv8JvZltgU7LKJz9YDH0ISD798GA0otzXBl7BhLdEKevSMWXuwB6brZEF5vytnHAnk3CVIhWoKOAzrYgrcVuVbZdZJ6rAZ7ftfOsa69lvVpU8usVIGg8QJzOd4sbIthyy085FV2giev2Ixk//XOU89WnI/gp7NW3KTRE//L2HVrjOdLMl3tYqXB+UOmQRBJ2aY8AihPUv7PUgLMYnwb32vlxTWuQGyKisegg1d2nnS6oKqbbLFzOvQM/f0lxJbUggXQTN4tHI2H0oA3xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OzYnQe6fdBla4ABk2/tHy5gf92LXd+R3+suiLttBwpA=; b=h7KNmw8+7yv09FVeWjHXR5pdgr9qDG3LOEafxotDCRZ9z5JCb6U+qZ7L0NtYOqPi04AnfedQ6t2nUuQh4MVq6O6Ceqwq9qawIAwJVkq+los8RFg6wUbkOovYOKRk7mydr/SHdNwSGjo5IyPxH1ZdY1iFq5gyNtehPUVlIxjNMcMnVc4FYUSCXDRdKSPQRG3fDcPED0j4WE1A4OCykozQByJkTS2hk2o+AbSb+vXzedTSbOGEu8ZOkkLyykVGzLWYCd+WLxKIU5wOxbpQe1bbfw4lSscgCkBs2usPA2P6OzK0nze3PRIKSuvk3TZtZSCpJ5/T+WXnBIdrLwcwoCDcDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OzYnQe6fdBla4ABk2/tHy5gf92LXd+R3+suiLttBwpA=; b=FimIDg9zG1F5BCoiS3iQPedb3WEpKd6rgYupj7mDJMx47fI6adNt4RnKl1gsOF8UT9uTjifYL7rRTLVHeUu+Dh/PIZ0bzUxL3ZAJH+B98o8BpGdIeY6EwSbmUBpNVbfw5UmGlaP16Qu3UDBcygL9hOsgStxe4MAsaSty44Eh0u4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; Received: from AM6PR04MB5925.eurprd04.prod.outlook.com (20.179.2.147) by AM6PR04MB5960.eurprd04.prod.outlook.com (20.178.92.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Tue, 24 Mar 2020 11:30:37 +0000 Received: from AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e]) by AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e%5]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 11:30:37 +0000 From: laurentiu.tudor@nxp.com To: robin.murphy@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Cc: ard.biesheuvel@linaro.org, ioana.ciornei@nxp.com, diana.craciun@oss.nxp.com, maz@kernel.org, jon@solid-run.com, pankaj.bansal@nxp.com, makarand.pawagi@nxp.com, calvin.johnson@nxp.com, V.Sethi@nxp.com, cristian.sovaiala@nxp.com, Stuart.Yoder@arm.com, jeremy.linton@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net Subject: [RFC PATCH v2 3/4] bus: fsl-mc: Add ACPI support for fsl-mc Date: Tue, 24 Mar 2020 13:30:22 +0200 Message-Id: <20200324113023.322-4-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324113023.322-1-laurentiu.tudor@nxp.com> References: <20200324113023.322-1-laurentiu.tudor@nxp.com> X-ClientProxiedBy: AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) To AM6PR04MB5925.eurprd04.prod.outlook.com (2603:10a6:20b:ab::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-101.ea.freescale.net (89.37.124.34) by AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Tue, 24 Mar 2020 11:30:35 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [89.37.124.34] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4a8eb7d5-d41b-4735-544b-08d7cfe6c5f8 X-MS-TrafficTypeDiagnostic: AM6PR04MB5960:|AM6PR04MB5960: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:152; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(39860400002)(346002)(396003)(366004)(66476007)(6486002)(66556008)(66946007)(6512007)(2906002)(9686003)(478600001)(81166006)(8676002)(186003)(16526019)(81156014)(26005)(52116002)(8936002)(6506007)(1076003)(7416002)(2616005)(5660300002)(956004)(4326008)(6666004)(36756003)(86362001)(316002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB5960;H:AM6PR04MB5925.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nhifNbmejs9D0UejEve1I9zGQPylFT1gHaJ2qUzhHdooF8y1S+Q9QTwl0Z7RHxtSF3JMI+TtT82+FyRyxXAWzEFDjt+BqICrQac3+ByW+/ajgRzsQbcs+DqmI1wstY18ekpsgRusYO5JGua/FKSF0VWzXdQ79MYMtATNggN6CwZuAi9EWyP86kgNE4PhAKT7FQNNQYmfELH4i1LDAo2opwMhwskFMxJKnDTJPwyOaD76Y9t7OFlHDJpcdHOwQ9cjWN3BlqLXjNQwAZTV7ohxusDm6dG+4cTFNCJ3cZiPOwbyjHgeKES6G3OsWov73n+K2bac9oThV6LL9qK9k3izFgGy/nJbBC/NfctmZ75YlqjV49ffbnTvIEU7eR5ma/cCDYDt20GyJ12AIhnIemLMwyIibDfQRoqAS4Zt9RioaIOHC5t8baUIDxvNlCzVXYz8 X-MS-Exchange-AntiSpam-MessageData: k8GZNfj5wuEMhq+1w4V1UN1apkG8sgXQ+qWypwSda0keCyfEnpA7+LcVKACcblvPU1Gly0YtxK7cmYfYL154GPZ2EI3TI92qLSxuB6MN1ECbsFtMHc/rXfbsNeBc7aW40xASUeFM+GnZ2peMj6g4xg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a8eb7d5-d41b-4735-544b-08d7cfe6c5f8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 11:30:36.9346 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5zyg9A1NrM5tg0Sw1X7T3Uv31YBjRk5Mdw//k8QlZRELfg7f0p0TaQRdTGPC5Sadm3NQiijwxuJR35+G2JIm5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5960 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Makarand Pawagi ACPI support is added in the fsl-mc driver. Driver will parse MC DSDT table to extract memory and other resorces. Interrupt (GIC ITS) information will be extracted from MADT table by drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c. IORT table will be parsed to configure DMA. Signed-off-by: Makarand Pawagi --- drivers/bus/fsl-mc/fsl-mc-bus.c | 35 ++++++----- drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c | 69 ++++++++++++++++++++- 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c index a3d25c1d4ff8..fbd248597e88 100644 --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -952,7 +952,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) phys_addr_t mc_portal_phys_addr; u32 mc_portal_size; struct mc_version mc_version; - struct resource res; + struct resource *plat_res; mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); if (!mc) @@ -963,16 +963,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) /* * Get physical address of MC portal for the root DPRC: */ - error = of_address_to_resource(pdev->dev.of_node, 0, &res); - if (error < 0) { - dev_err(&pdev->dev, - "of_address_to_resource() failed for %pOF\n", - pdev->dev.of_node); - return error; - } - - mc_portal_phys_addr = res.start; - mc_portal_size = resource_size(&res); + plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + mc_portal_phys_addr = plat_res->start; + mc_portal_size = resource_size(plat_res); error = fsl_create_mc_io(&pdev->dev, mc_portal_phys_addr, mc_portal_size, NULL, FSL_MC_IO_ATOMIC_CONTEXT_PORTAL, &mc_io); @@ -989,11 +982,13 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) dev_info(&pdev->dev, "MC firmware version: %u.%u.%u\n", mc_version.major, mc_version.minor, mc_version.revision); - error = get_mc_addr_translation_ranges(&pdev->dev, - &mc->translation_ranges, - &mc->num_translation_ranges); - if (error < 0) - goto error_cleanup_mc_io; + if (dev_of_node(&pdev->dev)) { + error = get_mc_addr_translation_ranges(&pdev->dev, + &mc->translation_ranges, + &mc->num_translation_ranges); + if (error < 0) + goto error_cleanup_mc_io; + } error = dprc_get_container_id(mc_io, 0, &container_id); if (error < 0) { @@ -1020,6 +1015,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) goto error_cleanup_mc_io; mc->root_mc_bus_dev = mc_bus_dev; + mc_bus_dev->dev.fwnode = pdev->dev.fwnode; return 0; error_cleanup_mc_io: @@ -1053,11 +1049,18 @@ static const struct of_device_id fsl_mc_bus_match_table[] = { MODULE_DEVICE_TABLE(of, fsl_mc_bus_match_table); +static const struct acpi_device_id fsl_mc_bus_acpi_match_table[] = { + {"NXP0008", 0 }, + { } +}; +MODULE_DEVICE_TABLE(acpi, fsl_mc_bus_acpi_match_table); + static struct platform_driver fsl_mc_bus_driver = { .driver = { .name = "fsl_mc_bus", .pm = NULL, .of_match_table = fsl_mc_bus_match_table, + .acpi_match_table = fsl_mc_bus_acpi_match_table, }, .probe = fsl_mc_bus_probe, .remove = fsl_mc_bus_remove, diff --git a/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c index 606efa64adff..6d67834722c9 100644 --- a/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c @@ -4,9 +4,11 @@ * * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. * Author: German Rivera + * Copyright 2020 NXP * */ +#include #include #include #include @@ -66,7 +68,65 @@ static const struct of_device_id its_device_id[] = { {}, }; -static int __init its_fsl_mc_msi_init(void) +static int __init its_fsl_mc_msi_init_one(struct fwnode_handle *handle, + const char *name) +{ + struct irq_domain *parent; + struct irq_domain *mc_msi_domain; + + parent = irq_find_matching_fwnode(handle, DOMAIN_BUS_NEXUS); + if (!parent || !msi_get_domain_info(parent)) { + pr_err("%s: Unable to locate ITS domain\n", name); + return -ENXIO; + } + + mc_msi_domain = fsl_mc_msi_create_irq_domain(handle, + &its_fsl_mc_msi_domain_info, + parent); + if (!mc_msi_domain) + pr_err("ACPIF: unable to create fsl-mc domain\n"); + + pr_info("fsl-mc MSI: domain created\n"); + + return 0; +} + +static int __init +its_fsl_mc_msi_parse_madt(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_madt_generic_translator *its_entry; + struct fwnode_handle *dom_handle; + const char *node_name; + int err = -ENXIO; + + its_entry = (struct acpi_madt_generic_translator *)header; + node_name = kasprintf(GFP_KERNEL, "ITS@0x%lx", + (long)its_entry->base_address); + + dom_handle = iort_find_domain_token(its_entry->translation_id); + if (!dom_handle) { + pr_err("%s: Unable to locate ITS domain handle\n", node_name); + goto out; + } + + err = its_fsl_mc_msi_init_one(dom_handle, node_name); + if (!err) + pr_info("fsl-mc MSI: %s domain created\n", node_name); + +out: + kfree(node_name); + return err; +} + +static int __init its_fsl_mc_acpi_msi_init(void) +{ + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, + its_fsl_mc_msi_parse_madt, 0); + return 0; +} + +static int __init its_fsl_mc_of_msi_init(void) { struct device_node *np; struct irq_domain *parent; @@ -100,4 +160,11 @@ static int __init its_fsl_mc_msi_init(void) return 0; } +static int __init its_fsl_mc_msi_init(void) +{ + its_fsl_mc_of_msi_init(); + its_fsl_mc_acpi_msi_init(); + + return 0; +} early_initcall(its_fsl_mc_msi_init); From patchwork Tue Mar 24 11:30:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurentiu Tudor X-Patchwork-Id: 11455229 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 E6F9F174A for ; Tue, 24 Mar 2020 11:30:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0587208C3 for ; Tue, 24 Mar 2020 11:30:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="LvZ2b4I1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbgCXLas (ORCPT ); Tue, 24 Mar 2020 07:30:48 -0400 Received: from mail-vi1eur05on2076.outbound.protection.outlook.com ([40.107.21.76]:6104 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727272AbgCXLap (ORCPT ); Tue, 24 Mar 2020 07:30:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nu6qHAModcbzc7GFiK8R7Y0JVcwZGpPEPBbMHgBHxJUCa4HOQ62cWPVBfDOpzyi2b6+8gYkqmG0pAV/qSXvaqPZ9BoW6ac19dHmGicB78K2Ev4r1CzB/R5eYKFWx5J9FKb3u/yIBl6P8qr4L1sWiI4HqifrJkCc+ITdIEKMRYclwYBYVCtd8HcnsqTNsXsHIPhp4Ys8MgtK3IFtBO0HlWYViDaDbJ4QVSuxqKhYoLp9w6EgBuSS4IeFl0zj0zmiYBJ1XcErs9LDV5AGCyG03bGJK4KoFMDgORh2TSCa6EDfG2bJ4vX290uPKwfQnPPbvOjnAAwsml8wpiy/0/7qFVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jLlmxo3F4Gx/ZLPQd1vZdy7uzn9E1hqWbQUmSJHTuto=; b=L5VKEDN4ufQRRTWbJMCFiDSTz/vjDVkYTKhuBO85sdRBurf1urykidcMsICHDPW+3sAleokomXgIQhpSRyMVcYJYaIqaVW74zDihJfmibHG4quvkUvwIk9HIe8q/JRM5leQRTpHV0OxkL4qZrSo/raNgrxBuGONe6kFeFUNllWnAyXvHWJnVqE2a1uSSps/aDGxOLP+ckwmO4V9V9VvYbaC/7lRPd1uheSyPQJcr/F2qgMr05h0ldbAY6WBp2NZkNwUKLJ66EZKJbTTQnJ6eI+Q19ylp/bFx9WrNQRqOWLv3JL3smd0jPk/gkpZGVnCT4FwnSXIlHS97QnVlcvTERg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jLlmxo3F4Gx/ZLPQd1vZdy7uzn9E1hqWbQUmSJHTuto=; b=LvZ2b4I1/uVU6wxK3XG1vSRwiAqHCCFl93Hb+2nB8swADLl04+B43FMijrBTwZ73LiIhyhUBmyXQvmsc104Fe3nJLyMPeeu0WRVBhrCZ6P+C/rkLIBnG6LzU4IM30eaIitbIPypu6mLVLDOIyQK/cMuMU2pho6CmE7ZNuuHErA4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; Received: from AM6PR04MB5925.eurprd04.prod.outlook.com (20.179.2.147) by AM6PR04MB5960.eurprd04.prod.outlook.com (20.178.92.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Tue, 24 Mar 2020 11:30:38 +0000 Received: from AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e]) by AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e%5]) with mapi id 15.20.2835.023; Tue, 24 Mar 2020 11:30:38 +0000 From: laurentiu.tudor@nxp.com To: robin.murphy@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Cc: ard.biesheuvel@linaro.org, ioana.ciornei@nxp.com, diana.craciun@oss.nxp.com, maz@kernel.org, jon@solid-run.com, pankaj.bansal@nxp.com, makarand.pawagi@nxp.com, calvin.johnson@nxp.com, V.Sethi@nxp.com, cristian.sovaiala@nxp.com, Stuart.Yoder@arm.com, jeremy.linton@arm.com, joro@8bytes.org, tglx@linutronix.de, jason@lakedaemon.net, Laurentiu Tudor Subject: [RFC PATCH v2 4/4] iommu/of: get rid of fsl-mc specific code Date: Tue, 24 Mar 2020 13:30:23 +0200 Message-Id: <20200324113023.322-5-laurentiu.tudor@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200324113023.322-1-laurentiu.tudor@nxp.com> References: <20200324113023.322-1-laurentiu.tudor@nxp.com> X-ClientProxiedBy: AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) To AM6PR04MB5925.eurprd04.prod.outlook.com (2603:10a6:20b:ab::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fsr-ub1864-101.ea.freescale.net (89.37.124.34) by AM0PR06CA0036.eurprd06.prod.outlook.com (2603:10a6:208:ab::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18 via Frontend Transport; Tue, 24 Mar 2020 11:30:37 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [89.37.124.34] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c3835b02-cca2-4989-c465-08d7cfe6c6ba X-MS-TrafficTypeDiagnostic: AM6PR04MB5960:|AM6PR04MB5960: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 03524FBD26 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(39860400002)(346002)(396003)(366004)(66476007)(6486002)(66556008)(66946007)(6512007)(2906002)(9686003)(478600001)(81166006)(8676002)(186003)(16526019)(81156014)(26005)(52116002)(8936002)(6506007)(1076003)(7416002)(2616005)(5660300002)(956004)(4326008)(6666004)(36756003)(86362001)(316002)(26583001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB5960;H:AM6PR04MB5925.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jprZlMPOlQpD9VWfoltab5EXeP6bdDQwY0YASstvjwzGpmJB7C9N0ISjKYV0W0htCwnHaxybkiBs7P+F/GCTRjx2JzxM2ysIJZolbgbQ8y6fUapT2Jy4nEcE29dB8NsEgjkSK8Omb0Y3VzBw0628yRTZU91iDLqvTPfvNbqGlRV7w74x5TGHXzhhf13wx6wl/SuNaUccO1AfIUCGDpQyEcIWEse2UgxU6UF1w6li8lQAY3YDKZPhgkGVZ99gJA0TW2F7FcmMznicD06iAXiKuvkZbPb7Qrcp8A2KkUPO5jQQkmPq1d3yNPckNbYRXdL5xPbmA1A5QeBCoApP5lmfjgzYjSPfIpWYJjZDCkOMLCyAApjwqYih5ZMYrWKIdYdefMmMvZBkET5E2uAZWpk7h8o9wt1fI7+tWQmNNQ4/PJxIGq0s0waDv65t9ZbUO3BXXbKxZ059fIrqPZpwPCUOAWOCiUTxgIycHzqQiOrkaYGsEKZev39PAQxxwdIbywoi X-MS-Exchange-AntiSpam-MessageData: joCfkiIEpH/jZf9b5dOKaRl0IjWZal71mb2WT0Tm+6NPnBWMbbmHtKUFbbui1jLEhMtDrfEZnUPLsUg+SbxTSlrJ3sXKs+Zg4Q3rjJPvRIdqgnBfViCD2kaLSGdbBNrxYr6TytDfqtMBiofSstiFzw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3835b02-cca2-4989-c465-08d7cfe6c6ba X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2020 11:30:38.2059 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: whkgTZ+FC6C/qgiOtKb6moU+0rq7TWFJejOvJeAIQb6Nh0HU98S9DRUgCIWXa3fwSQ60wZpBhdL2v3c1SgpZWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5960 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Laurentiu Tudor Changing the way we configure dma for fsl-mc devices allows us to get rid of our fsl-mc specific code in the generic of iommu code. Signed-off-by: Laurentiu Tudor --- drivers/iommu/of_iommu.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 20738aacac89..332072ada474 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -15,7 +15,6 @@ #include #include #include -#include #define NO_IOMMU 1 @@ -139,23 +138,6 @@ static int of_pci_iommu_init(struct pci_dev *pdev, u16 alias, void *data) return err; } -static int of_fsl_mc_iommu_init(struct fsl_mc_device *mc_dev, - struct device_node *master_np) -{ - struct of_phandle_args iommu_spec = { .args_count = 1 }; - int err; - - err = of_map_rid(master_np, mc_dev->icid, "iommu-map", - "iommu-map-mask", &iommu_spec.np, - iommu_spec.args); - if (err) - return err == -ENODEV ? NO_IOMMU : err; - - err = of_iommu_xlate(&mc_dev->dev, &iommu_spec); - of_node_put(iommu_spec.np); - return err; -} - const struct iommu_ops *of_iommu_configure(struct device *dev, struct device_node *master_np) { @@ -188,8 +170,6 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, pci_request_acs(); err = pci_for_each_dma_alias(to_pci_dev(dev), of_pci_iommu_init, &info); - } else if (dev_is_fsl_mc(dev)) { - err = of_fsl_mc_iommu_init(to_fsl_mc_device(dev), master_np); } else { struct of_phandle_args iommu_spec; int idx = 0;