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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f5e2a73.YyO0Gu2m5JhSVsu6%tadeusz.struk@intel.com>
Date:	Mon, 12 Mar 2012 16:55:15 +0000
From:	Tadeusz Struk <tadeusz.struk@...el.com>
To:	bhelgaas@...gle.com, jbarnes@...tuousgeek.org
Cc:	linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
	linux-pci@...r.kernel.org, tadeusz.struk@...el.com
Subject: [PATCH] PCI: Device specific reset function

I have a use case where I need to cleanup resource allocated for Virtual
Functions after a guest OS that used it crashed. This cleanup needs to
be done before the VF is being FLRed. The only possible way to do this
seems to be by using pci_dev_specific_reset() function.
This patch adds specific reset function to the pci_driver struct.

Signed-off-by: Tadeusz Struk <tadeusz.struk@...el.com>
---
 drivers/pci/quirks.c |    4 ++++
 include/linux/pci.h  |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6476547..13d224b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3081,8 +3081,12 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
 
 int pci_dev_specific_reset(struct pci_dev *dev, int probe)
 {
+	struct pci_driver *drv = dev->driver;
 	const struct pci_dev_reset_methods *i;
 
+	if (drv && drv->reset)
+		return drv->reset(dev, probe);
+
 	for (i = pci_dev_reset_methods; i->reset; i++) {
 		if ((i->vendor == dev->vendor ||
 		     i->vendor == (u16)PCI_ANY_ID) &&
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a16b1df..2ccd838 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -560,6 +560,7 @@ struct pci_driver {
 	int  (*resume_early) (struct pci_dev *dev);
 	int  (*resume) (struct pci_dev *dev);	                /* Device woken up */
 	void (*shutdown) (struct pci_dev *dev);
+	int  (*reset) (struct pci_dev *dev, int probe);
 	struct pci_error_handlers *err_handler;
 	struct device_driver	driver;
 	struct pci_dynids dynids;
-- 
1.7.7.6

--
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