2019-07-11 22:26:52

by Kelsey

[permalink] [raw]
Subject: [PATCH 00/11] PCI: Move symbols to drivers/pci/pci.h

Move symbols defined in include/linux/pci.h that are only used in
drivers/pci/ to drivers/pci/pci.h.

Symbols only used in drivers/pci/ do not need to be visible to the rest of
the kernel.

Kelsey Skunberg (11):
PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h
PCI: Move PME declarations to drivers/pci/pci.h
PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h
PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h
PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h
PCI: Move pci_bus_* declarations to drivers/pci/pci.h
PCI: Move pcie_update_link_speed() to drivers/pci/pci.h
PCI: Move pci_ats_init() to drivers/pci/pci.h
PCI: Move ECRC declarations to drivers/pci/pci.h
PCI: Move PTM declaration to drivers/pci/pci.h
PCI: Move pci_*_node() declarations to drivers/pci/pci.h

drivers/pci/pci.h | 48 ++++++++++++++++++++++++++++++++++++++++++---
include/linux/pci.h | 47 --------------------------------------------
2 files changed, 45 insertions(+), 50 deletions(-)

--
2.20.1


2019-07-11 22:27:05

by Kelsey

[permalink] [raw]
Subject: [PATCH 04/11] PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h

PCI Virtual Channel declarations are only called within drivers/pci/.
Since declarations do not need to be visible to the rest of the kernel,
move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 5 +++++
include/linux/pci.h | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f2ba33613c21..6ba790a77be4 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -128,6 +128,11 @@ void pci_vpd_release(struct pci_dev *dev);
void pcie_vpd_create_sysfs_dev_files(struct pci_dev *dev);
void pcie_vpd_remove_sysfs_dev_files(struct pci_dev *dev);

+/* PCI Virtual Channel */
+int pci_save_vc_state(struct pci_dev *dev);
+void pci_restore_vc_state(struct pci_dev *dev);
+void pci_allocate_vc_save_buffers(struct pci_dev *dev);
+
/* PCI /proc functions */
#ifdef CONFIG_PROC_FS
int pci_proc_attach_device(struct pci_dev *dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 39e609ea316e..2c5609b5782e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1190,11 +1190,6 @@ bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
void pci_wakeup_bus(struct pci_bus *bus);
void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state);

-/* PCI Virtual Channel */
-int pci_save_vc_state(struct pci_dev *dev);
-void pci_restore_vc_state(struct pci_dev *dev);
-void pci_allocate_vc_save_buffers(struct pci_dev *dev);
-
/* For use by arch with custom probe code */
void set_pcie_port_type(struct pci_dev *pdev);
void set_pcie_hotplug_bridge(struct pci_dev *pdev);
--
2.20.1

2019-07-11 22:27:12

by Kelsey

[permalink] [raw]
Subject: [PATCH 07/11] PCI: Move pcie_update_link_speed() to drivers/pci/pci.h

pcie_update_line_speed() is only called within drivers/pci/. Since
declaration does not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 1 +
include/linux/pci.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9b87309f5c12..59321488da03 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -295,6 +295,7 @@ u32 pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
enum pcie_link_width *width);
void __pcie_print_link_status(struct pci_dev *dev, bool verbose);
void pcie_report_downtraining(struct pci_dev *dev);
+void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);

/* Single Root I/O Virtualization */
struct pci_sriov {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 54946423d901..3221d9f61ab4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -938,7 +938,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge);
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
int busnr);
-void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
const char *name,
struct hotplug_slot *hotplug);
--
2.20.1

2019-07-11 22:27:23

by Kelsey

[permalink] [raw]
Subject: [PATCH 09/11] PCI: Move ECRC declarations to drivers/pci/pci.h

pcie_set_ecrc_checking() and pcie_ecrc_get_policy() are only called within
drivers/pci/. Since declarations do not need to be visible to the rest of
the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 8 ++++++++
include/linux/pci.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index bc677e97a262..74249c31325c 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -537,6 +537,14 @@ static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) { }
static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { }
#endif

+#ifdef CONFIG_PCIE_ECRC
+void pcie_set_ecrc_checking(struct pci_dev *dev);
+void pcie_ecrc_get_policy(char *str);
+#else
+static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
+static inline void pcie_ecrc_get_policy(char *str) { }
+#endif
+
#ifdef CONFIG_PCIE_PTM
void pci_ptm_init(struct pci_dev *dev);
#else
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 263c087b95d5..8fbe3471e8f0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1501,14 +1501,6 @@ bool pci_aer_available(void);
static inline bool pci_aer_available(void) { return false; }
#endif

-#ifdef CONFIG_PCIE_ECRC
-void pcie_set_ecrc_checking(struct pci_dev *dev);
-void pcie_ecrc_get_policy(char *str);
-#else
-static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
-static inline void pcie_ecrc_get_policy(char *str) { }
-#endif
-
bool pci_ats_disabled(void);

#ifdef CONFIG_PCIE_PTM
--
2.20.1

2019-07-11 22:27:23

by Kelsey

[permalink] [raw]
Subject: [PATCH 10/11] PCI: Move PTM declaration to drivers/pci/pci.h

