All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Remove dead code
@ 2014-01-30 19:20 Bjorn Helgaas
  2014-01-30 19:20 ` [PATCH 1/2] PCI: Remove unused MMIO exclusivity support Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2014-01-30 19:20 UTC (permalink / raw)
  To: linux-pci; +Cc: e1000-devel, Stephen Hemminger, Arjan van de Ven, linux-kernel

This is a rework of part of Stephen's patch [1].

This removes the MMIO exclusivity support that was added as part of an
e1000e bug hunt.

The e1000e driver still uses pci_request_selected_regions_exclusive(), but
there are no callers of pci_request_region_exclusive() and
pci_request_regions_exclusive().  I thought it was cleaner to remove the
whole thing than to leave parts of it in place.  But I could easily be
convinced to leave part or all of this in place if people think it's still
useful.

It also removes SR-IOV migration support, which is completely unused, as
far as I can tell.

[1] http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net

---

Bjorn Helgaas (2):
      PCI: Remove unused MMIO exclusivity support
      PCI: Remove unused SR-IOV VF Migration support


 Documentation/PCI/pci-iov-howto.txt        |    4 -
 Documentation/kernel-parameters.txt        |    4 -
 arch/x86/mm/init.c                         |    2 
 drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
 drivers/pci/iov.c                          |  119 ----------------------------
 drivers/pci/pci-sysfs.c                    |    3 -
 drivers/pci/pci.c                          |  112 +++-----------------------
 drivers/pci/pci.h                          |    4 -
 include/linux/ioport.h                     |    5 -
 include/linux/pci.h                        |    7 --
 kernel/resource.c                          |   54 -------------
 11 files changed, 14 insertions(+), 303 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] PCI: Remove unused MMIO exclusivity support
  2014-01-30 19:20 [PATCH 0/2] Remove dead code Bjorn Helgaas
@ 2014-01-30 19:20 ` Bjorn Helgaas
  2014-02-14 21:00   ` Bjorn Helgaas
  2014-01-30 19:20 ` [PATCH 2/2] PCI: Remove unused SR-IOV VF Migration support Bjorn Helgaas
  2014-01-31  9:10   ` Brown, Aaron F
  2 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2014-01-30 19:20 UTC (permalink / raw)
  To: linux-pci; +Cc: e1000-devel, Stephen Hemminger, Arjan van de Ven, linux-kernel

This reverts commit e8de1481fd71 ("resource: allow MMIO exclusivity for
device drivers"), removing these exported interfaces:

  pci_request_region_exclusive()
  pci_request_regions_exclusive()
  pci_request_selected_regions_exclusive()

There's nothing wrong with the MMIO exclusivity code, but it is used only
by the e1000e driver, and the only reason it's there is because it was
added during a bug hunt.  The bug has been fixed, and apparently no other
drivers have found it useful in the five years since then.

This is based on Stephen Hemminger's patch (see link below), but goes a bit
further by removing the use in e1000e.

Link: http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Arjan van de Ven <arjan@linux.intel.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
---
 Documentation/kernel-parameters.txt        |    4 -
 arch/x86/mm/init.c                         |    2 -
 drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
 drivers/pci/pci-sysfs.c                    |    3 -
 drivers/pci/pci.c                          |  112 +++-------------------------
 include/linux/ioport.h                     |    5 -
 include/linux/pci.h                        |    3 -
 kernel/resource.c                          |   54 --------------
 8 files changed, 14 insertions(+), 172 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 8f441dab0396..4943bddeacc1 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1323,10 +1323,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			no_x2apic_optout
 				BIOS x2APIC opt-out request will be ignored
 
-	iomem=		Disable strict checking of access to MMIO memory
-		strict	regions from userspace.
-		relaxed
-
 	iommu=		[x86]
 		off
 		force
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index f97130618113..575cbfd89238 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -583,8 +583,6 @@ int devmem_is_allowed(unsigned long pagenr)
 {
 	if (pagenr < 256)
 		return 1;
-	if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
-		return 0;
 	if (!page_is_ram(pagenr))
 		return 1;
 	return 0;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 6d91933c4cdd..97a11b19e46f 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6574,8 +6574,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 
 	bars = pci_select_bars(pdev, IORESOURCE_MEM);
-	err = pci_request_selected_regions_exclusive(pdev, bars,
-						     e1000e_driver_name);
+	err = pci_request_selected_regions(pdev, bars, e1000e_driver_name);
 	if (err)
 		goto err_pci_reg;
 
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 276ef9c18802..4580fa859f38 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -993,9 +993,6 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
 	vma->vm_pgoff += start >> PAGE_SHIFT;
 	mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
 
-	if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(start))
-		return -EINVAL;
-
 	return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
 }
 
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1febe90831b4..1011c0b281ca 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2432,26 +2432,20 @@ void pci_release_region(struct pci_dev *pdev, int bar)
 }
 
 /**
- *	__pci_request_region - Reserved PCI I/O and memory resource
+ *	pci_request_region - Reserved PCI I/O and memory resource
  *	@pdev: PCI device whose resources are to be reserved
  *	@bar: BAR to be reserved
  *	@res_name: Name to be associated with resource.
- *	@exclusive: whether the region access is exclusive or not
  *
  *	Mark the PCI region associated with PCI device @pdev BR @bar as
  *	being reserved by owner @res_name.  Do not access any
  *	address inside the PCI regions unless this call returns
  *	successfully.
  *
- *	If @exclusive is set, then the region is marked so that userspace
- *	is explicitly not allowed to map the resource via /dev/mem or
- *	sysfs MMIO access.
- *
  *	Returns 0 on success, or %EBUSY on error.  A warning
  *	message is also printed on failure.
  */
-static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name,
-									int exclusive)
+int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
 {
 	struct pci_devres *dr;
 
@@ -2464,9 +2458,8 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
 			goto err_out;
 	}
 	else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
-		if (!__request_mem_region(pci_resource_start(pdev, bar),
-					pci_resource_len(pdev, bar), res_name,
-					exclusive))
+		if (!request_mem_region(pci_resource_start(pdev, bar),
+					pci_resource_len(pdev, bar), res_name))
 			goto err_out;
 	}
 
@@ -2483,47 +2476,6 @@ err_out:
 }
 
 /**
- *	pci_request_region - Reserve PCI I/O and memory resource
- *	@pdev: PCI device whose resources are to be reserved
- *	@bar: BAR to be reserved
- *	@res_name: Name to be associated with resource
- *
- *	Mark the PCI region associated with PCI device @pdev BAR @bar as
- *	being reserved by owner @res_name.  Do not access any
- *	address inside the PCI regions unless this call returns
- *	successfully.
- *
- *	Returns 0 on success, or %EBUSY on error.  A warning
- *	message is also printed on failure.
- */
-int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
-{
-	return __pci_request_region(pdev, bar, res_name, 0);
-}
-
-/**
- *	pci_request_region_exclusive - Reserved PCI I/O and memory resource
- *	@pdev: PCI device whose resources are to be reserved
- *	@bar: BAR to be reserved
- *	@res_name: Name to be associated with resource.
- *
- *	Mark the PCI region associated with PCI device @pdev BR @bar as
- *	being reserved by owner @res_name.  Do not access any
- *	address inside the PCI regions unless this call returns
- *	successfully.
- *
- *	Returns 0 on success, or %EBUSY on error.  A warning
- *	message is also printed on failure.
- *
- *	The key difference that _exclusive makes it that userspace is
- *	explicitly not allowed to map the resource via /dev/mem or
- *	sysfs.
- */
-int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
-{
-	return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
-}
-/**
  * pci_release_selected_regions - Release selected PCI I/O and memory resources
  * @pdev: PCI device whose resources were previously reserved
  * @bars: Bitmask of BARs to be released
@@ -2540,14 +2492,20 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
 			pci_release_region(pdev, i);
 }
 
-static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
-				 const char *res_name, int excl)
+/**
+ * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
+ * @pdev: PCI device whose resources are to be reserved
+ * @bars: Bitmask of BARs to be requested
+ * @res_name: Name to be associated with resource
+ */
+int pci_request_selected_regions(struct pci_dev *pdev, int bars,
+				 const char *res_name)
 {
 	int i;
 
 	for (i = 0; i < 6; i++)
 		if (bars & (1 << i))
-			if (__pci_request_region(pdev, i, res_name, excl))
+			if (pci_request_region(pdev, i, res_name))
 				goto err_out;
 	return 0;
 
@@ -2561,25 +2519,6 @@ err_out:
 
 
 /**
- * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
- * @pdev: PCI device whose resources are to be reserved
- * @bars: Bitmask of BARs to be requested
- * @res_name: Name to be associated with resource
- */
-int pci_request_selected_regions(struct pci_dev *pdev, int bars,
-				 const char *res_name)
-{
-	return __pci_request_selected_regions(pdev, bars, res_name, 0);
-}
-
-int pci_request_selected_regions_exclusive(struct pci_dev *pdev,
-				 int bars, const char *res_name)
-{
-	return __pci_request_selected_regions(pdev, bars, res_name,
-			IORESOURCE_EXCLUSIVE);
-}
-
-/**
  *	pci_release_regions - Release reserved PCI I/O and memory resources
  *	@pdev: PCI device whose resources were previously reserved by pci_request_regions
  *
@@ -2611,28 +2550,6 @@ int pci_request_regions(struct pci_dev *pdev, const char *res_name)
 	return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
 }
 
-/**
- *	pci_request_regions_exclusive - Reserved PCI I/O and memory resources
- *	@pdev: PCI device whose resources are to be reserved
- *	@res_name: Name to be associated with resource.
- *
- *	Mark all PCI regions associated with PCI device @pdev as
- *	being reserved by owner @res_name.  Do not access any
- *	address inside the PCI regions unless this call returns
- *	successfully.
- *
- *	pci_request_regions_exclusive() will mark the region so that
- *	/dev/mem and the sysfs MMIO access will not be allowed.
- *
- *	Returns 0 on success, or %EBUSY on error.  A warning
- *	message is also printed on failure.
- */
-int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
-{
-	return pci_request_selected_regions_exclusive(pdev,
-					((1 << 6) - 1), res_name);
-}
-
 static void __pci_set_master(struct pci_dev *dev, bool enable)
 {
 	u16 old_cmd, cmd;
@@ -4387,13 +4304,10 @@ EXPORT_SYMBOL(pci_find_capability);
 EXPORT_SYMBOL(pci_bus_find_capability);
 EXPORT_SYMBOL(pci_release_regions);
 EXPORT_SYMBOL(pci_request_regions);
-EXPORT_SYMBOL(pci_request_regions_exclusive);
 EXPORT_SYMBOL(pci_release_region);
 EXPORT_SYMBOL(pci_request_region);
-EXPORT_SYMBOL(pci_request_region_exclusive);
 EXPORT_SYMBOL(pci_release_selected_regions);
 EXPORT_SYMBOL(pci_request_selected_regions);
-EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
 EXPORT_SYMBOL(pci_set_master);
 EXPORT_SYMBOL(pci_clear_master);
 EXPORT_SYMBOL(pci_set_mwi);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 89b7c24a36e9..f2d45ea3ee53 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -49,7 +49,6 @@ struct resource {
 #define IORESOURCE_WINDOW	0x00200000	/* forwarded by bridge */
 #define IORESOURCE_MUXED	0x00400000	/* Resource is software muxed */
 
-#define IORESOURCE_EXCLUSIVE	0x08000000	/* Userland may not map this resource */
 #define IORESOURCE_DISABLED	0x10000000
 #define IORESOURCE_UNSET	0x20000000
 #define IORESOURCE_AUTO		0x40000000
@@ -173,10 +172,7 @@ static inline unsigned long resource_type(const struct resource *res)
 /* Convenience shorthand with allocation */
 #define request_region(start,n,name)		__request_region(&ioport_resource, (start), (n), (name), 0)
 #define request_muxed_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
-#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
-#define request_mem_region_exclusive(start,n,name) \
-	__request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
 #define rename_region(region, newname) do { (region)->name = (newname); } while (0)
 
 extern struct resource * __request_region(struct resource *,
@@ -222,7 +218,6 @@ extern struct resource * __devm_request_region(struct device *dev,
 extern void __devm_release_region(struct device *dev, struct resource *parent,
 				  resource_size_t start, resource_size_t n);
 extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
-extern int iomem_is_exclusive(u64 addr);
 
 extern int
 walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fb57c892b214..b3cd9d58f5a9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1038,13 +1038,10 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
 		    int (*)(const struct pci_dev *, u8, u8));
 #define HAVE_PCI_REQ_REGIONS	2
 int __must_check pci_request_regions(struct pci_dev *, const char *);
-int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
 void pci_release_regions(struct pci_dev *);
 int __must_check pci_request_region(struct pci_dev *, int, const char *);
-int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
 void pci_release_region(struct pci_dev *, int);
 int pci_request_selected_regions(struct pci_dev *, int, const char *);
-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 */
diff --git a/kernel/resource.c b/kernel/resource.c
index 3f285dce9347..9a29d989aa5e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1306,57 +1306,3 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
 
 	return err;
 }
-
-#ifdef CONFIG_STRICT_DEVMEM
-static int strict_iomem_checks = 1;
-#else
-static int strict_iomem_checks;
-#endif
-
-/*
- * check if an address is reserved in the iomem resource tree
- * returns 1 if reserved, 0 if not reserved.
- */
-int iomem_is_exclusive(u64 addr)
-{
-	struct resource *p = &iomem_resource;
-	int err = 0;
-	loff_t l;
-	int size = PAGE_SIZE;
-
-	if (!strict_iomem_checks)
-		return 0;
-
-	addr = addr & PAGE_MASK;
-
-	read_lock(&resource_lock);
-	for (p = p->child; p ; p = r_next(NULL, p, &l)) {
-		/*
-		 * We can probably skip the resources without
-		 * IORESOURCE_IO attribute?
-		 */
-		if (p->start >= addr + size)
-			break;
-		if (p->end < addr)
-			continue;
-		if (p->flags & IORESOURCE_BUSY &&
-		     p->flags & IORESOURCE_EXCLUSIVE) {
-			err = 1;
-			break;
-		}
-	}
-	read_unlock(&resource_lock);
-
-	return err;
-}
-
-static int __init strict_iomem(char *str)
-{
-	if (strstr(str, "relaxed"))
-		strict_iomem_checks = 0;
-	if (strstr(str, "strict"))
-		strict_iomem_checks = 1;
-	return 1;
-}
-
-__setup("iomem=", strict_iomem);


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] PCI: Remove unused SR-IOV VF Migration support
  2014-01-30 19:20 [PATCH 0/2] Remove dead code Bjorn Helgaas
  2014-01-30 19:20 ` [PATCH 1/2] PCI: Remove unused MMIO exclusivity support Bjorn Helgaas
