History

Merge tag 'x86_platform_for_6.7_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 platform updates from Borislav Petkov: - Make sure PCI function 4 IDs of AMD family 0x19, models 0x60-0x7f are actually used in the amd_nb.c enumeration - Add support for extracting NUMA information from devicetree for Hyper-V usages - Add PCI device IDs for the new AMD MI300 AI accelerators - Annotate an array in struct uv_rtc_timer_head with the new __counted_by attribute - Rework UV's NMI action parameter handling * tag 'x86_platform_for_6.7_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/amd_nb: Use Family 19h Models 60h-7Fh Function 4 IDs x86/numa: Add Devicetree support x86/of: Move the x86_flattree_get_config() call out of x86_dtb_init() x86/amd_nb: Add AMD Family MI300 PCI IDs x86/platform/uv: Annotate struct uv_rtc_timer_head with __counted_by x86/platform/uv: Rework NMI "action" modparam handling

Linus Torvalds committed 3 years ago

Commit f155f3b2 parents ca2e9c3 2a565259 files · +79 −53Browse files

Unified · Split

9 files
  1. arch/x86/Kconfig +1 −0
  2. arch/x86/include/asm/prom.h +5 −0
  3. arch/x86/kernel/amd_nb.c +8 −0
  4. arch/x86/kernel/devicetree.c +1 −5
  5. arch/x86/kernel/setup.c +2 −0
  6. arch/x86/mm/numa.c +3 −0
  7. arch/x86/platform/uv/uv_nmi.c +57 −47
  8. arch/x86/platform/uv/uv_time.c +1 −1
  9. include/linux/pci_ids.h +1 −0