pci_enable_ptm() is only called within drivers/pci/. Since declaration
does not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 7 -------
2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 74249c31325c..95bca00ea85a 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -547,8 +547,11 @@ static inline void pcie_ecrc_get_policy(char *str) { }

#ifdef CONFIG_PCIE_PTM
void pci_ptm_init(struct pci_dev *dev);
+int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
#else
static inline void pci_ptm_init(struct pci_dev *dev) { }
+static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
+{ return -EINVAL; }
#endif

struct pci_dev_reset_methods {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 8fbe3471e8f0..ea4dfb6b6693 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1503,13 +1503,6 @@ static inline bool pci_aer_available(void) { return false; }

bool pci_ats_disabled(void);

-#ifdef CONFIG_PCIE_PTM
-int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
-#else
-static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
-{ return -EINVAL; }
-#endif
-
void pci_cfg_access_lock(struct pci_dev *dev);
bool pci_cfg_access_trylock(struct pci_dev *dev);
void pci_cfg_access_unlock(struct pci_dev *dev);
--
2.20.1

2019-07-11 22:27:26

by Kelsey

[permalink] [raw]
Subject: [PATCH 11/11] PCI: Move pci_*_node() declarations to drivers/pci/pci.h

pci_*_node() is only called from drivers/pci/. Since these declarations do
not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 8 ++++++++
include/linux/pci.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 95bca00ea85a..a8d04dac3430 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -588,6 +588,10 @@ struct device_node;
int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
int of_get_pci_domain_nr(struct device_node *node);
int of_pci_get_max_link_speed(struct device_node *node);
+void pci_set_of_node(struct pci_dev *dev);
+void pci_release_of_node(struct pci_dev *dev);
+void pci_set_bus_of_node(struct pci_bus *bus);
+void pci_release_bus_of_node(struct pci_bus *bus);

#else
static inline int
@@ -607,6 +611,10 @@ of_pci_get_max_link_speed(struct device_node *node)
{
return -EINVAL;
}
+static inline void pci_set_of_node(struct pci_dev *dev) { }
+static inline void pci_release_of_node(struct pci_dev *dev) { }
+static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
+static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
#endif /* CONFIG_OF */

#if defined(CONFIG_OF_ADDRESS)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ea4dfb6b6693..cf380544c700 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2206,10 +2206,6 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
#ifdef CONFIG_OF
struct device_node;
struct irq_domain;
-void pci_set_of_node(struct pci_dev *dev);
-void pci_release_of_node(struct pci_dev *dev);
-void pci_set_bus_of_node(struct pci_bus *bus);
-void pci_release_bus_of_node(struct pci_bus *bus);
struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);
int pci_parse_request_of_pci_ranges(struct device *dev,
struct list_head *resources,
@@ -2219,10 +2215,6 @@ int pci_parse_request_of_pci_ranges(struct device *dev,
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);

#else /* CONFIG_OF */
-static inline void pci_set_of_node(struct pci_dev *dev) { }
-static inline void pci_release_of_node(struct pci_dev *dev) { }
-static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
-static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
static inline struct irq_domain *
pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }
static inline int pci_parse_request_of_pci_ranges(struct device *dev,
--
2.20.1

2019-07-11 22:27:51

by Kelsey

[permalink] [raw]
Subject: [PATCH 05/11] PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h

pci_hotplug_*_size declarations are only called within drivers/pci/pci/.
Since declarations do not need to be seen by the rest of the kernel, move
to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 4 ----
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 6ba790a77be4..ee7b7383e497 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -206,6 +206,9 @@ extern const struct attribute_group *pcibus_groups[];
extern const struct device_type pci_dev_type;
extern const struct attribute_group *pci_bus_groups[];

+extern unsigned long pci_hotplug_io_size;
+extern unsigned long pci_hotplug_mem_size;
+extern unsigned long pci_hotplug_bus_size;

/**
* pci_match_one_device - Tell if a PCI device structure has a matching
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 2c5609b5782e..ead399b8d136 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1957,10 +1957,6 @@ extern unsigned long pci_cardbus_mem_size;
extern u8 pci_dfl_cache_line_size;
extern u8 pci_cache_line_size;

-extern unsigned long pci_hotplug_io_size;
-extern unsigned long pci_hotplug_mem_size;
-extern unsigned long pci_hotplug_bus_size;
-
/* Architecture-specific versions may override these (weak) */
void pcibios_disable_device(struct pci_dev *dev);
void pcibios_set_master(struct pci_dev *dev);
--
2.20.1

2019-07-11 22:28:07

by Kelsey

[permalink] [raw]
Subject: [PATCH 06/11] PCI: Move pci_bus_* declarations to drivers/pci/pci.h

pci_bus_* declarations are only called within drivers/pci/. Since
declarations do not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ee7b7383e497..9b87309f5c12 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -270,6 +270,9 @@ bool pci_bus_clip_resource(struct pci_dev *dev, int idx);
void pci_reassigndev_resource_alignment(struct pci_dev *dev);
void pci_disable_bridge_window(struct pci_dev *dev);

+struct pci_bus *pci_bus_get(struct pci_bus *bus);
+void pci_bus_put(struct pci_bus *bus);
+
/* PCIe link information */
#define PCIE_SPEED2STR(speed) \
((speed) == PCIE_SPEED_16_0GT ? "16 GT/s" : \
diff --git a/include/linux/pci.h b/include/linux/pci.h
index ead399b8d136..54946423d901 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1233,8 +1233,6 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
void pci_release_selected_regions(struct pci_dev *, int);

/* drivers/pci/bus.c */
-struct pci_bus *pci_bus_get(struct pci_bus *bus);
-void pci_bus_put(struct pci_bus *bus);
void pci_add_resource(struct list_head *resources, struct resource *res);
void pci_add_resource_offset(struct list_head *resources, struct resource *res,
resource_size_t offset);
--
2.20.1

2019-07-11 22:28:13

by Kelsey

[permalink] [raw]
Subject: [PATCH 08/11] PCI: Move pci_ats_init() to drivers/pci/pci.h

pci_ats_init() is only called with drivers/pci/. Since declarations do not
need to be visible to the rest of the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 7 ++++---
include/linux/pci.h | 2 --
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 59321488da03..bc677e97a262 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -436,11 +436,12 @@ static inline void pci_restore_dpc_state(struct pci_dev *dev) {}
#endif

#ifdef CONFIG_PCI_ATS
+/* Address Translation Service */
+void pci_ats_init(struct pci_dev *dev);
void pci_restore_ats_state(struct pci_dev *dev);
#else
-static inline void pci_restore_ats_state(struct pci_dev *dev)
-{
-}
+static inline void pci_ats_init(struct pci_dev *d) { }
+static inline void pci_restore_ats_state(struct pci_dev *dev) { }
#endif /* CONFIG_PCI_ATS */

#ifdef CONFIG_PCI_IOV
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3221d9f61ab4..263c087b95d5 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1708,13 +1708,11 @@ static inline bool pci_ats_disabled(void) { return true; }

#ifdef CONFIG_PCI_ATS
/* Address Translation Service */
-void pci_ats_init(struct pci_dev *dev);
int pci_enable_ats(struct pci_dev *dev, int ps);
void pci_disable_ats(struct pci_dev *dev);
int pci_ats_queue_depth(struct pci_dev *dev);
int pci_ats_page_aligned(struct pci_dev *dev);
#else
-static inline void pci_ats_init(struct pci_dev *d) { }
static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
static inline void pci_disable_ats(struct pci_dev *d) { }
static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
--
2.20.1

2019-07-11 22:28:58

by Kelsey

[permalink] [raw]
Subject: [PATCH 03/11] PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h

pci_get_host_bridge_device() and pci_put_host_bridge_device() are only
called within drivers/pci/pci.h. Since declarations do not need to be visible
to the rest of the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 800fe8989f48..f2ba33613c21 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -100,6 +100,9 @@ void pci_free_cap_save_buffers(struct pci_dev *dev);
bool pci_bridge_d3_possible(struct pci_dev *dev);
void pci_bridge_d3_update(struct pci_dev *dev);

+struct device *pci_get_host_bridge_device(struct pci_dev *dev);
+void pci_put_host_bridge_device(struct device *dev);
+
static inline void pci_wakeup_event(struct pci_dev *dev)
{
/* Wait 100 ms before the system can be put into a sleep state. */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index cedebb08a32d..39e609ea316e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -639,9 +639,6 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
return dev->bus->self;
}

-struct device *pci_get_host_bridge_device(struct pci_dev *dev);
-void pci_put_host_bridge_device(struct device *dev);
-
#ifdef CONFIG_PCI_MSI
static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
{
--
2.20.1

2019-07-11 22:29:35

by Kelsey

[permalink] [raw]
Subject: [PATCH 02/11] PCI: Move PME declarations to drivers/pci/pci.h

pci_check_pme_status() and pci_pme_wakeup_bus() are only
called within drivers/pci/. Since declarations do not need to be visible
to the rest of the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 2 ++
include/linux/pci.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 7e30fbde5c84..800fe8989f48 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -85,6 +85,8 @@ void pci_power_up(struct pci_dev *dev);
void pci_disable_enabled_device(struct pci_dev *dev);
int pci_finish_runtime_suspend(struct pci_dev *dev);
void pcie_clear_root_pme_status(struct pci_dev *dev);
+bool pci_check_pme_status(struct pci_dev *dev);
+void pci_pme_wakeup_bus(struct pci_bus *bus);
int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
void pci_pme_restore(struct pci_dev *dev);
bool pci_dev_keep_suspended(struct pci_dev *dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 3bda6a87a815..cedebb08a32d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1187,8 +1187,6 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable);
int pci_prepare_to_sleep(struct pci_dev *dev);
int pci_back_from_sleep(struct pci_dev *dev);
bool pci_dev_run_wake(struct pci_dev *dev);
-bool pci_check_pme_status(struct pci_dev *dev);
-void pci_pme_wakeup_bus(struct pci_bus *bus);
void pci_d3cold_enable(struct pci_dev *dev);
void pci_d3cold_disable(struct pci_dev *dev);
bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
--
2.20.1

2019-07-11 22:39:17

by Kelsey

[permalink] [raw]
Subject: [PATCH 01/11] PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h

The #define PCI_PM_* lines are only used within drivers/pci/ and they do not
need to be seen by the rest of the kernel. Move #define PCI_* to
drivers/pci/pci.h

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 5 +++++
include/linux/pci.h | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9cb99380c61e..7e30fbde5c84 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -39,6 +39,11 @@ int pci_probe_reset_function(struct pci_dev *dev);
int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
int pci_bus_error_reset(struct pci_dev *dev);

+#define PCI_PM_D2_DELAY 200
+#define PCI_PM_D3_WAIT 10
+#define PCI_PM_D3COLD_WAIT 100
+#define PCI_PM_BUS_WAIT 50
+
/**
* struct pci_platform_pm_ops - Firmware PM callbacks
*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index dd436da7eccc..3bda6a87a815 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -145,11 +145,6 @@ static inline const char *pci_power_name(pci_power_t state)
return pci_power_names[1 + (__force int) state];
}

-#define PCI_PM_D2_DELAY 200
-#define PCI_PM_D3_WAIT 10
-#define PCI_PM_D3COLD_WAIT 100
-#define PCI_PM_BUS_WAIT 50
-
/**
* The pci_channel state describes connectivity between the CPU and
* the PCI device. If some PCI bus between here and the PCI device
--
2.20.1

2019-07-24 02:36:07

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 00/11] PCI: Move symbols to drivers/pci/pci.h

On Thu, Jul 11, 2019 at 04:23:30PM -0600, Kelsey Skunberg wrote:
> Move symbols defined in include/linux/pci.h that are only used in
> drivers/pci/ to drivers/pci/pci.h.
>
> Symbols only used in drivers/pci/ do not need to be visible to the rest of
> the kernel.
>
> Kelsey Skunberg (11):
> PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h
> PCI: Move PME declarations to drivers/pci/pci.h
> PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h
> PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h
> PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h
> PCI: Move pci_bus_* declarations to drivers/pci/pci.h
> PCI: Move pcie_update_link_speed() to drivers/pci/pci.h
> PCI: Move pci_ats_init() to drivers/pci/pci.h
> PCI: Move ECRC declarations to drivers/pci/pci.h
> PCI: Move PTM declaration to drivers/pci/pci.h
> PCI: Move pci_*_node() declarations to drivers/pci/pci.h
>
> drivers/pci/pci.h | 48 ++++++++++++++++++++++++++++++++++++++++++---
> include/linux/pci.h | 47 --------------------------------------------
> 2 files changed, 45 insertions(+), 50 deletions(-)

Hi Kelsey,

I didn't get these applied before v5.3-rc1, so now they don't apply
cleanly. Would you mind refreshing them and posting a v2 that does
apply to my "master" branch (v5.3-rc1)?

Bjorn

2019-07-24 02:36:12

by Kelsey

[permalink] [raw]
Subject: Re: [PATCH 00/11] PCI: Move symbols to drivers/pci/pci.h

On Tue, Jul 23, 2019 at 06:07:01PM -0500, Bjorn Helgaas wrote:
> On Thu, Jul 11, 2019 at 04:23:30PM -0600, Kelsey Skunberg wrote:
> > Move symbols defined in include/linux/pci.h that are only used in
> > drivers/pci/ to drivers/pci/pci.h.
> >
> > Symbols only used in drivers/pci/ do not need to be visible to the rest of
> > the kernel.
> >
> > Kelsey Skunberg (11):
> > PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h
> > PCI: Move PME declarations to drivers/pci/pci.h
> > PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h
> > PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h
> > PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h
> > PCI: Move pci_bus_* declarations to drivers/pci/pci.h
> > PCI: Move pcie_update_link_speed() to drivers/pci/pci.h
> > PCI: Move pci_ats_init() to drivers/pci/pci.h
> > PCI: Move ECRC declarations to drivers/pci/pci.h
> > PCI: Move PTM declaration to drivers/pci/pci.h
> > PCI: Move pci_*_node() declarations to drivers/pci/pci.h
> >
> > drivers/pci/pci.h | 48 ++++++++++++++++++++++++++++++++++++++++++---
> > include/linux/pci.h | 47 --------------------------------------------
> > 2 files changed, 45 insertions(+), 50 deletions(-)
>
> Hi Kelsey,
>
> I didn't get these applied before v5.3-rc1, so now they don't apply
> cleanly. Would you mind refreshing them and posting a v2 that does
> apply to my "master" branch (v5.3-rc1)?
>
> Bjorn

Hi Bjorn,

I can absolutely do that. I'll have v2 sent out soon.

-Kelsey

2019-07-25 05:50:15

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 00/11] Hide PCI symbols that don't need to be global

The include/linux/pci.h header file defines several symbols that are used
only in drivers/pci/. These symbols do not need to be visible to the rest
of the kernel. Move PCI symbols that are only used in drivers/pci/ to
drivers/pci/pci.h.

Changes in v2:
- Built patches to work with v5.3-rc1
- Changed line lengths on commit logs to stay below 80 characters
- Changed cover-letter log to better explain patch series


Kelsey Skunberg (11):
PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h
PCI: Move PME declarations to drivers/pci/pci.h
PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h
PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h
PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h
PCI: Move pci_bus_* declarations to drivers/pci/pci.h
PCI: Move pcie_update_link_speed() to drivers/pci/pci.h
PCI: Move pci_ats_init() to drivers/pci/pci.h
PCI: Move ECRC declarations to drivers/pci/pci.h
PCI: Move PTM declaration to drivers/pci/pci.h
PCI: Move pci_*_node() declarations to drivers/pci/pci.h

drivers/pci/pci.h | 48 ++++++++++++++++++++++++++++++++++++++++++---
include/linux/pci.h | 47 --------------------------------------------
2 files changed, 45 insertions(+), 50 deletions(-)

--
2.20.1

2019-07-25 05:50:20

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 01/11] PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h

The #define PCI_PM_* lines are only used within drivers/pci/ and they do
not need to be seen by the rest of the kernel. Move #define PCI_* to
drivers/pci/pci.h

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 5 +++++
include/linux/pci.h | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 1be03a97cb92..708413632429 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -39,6 +39,11 @@ int pci_probe_reset_function(struct pci_dev *dev);
int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
int pci_bus_error_reset(struct pci_dev *dev);

+#define PCI_PM_D2_DELAY 200
+#define PCI_PM_D3_WAIT 10
+#define PCI_PM_D3COLD_WAIT 100
+#define PCI_PM_BUS_WAIT 50
+
/**
* struct pci_platform_pm_ops - Firmware PM callbacks
*
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9e700d9f9f28..238449460210 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -145,11 +145,6 @@ static inline const char *pci_power_name(pci_power_t state)
return pci_power_names[1 + (__force int) state];
}

-#define PCI_PM_D2_DELAY 200
-#define PCI_PM_D3_WAIT 10
-#define PCI_PM_D3COLD_WAIT 100
-#define PCI_PM_BUS_WAIT 50
-
/**
* typedef pci_channel_state_t
*
--
2.20.1

2019-07-25 05:50:21

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 02/11] PCI: Move PME declarations to drivers/pci/pci.h

pci_check_pme_status() and pci_pme_wakeup_bus() are only
called within drivers/pci/. Since declarations do not need to be visible
to the rest of the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 2 ++
include/linux/pci.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 708413632429..ad1fe54ab8ee 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -89,6 +89,8 @@ void pci_power_up(struct pci_dev *dev);
void pci_disable_enabled_device(struct pci_dev *dev);
int pci_finish_runtime_suspend(struct pci_dev *dev);
void pcie_clear_root_pme_status(struct pci_dev *dev);
+bool pci_check_pme_status(struct pci_dev *dev);
+void pci_pme_wakeup_bus(struct pci_bus *bus);
int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
void pci_pme_restore(struct pci_dev *dev);
bool pci_dev_need_resume(struct pci_dev *dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 238449460210..e1f784de459f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1236,8 +1236,6 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable);
int pci_prepare_to_sleep(struct pci_dev *dev);
int pci_back_from_sleep(struct pci_dev *dev);
bool pci_dev_run_wake(struct pci_dev *dev);
-bool pci_check_pme_status(struct pci_dev *dev);
-void pci_pme_wakeup_bus(struct pci_bus *bus);
void pci_d3cold_enable(struct pci_dev *dev);
void pci_d3cold_disable(struct pci_dev *dev);
bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
--
2.20.1

2019-07-25 05:50:23

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 03/11] PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h

pci_get_host_bridge_device() and pci_put_host_bridge_device() are only
called within drivers/pci/pci.h. Since declarations do not need to be
visible to the rest of the kernel, move to drives/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index ad1fe54ab8ee..f41dde136648 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -105,6 +105,9 @@ void pci_free_cap_save_buffers(struct pci_dev *dev);
bool pci_bridge_d3_possible(struct pci_dev *dev);
void pci_bridge_d3_update(struct pci_dev *dev);

+struct device *pci_get_host_bridge_device(struct pci_dev *dev);
+void pci_put_host_bridge_device(struct device *dev);
+
static inline void pci_wakeup_event(struct pci_dev *dev)
{
/* Wait 100 ms before the system can be put into a sleep state. */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e1f784de459f..cd49427e198e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -644,9 +644,6 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
return dev->bus->self;
}

-struct device *pci_get_host_bridge_device(struct pci_dev *dev);
-void pci_put_host_bridge_device(struct device *dev);
-
#ifdef CONFIG_PCI_MSI
static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
{
--
2.20.1

2019-07-25 05:50:32

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 08/11] PCI: Move pci_ats_init() to drivers/pci/pci.h

pci_ats_init() is only called with drivers/pci/. Since declarations do not
need to be visible to the rest of the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 7 ++++---
include/linux/pci.h | 2 --
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index feec29853a44..7c0488b64faf 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -439,11 +439,12 @@ static inline void pci_restore_dpc_state(struct pci_dev *dev) {}
#endif

#ifdef CONFIG_PCI_ATS
+/* Address Translation Service */
+void pci_ats_init(struct pci_dev *dev);
void pci_restore_ats_state(struct pci_dev *dev);
#else
-static inline void pci_restore_ats_state(struct pci_dev *dev)
-{
-}
+static inline void pci_ats_init(struct pci_dev *d) { }
+static inline void pci_restore_ats_state(struct pci_dev *dev) { }
#endif /* CONFIG_PCI_ATS */

#ifdef CONFIG_PCI_IOV
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c6a25c32a49a..5760e19cb625 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1766,13 +1766,11 @@ static inline bool pci_ats_disabled(void) { return true; }

#ifdef CONFIG_PCI_ATS
/* Address Translation Service */
-void pci_ats_init(struct pci_dev *dev);
int pci_enable_ats(struct pci_dev *dev, int ps);
void pci_disable_ats(struct pci_dev *dev);
int pci_ats_queue_depth(struct pci_dev *dev);
int pci_ats_page_aligned(struct pci_dev *dev);
#else
-static inline void pci_ats_init(struct pci_dev *d) { }
static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }
static inline void pci_disable_ats(struct pci_dev *d) { }
static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; }
--
2.20.1

