From: Oza Pawandeep <oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>,
Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
Oza Pawandeep
<oza.pawandeep-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Oza Pawandeep <oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: [PATCH v7 2/3] PCI: Add support for PCI inbound windows resources
Date: Mon, 22 May 2017 22:09:41 +0530 [thread overview]
Message-ID: <1495471182-12490-3-git-send-email-oza.oza@broadcom.com> (raw)
In-Reply-To: <1495471182-12490-1-git-send-email-oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
This patch adds support for inbound memory window
for PCI RC drivers.
It defines new function pci_create_root_bus2 which
takes inbound resources as an argument and fills in the
memory resource to PCI internal host bridge structure
as inbound_windows.
Legacy RC driver could continue to use pci_create_root_bus,
but any RC driver who wants to reseve IOVAS for their
inbound memory holes, should use new API pci_create_root_bus2.
Signed-off-by: Oza Pawandeep <oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 19c8950..a95b9bb 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -531,6 +531,7 @@ struct pci_host_bridge *pci_alloc_host_bridge(size_t priv)
return NULL;
INIT_LIST_HEAD(&bridge->windows);
+ INIT_LIST_HEAD(&bridge->inbound_windows);
return bridge;
}
@@ -726,6 +727,7 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
struct pci_bus *bus, *b;
resource_size_t offset;
LIST_HEAD(resources);
+ LIST_HEAD(inbound_resources);
struct resource *res;
char addr[64], *fmt;
const char *name;
@@ -739,6 +741,8 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
/* temporarily move resources off the list */
list_splice_init(&bridge->windows, &resources);
+ list_splice_init(&bridge->inbound_windows, &inbound_resources);
+
bus->sysdata = bridge->sysdata;
bus->msi = bridge->msi;
bus->ops = bridge->ops;
@@ -794,6 +798,10 @@ int pci_register_host_bridge(struct pci_host_bridge *bridge)
else
pr_info("PCI host bridge to bus %s\n", name);
+ /* Add inbound mem resource. */
+ resource_list_for_each_entry_safe(window, n, &inbound_resources)
+ list_move_tail(&window->node, &bridge->inbound_windows);
+
/* Add initial resources to the bus */
resource_list_for_each_entry_safe(window, n, &resources) {
list_move_tail(&window->node, &bridge->windows);
@@ -2300,7 +2308,8 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
static struct pci_bus *pci_create_root_bus_msi(struct device *parent,
int bus, struct pci_ops *ops, void *sysdata,
- struct list_head *resources, struct msi_controller *msi)
+ struct list_head *resources, struct list_head *in_res,
+ struct msi_controller *msi)
{
int error;
struct pci_host_bridge *bridge;
@@ -2313,6 +2322,9 @@ static struct pci_bus *pci_create_root_bus_msi(struct device *parent,
bridge->dev.release = pci_release_host_bridge_dev;
list_splice_init(resources, &bridge->windows);
+ if (in_res)
+ list_splice_init(in_res, &bridge->inbound_windows);
+
bridge->sysdata = sysdata;
bridge->busnr = bus;
bridge->ops = ops;
@@ -2329,11 +2341,20 @@ static struct pci_bus *pci_create_root_bus_msi(struct device *parent,
return NULL;
}
+struct pci_bus *pci_create_root_bus2(struct device *parent, int bus,
+ struct pci_ops *ops, void *sysdata, struct list_head *resources,
+ struct list_head *in_res)
+{
+ return pci_create_root_bus_msi(parent, bus, ops, sysdata,
+ resources, in_res, NULL);
+}
+EXPORT_SYMBOL_GPL(pci_create_root_bus2);
+
struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
struct pci_ops *ops, void *sysdata, struct list_head *resources)
{
- return pci_create_root_bus_msi(parent, bus, ops, sysdata, resources,
- NULL);
+ return pci_create_root_bus_msi(parent, bus, ops, sysdata,
+ resources, NULL, NULL);
}
EXPORT_SYMBOL_GPL(pci_create_root_bus);
@@ -2415,7 +2436,8 @@ struct pci_bus *pci_scan_root_bus_msi(struct device *parent, int bus,
break;
}
- b = pci_create_root_bus_msi(parent, bus, ops, sysdata, resources, msi);
+ b = pci_create_root_bus_msi(parent, bus, ops, sysdata,
+ resources, NULL, msi);
if (!b)
return NULL;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33c2b0b..d2df107 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -432,6 +432,7 @@ struct pci_host_bridge {
void *sysdata;
int busnr;
struct list_head windows; /* resource_entry */
+ struct list_head inbound_windows; /* inbound memory */
void (*release_fn)(struct pci_host_bridge *);
void *release_data;
struct msi_controller *msi;
--
1.9.1
--
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 prev parent reply other threads:[~2017-05-22 16:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 16:39 [PATCH v7 0/3] PCI/IOMMU: Reserve IOVAs for PCI inbound memory Oza Pawandeep via iommu
[not found] ` <1495471182-12490-1-git-send-email-oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-05-22 16:39 ` [PATCH v7 1/3] OF/PCI: Export inbound memory interface to PCI RC drivers Oza Pawandeep
2017-05-22 16:39 ` Oza Pawandeep [this message]
[not found] ` <1495471182-12490-3-git-send-email-oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-05-30 22:42 ` [PATCH v7 2/3] PCI: Add support for PCI inbound windows resources Bjorn Helgaas via iommu
2017-05-31 16:17 ` Oza Oza
[not found] ` <CAMSpPPdXbCteC7scb99CMKqdif0q9ngZnzJMhGa6xZt7BM0yKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-01 17:08 ` Bjorn Helgaas via iommu
2017-06-01 18:06 ` Oza Oza
2017-05-22 16:39 ` [PATCH v7 3/3] IOMMU/PCI: Reserve IOVA for inbound memory for PCI masters Oza Pawandeep via iommu
[not found] ` <1495471182-12490-4-git-send-email-oza.oza-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-07-19 12:07 ` Oza Oza
2017-05-22 19:18 ` [PATCH v7 0/3] PCI/IOMMU: Reserve IOVAs for PCI inbound memory Alex Williamson
[not found] ` <20170522131838.71258483-DGNDKt5SQtizQB+pC5nmwQ@public.gmane.org>
2017-05-23 5:00 ` Oza Oza via iommu
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=1495471182-12490-3-git-send-email-oza.oza@broadcom.com \
--to=oza.oza-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
--cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oza.pawandeep-Re5JQEeQqe8AvxtiuMwx3w@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).