@ 2014-01-30 19:20 ` Bjorn Helgaas
  2014-01-31  9:10   ` Brown, Aaron F
  2 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2014-01-30 19:20 UTC (permalink / raw)
  To: linux-pci; +Cc: e1000-devel, Stephen Hemminger, Arjan van de Ven, linux-kernel

This reverts commit 74bb1bcc7dbb ("PCI: handle SR-IOV Virtual Function
Migration"), removing this exported interface:

  pci_sriov_migration()

Since pci_sriov_migration() is unused, it is impossible to schedule
sriov_migration_task() or use any of the other migration infrastructure.

This is based on Stephen Hemminger's patch (see link below), but goes a bit
further.

Link: http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
---
 Documentation/PCI/pci-iov-howto.txt |    4 -
 drivers/pci/iov.c                   |  119 -----------------------------------
 drivers/pci/pci.h                   |    4 -
 include/linux/pci.h                 |    4 -
 4 files changed, 131 deletions(-)

diff --git a/Documentation/PCI/pci-iov-howto.txt b/Documentation/PCI/pci-iov-howto.txt
index 86551cc72e03..2d91ae251982 100644
--- a/Documentation/PCI/pci-iov-howto.txt
+++ b/Documentation/PCI/pci-iov-howto.txt
@@ -68,10 +68,6 @@ To disable SR-IOV capability:
 	echo  0 > \
         /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_numvfs
 
-To notify SR-IOV core of Virtual Function Migration:
-(a) In the driver:
-	irqreturn_t pci_sriov_migration(struct pci_dev *dev);
-
 3.2 Usage example
 
 Following piece of code illustrates the usage of the SR-IOV API.
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index 9dce7c5e2a77..de7a74782f92 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -170,97 +170,6 @@ static void virtfn_remove(struct pci_dev *dev, int id, int reset)
 	pci_dev_put(dev);
 }
 
