Skip to content

Commit e486612

Browse files
committed
Merge tag 's390-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull more s390 updates from Heiko Carstens: - add support for system call stack randomization - handle stale PCI deconfiguration events - couple of defconfig updates - some fixes and cleanups * tag 's390-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390: fix detection of vector enhancements facility 1 vs. vector packed decimal facility s390/entry: add support for syscall stack randomization s390/configs: change CONFIG_VIRTIO_CONSOLE to "m" s390/cio: remove invalid condition on IO_SCH_UNREG s390/cpumf: remove call to perf_event_update_userpage s390/cpumf: move counter set size calculation to common place s390/cpumf: beautify if-then-else indentation s390/configs: enable CONFIG_PCI_IOV s390/pci: handle stale deconfiguration events s390/pci: rename zpci_configure_device()
2 parents a2de4bb + b208108 commit e486612

File tree

16 files changed

+103
-80
lines changed

16 files changed

+103
-80
lines changed

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ config S390
140140
select HAVE_ARCH_JUMP_LABEL_RELATIVE
141141
select HAVE_ARCH_KASAN
142142
select HAVE_ARCH_KASAN_VMALLOC
143+
select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
143144
select HAVE_ARCH_SECCOMP_FILTER
144145
select HAVE_ARCH_SOFT_DIRTY
145146
select HAVE_ARCH_TRACEHOOK

arch/s390/configs/debug_defconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ CONFIG_CGROUP_NET_PRIO=y
387387
CONFIG_BPF_JIT=y
388388
CONFIG_NET_PKTGEN=m
389389
CONFIG_PCI=y
390+
CONFIG_PCI_IOV=y
390391
# CONFIG_PCIEASPM is not set
391392
CONFIG_PCI_DEBUG=y
392393
CONFIG_HOTPLUG_PCI=y
@@ -548,7 +549,7 @@ CONFIG_INPUT_EVDEV=y
548549
# CONFIG_INPUT_MOUSE is not set
549550
# CONFIG_SERIO is not set
550551
CONFIG_LEGACY_PTY_COUNT=0
551-
CONFIG_VIRTIO_CONSOLE=y
552+
CONFIG_VIRTIO_CONSOLE=m
552553
CONFIG_HW_RANDOM_VIRTIO=m
553554
CONFIG_RAW_DRIVER=m
554555
CONFIG_HANGCHECK_TIMER=m

arch/s390/configs/defconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ CONFIG_CGROUP_NET_PRIO=y
377377
CONFIG_BPF_JIT=y
378378
CONFIG_NET_PKTGEN=m
379379
CONFIG_PCI=y
380+
CONFIG_PCI_IOV=y
380381
# CONFIG_PCIEASPM is not set
381382
CONFIG_HOTPLUG_PCI=y
382383
CONFIG_HOTPLUG_PCI_S390=y
@@ -540,7 +541,7 @@ CONFIG_INPUT_EVDEV=y
540541
# CONFIG_INPUT_MOUSE is not set
541542
# CONFIG_SERIO is not set
542543
CONFIG_LEGACY_PTY_COUNT=0
543-
CONFIG_VIRTIO_CONSOLE=y
544+
CONFIG_VIRTIO_CONSOLE=m
544545
CONFIG_HW_RANDOM_VIRTIO=m
545546
CONFIG_RAW_DRIVER=m
546547
CONFIG_HANGCHECK_TIMER=m

arch/s390/include/asm/cpu_mcf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,6 @@ static inline int stccm_avail(void)
123123
return test_facility(142);
124124
}
125125

126+
size_t cpum_cf_ctrset_size(enum cpumf_ctr_set ctrset,
127+
struct cpumf_ctr_info *info);
126128
#endif /* _ASM_S390_CPU_MCF_H */

arch/s390/include/asm/entry-common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
#include <linux/sched.h>
66
#include <linux/audit.h>
7+
#include <linux/randomize_kstack.h>
78
#include <linux/tracehook.h>
89
#include <linux/processor.h>
910
#include <linux/uaccess.h>
11+
#include <asm/timex.h>
1012
#include <asm/fpu/api.h>
1113

1214
#define ARCH_EXIT_TO_USER_MODE_WORK (_TIF_GUARDED_STORAGE | _TIF_PER_TRAP)
@@ -48,6 +50,14 @@ static __always_inline void arch_exit_to_user_mode(void)
4850

4951
#define arch_exit_to_user_mode arch_exit_to_user_mode
5052