2019-07-25 05:50:35

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 11/11] PCI: Move pci_*_node() declarations to drivers/pci/pci.h

pci_*_node() is only called from drivers/pci/. Since these declarations do
not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 9 +++++++++
include/linux/pci.h | 8 --------
2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 6cdc3500de15..27089a87dfea 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -592,6 +592,10 @@ struct device_node;
int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
int of_get_pci_domain_nr(struct device_node *node);
int of_pci_get_max_link_speed(struct device_node *node);
+void pci_set_of_node(struct pci_dev *dev);
+void pci_release_of_node(struct pci_dev *dev);
+void pci_set_bus_of_node(struct pci_bus *bus);
+void pci_release_bus_of_node(struct pci_bus *bus);

#else
static inline int
@@ -611,6 +615,11 @@ of_pci_get_max_link_speed(struct device_node *node)
{
return -EINVAL;
}
+
+static inline void pci_set_of_node(struct pci_dev *dev) { }
+static inline void pci_release_of_node(struct pci_dev *dev) { }
+static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
+static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
#endif /* CONFIG_OF */

#if defined(CONFIG_OF_ADDRESS)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a483b7598059..d354fbcee5a7 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2264,10 +2264,6 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
#ifdef CONFIG_OF
struct device_node;
struct irq_domain;
-void pci_set_of_node(struct pci_dev *dev);
-void pci_release_of_node(struct pci_dev *dev);
-void pci_set_bus_of_node(struct pci_bus *bus);
-void pci_release_bus_of_node(struct pci_bus *bus);
struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);
int pci_parse_request_of_pci_ranges(struct device *dev,
struct list_head *resources,
@@ -2277,10 +2273,6 @@ int pci_parse_request_of_pci_ranges(struct device *dev,
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);

#else /* CONFIG_OF */
-static inline void pci_set_of_node(struct pci_dev *dev) { }
-static inline void pci_release_of_node(struct pci_dev *dev) { }
-static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
-static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
static inline struct irq_domain *
pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }
static inline int pci_parse_request_of_pci_ranges(struct device *dev,
--
2.20.1

2019-07-25 05:50:39

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 10/11] PCI: Move PTM declaration to drivers/pci/pci.h