-static int sriov_migration(struct pci_dev *dev)
-{
-	u16 status;
-	struct pci_sriov *iov = dev->sriov;
-
-	if (!iov->num_VFs)
-		return 0;
-
-	if (!(iov->cap & PCI_SRIOV_CAP_VFM))
-		return 0;
-
-	pci_read_config_word(dev, iov->pos + PCI_SRIOV_STATUS, &status);
-	if (!(status & PCI_SRIOV_STATUS_VFM))
-		return 0;
-
-	schedule_work(&iov->mtask);
-
-	return 1;
-}
-
-static void sriov_migration_task(struct work_struct *work)
-{
-	int i;
-	u8 state;
-	u16 status;
-	struct pci_sriov *iov = container_of(work, struct pci_sriov, mtask);
-
-	for (i = iov->initial_VFs; i < iov->num_VFs; i++) {
-		state = readb(iov->mstate + i);
-		if (state == PCI_SRIOV_VFM_MI) {
-			writeb(PCI_SRIOV_VFM_AV, iov->mstate + i);
-			state = readb(iov->mstate + i);
-			if (state == PCI_SRIOV_VFM_AV)
-				virtfn_add(iov->self, i, 1);
-		} else if (state == PCI_SRIOV_VFM_MO) {
-			virtfn_remove(iov->self, i, 1);
-			writeb(PCI_SRIOV_VFM_UA, iov->mstate + i);
-			state = readb(iov->mstate + i);
-			if (state == PCI_SRIOV_VFM_AV)
-				virtfn_add(iov->self, i, 0);
-		}
-	}
-
-	pci_read_config_word(iov->self, iov->pos + PCI_SRIOV_STATUS, &status);
-	status &= ~PCI_SRIOV_STATUS_VFM;
-	pci_write_config_word(iov->self, iov->pos + PCI_SRIOV_STATUS, status);
-}
-
-static int sriov_enable_migration(struct pci_dev *dev, int nr_virtfn)
-{
-	int bir;
-	u32 table;
-	resource_size_t pa;
-	struct pci_sriov *iov = dev->sriov;
-
-	if (nr_virtfn <= iov->initial_VFs)
-		return 0;
-
-	pci_read_config_dword(dev, iov->pos + PCI_SRIOV_VFM, &table);
-	bir = PCI_SRIOV_VFM_BIR(table);
-	if (bir > PCI_STD_RESOURCE_END)
-		return -EIO;
-
-	table = PCI_SRIOV_VFM_OFFSET(table);
-	if (table + nr_virtfn > pci_resource_len(dev, bir))
-		return -EIO;
-
-	pa = pci_resource_start(dev, bir) + table;
-	iov->mstate = ioremap(pa, nr_virtfn);
-	if (!iov->mstate)
-		return -ENOMEM;
-
-	INIT_WORK(&iov->mtask, sriov_migration_task);
-
-	iov->ctrl |= PCI_SRIOV_CTRL_VFM | PCI_SRIOV_CTRL_INTR;
-	pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
-
-	return 0;
-}
-
-static void sriov_disable_migration(struct pci_dev *dev)
-{
-	struct pci_sriov *iov = dev->sriov;
-
-	iov->ctrl &= ~(PCI_SRIOV_CTRL_VFM | PCI_SRIOV_CTRL_INTR);
-	pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
-
-	cancel_work_sync(&iov->mtask);
-	iounmap(iov->mstate);
-}
-
 static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
 {
 	int rc;
@@ -351,12 +260,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
 			goto failed;
 	}
 
-	if (iov->cap & PCI_SRIOV_CAP_VFM) {
-		rc = sriov_enable_migration(dev, nr_virtfn);
-		if (rc)
-			goto failed;
-	}
-
 	kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE);
 	iov->num_VFs = nr_virtfn;
 
@@ -387,9 +290,6 @@ static void sriov_disable(struct pci_dev *dev)
 	if (!iov->num_VFs)
 		return;
 
-	if (iov->cap & PCI_SRIOV_CAP_VFM)
-		sriov_disable_migration(dev);
-
 	for (i = 0; i < iov->num_VFs; i++)
 		virtfn_remove(dev, i, 0);
 
@@ -688,25 +588,6 @@ void pci_disable_sriov(struct pci_dev *dev)
 EXPORT_SYMBOL_GPL(pci_disable_sriov);
 
 /**
- * pci_sriov_migration - notify SR-IOV core of Virtual Function Migration
- * @dev: the PCI device
- *
- * Returns IRQ_HANDLED if the IRQ is handled, or IRQ_NONE if not.
- *
- * Physical Function driver is responsible to register IRQ handler using
- * VF Migration Interrupt Message Number, and call this function when the
- * interrupt is generated by the hardware.
- */
-irqreturn_t pci_sriov_migration(struct pci_dev *dev)
-{
-	if (!dev->is_physfn)
-		return IRQ_NONE;
-
-	return sriov_migration(dev) ? IRQ_HANDLED : IRQ_NONE;
-}
-EXPORT_SYMBOL_GPL(pci_sriov_migration);
-
-/**
  * pci_num_vf - return number of VFs associated with a PF device_release_driver
  * @dev: the PCI device
  *
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 4df38df224f4..6bd082299e31 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -1,8 +1,6 @@
 #ifndef DRIVERS_PCI_H
 #define DRIVERS_PCI_H
 
-#include <linux/workqueue.h>
-
 #define PCI_CFG_SPACE_SIZE	256
 #define PCI_CFG_SPACE_EXP_SIZE	4096
 
@@ -240,8 +238,6 @@ struct pci_sriov {
 	struct pci_dev *dev;	/* lowest numbered PF */
 	struct pci_dev *self;	/* this PF */
 	struct mutex lock;	/* lock for VF bus */
