lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210811153619.88922-2-boqun.feng@gmail.com>
Date:   Wed, 11 Aug 2021 23:36:15 +0800
From:   Boqun Feng <boqun.feng@...il.com>
To:     Lorenzo Pieralisi <lorenzo.pieralisi@....com>
Cc:     Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        "K. Y. Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
        Rob Herring <robh@...nel.org>,
        Krzysztof WilczyƄski <kw@...ux.com>,
        Boqun Feng <boqun.feng@...il.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-pci@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-hyperv@...r.kernel.org,
        Sunil Muthuswamy <sunilmut@...rosoft.com>,
        Marc Zyngier <maz@...nel.org>, Arnd Bergmann <arnd@...db.de>
Subject: [RFC 1/5] PCI: Introduce pci_create_root_bus_priv()

In order to allow root bus creation to populate the ->private of the
pci_host_bridge at the same, pci_create_root_bus_priv() is introduced.
The new function will be used to support passing the corresponding ACPI
device as the ->private field when creating the PCI root bus.

No functional change.

Signed-off-by: Boqun Feng <boqun.feng@...il.com>
---
 drivers/pci/probe.c | 15 ++++++++++++---
 include/linux/pci.h |  3 +++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ea7f2a57e2f5..8f5fea2a7bd9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2991,13 +2991,14 @@ void __weak pcibios_remove_bus(struct pci_bus *bus)
 {
 }
 
-struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
-		struct pci_ops *ops, void *sysdata, struct list_head *resources)
+struct pci_bus *pci_create_root_bus_priv(struct device *parent, int bus,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources,
+		void *private, size_t priv_size)
 {
 	int error;
 	struct pci_host_bridge *bridge;
 
-	bridge = pci_alloc_host_bridge(0);
+	bridge = pci_alloc_host_bridge(priv_size);
 	if (!bridge)
 		return NULL;
 
@@ -3008,6 +3009,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	bridge->busnr = bus;
 	bridge->ops = ops;
 
+	if (priv_size)
+		memcpy(bridge->private, private, priv_size);
+
 	error = pci_register_host_bridge(bridge);
 	if (error < 0)
 		goto err_out;
@@ -3018,6 +3022,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 	put_device(&bridge->dev);
 	return NULL;
 }
+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_priv(parent, bus, ops, sysdata, resources, NULL, 0);
+}
 EXPORT_SYMBOL_GPL(pci_create_root_bus);
 
 int pci_host_probe(struct pci_host_bridge *bridge)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 01aa201e1df0..119356312979 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1041,6 +1041,9 @@ void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);
 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
+struct pci_bus *pci_create_root_bus_priv(struct device *parent, int bus,
+		struct pci_ops *ops, void *sysdata, struct list_head *resources,
+		void *private, size_t priv_size);
 struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
 				    struct pci_ops *ops, void *sysdata,
 				    struct list_head *resources);
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