From b3bb0ed335b44fd5d11f8afbb6750b3eb7e58da3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 24 Aug 2018 09:05:45 +0200 Subject: [PATCH] fix up a pci patch for 4.14 and 4.9 --- .../pci-of-fix-i-o-space-page-leak.patch | 14 ++++++++++- .../pci-of-fix-i-o-space-page-leak.patch | 24 ++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/queue-4.14/pci-of-fix-i-o-space-page-leak.patch b/queue-4.14/pci-of-fix-i-o-space-page-leak.patch index 2132eb98f1b..cbb577faca0 100644 --- a/queue-4.14/pci-of-fix-i-o-space-page-leak.patch +++ b/queue-4.14/pci-of-fix-i-o-space-page-leak.patch @@ -73,9 +73,10 @@ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/host/pci-host-common.c | 2 - + drivers/pci/host/pcie-rcar.c | 2 - drivers/pci/pci.c | 38 +++++++++++++++++++++++++++++++++++++ include/linux/pci.h | 2 + - 3 files changed, 41 insertions(+), 1 deletion(-) + 4 files changed, 42 insertions(+), 2 deletions(-) --- a/drivers/pci/host/pci-host-common.c +++ b/drivers/pci/host/pci-host-common.c @@ -84,6 +85,17 @@ Signed-off-by: Greg Kroah-Hartman switch (resource_type(res)) { case IORESOURCE_IO: - err = pci_remap_iospace(res, iobase); ++ err = devm_pci_remap_iospace(dev, res, iobase); + if (err) { + dev_warn(dev, "error %d: failed to map resource %pR\n", + err, res); +--- a/drivers/pci/host/pcie-rcar.c ++++ b/drivers/pci/host/pcie-rcar.c +@@ -1105,7 +1105,7 @@ static int rcar_pcie_parse_request_of_pc + struct resource *res = win->res; + + if (resource_type(res) == IORESOURCE_IO) { +- err = pci_remap_iospace(res, iobase); + err = devm_pci_remap_iospace(dev, res, iobase); if (err) { dev_warn(dev, "error %d: failed to map resource %pR\n", diff --git a/queue-4.9/pci-of-fix-i-o-space-page-leak.patch b/queue-4.9/pci-of-fix-i-o-space-page-leak.patch index 66deae4aff3..03d2823f1de 100644 --- a/queue-4.9/pci-of-fix-i-o-space-page-leak.patch +++ b/queue-4.9/pci-of-fix-i-o-space-page-leak.patch @@ -73,9 +73,10 @@ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/host/pci-host-common.c | 2 - + drivers/pci/host/pcie-rcar.c | 2 - drivers/pci/pci.c | 38 +++++++++++++++++++++++++++++++++++++ include/linux/pci.h | 2 + - 3 files changed, 41 insertions(+), 1 deletion(-) + 4 files changed, 42 insertions(+), 2 deletions(-) --- a/drivers/pci/host/pci-host-common.c +++ b/drivers/pci/host/pci-host-common.c @@ -84,15 +85,26 @@ Signed-off-by: Greg Kroah-Hartman switch (resource_type(res)) { case IORESOURCE_IO: - err = pci_remap_iospace(res, iobase); ++ err = devm_pci_remap_iospace(dev, res, iobase); + if (err) { + dev_warn(dev, "error %d: failed to map resource %pR\n", + err, res); +--- a/drivers/pci/host/pcie-rcar.c ++++ b/drivers/pci/host/pcie-rcar.c +@@ -1102,7 +1102,7 @@ static int rcar_pcie_parse_request_of_pc + struct resource *res = win->res; + + if (resource_type(res) == IORESOURCE_IO) { +- err = pci_remap_iospace(res, iobase); + err = devm_pci_remap_iospace(dev, res, iobase); if (err) { dev_warn(dev, "error %d: failed to map resource %pR\n", err, res); --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c -@@ -3575,6 +3575,44 @@ int pci_try_set_mwi(struct pci_dev *dev) +@@ -3407,6 +3407,44 @@ void pci_unmap_iospace(struct resource * + #endif } - EXPORT_SYMBOL(pci_try_set_mwi); +static void devm_pci_unmap_iospace(struct device *dev, void *ptr) +{ @@ -132,9 +144,9 @@ Signed-off-by: Greg Kroah-Hartman +} +EXPORT_SYMBOL(devm_pci_remap_iospace); + - /** - * pci_clear_mwi - disables Memory-Write-Invalidate for device dev - * @dev: the PCI device to disable + static void __pci_set_master(struct pci_dev *dev, bool enable) + { + u16 old_cmd, cmd; --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1190,6 +1190,8 @@ int pci_register_io_range(phys_addr_t ad -- 2.47.3