pci_enable_ptm() is only called within drivers/pci/. Since declaration
does not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 7 -------
2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 5e5ce04bda59..6cdc3500de15 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -551,8 +551,11 @@ static inline void pcie_ecrc_get_policy(char *str) { }

#ifdef CONFIG_PCIE_PTM
void pci_ptm_init(struct pci_dev *dev);
+int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
#else
static inline void pci_ptm_init(struct pci_dev *dev) { }
+static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
+{ return -EINVAL; }
#endif

struct pci_dev_reset_methods {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5dd4abeef8b0..a483b7598059 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1561,13 +1561,6 @@ static inline bool pci_aer_available(void) { return false; }

bool pci_ats_disabled(void);

-#ifdef CONFIG_PCIE_PTM
-int pci_enable_ptm(struct pci_dev *dev, u8 *granularity);
-#else
-static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity)
-{ return -EINVAL; }
-#endif
-
void pci_cfg_access_lock(struct pci_dev *dev);
bool pci_cfg_access_trylock(struct pci_dev *dev);
void pci_cfg_access_unlock(struct pci_dev *dev);
--
2.20.1

2019-07-25 05:51:06

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 06/11] PCI: Move pci_bus_* declarations to drivers/pci/pci.h

pci_bus_* declarations are only called within drivers/pci/. Since
declarations do not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 2 ++
include/linux/pci.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9391330805e9..3e9dfca4b661 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -274,6 +274,8 @@ bool pci_bus_clip_resource(struct pci_dev *dev, int idx);