-	struct work_struct mtask; /* VF Migration task */
-	u8 __iomem *mstate;	/* VF Migration State Array */
 };
 
 #ifdef CONFIG_PCI_ATS
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b3cd9d58f5a9..bd0e268c80b5 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -29,7 +29,6 @@
 #include <linux/atomic.h>
 #include <linux/device.h>
 #include <linux/io.h>
-#include <linux/irqreturn.h>
 #include <uapi/linux/pci.h>
 
 #include <linux/pci_ids.h>
@@ -1574,7 +1573,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
 #ifdef CONFIG_PCI_IOV
 int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
 void pci_disable_sriov(struct pci_dev *dev);
-irqreturn_t pci_sriov_migration(struct pci_dev *dev);
 int pci_num_vf(struct pci_dev *dev);
 int pci_vfs_assigned(struct pci_dev *dev);
 int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
@@ -1583,8 +1581,6 @@ int pci_sriov_get_totalvfs(struct pci_dev *dev);
 static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
 { return -ENODEV; }
 static inline void pci_disable_sriov(struct pci_dev *dev) { }
-static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
-{ return IRQ_NONE; }
 static inline int pci_num_vf(struct pci_dev *dev) { return 0; }
 static inline int pci_vfs_assigned(struct pci_dev *dev)
 { return 0; }


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [E1000-devel] [PATCH 0/2] Remove dead code
  2014-01-30 19:20 [PATCH 0/2] Remove dead code Bjorn Helgaas
@ 2014-01-31  9:10   ` Brown, Aaron F
  2014-01-30 19:20 ` [PATCH 2/2] PCI: Remove unused SR-IOV VF Migration support Bjorn Helgaas
  2014-01-31  9:10   ` Brown, Aaron F
  2 siblings, 0 replies; 10+ messages in thread
From: Brown, Aaron F @ 2014-01-31  9:10 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci; +Cc: e1000-devel, Arjan van de Ven, linux-kernel

> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Thursday, January 30, 2014 11:21 AM
> To: linux-pci@vger.kernel.org
> Cc: e1000-devel@lists.sourceforge.net; Arjan van de Ven; linux-
> kernel@vger.kernel.org
> Subject: [E1000-devel] [PATCH 0/2] Remove dead code
> 
> This is a rework of part of Stephen's patch [1].
> 
> This removes the MMIO exclusivity support that was added as part of an
> e1000e bug hunt.
> 
> The e1000e driver still uses pci_request_selected_regions_exclusive(), but
> there are no callers of pci_request_region_exclusive() and
> pci_request_regions_exclusive().  I thought it was cleaner to remove the
> whole thing than to leave parts of it in place.  But I could easily be
> convinced to leave part or all of this in place if people think it's still
> useful.

Thanks Bjorn, I have added these to Jeff's queue.

> 
> It also removes SR-IOV migration support, which is completely unused, as
> far as I can tell.
> 
> [1]
> http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.n
> et
> 
> ---
> 
> Bjorn Helgaas (2):
>       PCI: Remove unused MMIO exclusivity support
>       PCI: Remove unused SR-IOV VF Migration support
> 
> 
>  Documentation/PCI/pci-iov-howto.txt        |    4 -
>  Documentation/kernel-parameters.txt        |    4 -
>  arch/x86/mm/init.c                         |    2
>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
>  drivers/pci/iov.c                          |  119 -----------------------
> -----
>  drivers/pci/pci-sysfs.c                    |    3 -
>  drivers/pci/pci.c                          |  112 +++--------------------
> ---
>  drivers/pci/pci.h                          |    4 -
>  include/linux/ioport.h                     |    5 -
>  include/linux/pci.h                        |    7 --
>  kernel/resource.c                          |   54 -------------
>  11 files changed, 14 insertions(+), 303 deletions(-)
> 
> --------------------------------------------------------------------------
> ----
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import a
> virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clkt
> rk
> _______________________________________________
> E1000-devel mailing list
> E1000-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/e1000-devel
> To learn more about Intel&#174; Ethernet, visit
> http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [E1000-devel] [PATCH 0/2] Remove dead code
@ 2014-01-31  9:10   ` Brown, Aaron F
  0 siblings, 0 replies; 10+ messages in thread
From: Brown, Aaron F @ 2014-01-31  9:10 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci; +Cc: e1000-devel, Arjan van de Ven, linux-kernel

> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Thursday, January 30, 2014 11:21 AM
> To: linux-pci@vger.kernel.org
> Cc: e1000-devel@lists.sourceforge.net; Arjan van de Ven; linux-
> kernel@vger.kernel.org
> Subject: [E1000-devel] [PATCH 0/2] Remove dead code
> 
> This is a rework of part of Stephen's patch [1].
> 
> This removes the MMIO exclusivity support that was added as part of an
> e1000e bug hunt.
> 
> The e1000e driver still uses pci_request_selected_regions_exclusive(), but
> there are no callers of pci_request_region_exclusive() and
> pci_request_regions_exclusive().  I thought it was cleaner to remove the
> whole thing than to leave parts of it in place.  But I could easily be
> convinced to leave part or all of this in place if people think it's still
> useful.

Thanks Bjorn, I have added these to Jeff's queue.

> 
> It also removes SR-IOV migration support, which is completely unused, as
> far as I can tell.
> 
> [1]
> http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.n
> et
> 
> ---
> 
> Bjorn Helgaas (2):
>       PCI: Remove unused MMIO exclusivity support
>       PCI: Remove unused SR-IOV VF Migration support
> 
> 
>  Documentation/PCI/pci-iov-howto.txt        |    4 -
>  Documentation/kernel-parameters.txt        |    4 -
>  arch/x86/mm/init.c                         |    2
>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
>  drivers/pci/iov.c                          |  119 -----------------------
> -----
>  drivers/pci/pci-sysfs.c                    |    3 -
>  drivers/pci/pci.c                          |  112 +++--------------------
> ---
>  drivers/pci/pci.h                          |    4 -
>  include/linux/ioport.h                     |    5 -
>  include/linux/pci.h                        |    7 --
>  kernel/resource.c                          |   54 -------------
>  11 files changed, 14 insertions(+), 303 deletions(-)
> 
> --------------------------------------------------------------------------
> ----
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import a
> virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clkt
> rk
> _______________________________________________
> E1000-devel mailing list
> E1000-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/e1000-devel
> To learn more about Intel&#174; Ethernet, visit
> http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [E1000-devel] [PATCH 0/2] Remove dead code
  2014-01-31  9:10   ` Brown, Aaron F
@ 2014-01-31 17:59     ` Bjorn Helgaas
  -1 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2014-01-31 17:59 UTC (permalink / raw)
  To: Brown, Aaron F; +Cc: linux-pci, e1000-devel, Arjan van de Ven, linux-kernel

