Commit a2ab8333 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/pci: debug device states

Use the debugfs to keep track of a pci function's status changes.
Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent ea793788
...@@ -7,14 +7,11 @@ extern debug_info_t *pci_debug_msg_id; ...@@ -7,14 +7,11 @@ extern debug_info_t *pci_debug_msg_id;
extern debug_info_t *pci_debug_err_id; extern debug_info_t *pci_debug_err_id;
#ifdef CONFIG_PCI_DEBUG #ifdef CONFIG_PCI_DEBUG
#define zpci_dbg(fmt, args...) \ #define zpci_dbg(imp, fmt, args...) \
do { \ debug_sprintf_event(pci_debug_msg_id, imp, fmt, ##args)
if (pci_debug_msg_id->level >= 2) \
debug_sprintf_event(pci_debug_msg_id, 2, fmt , ## args);\
} while (0)
#else /* !CONFIG_PCI_DEBUG */ #else /* !CONFIG_PCI_DEBUG */
#define zpci_dbg(fmt, args...) do { } while (0) #define zpci_dbg(imp, fmt, args...) do { } while (0)
#endif #endif
#define zpci_err(text...) \ #define zpci_err(text...) \
......
...@@ -99,9 +99,6 @@ static int __read_mostly aisb_max; ...@@ -99,9 +99,6 @@ static int __read_mostly aisb_max;
static struct kmem_cache *zdev_irq_cache; static struct kmem_cache *zdev_irq_cache;
static struct kmem_cache *zdev_fmb_cache; static struct kmem_cache *zdev_fmb_cache;
debug_info_t *pci_debug_msg_id;
debug_info_t *pci_debug_err_id;
static inline int irq_to_msi_nr(unsigned int irq) static inline int irq_to_msi_nr(unsigned int irq)
{ {
return irq & ZPCI_MSI_MASK; return irq & ZPCI_MSI_MASK;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/pci_debug.h>
#include <asm/pci_clp.h> #include <asm/pci_clp.h>
/* /*
...@@ -144,6 +145,7 @@ int clp_add_pci_device(u32 fid, u32 fh, int configured) ...@@ -144,6 +145,7 @@ int clp_add_pci_device(u32 fid, u32 fh, int configured)
struct zpci_dev *zdev; struct zpci_dev *zdev;
int rc; int rc;
zpci_dbg(3, "add fid:%x, fh:%x, c:%d\n", fid, fh, configured);
zdev = zpci_alloc_device(); zdev = zpci_alloc_device();
if (IS_ERR(zdev)) if (IS_ERR(zdev))
return PTR_ERR(zdev); return PTR_ERR(zdev);
...@@ -204,8 +206,8 @@ static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command) ...@@ -204,8 +206,8 @@ static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command)
if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
*fh = rrb->response.fh; *fh = rrb->response.fh;
else { else {
pr_err("Set PCI FN failed with response: %x cc: %d\n", zpci_dbg(0, "SPF fh:%x, cc:%d, resp:%x\n", *fh, rc,
rrb->response.hdr.rsp, rc); rrb->response.hdr.rsp);
rc = -EIO; rc = -EIO;
} }
clp_free_block(rrb); clp_free_block(rrb);
...@@ -221,6 +223,8 @@ int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as) ...@@ -221,6 +223,8 @@ int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
if (!rc) if (!rc)
/* Success -> store enabled handle in zdev */ /* Success -> store enabled handle in zdev */
zdev->fh = fh; zdev->fh = fh;
zpci_dbg(3, "ena fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
return rc; return rc;
} }
...@@ -237,9 +241,8 @@ int clp_disable_fh(struct zpci_dev *zdev) ...@@ -237,9 +241,8 @@ int clp_disable_fh(struct zpci_dev *zdev)
if (!rc) if (!rc)
/* Success -> store disabled handle in zdev */ /* Success -> store disabled handle in zdev */
zdev->fh = fh; zdev->fh = fh;
else
dev_err(&zdev->pdev->dev, zpci_dbg(3, "dis fid:%x, fh:%x, rc:%d\n", zdev->fid, zdev->fh, rc);
"Failed to disable fn handle: 0x%x\n", fh);
return rc; return rc;
} }
......
...@@ -11,12 +11,17 @@ ...@@ -11,12 +11,17 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/export.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/pci_dma.h> #include <asm/pci_dma.h>
static struct dentry *debugfs_root; static struct dentry *debugfs_root;
debug_info_t *pci_debug_msg_id;
EXPORT_SYMBOL_GPL(pci_debug_msg_id);
debug_info_t *pci_debug_err_id;
EXPORT_SYMBOL_GPL(pci_debug_err_id);
static char *pci_perf_names[] = { static char *pci_perf_names[] = {
/* hardware counters */ /* hardware counters */
...@@ -168,7 +173,6 @@ int __init zpci_debug_init(void) ...@@ -168,7 +173,6 @@ int __init zpci_debug_init(void)
return -EINVAL; return -EINVAL;
debug_register_view(pci_debug_msg_id, &debug_sprintf_view); debug_register_view(pci_debug_msg_id, &debug_sprintf_view);
debug_set_level(pci_debug_msg_id, 3); debug_set_level(pci_debug_msg_id, 3);
zpci_dbg("Debug view initialized\n");
/* error log */ /* error log */
pci_debug_err_id = debug_register("pci_error", 2, 1, 16); pci_debug_err_id = debug_register("pci_error", 2, 1, 16);
...@@ -176,7 +180,6 @@ int __init zpci_debug_init(void) ...@@ -176,7 +180,6 @@ int __init zpci_debug_init(void)
return -EINVAL; return -EINVAL;
debug_register_view(pci_debug_err_id, &debug_hex_ascii_view); debug_register_view(pci_debug_err_id, &debug_hex_ascii_view);
debug_set_level(pci_debug_err_id, 6); debug_set_level(pci_debug_err_id, 6);
zpci_err("Debug view initialized\n");
debugfs_root = debugfs_create_dir("pci", NULL); debugfs_root = debugfs_create_dir("pci", NULL);
return 0; return 0;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/pci_hotplug.h> #include <linux/pci_hotplug.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/pci_debug.h>
#include <asm/sclp.h> #include <asm/sclp.h>
#define SLOT_NAME_SIZE 10 #define SLOT_NAME_SIZE 10
...@@ -49,6 +50,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) ...@@ -49,6 +50,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
return -EIO; return -EIO;
rc = sclp_pci_configure(slot->zdev->fid); rc = sclp_pci_configure(slot->zdev->fid);
zpci_dbg(3, "conf fid:%x, rc:%d\n", slot->zdev->fid, rc);
if (!rc) { if (!rc) {
slot->zdev->state = ZPCI_FN_STATE_CONFIGURED; slot->zdev->state = ZPCI_FN_STATE_CONFIGURED;
/* automatically scan the device after is was configured */ /* automatically scan the device after is was configured */
...@@ -70,6 +72,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) ...@@ -70,6 +72,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
* or do we need to trigger that here? * or do we need to trigger that here?
*/ */
rc = sclp_pci_deconfigure(slot->zdev->fid); rc = sclp_pci_deconfigure(slot->zdev->fid);
zpci_dbg(3, "deconf fid:%x, rc:%d\n", slot->zdev->fid, rc);
if (!rc) { if (!rc) {
/* Fixme: better call List-PCI to find the disabled FH /* Fixme: better call List-PCI to find the disabled FH
for the FID since the FH should be opaque... */ for the FID since the FH should be opaque... */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment