From: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Cc: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
Bjorn Helgaas <bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
nsekhar-l0cyMroinI0@public.gmane.org
Subject: [PATCH] of: Devices with pci_epf_bus_type require DMA configuration
Date: Wed, 11 Oct 2017 13:30:41 +0530 [thread overview]
Message-ID: <20171011080041.12918-1-kishon@ti.com> (raw)
pci-epc-core.c invokes of_dma_configure in order to configure
the coherent_dma_mask/dma_mask of endpoint function device. This is
required for dma_alloc_coherent to succeed in pci function driver
(pci-epf-test.c). However after
commit 723288836628bc1c08 ("of: restrict DMA configuration"),
of_dma_configure doesn't configure the coherent_dma_mask/dma_mask
of endpoint function device (since it doesn't have dma-ranges
property), resulting in dma_alloc_coherent in pci endpoint function
driver to to fail. Fix it by making sure of_dma_configure configures
coherent_dma_mask/dma_mask irrespective of whether the node has
dma-ranges property or not.
Fixes: 723288836628bc1c08 ("of: restrict DMA configuration")
Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
---
drivers/of/device.c | 4 +++-
drivers/pci/endpoint/pci-epf-core.c | 3 +--
include/linux/pci-epf.h | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 64b710265d39..881cf80a3d69 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -10,6 +10,7 @@
#include <linux/mod_devicetable.h>
#include <linux/slab.h>
#include <linux/pci.h>
+#include <linux/pci-epf.h>
#include <linux/platform_device.h>
#include <linux/amba/bus.h>
@@ -105,7 +106,8 @@ int of_dma_configure(struct device *dev, struct device_node *np)
#ifdef CONFIG_ARM_AMBA
dev->bus != &amba_bustype &&
#endif
- dev->bus != &platform_bus_type)
+ dev->bus != &platform_bus_type &&
+ dev->bus != &pci_epf_bus_type)
return ret == -ENODEV ? 0 : ret;
dma_addr = offset = 0;
diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index ae1611a62808..6f354ec6be71 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -26,7 +26,6 @@
#include <linux/pci-epf.h>
#include <linux/pci-ep-cfs.h>
-static struct bus_type pci_epf_bus_type;
static const struct device_type pci_epf_type;
/**
@@ -344,7 +343,7 @@ static int pci_epf_device_remove(struct device *dev)
return ret;
}
-static struct bus_type pci_epf_bus_type = {
+struct bus_type pci_epf_bus_type = {
.name = "pci-epf",
.match = pci_epf_device_match,
.probe = pci_epf_device_probe,
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 60d551a9a1ba..83a3fb7e6ac1 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -16,6 +16,7 @@
#include <linux/mod_devicetable.h>
#include <linux/pci.h>
+extern struct bus_type pci_epf_bus_type;
struct pci_epf;
enum pci_barno {
--
2.11.0
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2017-10-11 8:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 8:00 Kishon Vijay Abraham I [this message]
2017-10-11 13:07 ` [PATCH] of: Devices with pci_epf_bus_type require DMA configuration Rob Herring
[not found] ` <20171011080041.12918-1-kishon-l0cyMroinI0@public.gmane.org>
2017-10-11 16:45 ` Robin Murphy
[not found] ` <cae4b8e9-9944-6482-c12c-8ce87aea1487-5wv7dgnIgG8@public.gmane.org>
2017-10-23 5:43 ` Kishon Vijay Abraham I
2017-10-23 6:31 ` Christoph Hellwig
2017-10-23 13:05 ` Robin Murphy
[not found] ` <037082e6-5abe-daf9-47aa-9586a4aead99-5wv7dgnIgG8@public.gmane.org>
2017-10-24 5:43 ` Kishon Vijay Abraham I
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171011080041.12918-1-kishon@ti.com \
--to=kishon-l0cymroini0@public.gmane.org \
--cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hch-jcswGhMUV9g@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=nsekhar-l0cyMroinI0@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).