From patchwork Fri Mar 30 07:54:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 10317327 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 52D0260383 for ; Fri, 30 Mar 2018 07:55:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 495082A565 for ; Fri, 30 Mar 2018 07:55:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DBB22A466; Fri, 30 Mar 2018 07:55:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 336CC2A466 for ; Fri, 30 Mar 2018 07:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750927AbeC3Hzh (ORCPT ); Fri, 30 Mar 2018 03:55:37 -0400 Received: from mail-eopbgr10087.outbound.protection.outlook.com ([40.107.1.87]:25740 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750831AbeC3Hzd (ORCPT ); Fri, 30 Mar 2018 03:55:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5CF1MtVejoSfpwbDanFYmD8QjuYv4IMRof26woZQ1os=; b=oGqONPX1rXkYXCmyuRyg5OFUv6+FYY9kKRwmUxcszCUvhxkDx808Ow5f9WJfR87lrgqpWGKGkr7XxUVfx6DcgpmFAv3SNuZnTnZSKfagK6+CqmEcgOh1L1OQZBgYJtBTj2odB1CaviwbZ9hwjnOr+XKQgvyndrU03AR2dMXft9M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by HE1PR0401MB2426.eurprd04.prod.outlook.com (2603:10a6:3:25::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Fri, 30 Mar 2018 07:55:21 +0000 From: Nipun Gupta To: robin.murphy@arm.com, hch@lst.de, linux@armlinux.org.uk, gregkh@linuxfoundation.org, m.szyprowski@samsung.com Cc: bhelgaas@google.com, zajec5@gmail.com, andy.gross@linaro.org, david.brown@linaro.org, dan.j.williams@intel.com, vinod.koul@intel.com, thierry.reding@gmail.com, robh+dt@kernel.org, frowand.list@gmail.com, jarkko.sakkinen@linux.intel.com, rafael.j.wysocki@intel.com, dmitry.torokhov@gmail.com, johan@kernel.org, msuchanek@suse.de, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, bharat.bhushan@nxp.com, leoyang.li@nxp.com, Nipun Gupta Subject: [PATCH v3 2/2] drivers: remove force dma flag from buses Date: Fri, 30 Mar 2018 13:24:45 +0530 Message-Id: <1522396485-10248-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522396485-10248-1-git-send-email-nipun.gupta@nxp.com> References: <1520868292-2479-1-git-send-email-nipun.gupta@nxp.com> <1522396485-10248-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::27) To HE1PR0401MB2426.eurprd04.prod.outlook.com (2603:10a6:3:25::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: de1ecec9-c513-4caf-0703-08d596139a0d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0401MB2426; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2426; 3:Synvh4c78bSKK9SvCr8di7mwI51p66K6L0Xxi7CN1xR6lLCwaAIxAIWwAde4HPvZuF046n047Kb6Jz3Y6zPxJuNCFsCYqf4xiFNiTtJn4mDErn46BO1lxecPjclTt69OOxnjuhRX3xiQq2V/un3AU6kd3Gix0fzywrjw2p0l9f9u3th2qmbvJj40hJxFItS00aZAsIErKXlF3OhZNhAij85OVH6S39zRkpJwpXzVpNuFV9GkU2wSISdn5xeoSVXV; 25:AV80DYt3UlioPPP1bPS5zICCRFwPEPdY8MTFW6mkrPGyU+8SyZDVGQoGI2GNOjbcamYAOd3s4NgJaKGMqZNp2yoLIuXcXcxb0QKW4sKqDk8kGnqSy/XBYNvq7z9GVwzR++rP8/+OflsyDhlGway9E1+sPc+DteGuF1G14kj5fj35pkp15jV/CWqu/ywwl7aFvaAifjxROUyMuVqzz7sycQD01s7NZsT0/i7JcpegTY2Y2SGnokI41d2OA6RsCTH+AT4nwugWs6O6bweleqoZPwc96Ymtm6iNj/qW9WZI89jODSxH6iAZQ6/Tn2YhkXwkfgO30vWlFDSeZaGdk0m+jg==; 31:zJBQW7QCHej3jifduf57bUEqxbqWI9jh86oPopZls2t4zgHEC0Be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DA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:HE1PR0401MB2426; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0401MB2426; X-Forefront-PRVS: 06274D1C43 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(39380400002)(396003)(366004)(376002)(199004)(189003)(68736007)(50466002)(86362001)(7416002)(6116002)(2906002)(16586007)(66066001)(305945005)(6666003)(7736002)(316002)(3846002)(48376002)(5009440100003)(97736004)(186003)(16526019)(486005)(6486002)(8676002)(6512007)(8936002)(50226002)(81166006)(81156014)(476003)(956004)(486005)(2616005)(11346002)(53936002)(446003)(47776003)(5660300001)(106356001)(478600001)(25786009)(39060400002)(105586002)(6506007)(59450400001)(55236004)(386003)(4326008)(36756003)(76176011)(51416003)(26005)(52116002)(110426004)(357404004); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0401MB2426; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0401MB2426; 23:XLZWX2K9+6xHD7MPISbOsMfNiH9pZPgwupw6hcW?= =?us-ascii?Q?tUvjovaAOhLJsQGO19fFVYOBVhJQ0EjpTEW8wMTzarbyXrOG6Z8DFu5j3xzn?= =?us-ascii?Q?flprNMaUGZ2JEtedjb1UrdzRL6lzXjq2YE2zASB9LQNjhz+vqprcmkwiZZHE?= =?us-ascii?Q?fMuKTsO2fwa/LG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1c?= =?us-ascii?Q?6hV41Tb4RVJjIur5yii5kYt86nzlFHyt0/ZJA6EIvLUgkpgai2mrPq8uvto9?= =?us-ascii?Q?OoxCzTdNUXuX/chNe9SImGRRKYzAZORNmj1PmfV04RSA0uCzGxjbI5GnXczA?= =?us-ascii?Q?3HtWR9rCgWHksWh53l1zyqUV2xB882GFxAPkSqLwNfxU2jiInCK9Smsz/LLg?= =?us-ascii?Q?jPn7T/HQVXnbfXCGoperPugA42TK9YA9iT7FmSNcKG8TLB5GTubjkTrABJPP?= =?us-ascii?Q?ykNlsvmSZfC8MJpCtLiW+iznypt+uVXB25wpLMNHoUNI7kEiMpEPh3HYf400?= =?us-ascii?Q?NSnziNw=3D=3D?= X-Microsoft-Antispam-Message-Info: PyettY3SapV9gtZCNXmqkwyLA5AnZ1FvLupFVnwZ8BxPK8BzW/ibzZc9wNxpwA5uo9Hml2+ceQ4zvj9DRaF61WECn2CUiDfYIhoEJQ6o2QfpU6MiwwIpnB52Qn2YQTCx4jmZdLLwjrmmj49dn/jH6ug1fXeqUiP92FFakZkKsNAmhUDWsNrNNciHXKliGHhO X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2426; 6:heJ8PCZo8QO+VYPGQGen2LuFOcQAXuR9KlUzKm1cYsD4nkOz/MZkRm8SALLqgzRJ5ulN7PaQGWnZjzcsoiAqwVlrNT4oYteXjgfN+jCCqXBth3H2n31K11VjyTJRL9DvkX28N5DjBDKHyn3OixjoO8VNjXoSO7080MUDlr0CpLlu2+3Cpyuco5d1zW1Se31gcQ03U9xN/m9nW9AiRent1PCLkslA9fLj/K12fkvDHL7AhELnOCLDE8/znmDhkHUkdDSI/Sc1EyezVMaW7VZNDu9UturEEMXP1jqZCio1SswltIlfWtSWuY4MMVoRiiq74Ie5ByMGTl8cK1FgiWyG8Oo0mPXszuS9xXvNytI4QDKkbAXZjQr1VVEmwr0hZRc+fBbFB1oN4/gGAwQwwZVLsYbqm/BRDPYwEteUtVWDYODxaJR9dDM0wXxsBsHXvzZJkbQBt1ktcAuN/tVALSZbDg==; 5:XiLcJl8dGUStuD4ZDW3kx9/0npWeOGa9JmAqwvMC7M3HABGO5PEZAUBQ12TVkRWEI1nnQFxwNOc5GLR4TNfi1lElQKI8gfpxv7osemfWw5r90UE5VJ+Y6Gquj21I+9O5fctjUDWuft7SQWxyf/8hh5IT6WBDPHps0ps6JouoNwk=; 24:FIT112lGk1xefREDOpXCOKcH+7iAbNASdsjuSkx2Kwy6V+1W79RjDd1z0cp/x01stOefsDDtKPFBV/k20u3kEC7kGD6lH0xMgOFvwHn5Kt4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0401MB2426; 7:2Mc0pdOc02FbCjGkO9LQz+nkVjh4ZKbzkuxn4+xmDSlwY4i2wYSUqql7jEcVDZHbsqW2peaPEIc4nIoOLC9vqERKqJ37r01VZUrun77acPsi0TcZtrzIcKwl95Uv3sO0nG7AzdeZ8+gRvtZe/01JGMSvVxcbGw8Fcjb9PcLQmRCz7DjC4MFu+wXio9jjO+IVKE5McmNB9zuMKiALjNoFPxft2bBjNl9hYMD/R0go+m4HYodFbKgs0cKMTTzzXcRy X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2018 07:55:21.4477 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de1ecec9-c513-4caf-0703-08d596139a0d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2426 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With each bus implementing its own DMA configuration callback, there is no need for bus to explicitly have force_dma in its global structure. This patch modifies of_dma_configure API to accept an input parameter which specifies if implicit DMA configuration is required even when it is not described by the firmware. Signed-off-by: Nipun Gupta Reviewed-by: Rob Herring Acked-by: Bjorn Helgaas # PCI parts --- Changes in v2: - This is a new change suggested by Robin and Christoph and is added to the series. Changes in v3: - Rebase and changes corresponding to the changes in patch 1/2 drivers/amba/bus.c | 1 - drivers/base/platform.c | 3 +-- drivers/bcma/main.c | 2 +- drivers/dma/qcom/hidma_mgmt.c | 2 +- drivers/gpu/host1x/bus.c | 5 ++--- drivers/of/device.c | 6 ++++-- drivers/of/of_reserved_mem.c | 2 +- drivers/pci/pci-driver.c | 3 +-- include/linux/device.h | 4 ---- include/linux/of_device.h | 8 ++++++-- 10 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 867dc2b..abe73c4 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -199,7 +199,6 @@ struct bus_type amba_bustype = { .uevent = amba_uevent, .dma_configure = platform_dma_configure, .pm = &amba_pm, - .force_dma = true, }; static int __init amba_init(void) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 72fdbf6..cfbc569 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1136,7 +1136,7 @@ int platform_dma_configure(struct device *dev) int ret = 0; if (dev->of_node) { - ret = of_dma_configure(dev, dev->of_node); + ret = of_dma_configure(dev, dev->of_node, true); } else if (has_acpi_companion(dev)) { attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); if (attr != DEV_DMA_NOT_SUPPORTED) @@ -1159,7 +1159,6 @@ struct bus_type platform_bus_type = { .uevent = platform_uevent, .dma_configure = platform_dma_configure, .pm = &platform_dev_pm_ops, - .force_dma = true, }; EXPORT_SYMBOL_GPL(platform_bus_type); diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index e6986c7..fc1f4ac 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -207,7 +207,7 @@ static void bcma_of_fill_device(struct device *parent, core->irq = bcma_of_get_irq(parent, core, 0); - of_dma_configure(&core->dev, node); + of_dma_configure(&core->dev, node, false); } unsigned int bcma_core_irq(struct bcma_device *core, int num) diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c index 000c7019..d64edeb 100644 --- a/drivers/dma/qcom/hidma_mgmt.c +++ b/drivers/dma/qcom/hidma_mgmt.c @@ -398,7 +398,7 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np) } of_node_get(child); new_pdev->dev.of_node = child; - of_dma_configure(&new_pdev->dev, child); + of_dma_configure(&new_pdev->dev, child, true); /* * It is assumed that calling of_msi_configure is safe on * platforms with or without MSI support. diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index a9ec99d..b39c1e9 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -317,7 +317,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv) static int host1x_dma_configure(struct device *dev) { if (dev->of_node) - return of_dma_configure(dev, dev->of_node); + return of_dma_configure(dev, dev->of_node, true); return 0; } @@ -335,7 +335,6 @@ struct bus_type host1x_bus_type = { .match = host1x_device_match, .dma_configure = host1x_dma_configure, .pm = &host1x_device_pm_ops, - .force_dma = true, }; static void __host1x_device_del(struct host1x_device *device) @@ -424,7 +423,7 @@ static int host1x_device_add(struct host1x *host1x, device->dev.bus = &host1x_bus_type; device->dev.parent = host1x->dev; - of_dma_configure(&device->dev, host1x->dev->of_node); + of_dma_configure(&device->dev, host1x->dev->of_node, true); err = host1x_device_parse_dt(device, driver); if (err < 0) { diff --git a/drivers/of/device.c b/drivers/of/device.c index 064c818..33d8551 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -76,6 +76,8 @@ int of_device_add(struct platform_device *ofdev) * of_dma_configure - Setup DMA configuration * @dev: Device to apply DMA configuration * @np: Pointer to OF node having DMA configuration + * @force_dma: Whether device is to be set up by of_dma_configure() even if + * DMA capability is not explicitly described by firmware. * * Try to get devices's DMA configuration from DT and update it * accordingly. @@ -84,7 +86,7 @@ int of_device_add(struct platform_device *ofdev) * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events * to fix up DMA configuration. */ -int of_dma_configure(struct device *dev, struct device_node *np) +int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) { u64 dma_addr, paddr, size = 0; int ret; @@ -100,7 +102,7 @@ int of_dma_configure(struct device *dev, struct device_node *np) * DMA configuration regardless of whether "dma-ranges" is * correctly specified or not. */ - if (!dev->bus->force_dma) + if (!force_dma) return ret == -ENODEV ? 0 : ret; dma_addr = offset = 0; diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 9a4f4246..895c83e 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -353,7 +353,7 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, /* ensure that dma_ops is set for virtual devices * using reserved memory */ - of_dma_configure(dev, np); + of_dma_configure(dev, np, true); dev_info(dev, "assigned reserved memory node %s\n", rmem->name); } else { diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 78e507f..27c832f 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1540,7 +1540,7 @@ static int pci_dma_configure(struct device *dev) if (IS_ENABLED(CONFIG_OF) && bridge->parent && bridge->parent->of_node) { - ret = of_dma_configure(dev, bridge->parent->of_node); + ret = of_dma_configure(dev, bridge->parent->of_node, true); } else if (has_acpi_companion(bridge)) { struct acpi_device *adev = to_acpi_device_node(bridge->fwnode); enum dev_dma_attr attr = acpi_get_dma_attr(adev); @@ -1566,7 +1566,6 @@ struct bus_type pci_bus_type = { .pm = PCI_PM_OPS_PTR, .num_vf = pci_bus_num_vf, .dma_configure = pci_dma_configure, - .force_dma = true, }; EXPORT_SYMBOL(pci_bus_type); diff --git a/include/linux/device.h b/include/linux/device.h index 1832d90..92c530e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -98,8 +98,6 @@ extern int __must_check bus_create_file(struct bus_type *, * @p: The private data of the driver core, only the driver core can * touch this. * @lock_key: Lock class key for use by the lock validator - * @force_dma: Assume devices on this bus should be set up by dma_configure() - * even if DMA capability is not explicitly described by firmware. * * A bus is a channel between the processor and one or more devices. For the * purposes of the device model, all devices are connected via a bus, even if @@ -140,8 +138,6 @@ struct bus_type { struct subsys_private *p; struct lock_class_key lock_key; - - bool force_dma; }; extern int __must_check bus_register(struct bus_type *bus); diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 8da5a1b..165fd30 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -55,7 +55,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) return of_node_get(cpu_dev->of_node); } -int of_dma_configure(struct device *dev, struct device_node *np); +int of_dma_configure(struct device *dev, + struct device_node *np, + bool force_dma); void of_dma_deconfigure(struct device *dev); #else /* CONFIG_OF */ @@ -105,7 +107,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu) return NULL; } -static inline int of_dma_configure(struct device *dev, struct device_node *np) +static inline int of_dma_configure(struct device *dev, + struct device_node *np, + bool force_dma) { return 0; }