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

s390/pci: prevent inadvertently triggered bus scans

Initialization and scanning of the pci bus is omitted on older
machines without pci support or if pci=off was specified. Remember
the fact that we ran without pci support and prevent further bus
scans during resume from hibernate or after receiving hotplug
notifications.
Reported-by: default avatarStefan Haberland <stefan.haberland@de.ibm.com>
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 99c64b66
...@@ -144,6 +144,7 @@ int clp_disable_fh(struct zpci_dev *); ...@@ -144,6 +144,7 @@ int clp_disable_fh(struct zpci_dev *);
void zpci_event_error(void *); void zpci_event_error(void *);
void zpci_event_availability(void *); void zpci_event_availability(void *);
void zpci_rescan(void); void zpci_rescan(void);
bool zpci_is_enabled(void);
#else /* CONFIG_PCI */ #else /* CONFIG_PCI */
static inline void zpci_event_error(void *e) {} static inline void zpci_event_error(void *e) {}
static inline void zpci_event_availability(void *e) {} static inline void zpci_event_availability(void *e) {}
......
...@@ -920,6 +920,7 @@ static void zpci_mem_exit(void) ...@@ -920,6 +920,7 @@ static void zpci_mem_exit(void)
} }
static unsigned int s390_pci_probe; static unsigned int s390_pci_probe;
static unsigned int s390_pci_initialized;
char * __init pcibios_setup(char *str) char * __init pcibios_setup(char *str)
{ {
...@@ -930,6 +931,11 @@ char * __init pcibios_setup(char *str) ...@@ -930,6 +931,11 @@ char * __init pcibios_setup(char *str)
return str; return str;
} }
bool zpci_is_enabled(void)
{
return s390_pci_initialized;
}
static int __init pci_base_init(void) static int __init pci_base_init(void)
{ {
int rc; int rc;
...@@ -961,6 +967,7 @@ static int __init pci_base_init(void) ...@@ -961,6 +967,7 @@ static int __init pci_base_init(void)
if (rc) if (rc)
goto out_find; goto out_find;
s390_pci_initialized = 1;
return 0; return 0;
out_find: out_find:
...@@ -978,5 +985,6 @@ subsys_initcall_sync(pci_base_init); ...@@ -978,5 +985,6 @@ subsys_initcall_sync(pci_base_init);
void zpci_rescan(void) void zpci_rescan(void)
{ {
if (zpci_is_enabled())
clp_rescan_pci_devices_simple(); clp_rescan_pci_devices_simple();
} }
...@@ -43,9 +43,8 @@ struct zpci_ccdf_avail { ...@@ -43,9 +43,8 @@ struct zpci_ccdf_avail {
u16 pec; /* PCI event code */ u16 pec; /* PCI event code */
} __packed; } __packed;
void zpci_event_error(void *data) static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
{ {
struct zpci_ccdf_err *ccdf = data;
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
zpci_err("error CCDF:\n"); zpci_err("error CCDF:\n");
...@@ -58,9 +57,14 @@ void zpci_event_error(void *data) ...@@ -58,9 +57,14 @@ void zpci_event_error(void *data)
pci_name(zdev->pdev), ccdf->pec, ccdf->fid); pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
} }
void zpci_event_availability(void *data) void zpci_event_error(void *data)
{
if (zpci_is_enabled())
__zpci_event_error(data);
}
static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
{ {
struct zpci_ccdf_avail *ccdf = data;
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
struct pci_dev *pdev = zdev ? zdev->pdev : NULL; struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
int ret; int ret;
...@@ -115,3 +119,9 @@ void zpci_event_availability(void *data) ...@@ -115,3 +119,9 @@ void zpci_event_availability(void *data)
break; break;
} }
} }
void zpci_event_availability(void *data)
{
if (zpci_is_enabled())
__zpci_event_availability(data);
}
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