On Fri, Jan 31, 2014 at 2:10 AM, Brown, Aaron F <aaron.f.brown@intel.com> wrote:
>> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
>> Sent: Thursday, January 30, 2014 11:21 AM
>> To: linux-pci@vger.kernel.org
>> Cc: e1000-devel@lists.sourceforge.net; Arjan van de Ven; linux-
>> kernel@vger.kernel.org
>> Subject: [E1000-devel] [PATCH 0/2] Remove dead code
>>
>> This is a rework of part of Stephen's patch [1].
>>
>> This removes the MMIO exclusivity support that was added as part of an
>> e1000e bug hunt.
>>
>> The e1000e driver still uses pci_request_selected_regions_exclusive(), but
>> there are no callers of pci_request_region_exclusive() and
>> pci_request_regions_exclusive().  I thought it was cleaner to remove the
>> whole thing than to leave parts of it in place.  But I could easily be
>> convinced to leave part or all of this in place if people think it's still
>> useful.
>
> Thanks Bjorn, I have added these to Jeff's queue.

Let's wait for a bit more discussion on this.

For one thing, Fengguang's autobuilder found a handful of issues,
including a couple more users of the exclusive mappings.  For another,
Arjan reminded me that the e1000e bug hung was for a problem that
bricked the device, requiring replacement of the part or significant
effort to fix the EEPROM.  I *suspect* this is a potential issue for
many devices, but if the e1000e is particularly susceptible for some
reason, we might want to keep the exclusive mappings for it.

If you want to apply just the e1000e part that removes its use of
pci_request_selected_regions_exclusive(), I would have no complaints
about that, of course.  But we can't apply the whole thing as-is
without at least fixing the build issues.

>> It also removes SR-IOV migration support, which is completely unused, as
>> far as I can tell.
>>
>> [1]
>> http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.n
>> et
>>
>> ---
>>
>> Bjorn Helgaas (2):
>>       PCI: Remove unused MMIO exclusivity support
>>       PCI: Remove unused SR-IOV VF Migration support
>>
>>
>>  Documentation/PCI/pci-iov-howto.txt        |    4 -
>>  Documentation/kernel-parameters.txt        |    4 -
>>  arch/x86/mm/init.c                         |    2
>>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
>>  drivers/pci/iov.c                          |  119 -----------------------
>> -----
>>  drivers/pci/pci-sysfs.c                    |    3 -
>>  drivers/pci/pci.c                          |  112 +++--------------------
>> ---
>>  drivers/pci/pci.h                          |    4 -
>>  include/linux/ioport.h                     |    5 -
>>  include/linux/pci.h                        |    7 --
>>  kernel/resource.c                          |   54 -------------
>>  11 files changed, 14 insertions(+), 303 deletions(-)
>>
>> --------------------------------------------------------------------------
>> ----
>> WatchGuard Dimension instantly turns raw network data into actionable
>> security intelligence. It gives you real-time visual feedback on key
>> security issues and trends.  Skip the complicated setup - simply import a
>> virtual appliance and go from zero to informed in seconds.
>> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clkt
>> rk
>> _______________________________________________
>> E1000-devel mailing list
>> E1000-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/e1000-devel
>> To learn more about Intel&#174; Ethernet, visit
>> http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [E1000-devel] [PATCH 0/2] Remove dead code
@ 2014-01-31 17:59     ` Bjorn Helgaas
  0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2014-01-31 17:59 UTC (permalink / raw)
  To: Brown, Aaron F; +Cc: linux-pci, e1000-devel, Arjan van de Ven, linux-kernel

On Fri, Jan 31, 2014 at 2:10 AM, Brown, Aaron F <aaron.f.brown@intel.com> wrote:
>> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
>> Sent: Thursday, January 30, 2014 11:21 AM
>> To: linux-pci@vger.kernel.org
>> Cc: e1000-devel@lists.sourceforge.net; Arjan van de Ven; linux-
>> kernel@vger.kernel.org
>> Subject: [E1000-devel] [PATCH 0/2] Remove dead code
>>
>> This is a rework of part of Stephen's patch [1].
>>
>> This removes the MMIO exclusivity support that was added as part of an
>> e1000e bug hunt.
>>
>> The e1000e driver still uses pci_request_selected_regions_exclusive(), but
>> there are no callers of pci_request_region_exclusive() and
>> pci_request_regions_exclusive().  I thought it was cleaner to remove the
>> whole thing than to leave parts of it in place.  But I could easily be
>> convinced to leave part or all of this in place if people think it's still
>> useful.
>
> Thanks Bjorn, I have added these to Jeff's queue.

Let's wait for a bit more discussion on this.

For one thing, Fengguang's autobuilder found a handful of issues,
including a couple more users of the exclusive mappings.  For another,
Arjan reminded me that the e1000e bug hung was for a problem that
bricked the device, requiring replacement of the part or significant
effort to fix the EEPROM.  I *suspect* this is a potential issue for
many devices, but if the e1000e is particularly susceptible for some
reason, we might want to keep the exclusive mappings for it.

If you want to apply just the e1000e part that removes its use of
pci_request_selected_regions_exclusive(), I would have no complaints
about that, of course.  But we can't apply the whole thing as-is
without at least fixing the build issues.

>> It also removes SR-IOV migration support, which is completely unused, as
>> far as I can tell.
>>
>> [1]
>> http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.n
>> et
>>
>> ---
>>
>> Bjorn Helgaas (2):
>>       PCI: Remove unused MMIO exclusivity support
>>       PCI: Remove unused SR-IOV VF Migration support
>>
>>
>>  Documentation/PCI/pci-iov-howto.txt        |    4 -
>>  Documentation/kernel-parameters.txt        |    4 -
>>  arch/x86/mm/init.c                         |    2
>>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
>>  drivers/pci/iov.c                          |  119 -----------------------
>> -----
>>  drivers/pci/pci-sysfs.c                    |    3 -
>>  drivers/pci/pci.c                          |  112 +++--------------------
>> ---
>>  drivers/pci/pci.h                          |    4 -
>>  include/linux/ioport.h                     |    5 -
>>  include/linux/pci.h                        |    7 --
>>  kernel/resource.c                          |   54 -------------
>>  11 files changed, 14 insertions(+), 303 deletions(-)
>>
>> --------------------------------------------------------------------------
>> ----
>> WatchGuard Dimension instantly turns raw network data into actionable
>> security intelligence. It gives you real-time visual feedback on key
>> security issues and trends.  Skip the complicated setup - simply import a
>> virtual appliance and go from zero to informed in seconds.
>> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clkt
>> rk
>> _______________________________________________
>> E1000-devel mailing list
>> E1000-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/e1000-devel
>> To learn more about Intel&#174; Ethernet, visit
>> http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [E1000-devel] [PATCH 0/2] Remove dead code
  2014-01-31 17:59     ` Bjorn Helgaas