void pci_reassigndev_resource_alignment(struct pci_dev *dev);
void pci_disable_bridge_window(struct pci_dev *dev);
+struct pci_bus *pci_bus_get(struct pci_bus *bus);
+void pci_bus_put(struct pci_bus *bus);

/* PCIe link information */
#define PCIE_SPEED2STR(speed) \
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9c9554906659..af59ecf8ccff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1282,8 +1282,6 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
void pci_release_selected_regions(struct pci_dev *, int);

/* drivers/pci/bus.c */
-struct pci_bus *pci_bus_get(struct pci_bus *bus);
-void pci_bus_put(struct pci_bus *bus);
void pci_add_resource(struct list_head *resources, struct resource *res);
void pci_add_resource_offset(struct list_head *resources, struct resource *res,
resource_size_t offset);
--
2.20.1

2019-07-25 05:51:41

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 09/11] PCI: Move ECRC declarations to drivers/pci/pci.h

pcie_set_ecrc_checking() and pcie_ecrc_get_policy() are only called within
drivers/pci/. Since declarations do not need to be visible to the rest of
the kernel, move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 8 ++++++++
include/linux/pci.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 7c0488b64faf..5e5ce04bda59 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -541,6 +541,14 @@ static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) { }
static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { }
#endif

+#ifdef CONFIG_PCIE_ECRC
+void pcie_set_ecrc_checking(struct pci_dev *dev);
+void pcie_ecrc_get_policy(char *str);
+#else
+static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
+static inline void pcie_ecrc_get_policy(char *str) { }
+#endif
+
#ifdef CONFIG_PCIE_PTM
void pci_ptm_init(struct pci_dev *dev);
#else
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5760e19cb625..5dd4abeef8b0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1559,14 +1559,6 @@ bool pci_aer_available(void);
static inline bool pci_aer_available(void) { return false; }
#endif

