Skip to content

Commit 973c57c

Browse files
niklas88gregkh
authored andcommitted
s390: make PCI mio support a machine flag
[ Upstream commit 3322ba0 ] Kernel support for the newer PCI mio instructions can be toggled off with the pci=nomio command line option which needs to integrate with common code PCI option parsing. However this option then toggles static branches which can't be toggled yet in an early_param() call. Thus commit 9964f39 ("s390: fix setting of mio addressing control") moved toggling the static branches to the PCI init routine. With this setup however we can't check for mio support outside the PCI code during early boot, i.e. before switching the static branches, which we need to be able to export this as an ELF HWCAP. Improve on this by turning mio availability into a machine flag that gets initially set based on CONFIG_PCI and the facility bit and gets toggled off if pci=nomio is found during PCI option parsing allowing simple access to this machine flag after early init. Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 77d62f2 commit 973c57c

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎arch/s390/include/asm/setup.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define MACHINE_FLAG_NX BIT(15)
3939
#define MACHINE_FLAG_GS BIT(16)
4040
#define MACHINE_FLAG_SCC BIT(17)
41+
#define MACHINE_FLAG_PCI_MIO BIT(18)
4142

4243
#define LPP_MAGIC BIT(31)
4344
#define LPP_PID_MASK _AC(0xffffffff, UL)
@@ -113,6 +114,7 @@ extern unsigned long mio_wb_bit_mask;
113114
#define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX)
114115
#define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS)
115116
#define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC)
117+
#define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO)
116118

117119
/*
118120
* Console mode. Override with conmode=

‎arch/s390/kernel/early.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ static __init void detect_machine_facilities(void)
238238
clock_comparator_max = -1ULL >> 1;
239239
__ctl_set_bit(0, 53);
240240
}
241+
if (IS_ENABLED(CONFIG_PCI) && test_facility(153)) {
242+
S390_lowcore.machine_flags |= MACHINE_FLAG_PCI_MIO;
243+
/* the control bit is set during PCI initialization */
244+
}
241245
}
242246

243247
static inline void save_vector_registers(void)

‎arch/s390/pci/pci.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,6 @@ static void zpci_mem_exit(void)
866866
}
867867

868868
static unsigned int s390_pci_probe __initdata = 1;
869-
static unsigned int s390_pci_no_mio __initdata;
870869
unsigned int s390_pci_force_floating __initdata;
871870
static unsigned int s390_pci_initialized;
872871

@@ -877,7 +876,7 @@ char * __init pcibios_setup(char *str)
877876
return NULL;
878877
}
879878
if (!strcmp(str, "nomio")) {
880-
s390_pci_no_mio = 1;
879+
S390_lowcore.machine_flags &= ~MACHINE_FLAG_PCI_MIO;
881880
return NULL;
882881
}
883882
if (!strcmp(str, "force_floating")) {
@@ -906,7 +905,7 @@ static int __init pci_base_init(void)
906905
if (!test_facility(69) || !test_facility(71))
907906
return 0;
908907

909-
if (test_facility(153) && !s390_pci_no_mio) {
908+
if (MACHINE_HAS_PCI_MIO) {
910909
static_branch_enable(&have_mio);
911910
ctl_set_bit(2, 5);
912911
}

0 commit comments

Comments
 (0)