arch/x86/Kconfig+1−0
@@ -1534,6 +1534,7 @@ config NUMA · 1533 unmodified lines
15341534 depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP)
15351535 default y if X86_BIGSMP
15361536 select USE_PERCPU_NUMA_NODE_ID
1537+ select OF_NUMA if OF
15371538 help
15381539 Enable NUMA (Non-Uniform Memory Access) support.
15391540
arch/x86/include/asm/prom.h+5−0
@@ -31,6 +31,11 @@ static inline void x86_dtb_init(void) { } · 30 unmodified lines
3131 #define of_ioapic 0
3232 #endif
3333
34+#ifdef CONFIG_OF_EARLY_FLATTREE
35+void x86_flattree_get_config(void);
36+#else
37+static inline void x86_flattree_get_config(void) { }
38+#endif
3439 extern char cmd_line[COMMAND_LINE_SIZE];
3540
3641 #endif /* __ASSEMBLY__ */
arch/x86/kernel/amd_nb.c+8−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define PCI_DEVICE_ID_AMD_1AH_M00H_ROOT 0x153a
2828 #define PCI_DEVICE_ID_AMD_1AH_M20H_ROOT 0x1507
2929 #define PCI_DEVICE_ID_AMD_MI200_ROOT 0x14bb
30+#define PCI_DEVICE_ID_AMD_MI300_ROOT 0x14f8
3031
3132 #define PCI_DEVICE_ID_AMD_17H_DF_F4 0x1464
3233 #define PCI_DEVICE_ID_AMD_17H_M10H_DF_F4 0x15ec
@@ -43,6 +44,7 @@ · 10 unmodified lines
4344 #define PCI_DEVICE_ID_AMD_19H_M78H_DF_F4 0x12fc
4445 #define PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4 0x12c4
4546 #define PCI_DEVICE_ID_AMD_MI200_DF_F4 0x14d4
47+#define PCI_DEVICE_ID_AMD_MI300_DF_F4 0x152c
4648
4749 /* Protect the PCI config register pairs used for SMN. */
4850 static DEFINE_MUTEX(smn_mutex);
@@ -62,6 +64,7 @@ static const struct pci_device_id amd_root_ids[] = { · 13 unmodified lines
6264 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M00H_ROOT) },
6365 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M20H_ROOT) },
6466 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI200_ROOT) },
67+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI300_ROOT) },
6568 {}
6669 };
6770
@@ -93,6 +96,7 @@ static const struct pci_device_id amd_nb_misc_ids[] = { · 25 unmodified lines
9396 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F3) },
9497 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M20H_DF_F3) },
9598 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI200_DF_F3) },
99+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI300_DF_F3) },
96100 {}
97101 };
98102
@@ -112,9 +116,13 @@ static const struct pci_device_id amd_nb_link_ids[] = { · 13 unmodified lines
112116 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M10H_DF_F4) },
113117 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M40H_DF_F4) },
114118 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M50H_DF_F4) },
119+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M60H_DF_F4) },
120+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M70H_DF_F4) },
121+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F4) },
115122 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) },
116123 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4) },
117124 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI200_DF_F4) },
125+ { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI300_DF_F4) },
118126 {}
119127 };
120128
arch/x86/kernel/devicetree.c+1−5
@@ -278,7 +278,7 @@ static void __init dtb_apic_setup(void) · 277 unmodified lines
278278 }
279279
280280 #ifdef CONFIG_OF_EARLY_FLATTREE
281−static void __init x86_flattree_get_config(void)
281+void __init x86_flattree_get_config(void)
282282 {
283283 u32 size, map_len;
284284 void *dt;
@@ -300,14 +300,10 @@ static void __init x86_flattree_get_config(void) · 15 unmodified lines
300300 unflatten_and_copy_device_tree();
301301 early_memunmap(dt, map_len);
302302 }
303−#else
304−static inline void x86_flattree_get_config(void) { }
305303 #endif
306304
307305 void __init x86_dtb_init(void)
308306 {
309− x86_flattree_get_config();
310−
311307 if (!of_have_populated_dt())
312308 return;
313309
arch/x86/kernel/setup.c+2−0
@@ -1217,6 +1217,8 @@ void __init setup_arch(char **cmdline_p) · 1216 unmodified lines
12171217
12181218 early_acpi_boot_init();
12191219
1220+ x86_flattree_get_config();
1221+
12201222 initmem_init();
12211223 dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
12221224
arch/x86/mm/numa.c+3−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #include <linux/acpi.h>
44 #include <linux/kernel.h>
55 #include <linux/mm.h>
6+#include <linux/of.h>
67 #include <linux/string.h>
78 #include <linux/init.h>
89 #include <linux/memblock.h>
@@ -733,6 +734,8 @@ void __init x86_numa_init(void) · 724 unmodified lines
733734 if (!numa_init(amd_numa_init))
734735 return;
735736 #endif
737+ if (acpi_disabled && !numa_init(of_numa_init))
738+ return;
736739 }
737740
738741 numa_init(dummy_numa_init);
arch/x86/platform/uv/uv_nmi.c+57−47
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/sched.h>
1818 #include <linux/sched/debug.h>
1919 #include <linux/slab.h>
20+#include <linux/string.h>
2021 #include <linux/clocksource.h>
2122
2223 #include <asm/apic.h>
@@ -178,49 +179,56 @@ module_param_named(debug, uv_nmi_debug, int, 0644); · 155 unmodified lines
178179 } while (0)
179180
180181 /* Valid NMI Actions */
181−#define ACTION_LEN 16
182−static struct nmi_action {
183− char *action;
184− char *desc;
185−} valid_acts[] = {
186− { "kdump", "do kernel crash dump" },
187− { "dump", "dump process stack for each cpu" },
188− { "ips", "dump Inst Ptr info for each cpu" },
189− { "kdb", "enter KDB (needs kgdboc= assignment)" },
190− { "kgdb", "enter KGDB (needs gdb target remote)" },
191− { "health", "check if CPUs respond to NMI" },
182+enum action_t {
183+ nmi_act_kdump,
184+ nmi_act_dump,
185+ nmi_act_ips,
186+ nmi_act_kdb,
187+ nmi_act_kgdb,
188+ nmi_act_health,
189+ nmi_act_max
192190 };
193−typedef char action_t[ACTION_LEN];
194−static action_t uv_nmi_action = { "dump" };
191+
192+static const char * const actions[nmi_act_max] = {
193+ [nmi_act_kdump] = "kdump",
194+ [nmi_act_dump] = "dump",
195+ [nmi_act_ips] = "ips",
196+ [nmi_act_kdb] = "kdb",
197+ [nmi_act_kgdb] = "kgdb",
198+ [nmi_act_health] = "health",
199+};
200+
201+static const char * const actions_desc[nmi_act_max] = {
202+ [nmi_act_kdump] = "do kernel crash dump",
203+ [nmi_act_dump] = "dump process stack for each cpu",
204+ [nmi_act_ips] = "dump Inst Ptr info for each cpu",
205+ [nmi_act_kdb] = "enter KDB (needs kgdboc= assignment)",
206+ [nmi_act_kgdb] = "enter KGDB (needs gdb target remote)",
207+ [nmi_act_health] = "check if CPUs respond to NMI",
208+};
209+
210+static enum action_t uv_nmi_action = nmi_act_dump;
195211
196212 static int param_get_action(char *buffer, const struct kernel_param *kp)
197213 {
198− return sprintf(buffer, "%s\n", uv_nmi_action);
214+ return sprintf(buffer, "%s\n", actions[uv_nmi_action]);
199215 }
200216
201217 static int param_set_action(const char *val, const struct kernel_param *kp)
202218 {
203− int i;
204− int n = ARRAY_SIZE(valid_acts);
205− char arg[ACTION_LEN];
206−
207− /* (remove possible '\n') */
208− strscpy(arg, val, strnchrnul(val, sizeof(arg)-1, '\n') - val + 1);
209−
210− for (i = 0; i < n; i++)
211− if (!strcmp(arg, valid_acts[i].action))
212− break;
219+ int i, n = ARRAY_SIZE(actions);
213220
214− if (i < n) {
215− strscpy(uv_nmi_action, arg, sizeof(uv_nmi_action));
216− pr_info("UV: New NMI action:%s\n", uv_nmi_action);
221+ i = sysfs_match_string(actions, val);
222+ if (i >= 0) {
223+ uv_nmi_action = i;
224+ pr_info("UV: New NMI action:%s\n", actions[i]);
217225 return 0;
218226 }
219227
220− pr_err("UV: Invalid NMI action:%s, valid actions are:\n", arg);
228+ pr_err("UV: Invalid NMI action. Valid actions are:\n");
221229 for (i = 0; i < n; i++)
222− pr_err("UV: %-8s - %s\n",
223− valid_acts[i].action, valid_acts[i].desc);
230+ pr_err("UV: %-8s - %s\n", actions[i], actions_desc[i]);
231+
224232 return -EINVAL;
225233 }
226234
@@ -228,15 +236,10 @@ static const struct kernel_param_ops param_ops_action = { · 1 unmodified line
228236 .get = param_get_action,
229237 .set = param_set_action,
230238 };
231−#define param_check_action(name, p) __param_check(name, p, action_t)
239+#define param_check_action(name, p) __param_check(name, p, enum action_t)
232240
233241 module_param_named(action, uv_nmi_action, action, 0644);
234242
235−static inline bool uv_nmi_action_is(const char *action)
236−{
237− return (strncmp(uv_nmi_action, action, strlen(action)) == 0);
238−}
239−
240243 /* Setup which NMI support is present in system */
241244 static void uv_nmi_setup_mmrs(void)
242245 {
@@ -727,10 +730,10 @@ static void uv_nmi_dump_state_cpu(int cpu, struct pt_regs *regs) · 484 unmodified lines
727730 if (cpu == 0)
728731 uv_nmi_dump_cpu_ip_hdr();
729732
730− if (current->pid != 0 || !uv_nmi_action_is("ips"))
733+ if (current->pid != 0 || uv_nmi_action != nmi_act_ips)
731734 uv_nmi_dump_cpu_ip(cpu, regs);
732735
733− if (uv_nmi_action_is("dump")) {
736+ if (uv_nmi_action == nmi_act_dump) {
734737 pr_info("UV:%sNMI process trace for CPU %d\n", dots, cpu);
735738 show_regs(regs);
736739 }
@@ -798,7 +801,7 @@ static void uv_nmi_dump_state(int cpu, struct pt_regs *regs, int master) · 61 unmodified lines
798801 int saved_console_loglevel = console_loglevel;
799802
800803 pr_alert("UV: tracing %s for %d CPUs from CPU %d\n",
801− uv_nmi_action_is("ips") ? "IPs" : "processes",
804+ uv_nmi_action == nmi_act_ips ? "IPs" : "processes",
802805 atomic_read(&uv_nmi_cpus_in_nmi), cpu);
803806
804807 console_loglevel = uv_nmi_loglevel;
@@ -874,7 +877,7 @@ static inline int uv_nmi_kdb_reason(void) · 69 unmodified lines
874877 static inline int uv_nmi_kdb_reason(void)
875878 {
876879 /* Ensure user is expecting to attach gdb remote */
877− if (uv_nmi_action_is("kgdb"))
880+ if (uv_nmi_action == nmi_act_kgdb)
878881 return 0;
879882
880883 pr_err("UV: NMI error: KDB is not enabled in this kernel\n");
@@ -950,28 +953,35 @@ static int uv_handle_nmi(unsigned int reason, struct pt_regs *regs) · 69 unmodified lines
950953 master = (atomic_read(&uv_nmi_cpu) == cpu);
951954
952955 /* If NMI action is "kdump", then attempt to do it */
953− if (uv_nmi_action_is("kdump")) {
956+ if (uv_nmi_action == nmi_act_kdump) {
954957 uv_nmi_kdump(cpu, master, regs);
955958
956959 /* Unexpected return, revert action to "dump" */
957960 if (master)
958− strscpy(uv_nmi_action, "dump", sizeof(uv_nmi_action));
961+ uv_nmi_action = nmi_act_dump;
959962 }
960963
961964 /* Pause as all CPU's enter the NMI handler */
962965 uv_nmi_wait(master);
963966
964967 /* Process actions other than "kdump": */
965− if (uv_nmi_action_is("health")) {
968+ switch (uv_nmi_action) {
969+ case nmi_act_health:
966970 uv_nmi_action_health(cpu, regs, master);
967− } else if (uv_nmi_action_is("ips") || uv_nmi_action_is("dump")) {
971+ break;
972+ case nmi_act_ips:
973+ case nmi_act_dump:
968974 uv_nmi_dump_state(cpu, regs, master);
969− } else if (uv_nmi_action_is("kdb") || uv_nmi_action_is("kgdb")) {
975+ break;
976+ case nmi_act_kdb:
977+ case nmi_act_kgdb:
970978 uv_call_kgdb_kdb(cpu, regs, master);
971− } else {
979+ break;
980+ default:
972981 if (master)
973− pr_alert("UV: unknown NMI action: %s\n", uv_nmi_action);
982+ pr_alert("UV: unknown NMI action: %d\n", uv_nmi_action);
974983 uv_nmi_sync_exit(master);
984+ break;
975985 }
976986
977987 /* Clear per_cpu "in_nmi" flag */
arch/x86/platform/uv/uv_time.c+1−1
@@ -53,7 +53,7 @@ struct uv_rtc_timer_head { · 52 unmodified lines
5353 struct {
5454 int lcpu; /* systemwide logical cpu number */
5555 u64 expires; /* next timer expiration for this cpu */
56− } cpu[];
56+ } cpu[] __counted_by(ncpus);
5757 };
5858
5959 /*
include/linux/pci_ids.h+1−0
@@ -579,6 +579,7 @@ · 578 unmodified lines
579579 #define PCI_DEVICE_ID_AMD_1AH_M00H_DF_F3 0x12c3
580580 #define PCI_DEVICE_ID_AMD_1AH_M20H_DF_F3 0x16fb
581581 #define PCI_DEVICE_ID_AMD_MI200_DF_F3 0x14d3
582+#define PCI_DEVICE_ID_AMD_MI300_DF_F3 0x152b
582583 #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
583584 #define PCI_DEVICE_ID_AMD_LANCE 0x2000
584585 #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t