-#ifdef CONFIG_PCIE_ECRC
-void pcie_set_ecrc_checking(struct pci_dev *dev);
-void pcie_ecrc_get_policy(char *str);
-#else
-static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
-static inline void pcie_ecrc_get_policy(char *str) { }
-#endif
-
bool pci_ats_disabled(void);

#ifdef CONFIG_PCIE_PTM
--
2.20.1

2019-07-25 05:51:42

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 05/11] PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h

pci_hotplug_*_size declarations are only called within drivers/pci/pci/.
Since declarations do not need to be seen by the rest of the kernel, move
to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 3 +++
include/linux/pci.h | 4 ----
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 0eb0fb7ad353..9391330805e9 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -211,6 +211,9 @@ extern const struct attribute_group *pcibus_groups[];
extern const struct device_type pci_dev_type;
extern const struct attribute_group *pci_bus_groups[];

+extern unsigned long pci_hotplug_io_size;
+extern unsigned long pci_hotplug_mem_size;
+extern unsigned long pci_hotplug_bus_size;

/**
* pci_match_one_device - Tell if a PCI device structure has a matching
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d1944e3e7eb2..9c9554906659 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2015,10 +2015,6 @@ extern unsigned long pci_cardbus_mem_size;
extern u8 pci_dfl_cache_line_size;
extern u8 pci_cache_line_size;

-extern unsigned long pci_hotplug_io_size;
-extern unsigned long pci_hotplug_mem_size;
-extern unsigned long pci_hotplug_bus_size;
-
/* Architecture-specific versions may override these (weak) */
void pcibios_disable_device(struct pci_dev *dev);
void pcibios_set_master(struct pci_dev *dev);
--
2.20.1

