linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cxl: abort cxl_pci_enable_device_hook() if PCI channel is offline
@ 2015-09-04  6:20 Andrew Donnellan
  2015-09-06 23:58 ` Ian Munsie
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andrew Donnellan @ 2015-09-04  6:20 UTC (permalink / raw)
  To: linuxppc-dev

cxl_pci_enable_device_hook() is called when attempting to enable an AFU
sitting on a vPHB. At present, the state of the underlying CXL card's PCI
channel is only checked when it calls cxl_afu_check_and_enable() at the
very end, after it has already set DMA options and initialised a default
context.

Check the CXL card's link status before setting DMA options or initialising
a default context. If the link is down, print a warning and return
immediately.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 drivers/misc/cxl/vphb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c
index 6dd16a6..1972fb6 100644
--- a/drivers/misc/cxl/vphb.c
+++ b/drivers/misc/cxl/vphb.c
@@ -48,6 +48,11 @@ static bool cxl_pci_enable_device_hook(struct pci_dev *dev)
 
 	phb = pci_bus_to_host(dev->bus);
 	afu = (struct cxl_afu *)phb->private_data;
+
+	if (!cxl_adapter_link_ok(afu->adapter))
+		dev_warn(&dev->dev, "%s: Device link is down, refusing to enable AFU\n", __func__);
+		return false;
+
 	set_dma_ops(&dev->dev, &dma_direct_ops);
 	set_dma_offset(&dev->dev, PAGE_OFFSET);
 
-- 
Andrew Donnellan              Software Engineer, OzLabs
andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
+61 2 6201 8874 (work)        IBM Australia Limited

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

end of thread, other threads:[~2015-09-08 12:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04  6:20 [PATCH] cxl: abort cxl_pci_enable_device_hook() if PCI channel is offline Andrew Donnellan
2015-09-06 23:58 ` Ian Munsie
2015-09-07  0:22   ` Andrew Donnellan
2015-09-07  6:33     ` Ian Munsie
2015-09-07  8:43       ` Michael Ellerman
2015-09-07  0:47 ` Andrew Donnellan
2015-09-07  1:01   ` Ian Munsie
2015-09-07  0:52 ` [PATCH v2] " Andrew Donnellan
2015-09-07  1:09   ` Ian Munsie
2015-09-07  2:53   ` Michael Ellerman
2015-09-07  4:00     ` Andrew Donnellan
2015-09-08 12:05   ` [v2] " Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).