PCI: BAR fixes ; context refresh

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/queue/PCI-Ignore-BAR-updates-on-virtual-functions.patch b/queue/PCI-Ignore-BAR-updates-on-virtual-functions.patch
index 1eb22d9..1994a75 100644
--- a/queue/PCI-Ignore-BAR-updates-on-virtual-functions.patch
+++ b/queue/PCI-Ignore-BAR-updates-on-virtual-functions.patch
@@ -1,4 +1,4 @@
-From 63880b230a4af502c56dde3d4588634c70c66006 Mon Sep 17 00:00:00 2001
+From bb4c01aed1a74fbc83d3d3cd2e8284bbbab653f5 Mon Sep 17 00:00:00 2001
 From: Bjorn Helgaas <bhelgaas@google.com>
 Date: Mon, 28 Nov 2016 11:19:27 -0600
 Subject: [PATCH] PCI: Ignore BAR updates on virtual functions
@@ -14,12 +14,13 @@
 
 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
 Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
 
 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
-index ba34907538f6..631eac2bed78 100644
+index d7d558f8b2ec..132fcd4a7f6f 100644
 --- a/drivers/pci/pci.c
 +++ b/drivers/pci/pci.c
-@@ -564,10 +564,6 @@ static void pci_restore_bars(struct pci_dev *dev)
+@@ -540,10 +540,6 @@ static void pci_restore_bars(struct pci_dev *dev)
  {
  	int i;
  
@@ -31,11 +32,11 @@
  		pci_update_resource(dev, i);
  }
 diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
-index 66c4d8f42233..d2a32d88d2ae 100644
+index 8a7322c4775d..4bc589ee78d0 100644
 --- a/drivers/pci/setup-res.c
 +++ b/drivers/pci/setup-res.c