2019-07-25 09:58:36

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 04/11] PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h

PCI Virtual Channel declarations are only called within drivers/pci/.
Since declarations do not need to be visible to the rest of the kernel,
move to drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 5 +++++
include/linux/pci.h | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index f41dde136648..0eb0fb7ad353 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -133,6 +133,11 @@ void pci_vpd_release(struct pci_dev *dev);
void pcie_vpd_create_sysfs_dev_files(struct pci_dev *dev);
void pcie_vpd_remove_sysfs_dev_files(struct pci_dev *dev);

+/* PCI Virtual Channel */
+int pci_save_vc_state(struct pci_dev *dev);
+void pci_restore_vc_state(struct pci_dev *dev);
+void pci_allocate_vc_save_buffers(struct pci_dev *dev);
+
/* PCI /proc functions */
#ifdef CONFIG_PROC_FS
int pci_proc_attach_device(struct pci_dev *dev);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index cd49427e198e..d1944e3e7eb2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1239,11 +1239,6 @@ bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);
void pci_wakeup_bus(struct pci_bus *bus);
void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state);

-/* PCI Virtual Channel */
-int pci_save_vc_state(struct pci_dev *dev);
-void pci_restore_vc_state(struct pci_dev *dev);
-void pci_allocate_vc_save_buffers(struct pci_dev *dev);
-
/* For use by arch with custom probe code */
void set_pcie_port_type(struct pci_dev *pdev);
void set_pcie_hotplug_bridge(struct pci_dev *pdev);
--
2.20.1


2019-07-25 10:43:10

by Kelsey

[permalink] [raw]
Subject: [PATCH v2 07/11] PCI: Move pcie_update_link_speed() to drivers/pci/pci.h

pcie_update_line_speed() is only called within drivers/pci/. Since
declaration does not need to be visible to the rest of the kernel, move to
drivers/pci/pci.h.

