Skip to content

Commit aa3b7c2

Browse files
Sebastian OttMartin Schwidefsky
authored andcommitted
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: Stefan Haberland <[email protected]> Reviewed-by: Gerald Schaefer <[email protected]> Signed-off-by: Sebastian Ott <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 99c64b6 commit aa3b7c2

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

arch/s390/include/asm/pci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ int clp_disable_fh(struct zpci_dev *);
144144
void zpci_event_error(void *);
145145
void zpci_event_availability(void *);
146146
void zpci_rescan(void);
147+
bool zpci_is_enabled(void);
147148
#else /* CONFIG_PCI */
148149
static inline void zpci_event_error(void *e) {}
149150
static inline void zpci_event_availability(void *e) {}

arch/s390/pci/pci.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ static void zpci_mem_exit(void)
920920
}
921921

922922
static unsigned int s390_pci_probe;
923+
static unsigned int s390_pci_initialized;
923924

924925
char * __init pcibios_setup(char *str)
925926
{
@@ -930,6 +931,11 @@ char * __init pcibios_setup(char *str)
930931
return str;
931932
}
932933

934+
bool zpci_is_enabled(void)
935+
{
936+
return s390_pci_initialized;
937+
}
938+
933939
static int __init pci_base_init(void)
934940
{
935941
int rc;
@@ -961,6 +967,7 @@ static int __init pci_base_init(void)
961967
if (rc)
962968
goto out_find;
963969

970+
s390_pci_initialized = 1;
964971
return 0;
965972

966973
out_find:
@@ -978,5 +985,6 @@ subsys_initcall_sync(pci_base_init);
978985

979986
void zpci_rescan(void)
980987
{
981-
clp_rescan_pci_devices_simple();
988+
if (zpci_is_enabled())
989+
clp_rescan_pci_devices_simple();
982990
}

arch/s390/pci/pci_event.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ struct zpci_ccdf_avail {
4343
u16 pec; /* PCI event code */
4444
} __packed;
4545

46-
void zpci_event_error(void *data)
46+
static void __zpci_event_error(struct zpci_ccdf_err *ccdf)
4747
{
48-
struct zpci_ccdf_err *ccdf = data;
4948
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
5049

5150
zpci_err("error CCDF:\n");
@@ -58,9 +57,14 @@ void zpci_event_error(void *data)
5857
pci_name(zdev->pdev), ccdf->pec, ccdf->fid);
5958
}
6059

61-
void zpci_event_availability(void *data)
60+
void zpci_event_error(void *data)
61+
{
62+
if (zpci_is_enabled())
63+
__zpci_event_error(data);
64+
}
65+
66+
static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf)
6267
{
63-
struct zpci_ccdf_avail *ccdf = data;
6468
struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid);
6569
struct pci_dev *pdev = zdev ? zdev->pdev : NULL;
6670
int ret;
@@ -115,3 +119,9 @@ void zpci_event_availability(void *data)
115119
break;
116120
}
117121
}
122+
123+
void zpci_event_availability(void *data)
124+
{
125+
if (zpci_is_enabled())
126+
__zpci_event_availability(data);
127+
}

0 commit comments

Comments
 (0)