53+
static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
54+
unsigned long ti_work)
55+
{
56+
choose_random_kstack_offset(get_tod_clock_fast() & 0xff);
57+
}
58+
59+
#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare
60+
5161
static inline bool on_thread_stack(void)
5262
{
5363
return !(((unsigned long)(current->stack) ^ current_stack_pointer()) & ~(THREAD_SIZE - 1));

arch/s390/include/asm/pci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ extern unsigned int s390_pci_no_rid;
204204
struct zpci_dev *zpci_create_device(u32 fid, u32 fh, enum zpci_state state);
205205
int zpci_enable_device(struct zpci_dev *);
206206
int zpci_disable_device(struct zpci_dev *);
207-
int zpci_configure_device(struct zpci_dev *zdev, u32 fh);
207+
int zpci_scan_configured_device(struct zpci_dev *zdev, u32 fh);
208208
int zpci_deconfigure_device(struct zpci_dev *zdev);
209209

210210
int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);

arch/s390/kernel/perf_cpum_cf.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,7 @@ static int __hw_perf_event_init(struct perf_event *event, unsigned int type)
230230
/* No support for kernel space counters only */
231231
} else if (!attr->exclude_kernel && attr->exclude_user) {
232232
return -EOPNOTSUPP;
233-
234-
/* Count user and kernel space */
235-
} else {
233+
} else { /* Count user and kernel space */
236234
if (ev >= ARRAY_SIZE(cpumf_generic_events_basic))
237235
return -EOPNOTSUPP;
238236
ev = cpumf_generic_events_basic[ev];
@@ -402,12 +400,12 @@ static void cpumf_pmu_stop(struct perf_event *event, int flags)
402400
*/
403401
if (!atomic_dec_return(&cpuhw->ctr_set[hwc->config_base]))
404402
ctr_set_stop(&cpuhw->state, hwc->config_base);
405-
event->hw.state |= PERF_HES_STOPPED;
403+
hwc->state |= PERF_HES_STOPPED;
406404
}
407405

408406
if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
409407
hw_perf_event_update(event);
410-
event->hw.state |= PERF_HES_UPTODATE;
408+
hwc->state |= PERF_HES_UPTODATE;
411409
}
412410
}
413411

@@ -430,8 +428,6 @@ static int cpumf_pmu_add(struct perf_event *event, int flags)
430428
if (flags & PERF_EF_START)
431429
cpumf_pmu_start(event, PERF_EF_RELOAD);
432430

433-
perf_event_update_userpage(event);
434-
435431
return 0;
436432
}
437433

@@ -451,8 +447,6 @@ static void cpumf_pmu_del(struct perf_event *event, int flags)
451447
*/
452448
if (!atomic_read(&cpuhw->ctr_set[event->hw.config_base]))
453449
ctr_set_disable(&cpuhw->state, event->hw.config_base);
454-
455-
perf_event_update_userpage(event);
456450
}
457451

458452
/*

arch/s390/kernel/perf_cpum_cf_common.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,52 @@ static int cpum_cf_offline_cpu(unsigned int cpu)
170170
return cpum_cf_setup(cpu, PMC_RELEASE);
171171
}
172172

173+
/* Return the maximum possible counter set size (in number of 8 byte counters)
174+
* depending on type and model number.
175+
*/
176+
size_t cpum_cf_ctrset_size(enum cpumf_ctr_set ctrset,
177+
struct cpumf_ctr_info *info)
178+
{
179+
size_t ctrset_size = 0;
180+
181+
switch (ctrset) {
182+
case CPUMF_CTR_SET_BASIC:
183+
if (info->cfvn >= 1)
184+
ctrset_size = 6;
185+
break;
186+
case CPUMF_CTR_SET_USER:
187+
if (info->cfvn == 1)
188+
ctrset_size = 6;
189+
else if (info->cfvn >= 3)
190+
ctrset_size = 2;
191+
break;
192+
case CPUMF_CTR_SET_CRYPTO:
193+
if (info->csvn >= 1 && info->csvn <= 5)
194+
ctrset_size = 16;
195+
else if (info->csvn == 6)
196+
ctrset_size = 20;
197+
break;
198+
case CPUMF_CTR_SET_EXT:
199+
if (info->csvn == 1)
200+
ctrset_size = 32;
201+
else if (info->csvn == 2)
202+
ctrset_size = 48;
203+
else if (info->csvn >= 3 && info->csvn <= 5)
204+
ctrset_size = 128;
205+
else if (info->csvn == 6)
206+
ctrset_size = 160;
207+
break;
208+
case CPUMF_CTR_SET_MT_DIAG:
209+
if (info->csvn > 3)
210+
ctrset_size = 48;
211+
break;
212+
case CPUMF_CTR_SET_MAX:
213+
break;
214+
}
215+
216+
return ctrset_size;
217+
}
218+
173219
static int __init cpum_cf_init(void)
174220
{
175221
int rc;

arch/s390/kernel/perf_cpum_cf_diag.c

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -316,52 +316,6 @@ static void cf_diag_read(struct perf_event *event)
316316
debug_sprintf_event(cf_diag_dbg, 5, "%s event %p\n", __func__, event);
317317
}
318318