Signed-off-by: Kelsey Skunberg <[email protected]>
---
drivers/pci/pci.h | 1 +
include/linux/pci.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 3e9dfca4b661..feec29853a44 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -299,6 +299,7 @@ u32 pcie_bandwidth_capable(struct pci_dev *dev, enum pci_bus_speed *speed,
enum pcie_link_width *width);
void __pcie_print_link_status(struct pci_dev *dev, bool verbose);
void pcie_report_downtraining(struct pci_dev *dev);
+void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);

/* Single Root I/O Virtualization */
struct pci_sriov {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index af59ecf8ccff..c6a25c32a49a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -987,7 +987,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,
int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge);
struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
int busnr);
-void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
const char *name,
struct hotplug_slot *hotplug);
--
2.20.1


2019-07-30 08:03:02

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [Linux-kernel-mentees] [PATCH v2 01/11] PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h

[+to Rafael, author of commits mentioned below]

On Wed, Jul 24, 2019 at 05:38:38PM -0600, Kelsey Skunberg wrote:
> The #define PCI_PM_* lines are only used within drivers/pci/ and they do
> not need to be seen by the rest of the kernel. Move #define PCI_* to
> drivers/pci/pci.h
>
> Signed-off-by: Kelsey Skunberg <[email protected]>
> ---
> drivers/pci/pci.h | 5 +++++
> include/linux/pci.h | 5 -----
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 1be03a97cb92..708413632429 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -39,6 +39,11 @@ int pci_probe_reset_function(struct pci_dev *dev);
> int pci_bridge_secondary_bus_reset(struct pci_dev *dev);
> int pci_bus_error_reset(struct pci_dev *dev);
>
> +#define PCI_PM_D2_DELAY 200
> +#define PCI_PM_D3_WAIT 10
> +#define PCI_PM_D3COLD_WAIT 100
> +#define PCI_PM_BUS_WAIT 50

Unrelated to *this* patch, but while reviewing, I noticed this a few
lines below:

static inline void pci_wakeup_event(struct pci_dev *dev)
{
/* Wait 100 ms before the system can be put into a sleep state. */
pm_wakeup_event(&dev->dev, 100);
}

I'm curious about what this 100ms is and whether it's related to
something in the PCIe spec. E.g., is this another way of writing
PCI_PM_D3COLD_WAIT?

This constant was added to drivers/pci/pci.c as PCI_WAKEUP_COOLDOWN by
c125e96f0444 ("PM: Make it possible to avoid races between wakeup and
system sleep") and then moved to drivers/pci/pci.h and the name
removed by b6e335aeeb11 ("PCI/PM: Use pm_wakeup_event() directly for
reporting wakeup events").

> /**
> * struct pci_platform_pm_ops - Firmware PM callbacks
> *
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 9e700d9f9f28..238449460210 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -145,11 +145,6 @@ static inline const char *pci_power_name(pci_power_t state)
> return pci_power_names[1 + (__force int) state];
> }
>
> -#define PCI_PM_D2_DELAY 200
> -#define PCI_PM_D3_WAIT 10
> -#define PCI_PM_D3COLD_WAIT 100
> -#define PCI_PM_BUS_WAIT 50
> -
> /**
> * typedef pci_channel_state_t
> *
> --
> 2.20.1
>
> _______________________________________________
> Linux-kernel-mentees mailing list
> [email protected]
> https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

2019-07-30 17:48:28

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [Linux-kernel-mentees] [PATCH v2 00/11] Hide PCI symbols that don't need to be global

On Wed, Jul 24, 2019 at 05:38:37PM -0600, Kelsey Skunberg wrote:
> The include/linux/pci.h header file defines several symbols that are used
> only in drivers/pci/. These symbols do not need to be visible to the rest
> of the kernel. Move PCI symbols that are only used in drivers/pci/ to
> drivers/pci/pci.h.
>
> Changes in v2:
> - Built patches to work with v5.3-rc1
> - Changed line lengths on commit logs to stay below 80 characters
> - Changed cover-letter log to better explain patch series
>
>
> Kelsey Skunberg (11):
> PCI: Move #define PCI_PM_* lines to drivers/pci/pci.h
> PCI: Move PME declarations to drivers/pci/pci.h
> PCI: Move *_host_bridge_device() declarations to drivers/pci.pci.h
> PCI: Move PCI Virtual Channel declarations to drivers/pci/pci.h
> PCI: Move pci_hotplug_*_size declarations to drivers/pci/pci.h
> PCI: Move pci_bus_* declarations to drivers/pci/pci.h
> PCI: Move pcie_update_link_speed() to drivers/pci/pci.h
> PCI: Move pci_ats_init() to drivers/pci/pci.h
> PCI: Move ECRC declarations to drivers/pci/pci.h
> PCI: Move PTM declaration to drivers/pci/pci.h
> PCI: Move pci_*_node() declarations to drivers/pci/pci.h
>
> drivers/pci/pci.h | 48 ++++++++++++++++++++++++++++++++++++++++++---
> include/linux/pci.h | 47 --------------------------------------------
> 2 files changed, 45 insertions(+), 50 deletions(-)

Applied to pci/encapsulate for v5.4, thanks a lot!