Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'x86/early-printk', 'x86/microcode' and 'core/objtool' into x86/urgent, to pick up simple topic branches

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+63 -22
+5 -1
Documentation/admin-guide/kernel-parameters.txt
··· 1068 1068 earlyprintk=serial[,0x...[,baudrate]] 1069 1069 earlyprintk=ttySn[,baudrate] 1070 1070 earlyprintk=dbgp[debugController#] 1071 - earlyprintk=pciserial,bus:device.function[,baudrate] 1071 + earlyprintk=pciserial[,force],bus:device.function[,baudrate] 1072 1072 earlyprintk=xdbc[xhciController#] 1073 1073 1074 1074 earlyprintk is useful when the kernel crashes before ··· 1099 1099 The xen output can only be used by Xen PV guests. 1100 1100 1101 1101 The sclp output can only be used on s390. 1102 + 1103 + The optional "force" to "pciserial" enables use of a 1104 + PCI device even when its classcode is not of the 1105 + UART class. 1102 1106 1103 1107 edac_report= [HW,EDAC] Control how to report EDAC event 1104 1108 Format: {"on" | "off" | "force"}
+2 -2
arch/x86/kernel/cpu/microcode/core.c
··· 666 666 } 667 667 668 668 static DEVICE_ATTR_WO(reload); 669 - static DEVICE_ATTR(version, 0400, version_show, NULL); 670 - static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL); 669 + static DEVICE_ATTR(version, 0444, version_show, NULL); 670 + static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL); 671 671 672 672 static struct attribute *mc_default_attrs[] = { 673 673 &dev_attr_version.attr,
+19 -10
arch/x86/kernel/early_printk.c
··· 213 213 * early_pci_serial_init() 214 214 * 215 215 * This function is invoked when the early_printk param starts with "pciserial" 216 - * The rest of the param should be ",B:D.F,baud" where B, D & F describe the 217 - * location of a PCI device that must be a UART device. 216 + * The rest of the param should be "[force],B:D.F,baud", where B, D & F describe 217 + * the location of a PCI device that must be a UART device. "force" is optional 218 + * and overrides the use of an UART device with a wrong PCI class code. 218 219 */ 219 220 static __init void early_pci_serial_init(char *s) 220 221 { ··· 225 224 u32 classcode, bar0; 226 225 u16 cmdreg; 227 226 char *e; 227 + int force = 0; 228 228 229 - 230 - /* 231 - * First, part the param to get the BDF values 232 - */ 233 229 if (*s == ',') 234 230 ++s; 235 231 236 232 if (*s == 0) 237 233 return; 238 234 235 + /* Force the use of an UART device with wrong class code */ 236 + if (!strncmp(s, "force,", 6)) { 237 + force = 1; 238 + s += 6; 239 + } 240 + 241 + /* 242 + * Part the param to get the BDF values 243 + */ 239 244 bus = (u8)simple_strtoul(s, &e, 16); 240 245 s = e; 241 246 if (*s != ':') ··· 260 253 s++; 261 254 262 255 /* 263 - * Second, find the device from the BDF 256 + * Find the device from the BDF 264 257 */ 265 258 cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND); 266 259 classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION); ··· 271 264 */ 272 265 if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) && 273 266 (classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) || 274 - (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ 275 - return; 267 + (((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ { 268 + if (!force) 269 + return; 270 + } 276 271 277 272 /* 278 273 * Determine if it is IO or memory mapped ··· 298 289 } 299 290 300 291 /* 301 - * Lastly, initialize the hardware 292 + * Initialize the hardware 302 293 */ 303 294 if (*s) { 304 295 if (strcmp(s, "nocfg") == 0)
+32 -6
tools/objtool/check.c
··· 836 836 struct symbol *pfunc = insn->func->pfunc; 837 837 unsigned int prev_offset = 0; 838 838 839 - list_for_each_entry_from(rela, &file->rodata->rela->rela_list, list) { 839 + list_for_each_entry_from(rela, &table->rela_sec->rela_list, list) { 840 840 if (rela == next_table) 841 841 break; 842 842 ··· 926 926 { 927 927 struct rela *text_rela, *rodata_rela; 928 928 struct instruction *orig_insn = insn; 929 + struct section *rodata_sec; 929 930 unsigned long table_offset; 930 931 931 932 /* ··· 954 953 /* look for a relocation which references .rodata */ 955 954 text_rela = find_rela_by_dest_range(insn->sec, insn->offset, 956 955 insn->len); 957 - if (!text_rela || text_rela->sym != file->rodata->sym) 956 + if (!text_rela || text_rela->sym->type != STT_SECTION || 957 + !text_rela->sym->sec->rodata) 958 958 continue; 959 959 960 960 table_offset = text_rela->addend; 961 + rodata_sec = text_rela->sym->sec; 962 + 961 963 if (text_rela->type == R_X86_64_PC32) 962 964 table_offset += 4; 963 965 ··· 968 964 * Make sure the .rodata address isn't associated with a 969 965 * symbol. gcc jump tables are anonymous data. 970 966 */ 971 - if (find_symbol_containing(file->rodata, table_offset)) 967 + if (find_symbol_containing(rodata_sec, table_offset)) 972 968 continue; 973 969 974 - rodata_rela = find_rela_by_dest(file->rodata, table_offset); 970 + rodata_rela = find_rela_by_dest(rodata_sec, table_offset); 975 971 if (rodata_rela) { 976 972 /* 977 973 * Use of RIP-relative switch jumps is quite rare, and ··· 1056 1052 struct symbol *func; 1057 1053 int ret; 1058 1054 1059 - if (!file->rodata || !file->rodata->rela) 1055 + if (!file->rodata) 1060 1056 return 0; 1061 1057 1062 1058 for_each_sec(file, sec) { ··· 1202 1198 return 0; 1203 1199 } 1204 1200 1201 + static void mark_rodata(struct objtool_file *file) 1202 + { 1203 + struct section *sec; 1204 + bool found = false; 1205 + 1206 + /* 1207 + * This searches for the .rodata section or multiple .rodata.func_name 1208 + * sections if -fdata-sections is being used. The .str.1.1 and .str.1.8 1209 + * rodata sections are ignored as they don't contain jump tables. 1210 + */ 1211 + for_each_sec(file, sec) { 1212 + if (!strncmp(sec->name, ".rodata", 7) && 1213 + !strstr(sec->name, ".str1.")) { 1214 + sec->rodata = true; 1215 + found = true; 1216 + } 1217 + } 1218 + 1219 + file->rodata = found; 1220 + } 1221 + 1205 1222 static int decode_sections(struct objtool_file *file) 1206 1223 { 1207 1224 int ret; 1225 + 1226 + mark_rodata(file); 1208 1227 1209 1228 ret = decode_instructions(file); 1210 1229 if (ret) ··· 2198 2171 INIT_LIST_HEAD(&file.insn_list); 2199 2172 hash_init(file.insn_hash); 2200 2173 file.whitelist = find_section_by_name(file.elf, ".discard.func_stack_frame_non_standard"); 2201 - file.rodata = find_section_by_name(file.elf, ".rodata"); 2202 2174 file.c_file = find_section_by_name(file.elf, ".comment"); 2203 2175 file.ignore_unreachables = no_unreachable; 2204 2176 file.hints = false;
+2 -2
tools/objtool/check.h
··· 60 60 struct elf *elf; 61 61 struct list_head insn_list; 62 62 DECLARE_HASHTABLE(insn_hash, 16); 63 - struct section *rodata, *whitelist; 64 - bool ignore_unreachables, c_file, hints; 63 + struct section *whitelist; 64 + bool ignore_unreachables, c_file, hints, rodata; 65 65 }; 66 66 67 67 int check(const char *objname, bool orc);
+1
tools/objtool/elf.c
··· 379 379 rela->offset = rela->rela.r_offset; 380 380 symndx = GELF_R_SYM(rela->rela.r_info); 381 381 rela->sym = find_symbol_by_index(elf, symndx); 382 + rela->rela_sec = sec; 382 383 if (!rela->sym) { 383 384 WARN("can't find rela entry symbol %d for %s", 384 385 symndx, sec->name);
+2 -1
tools/objtool/elf.h
··· 48 48 char *name; 49 49 int idx; 50 50 unsigned int len; 51 - bool changed, text; 51 + bool changed, text, rodata; 52 52 }; 53 53 54 54 struct symbol { ··· 68 68 struct list_head list; 69 69 struct hlist_node hash; 70 70 GElf_Rela rela; 71 + struct section *rela_sec; 71 72 struct symbol *sym; 72 73 unsigned int type; 73 74 unsigned long offset;