319-
/* Return the maximum possible counter set size (in number of 8 byte counters)
320-
* depending on type and model number.
321-
*/
322-
static size_t cf_diag_ctrset_size(enum cpumf_ctr_set ctrset,
323-
struct cpumf_ctr_info *info)
324-
{
325-
size_t ctrset_size = 0;
326-
327-
switch (ctrset) {
328-
case CPUMF_CTR_SET_BASIC:
329-
if (info->cfvn >= 1)
330-
ctrset_size = 6;
331-
break;
332-
case CPUMF_CTR_SET_USER:
333-
if (info->cfvn == 1)
334-
ctrset_size = 6;
335-
else if (info->cfvn >= 3)
336-
ctrset_size = 2;
337-
break;
338-
case CPUMF_CTR_SET_CRYPTO:
339-
if (info->csvn >= 1 && info->csvn <= 5)
340-
ctrset_size = 16;
341-
else if (info->csvn == 6)
342-
ctrset_size = 20;
343-
break;
344-
case CPUMF_CTR_SET_EXT:
345-
if (info->csvn == 1)
346-
ctrset_size = 32;
347-
else if (info->csvn == 2)
348-
ctrset_size = 48;
349-
else if (info->csvn >= 3 && info->csvn <= 5)
350-
ctrset_size = 128;
351-
else if (info->csvn == 6)
352-
ctrset_size = 160;
353-
break;
354-
case CPUMF_CTR_SET_MT_DIAG:
355-
if (info->csvn > 3)
356-
ctrset_size = 48;
357-
break;
358-
case CPUMF_CTR_SET_MAX:
359-
break;
360-
}
361-
362-
return ctrset_size;
363-
}
364-
365319
/* Calculate memory needed to store all counter sets together with header and
366320
* trailer data. This is independend of the counter set authorization which
367321
* can vary depending on the configuration.
@@ -372,7 +326,7 @@ static size_t cf_diag_ctrset_maxsize(struct cpumf_ctr_info *info)
372326
enum cpumf_ctr_set i;
373327

374328
for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) {
375-
size_t size = cf_diag_ctrset_size(i, info);
329+
size_t size = cpum_cf_ctrset_size(i, info);
376330

377331
if (size)
378332
max_size += size * sizeof(u64) +
@@ -405,7 +359,7 @@ static size_t cf_diag_getctrset(struct cf_ctrset_entry *ctrdata, int ctrset,
405359
ctrdata->def = CF_DIAG_CTRSET_DEF;
406360
ctrdata->set = ctrset;
407361
ctrdata->res1 = 0;
408-
ctrset_size = cf_diag_ctrset_size(ctrset, &cpuhw->info);
362+
ctrset_size = cpum_cf_ctrset_size(ctrset, &cpuhw->info);
409363

410364
if (ctrset_size) { /* Save data */
411365
need = ctrset_size * sizeof(u64) + sizeof(*ctrdata);
@@ -845,7 +799,7 @@ static void cf_diag_cpu_read(void *parm)
845799

846800
if (!(p->sets & cpumf_ctr_ctl[set]))
847801
continue; /* Counter set not in list */
848-
set_size = cf_diag_ctrset_size(set, &cpuhw->info);
802+
set_size = cpum_cf_ctrset_size(set, &cpuhw->info);
849803
space = sizeof(csd->data) - csd->used;
850804
space = cf_diag_cpuset_read(sp, set, set_size, space);
851805
if (space) {
@@ -975,7 +929,7 @@ static size_t cf_diag_needspace(unsigned int sets)
975929
for (i = CPUMF_CTR_SET_BASIC; i < CPUMF_CTR_SET_MAX; ++i) {
976930
if (!(sets & cpumf_ctr_ctl[i]))
977931
continue;
978-
bytes += cf_diag_ctrset_size(i, &cpuhw->info) * sizeof(u64) +
932+
bytes += cpum_cf_ctrset_size(i, &cpuhw->info) * sizeof(u64) +
979933
sizeof(((struct s390_ctrset_setdata *)0)->set) +
980934
sizeof(((struct s390_ctrset_setdata *)0)->no_cnts);
981935
}

arch/s390/kernel/setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,9 @@ static int __init setup_hwcaps(void)
937937
if (MACHINE_HAS_VX) {
938938
elf_hwcap |= HWCAP_S390_VXRS;
939939
if (test_facility(134))
940-
elf_hwcap |= HWCAP_S390_VXRS_EXT;
941-
if (test_facility(135))
942940
elf_hwcap |= HWCAP_S390_VXRS_BCD;
941+
if (test_facility(135))
942+
elf_hwcap |= HWCAP_S390_VXRS_EXT;
943943
if (test_facility(148))
944944
elf_hwcap |= HWCAP_S390_VXRS_EXT2;
945945
if (test_facility(152))

0 commit comments

Comments
 (0)