159243Sobrien 283098Smp#include <asm/hwrpb.h> 359243Sobrien#include <linux/device.h> 483098Smp 583098Smp 659243Sobrien#ifdef CONFIG_SYSFS 783098Smp 859243Sobrienstatic int cpu_is_ev6_or_later(void) 983098Smp{ 1083098Smp struct percpu_struct *cpu; 1183098Smp unsigned long cputype; 1283098Smp 1359243Sobrien cpu = (struct percpu_struct *)((char *)hwrpb + hwrpb->processor_offset); 14131962Smp cputype = cpu->type & 0xffffffff; 1559243Sobrien /* Include all of EV6, EV67, EV68, EV7, EV79 and EV69. */ 16131962Smp return (cputype == EV6_CPU) || ((cputype >= EV67_CPU) && (cputype <= EV69_CPU)); 17131962Smp} 18131962Smp 19131962Smpssize_t cpu_show_meltdown(struct device *dev, 20131962Smp struct device_attribute *attr, char *buf) 2183098Smp{ 2283098Smp if (cpu_is_ev6_or_later()) 2383098Smp return sprintf(buf, "Vulnerable\n"); 2483098Smp else 2583098Smp return sprintf(buf, "Not affected\n"); 2683098Smp} 2783098Smp 2859243Sobrienssize_t cpu_show_spectre_v1(struct device *dev, 2983098Smp struct device_attribute *attr, char *buf) 3083098Smp{ 3183098Smp if (cpu_is_ev6_or_later()) 3259243Sobrien return sprintf(buf, "Vulnerable\n"); 3383098Smp else 3483098Smp return sprintf(buf, "Not affected\n"); 3583098Smp} 3659243Sobrien 3759243Sobrienssize_t cpu_show_spectre_v2(struct device *dev, 3883098Smp struct device_attribute *attr, char *buf) 3959243Sobrien{ 4083098Smp if (cpu_is_ev6_or_later()) 4183098Smp return sprintf(buf, "Vulnerable\n"); 4259243Sobrien else 4383098Smp return sprintf(buf, "Not affected\n"); 4483098Smp} 4583098Smp#endif 4683098Smp