@ 2014-01-31 19:20       ` Brown, Aaron F
  -1 siblings, 0 replies; 10+ messages in thread
From: Brown, Aaron F @ 2014-01-31 19:20 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, e1000-devel, Arjan van de Ven, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4428 bytes --]

> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Friday, January 31, 2014 9:59 AM
> To: Brown, Aaron F
> Cc: linux-pci@vger.kernel.org; e1000-devel@lists.sourceforge.net; Arjan
> van de Ven; linux-kernel@vger.kernel.org
> Subject: Re: [E1000-devel] [PATCH 0/2] Remove dead code
> 
> On Fri, Jan 31, 2014 at 2:10 AM, Brown, Aaron F <aaron.f.brown@intel.com>
> wrote:
> >> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> >> Sent: Thursday, January 30, 2014 11:21 AM
> >> To: linux-pci@vger.kernel.org
> >> Cc: e1000-devel@lists.sourceforge.net; Arjan van de Ven; linux-
> >> kernel@vger.kernel.org
> >> Subject: [E1000-devel] [PATCH 0/2] Remove dead code
> >>
> >> This is a rework of part of Stephen's patch [1].
> >>
> >> This removes the MMIO exclusivity support that was added as part of
> >> an e1000e bug hunt.
> >>
> >> The e1000e driver still uses
> >> pci_request_selected_regions_exclusive(), but there are no callers of
> >> pci_request_region_exclusive() and pci_request_regions_exclusive().
> >> I thought it was cleaner to remove the whole thing than to leave
> >> parts of it in place.  But I could easily be convinced to leave part
> >> or all of this in place if people think it's still useful.
> >
> > Thanks Bjorn, I have added these to Jeff's queue.
> 
> Let's wait for a bit more discussion on this.
> 
> For one thing, Fengguang's autobuilder found a handful of issues,
> including a couple more users of the exclusive mappings.  For another,
> Arjan reminded me that the e1000e bug hung was for a problem that bricked
> the device, requiring replacement of the part or significant effort to fix
> the EEPROM.  I *suspect* this is a potential issue for many devices, but
> if the e1000e is particularly susceptible for some reason, we might want
> to keep the exclusive mappings for it.
> 
> If you want to apply just the e1000e part that removes its use of
> pci_request_selected_regions_exclusive(), I would have no complaints about
> that, of course.

Yes, that was my main intent.  I did pull them both in but the second was more as a heads up to our virtualization guys then as a request to test.

>  But we can't apply the whole thing as-is without at
> least fixing the build issues.

Thanks for the heads up on that.  I'll sort out something that builds with the e1000e parts removed on my end.

> 
> >> It also removes SR-IOV migration support, which is completely unused,
> >> as far as I can tell.
> >>
> >> [1]
> >> http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplum
> >> ber.n
> >> et
> >>
> >> ---
> >>
> >> Bjorn Helgaas (2):
> >>       PCI: Remove unused MMIO exclusivity support
> >>       PCI: Remove unused SR-IOV VF Migration support
> >>
> >>
> >>  Documentation/PCI/pci-iov-howto.txt        |    4 -
> >>  Documentation/kernel-parameters.txt        |    4 -
> >>  arch/x86/mm/init.c                         |    2
> >>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
> >>  drivers/pci/iov.c                          |  119 --------------------
> ---
> >> -----
> >>  drivers/pci/pci-sysfs.c                    |    3 -
> >>  drivers/pci/pci.c                          |  112 +++-----------------
> ---
> >> ---
> >>  drivers/pci/pci.h                          |    4 -
> >>  include/linux/ioport.h                     |    5 -
> >>  include/linux/pci.h                        |    7 --
> >>  kernel/resource.c                          |   54 -------------
> >>  11 files changed, 14 insertions(+), 303 deletions(-)
> >>
> >> ---------------------------------------------------------------------
> >> -----
> >> ----
> >> WatchGuard Dimension instantly turns raw network data into actionable
> >> security intelligence. It gives you real-time visual feedback on key
> >> security issues and trends.  Skip the complicated setup - simply
> >> import a virtual appliance and go from zero to informed in seconds.
> >> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg
> >> .clkt
> >> rk
> >> _______________________________________________
> >> E1000-devel mailing list
> >> E1000-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/e1000-devel
> >> To learn more about Intel&#174; Ethernet, visit
> >> http://communities.intel.com/community/wired
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [E1000-devel] [PATCH 0/2] Remove dead code
@ 2014-01-31 19:20       ` Brown, Aaron F
  0 siblings, 0 replies; 10+ messages in thread
From: Brown, Aaron F @ 2014-01-31 19:20 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, e1000-devel, Arjan van de Ven, linux-kernel

PiBGcm9tOiBCam9ybiBIZWxnYWFzIFttYWlsdG86YmhlbGdhYXNAZ29vZ2xlLmNvbV0NCj4gU2Vu
dDogRnJpZGF5LCBKYW51YXJ5IDMxLCAyMDE0IDk6NTkgQU0NCj4gVG86IEJyb3duLCBBYXJvbiBG
DQo+IENjOiBsaW51eC1wY2lAdmdlci5rZXJuZWwub3JnOyBlMTAwMC1kZXZlbEBsaXN0cy5zb3Vy
Y2Vmb3JnZS5uZXQ7IEFyamFuDQo+IHZhbiBkZSBWZW47IGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5l
bC5vcmcNCj4gU3ViamVjdDogUmU6IFtFMTAwMC1kZXZlbF0gW1BBVENIIDAvMl0gUmVtb3ZlIGRl
YWQgY29kZQ0KPiANCj4gT24gRnJpLCBKYW4gMzEsIDIwMTQgYXQgMjoxMCBBTSwgQnJvd24sIEFh
cm9uIEYgPGFhcm9uLmYuYnJvd25AaW50ZWwuY29tPg0KPiB3cm90ZToNCj4gPj4gRnJvbTogQmpv
cm4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BodHRwOi8vY29t
bXVuaXRpZXMuaW50ZWwuY29tL2NvbW11bml0eS93aXJlZA0K

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] PCI: Remove unused MMIO exclusivity support
  2014-01-30 19:20 ` [PATCH 1/2] PCI: Remove unused MMIO exclusivity support Bjorn Helgaas
@ 2014-02-14 21:00   ` Bjorn Helgaas
  0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2014-02-14 21:00 UTC (permalink / raw)
  To: linux-pci
  Cc: e1000-devel, Stephen Hemminger, Arjan van de Ven, linux-kernel,
	Aaron F Brown

[+cc Aaron]

