1*4253b0e0SMartin Schwidefsky // SPDX-License-Identifier: GPL-2.0 2*4253b0e0SMartin Schwidefsky #include <linux/device.h> 3*4253b0e0SMartin Schwidefsky #include <linux/cpu.h> 4*4253b0e0SMartin Schwidefsky #include <asm/facility.h> 5*4253b0e0SMartin Schwidefsky #include <asm/nospec-branch.h> 6*4253b0e0SMartin Schwidefsky 7*4253b0e0SMartin Schwidefsky ssize_t cpu_show_spectre_v1(struct device *dev, 8*4253b0e0SMartin Schwidefsky struct device_attribute *attr, char *buf) 9*4253b0e0SMartin Schwidefsky { 10*4253b0e0SMartin Schwidefsky return sprintf(buf, "Mitigation: __user pointer sanitization\n"); 11*4253b0e0SMartin Schwidefsky } 12*4253b0e0SMartin Schwidefsky 13*4253b0e0SMartin Schwidefsky ssize_t cpu_show_spectre_v2(struct device *dev, 14*4253b0e0SMartin Schwidefsky struct device_attribute *attr, char *buf) 15*4253b0e0SMartin Schwidefsky { 16*4253b0e0SMartin Schwidefsky if (IS_ENABLED(CC_USING_EXPOLINE) && !nospec_disable) 17*4253b0e0SMartin Schwidefsky return sprintf(buf, "Mitigation: execute trampolines\n"); 18*4253b0e0SMartin Schwidefsky if (__test_facility(82, S390_lowcore.alt_stfle_fac_list)) 19*4253b0e0SMartin Schwidefsky return sprintf(buf, "Mitigation: limited branch prediction\n"); 20*4253b0e0SMartin Schwidefsky return sprintf(buf, "Vulnerable\n"); 21*4253b0e0SMartin Schwidefsky } 22