-@@ -36,10 +36,9 @@ void pci_update_resource(struct pci_dev *dev, int resno)
- 	enum pci_bar_type type;
+@@ -34,10 +34,9 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
+ 	int reg;
  	struct resource *res = dev->resource + resno;
  
 -	if (dev->is_virtfn) {
diff --git a/queue/PCI-Remove-pci_resource_bar-and-pci_iov_resource_bar.patch b/queue/PCI-Remove-pci_resource_bar-and-pci_iov_resource_bar.patch
index b6d13d2..b19e2be 100644
--- a/queue/PCI-Remove-pci_resource_bar-and-pci_iov_resource_bar.patch
+++ b/queue/PCI-Remove-pci_resource_bar-and-pci_iov_resource_bar.patch
@@ -1,4 +1,4 @@
-From 286c2378aaccc7343ebf17ec6cd86567659caf70 Mon Sep 17 00:00:00 2001
+From f855fc1c72b39a681f4946e31c612b96b8f05e75 Mon Sep 17 00:00:00 2001
 From: Bjorn Helgaas <bhelgaas@google.com>
 Date: Mon, 28 Nov 2016 16:51:19 -0600
 Subject: [PATCH] PCI: Remove pci_resource_bar() and pci_iov_resource_bar()
@@ -13,12 +13,13 @@
 
 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
 Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
 
 diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
-index 2480b3879182..47227820406d 100644
+index f72968508a0d..f591b8fb029b 100644
 --- a/drivers/pci/iov.c
 +++ b/drivers/pci/iov.c
-@@ -554,24 +554,6 @@ void pci_iov_release(struct pci_dev *dev)
+@@ -551,24 +551,6 @@ void pci_iov_release(struct pci_dev *dev)
  }
  
  /**
@@ -44,10 +45,10 @@
   * @dev: the PCI device
   * @resno: the resource number
 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
-index 631eac2bed78..ec3f16d13307 100644
+index 24db77ea5093..d7d558f8b2ec 100644
 --- a/drivers/pci/pci.c
 +++ b/drivers/pci/pci.c
-@@ -4827,36 +4827,6 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags)
+@@ -4793,36 +4793,6 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags)
  }
  EXPORT_SYMBOL(pci_select_bars);
  
@@ -85,10 +86,10 @@
  static arch_set_vga_state_t arch_set_vga_state;
  
 diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
-index 5bfcb922f7f7..a5d37f6a9fb5 100644
+index 517bc2677489..73b7647619af 100644
 --- a/drivers/pci/pci.h
 +++ b/drivers/pci/pci.h
-@@ -245,7 +245,6 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl,
+@@ -242,7 +242,6 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl,
  int pci_setup_device(struct pci_dev *dev);
  int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
  		    struct resource *res, unsigned int reg);
@@ -96,7 +97,7 @@
  void pci_configure_ari(struct pci_dev *dev);
  void __pci_bus_size_bridges(struct pci_bus *bus,
  			struct list_head *realloc_head);
-@@ -289,7 +288,6 @@ static inline void pci_restore_ats_state(struct pci_dev *dev)
+@@ -286,7 +285,6 @@ static inline void pci_restore_ats_state(struct pci_dev *dev)
  #ifdef CONFIG_PCI_IOV
  int pci_iov_init(struct pci_dev *dev);
  void pci_iov_release(struct pci_dev *dev);
@@ -104,7 +105,7 @@
  void pci_iov_update_resource(struct pci_dev *dev, int resno);
  resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno);
  void pci_restore_iov_state(struct pci_dev *dev);
-@@ -304,10 +302,6 @@ static inline void pci_iov_release(struct pci_dev *dev)
+@@ -301,10 +299,6 @@ static inline void pci_iov_release(struct pci_dev *dev)
  
  {
  }
@@ -116,7 +117,7 @@
  {
  }
 diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
-index 5ddeb6737f99..99c9e32775ee 100644
+index 695f32daf466..182d0f065a42 100644
 --- a/drivers/pci/setup-res.c
 +++ b/drivers/pci/setup-res.c
 @@ -32,7 +32,6 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
@@ -126,10 +127,10 @@
 -	enum pci_bar_type type;
  	struct resource *res = dev->resource + resno;
  
- 	/* Per SR-IOV spec 3.4.1.11, VF BARs are RO zero */
-@@ -70,14 +69,16 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
- 		new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK;
- 	}
+ 	if (dev->is_virtfn) {
+@@ -66,14 +65,16 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
+ 	else
+ 		mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
  
 -	reg = pci_resource_bar(dev, resno, &type);
 -	if (!reg)
diff --git a/queue/PCI-Update-BARs-using-property-bits-appropriate-for-.patch b/queue/PCI-Update-BARs-using-property-bits-appropriate-for-.patch
index 9afd081..5b1c150 100644
--- a/queue/PCI-Update-BARs-using-property-bits-appropriate-for-.patch
+++ b/queue/PCI-Update-BARs-using-property-bits-appropriate-for-.patch
@@ -1,4 +1,4 @@
-From 45d004f4afefdd8d79916ee6d97a9ecd94bb1ffe Mon Sep 17 00:00:00 2001
+From 1b13cc4e45b11c2271ef08a779b58b0bad63636d Mon Sep 17 00:00:00 2001
 From: Bjorn Helgaas <bhelgaas@google.com>
 Date: Tue, 29 Nov 2016 08:14:47 -0600
 Subject: [PATCH] PCI: Update BARs using property bits appropriate for type
@@ -18,12 +18,13 @@
 the update was successful.
 
 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
 
 diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
-index d2a32d88d2ae..53bc0638cac6 100644
+index bd6fca91c736..8a7322c4775d 100644
 --- a/drivers/pci/setup-res.c
 +++ b/drivers/pci/setup-res.c
-@@ -59,12 +59,17 @@ void pci_update_resource(struct pci_dev *dev, int resno)
+@@ -58,12 +58,17 @@ static void pci_std_update_resource(struct pci_dev *dev, int resno)
  		return;
  
  	pcibios_resource_to_bus(dev->bus, &region, res);
@@ -42,8 +43,8 @@
 +		new |= res->flags & ~PCI_BASE_ADDRESS_MEM_MASK;
 +	}
  
- 	reg = pci_resource_bar(dev, resno, &type);
- 	if (!reg)
+ 	if (resno < PCI_ROM_RESOURCE) {
+ 		reg = PCI_BASE_ADDRESS_0 + 4 * resno;
 -- 
 2.12.0