lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <53232F01.8040209@gmail.com>
Date:	Fri, 14 Mar 2014 09:32:01 -0700
From:	Rajat Jain <rajatxjain@...il.com>
To:	Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
CC:	Rajat Jain <rajatjain@...iper.net>,
	Guenter Roeck <groeck@...iper.net>,
	Alex Williamson <alex.williamson@...hat.com>,
	Andrew Murray <amurray@...edded-bits.co.uk>,
	Alexander Gordeev <agordeev@...hat.com>
Subject: [PATCH] pci: Allow hotplug service drivers to operate in polling
 mode

Today the PCIe port bus driver disables the Hot-plug service if the
port device does not have the capability to generate interrupts.
However, drivers may have a polling method that can be used in this
case. In case of pciehp, user must be able to use the "pciehp_poll_mode"
parameter to use polling method in such a case. Today it is not
possible.

This patch allows a hotplug service driver to decide whether or not
it would like to continue in absense of interrupts. Also, the current
hotplug service driver (pciehp) is changed to check that either IRQs are
supported, or polling mode is to be used.

Signed-off-by: Rajat Jain <rajatxjain@...il.com>
Signed-off-by: Rajat Jain <rajatjain@...iper.net>
Signed-off-by: Guenter Roeck <groeck@...iper.net>
---
 drivers/pci/hotplug/pciehp_hpc.c |    8 ++++++++
 drivers/pci/pcie/portdrv_core.c  |    5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 1463412..65fc1ef 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -86,6 +86,14 @@ static inline int pciehp_request_irq(struct controller *ctrl)
 		init_timer(&ctrl->poll_timer);
 		start_int_poll_timer(ctrl, 10);
 		return 0;
+	} else if (irq == -1) {
+		/*
+		 * Bail out if there is neither a way to generate
+		 * interrupts, nor polling is to be used.
+		 */
+		ctrl_err(ctrl,
+			 "No way to generate IRQ. Use pciehp_poll_mode\n");
+		return -1;
 	}
 
 	/* Installs the interrupt handler */
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 986f8ea..e92cd34 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -379,10 +379,13 @@ int pcie_port_device_register(struct pci_dev *dev)
 	/*
 	 * Initialize service irqs. Don't use service devices that
 	 * require interrupts if there is no way to generate them.
+	 * However, some drivers (e.g. pciehp) may have a polling mode
+	 * that can be used in absense of irqs. Allow them to determine
+	 * if that is to be used.
 	 */
 	status = init_service_irqs(dev, irqs, capabilities);
 	if (status) {
-		capabilities &= PCIE_PORT_SERVICE_VC;
+		capabilities &= PCIE_PORT_SERVICE_VC | PCIE_PORT_SERVICE_HP;
 		if (!capabilities)
 			goto error_disable;
 	}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