On Thu, Jan 30, 2014 at 12:20:38PM -0700, Bjorn Helgaas wrote:
> This reverts commit e8de1481fd71 ("resource: allow MMIO exclusivity for
> device drivers"), removing these exported interfaces:
> 
>   pci_request_region_exclusive()
>   pci_request_regions_exclusive()
>   pci_request_selected_regions_exclusive()
> 
> There's nothing wrong with the MMIO exclusivity code, but it is used only
> by the e1000e driver, and the only reason it's there is because it was
> added during a bug hunt.  The bug has been fixed, and apparently no other
> drivers have found it useful in the five years since then.
> 
> This is based on Stephen Hemminger's patch (see link below), but goes a bit
> further by removing the use in e1000e.
> 
> Link: http://lkml.kernel.org/r/20131227132710.7190647c@nehalam.linuxnetplumber.net
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> CC: Arjan van de Ven <arjan@linux.intel.com>
> CC: Stephen Hemminger <stephen@networkplumber.org>

I'm dropping this one for now because it's used by:

  - e1000e
  - alpha pci_mmap_resource()
  - sp5100_tco_setupdevice()

That's still sort of a marginal number of users, but in any event, it's
clear that a little more work would be required to remove it.

> ---
>  Documentation/kernel-parameters.txt        |    4 -
>  arch/x86/mm/init.c                         |    2 -
>  drivers/net/ethernet/intel/e1000e/netdev.c |    3 -
>  drivers/pci/pci-sysfs.c                    |    3 -
>  drivers/pci/pci.c                          |  112 +++-------------------------
>  include/linux/ioport.h                     |    5 -
>  include/linux/pci.h                        |    3 -
>  kernel/resource.c                          |   54 --------------
>  8 files changed, 14 insertions(+), 172 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 8f441dab0396..4943bddeacc1 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1323,10 +1323,6 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  			no_x2apic_optout
>  				BIOS x2APIC opt-out request will be ignored
>  
> -	iomem=		Disable strict checking of access to MMIO memory
> -		strict	regions from userspace.
> -		relaxed
> -
>  	iommu=		[x86]
>  		off
>  		force
> diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> index f97130618113..575cbfd89238 100644
> --- a/arch/x86/mm/init.c
> +++ b/arch/x86/mm/init.c
> @@ -583,8 +583,6 @@ int devmem_is_allowed(unsigned long pagenr)
>  {
>  	if (pagenr < 256)
>  		return 1;
> -	if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
> -		return 0;
>  	if (!page_is_ram(pagenr))
>  		return 1;
>  	return 0;
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 6d91933c4cdd..97a11b19e46f 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -6574,8 +6574,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	}
>  
>  	bars = pci_select_bars(pdev, IORESOURCE_MEM);
> -	err = pci_request_selected_regions_exclusive(pdev, bars,
> -						     e1000e_driver_name);
> +	err = pci_request_selected_regions(pdev, bars, e1000e_driver_name);
>  	if (err)
>  		goto err_pci_reg;
>  
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 276ef9c18802..4580fa859f38 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -993,9 +993,6 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
>  	vma->vm_pgoff += start >> PAGE_SHIFT;
>  	mmap_type = res->flags & IORESOURCE_MEM ? pci_mmap_mem : pci_mmap_io;
>  
> -	if (res->flags & IORESOURCE_MEM && iomem_is_exclusive(start))
> -		return -EINVAL;
> -
>  	return pci_mmap_page_range(pdev, vma, mmap_type, write_combine);
>  }
>  
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 1febe90831b4..1011c0b281ca 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2432,26 +2432,20 @@ void pci_release_region(struct pci_dev *pdev, int bar)
>  }
>  
>  /**
> - *	__pci_request_region - Reserved PCI I/O and memory resource
> + *	pci_request_region - Reserved PCI I/O and memory resource
>   *	@pdev: PCI device whose resources are to be reserved
>   *	@bar: BAR to be reserved
>   *	@res_name: Name to be associated with resource.
> - *	@exclusive: whether the region access is exclusive or not
>   *
>   *	Mark the PCI region associated with PCI device @pdev BR @bar as
>   *	being reserved by owner @res_name.  Do not access any
>   *	address inside the PCI regions unless this call returns
>   *	successfully.
>   *
> - *	If @exclusive is set, then the region is marked so that userspace
> - *	is explicitly not allowed to map the resource via /dev/mem or
> - *	sysfs MMIO access.
> - *
>   *	Returns 0 on success, or %EBUSY on error.  A warning
>   *	message is also printed on failure.
>   */
> -static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_name,
> -									int exclusive)
> +int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
>  {
>  	struct pci_devres *dr;
>  
> @@ -2464,9 +2458,8 @@ static int __pci_request_region(struct pci_dev *pdev, int bar, const char *res_n
>  			goto err_out;
>  	}
>  	else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
> -		if (!__request_mem_region(pci_resource_start(pdev, bar),
> -					pci_resource_len(pdev, bar), res_name,
> -					exclusive))
> +		if (!request_mem_region(pci_resource_start(pdev, bar),
> +					pci_resource_len(pdev, bar), res_name))
>  			goto err_out;
>  	}
>  
> @@ -2483,47 +2476,6 @@ err_out:
>  }
>  
>  /**
> - *	pci_request_region - Reserve PCI I/O and memory resource
> - *	@pdev: PCI device whose resources are to be reserved
> - *	@bar: BAR to be reserved
> - *	@res_name: Name to be associated with resource
> - *
> - *	Mark the PCI region associated with PCI device @pdev BAR @bar as
> - *	being reserved by owner @res_name.  Do not access any
> - *	address inside the PCI regions unless this call returns
> - *	successfully.
> - *
> - *	Returns 0 on success, or %EBUSY on error.  A warning
> - *	message is also printed on failure.
> - */
> -int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
> -{
> -	return __pci_request_region(pdev, bar, res_name, 0);
> -}
> -
> -/**
> - *	pci_request_region_exclusive - Reserved PCI I/O and memory resource
> - *	@pdev: PCI device whose resources are to be reserved
> - *	@bar: BAR to be reserved
> - *	@res_name: Name to be associated with resource.
> - *
> - *	Mark the PCI region associated with PCI device @pdev BR @bar as
> - *	being reserved by owner @res_name.  Do not access any
> - *	address inside the PCI regions unless this call returns
> - *	successfully.
> - *
> - *	Returns 0 on success, or %EBUSY on error.  A warning
> - *	message is also printed on failure.
> - *
> - *	The key difference that _exclusive makes it that userspace is
> - *	explicitly not allowed to map the resource via /dev/mem or
> - *	sysfs.
> - */
> -int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
> -{
> -	return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE);
> -}
> -/**
>   * pci_release_selected_regions - Release selected PCI I/O and memory resources
>   * @pdev: PCI device whose resources were previously reserved
>   * @bars: Bitmask of BARs to be released
> @@ -2540,14 +2492,20 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars)
>  			pci_release_region(pdev, i);
>  }
>  
> -static int __pci_request_selected_regions(struct pci_dev *pdev, int bars,
> -				 const char *res_name, int excl)
> +/**
> + * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
> + * @pdev: PCI device whose resources are to be reserved
> + * @bars: Bitmask of BARs to be requested
> + * @res_name: Name to be associated with resource
> + */
> +int pci_request_selected_regions(struct pci_dev *pdev, int bars,
> +				 const char *res_name)
>  {
>  	int i;
>  
>  	for (i = 0; i < 6; i++)
>  		if (bars & (1 << i))
> -			if (__pci_request_region(pdev, i, res_name, excl))
> +			if (pci_request_region(pdev, i, res_name))
>  				goto err_out;
>  	return 0;
>  
> @@ -2561,25 +2519,6 @@ err_out:
>  
>  
>  /**
> - * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
> - * @pdev: PCI device whose resources are to be reserved
> - * @bars: Bitmask of BARs to be requested
> - * @res_name: Name to be associated with resource
> - */
> -int pci_request_selected_regions(struct pci_dev *pdev, int bars,
> -				 const char *res_name)
> -{
> -	return __pci_request_selected_regions(pdev, bars, res_name, 0);
> -}
> -
> -int pci_request_selected_regions_exclusive(struct pci_dev *pdev,
> -				 int bars, const char *res_name)
> -{
> -	return __pci_request_selected_regions(pdev, bars, res_name,
> -			IORESOURCE_EXCLUSIVE);
> -}
> -
> -/**
>   *	pci_release_regions - Release reserved PCI I/O and memory resources
>   *	@pdev: PCI device whose resources were previously reserved by pci_request_regions
>   *
> @@ -2611,28 +2550,6 @@ int pci_request_regions(struct pci_dev *pdev, const char *res_name)
>  	return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name);
>  }
>  
> -/**
> - *	pci_request_regions_exclusive - Reserved PCI I/O and memory resources
> - *	@pdev: PCI device whose resources are to be reserved
> - *	@res_name: Name to be associated with resource.
> - *
> - *	Mark all PCI regions associated with PCI device @pdev as
> - *	being reserved by owner @res_name.  Do not access any
> - *	address inside the PCI regions unless this call returns
> - *	successfully.
> - *
> - *	pci_request_regions_exclusive() will mark the region so that
> - *	/dev/mem and the sysfs MMIO access will not be allowed.
> - *
> - *	Returns 0 on success, or %EBUSY on error.  A warning
> - *	message is also printed on failure.
> - */
> -int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name)
> -{
> -	return pci_request_selected_regions_exclusive(pdev,
> -					((1 << 6) - 1), res_name);
> -}
> -
>  static void __pci_set_master(struct pci_dev *dev, bool enable)
>  {
>  	u16 old_cmd, cmd;
> @@ -4387,13 +4304,10 @@ EXPORT_SYMBOL(pci_find_capability);
>  EXPORT_SYMBOL(pci_bus_find_capability);
>  EXPORT_SYMBOL(pci_release_regions);
>  EXPORT_SYMBOL(pci_request_regions);
> -EXPORT_SYMBOL(pci_request_regions_exclusive);
>  EXPORT_SYMBOL(pci_release_region);
>  EXPORT_SYMBOL(pci_request_region);
> -EXPORT_SYMBOL(pci_request_region_exclusive);
>  EXPORT_SYMBOL(pci_release_selected_regions);
>  EXPORT_SYMBOL(pci_request_selected_regions);
> -EXPORT_SYMBOL(pci_request_selected_regions_exclusive);
>  EXPORT_SYMBOL(pci_set_master);
>  EXPORT_SYMBOL(pci_clear_master);
>  EXPORT_SYMBOL(pci_set_mwi);
> diff --git a/include/linux/ioport.h b/include/linux/ioport.h
> index 89b7c24a36e9..f2d45ea3ee53 100644
> --- a/include/linux/ioport.h
> +++ b/include/linux/ioport.h
> @@ -49,7 +49,6 @@ struct resource {
>  #define IORESOURCE_WINDOW	0x00200000	/* forwarded by bridge */
>  #define IORESOURCE_MUXED	0x00400000	/* Resource is software muxed */
>  
> -#define IORESOURCE_EXCLUSIVE	0x08000000	/* Userland may not map this resource */
>  #define IORESOURCE_DISABLED	0x10000000
>  #define IORESOURCE_UNSET	0x20000000
>  #define IORESOURCE_AUTO		0x40000000
> @@ -173,10 +172,7 @@ static inline unsigned long resource_type(const struct resource *res)
>  /* Convenience shorthand with allocation */
>  #define request_region(start,n,name)		__request_region(&ioport_resource, (start), (n), (name), 0)
>  #define request_muxed_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
> -#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
>  #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
> -#define request_mem_region_exclusive(start,n,name) \
> -	__request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
>  #define rename_region(region, newname) do { (region)->name = (newname); } while (0)
>  
>  extern struct resource * __request_region(struct resource *,
> @@ -222,7 +218,6 @@ extern struct resource * __devm_request_region(struct device *dev,
>  extern void __devm_release_region(struct device *dev, struct resource *parent,
>  				  resource_size_t start, resource_size_t n);
>  extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
> -extern int iomem_is_exclusive(u64 addr);
>  
>  extern int
>  walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index fb57c892b214..b3cd9d58f5a9 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1038,13 +1038,10 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
>  		    int (*)(const struct pci_dev *, u8, u8));
>  #define HAVE_PCI_REQ_REGIONS	2
>  int __must_check pci_request_regions(struct pci_dev *, const char *);
> -int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
>  void pci_release_regions(struct pci_dev *);
>  int __must_check pci_request_region(struct pci_dev *, int, const char *);
> -int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
>  void pci_release_region(struct pci_dev *, int);
>  int pci_request_selected_regions(struct pci_dev *, int, const char *);
> -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 */
> diff --git a/kernel/resource.c b/kernel/resource.c
> index 3f285dce9347..9a29d989aa5e 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -1306,57 +1306,3 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
>  
>  	return err;
>  }
> -
> -#ifdef CONFIG_STRICT_DEVMEM
> -static int strict_iomem_checks = 1;
> -#else
> -static int strict_iomem_checks;
> -#endif
> -
> -/*
> - * check if an address is reserved in the iomem resource tree
> - * returns 1 if reserved, 0 if not reserved.
> - */
> -int iomem_is_exclusive(u64 addr)
> -{
> -	struct resource *p = &iomem_resource;
> -	int err = 0;
> -	loff_t l;
> -	int size = PAGE_SIZE;
> -
> -	if (!strict_iomem_checks)
> -		return 0;
> -
> -	addr = addr & PAGE_MASK;
> -
> -	read_lock(&resource_lock);
> -	for (p = p->child; p ; p = r_next(NULL, p, &l)) {
> -		/*
> -		 * We can probably skip the resources without
> -		 * IORESOURCE_IO attribute?
> -		 */
> -		if (p->start >= addr + size)
> -			break;
> -		if (p->end < addr)
> -			continue;
> -		if (p->flags & IORESOURCE_BUSY &&
> -		     p->flags & IORESOURCE_EXCLUSIVE) {
> -			err = 1;
> -			break;
> -		}
> -	}
> -	read_unlock(&resource_lock);
> -
> -	return err;
> -}
> -
> -static int __init strict_iomem(char *str)
> -{
> -	if (strstr(str, "relaxed"))
> -		strict_iomem_checks = 0;
> -	if (strstr(str, "strict"))
> -		strict_iomem_checks = 1;
> -	return 1;
> -}
> -
> -__setup("iomem=", strict_iomem);
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-02-14 21:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 19:20 [PATCH 0/2] Remove dead code Bjorn Helgaas
2014-01-30 19:20 ` [PATCH 1/2] PCI: Remove unused MMIO exclusivity support Bjorn Helgaas
2014-02-14 21:00   ` Bjorn Helgaas
2014-01-30 19:20 ` [PATCH 2/2] PCI: Remove unused SR-IOV VF Migration support Bjorn Helgaas
2014-01-31  9:10 ` [E1000-devel] [PATCH 0/2] Remove dead code Brown, Aaron F
2014-01-31  9:10   ` Brown, Aaron F
2014-01-31 17:59   ` Bjorn Helgaas
2014-01-31 17:59     ` Bjorn Helgaas
2014-01-31 19:20     ` Brown, Aaron F
2014-01-31 19:20       ` Brown, Aaron F

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.