Skip to content

Commit c1ff843

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Peter Anvin: "Quite a varied little collection of fixes. Most of them are relatively small or isolated; the biggest one is Mel Gorman's fixes for TLB range flushing. A couple of AMD-related fixes (including not crashing when given an invalid microcode image) and fix a crash when compiled with gcov" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86, microcode, AMD: Unify valid container checks x86, hweight: Fix BUG when booting with CONFIG_GCOV_PROFILE_ALL=y x86/efi: Allow mapping BGRT on x86-32 x86: Fix the initialization of physnode_map x86, cpu hotplug: Fix stack frame warning in check_irq_vectors_for_cpu_disable() x86/intel/mid: Fix X86_INTEL_MID dependencies arch/x86/mm/srat: Skip NUMA_NO_NODE while parsing SLIT mm, x86: Revisit tlb_flushall_shift tuning for page flushes except on IvyBridge x86: mm: change tlb_flushall_shift for IvyBridge x86/mm: Eliminate redundant page table walk during TLB range flushing x86/mm: Clean up inconsistencies when flushing TLB ranges mm, x86: Account for TLB flushes only when debugging x86/AMD/NB: Fix amd_set_subcaches() parameter type x86/quirks: Add workaround for AMD F16h Erratum792 x86, doc, kconfig: Fix dud URL for Microcode data
2 parents ec2e6cb + a3b072c commit c1ff843

File tree

18 files changed

+138
-84
lines changed

18 files changed

+138
-84
lines changed

arch/x86/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ config X86_INTEL_MID
444444
bool "Intel MID platform support"
445445
depends on X86_32
446446
depends on X86_EXTENDED_PLATFORM
447+
depends on X86_PLATFORM_DEVICES
447448
depends on PCI
448449
depends on PCI_GOANY
449450
depends on X86_IO_APIC
@@ -1051,9 +1052,9 @@ config MICROCODE_INTEL
10511052
This options enables microcode patch loading support for Intel
10521053
processors.
10531054

1054-
For latest news and information on obtaining all the required
1055-
Intel ingredients for this driver, check:
1056-
<http://www.urbanmyth.org/microcode/>.
1055+
For the current Intel microcode data package go to
1056+
<https://downloadcenter.intel.com> and search for
1057+
'Linux Processor Microcode Data File'.
10571058

10581059
config MICROCODE_AMD
10591060
bool "AMD microcode loading support"

arch/x86/include/asm/amd_nb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern int amd_cache_northbridges(void);
1919
extern void amd_flush_garts(void);
2020
extern int amd_numa_init(void);
2121
extern int amd_get_subcaches(int);
22-
extern int amd_set_subcaches(int, int);
22+
extern int amd_set_subcaches(int, unsigned long);
2323

2424
struct amd_l3_cache {
2525
unsigned indices;

arch/x86/include/asm/tlbflush.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static inline void __flush_tlb_all(void)
6262

6363
static inline void __flush_tlb_one(unsigned long addr)
6464
{
65-
count_vm_event(NR_TLB_LOCAL_FLUSH_ONE);
65+
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ONE);
6666
__flush_tlb_single(addr);
6767
}
6868

@@ -93,13 +93,13 @@ static inline void __flush_tlb_one(unsigned long addr)
9393
*/
9494
static inline void __flush_tlb_up(void)
9595
{
96-
count_vm_event(NR_TLB_LOCAL_FLUSH_ALL);
96+
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
9797
__flush_tlb();
9898
}
9999

100100
static inline void flush_tlb_all(void)
101101
{
102-
count_vm_event(NR_TLB_LOCAL_FLUSH_ALL);
102+
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
103103
__flush_tlb_all();
104104
}
105105

arch/x86/kernel/amd_nb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int amd_get_subcaches(int cpu)
179179
return (mask >> (4 * cuid)) & 0xf;
180180
}
181181

182-
int amd_set_subcaches(int cpu, int mask)
182+
int amd_set_subcaches(int cpu, unsigned long mask)
183183
{
184184
static unsigned int reset, ban;
185185
struct amd_northbridge *nb = node_to_amd_nb(amd_get_nb_id(cpu));

arch/x86/kernel/cpu/amd.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,10 +767,7 @@ static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
767767

768768
static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c)
769769
{
770-
tlb_flushall_shift = 5;
771-
772-
if (c->x86 <= 0x11)
773-
tlb_flushall_shift = 4;
770+
tlb_flushall_shift = 6;
774771
}
775772

776773
static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c)

arch/x86/kernel/cpu/intel.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,21 +640,17 @@ static void intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c)
640640
case 0x61d: /* six-core 45 nm xeon "Dunnington" */
641641
tlb_flushall_shift = -1;
642642
break;
643+
case 0x63a: /* Ivybridge */
644+
tlb_flushall_shift = 2;
645+
break;
643646
case 0x61a: /* 45 nm nehalem, "Bloomfield" */
644647
case 0x61e: /* 45 nm nehalem, "Lynnfield" */
645648
case 0x625: /* 32 nm nehalem, "Clarkdale" */
646649
case 0x62c: /* 32 nm nehalem, "Gulftown" */
647650
case 0x62e: /* 45 nm nehalem-ex, "Beckton" */
648651
case 0x62f: /* 32 nm Xeon E7 */
649-
tlb_flushall_shift = 6;
650-
break;
651652
case 0x62a: /* SandyBridge */
652653
case 0x62d: /* SandyBridge, "Romely-EP" */
653-
tlb_flushall_shift = 5;
654-
break;
655-
case 0x63a: /* Ivybridge */
656-
tlb_flushall_shift = 1;
657-
break;
658654
default:
659655
tlb_flushall_shift = 6;
660656
}

arch/x86/kernel/cpu/microcode/amd_early.c

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ static void __init collect_cpu_sig_on_bsp(void *arg)
285285

286286
uci->cpu_sig.sig = cpuid_eax(0x00000001);
287287
}
288+
289+
static void __init get_bsp_sig(void)
290+
{
291+
unsigned int bsp = boot_cpu_data.cpu_index;
292+
struct ucode_cpu_info *uci = ucode_cpu_info + bsp;
293+
294+
if (!uci->cpu_sig.sig)
295+
smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1);
296+
}
288297
#else
289298
void load_ucode_amd_ap(void)
290299
{
@@ -337,31 +346,37 @@ void load_ucode_amd_ap(void)
337346

338347
int __init save_microcode_in_initrd_amd(void)
339348
{
349+
unsigned long cont;
340350
enum ucode_state ret;
341351
u32 eax;
342352

343-
#ifdef CONFIG_X86_32
344-
unsigned int bsp = boot_cpu_data.cpu_index;
345-
struct ucode_cpu_info *uci = ucode_cpu_info + bsp;
346-
347-
if (!uci->cpu_sig.sig)
348-
smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1);
353+
if (!container)
354+
return -EINVAL;
349355

356+
#ifdef CONFIG_X86_32
357+
get_bsp_sig();
358+
cont = (unsigned long)container;
359+
#else
350360
/*
351-
* Take into account the fact that the ramdisk might get relocated
352-
* and therefore we need to recompute the container's position in
353-
* virtual memory space.
361+
* We need the physical address of the container for both bitness since
362+
* boot_params.hdr.ramdisk_image is a physical address.
354363
*/
355-
container = (u8 *)(__va((u32)relocated_ramdisk) +
356-
((u32)container - boot_params.hdr.ramdisk_image));
364+
cont = __pa(container);
357365
#endif
366+
367+
/*
368+
* Take into account the fact that the ramdisk might get relocated and
369+
* therefore we need to recompute the container's position in virtual
370+
* memory space.
371+
*/
372+
if (relocated_ramdisk)
373+
container = (u8 *)(__va(relocated_ramdisk) +
374+
(cont - boot_params.hdr.ramdisk_image));
375+
358376
if (ucode_new_rev)
359377
pr_info("microcode: updated early to new patch_level=0x%08x\n",
360378
ucode_new_rev);
361379

362-
if (!container)
363-
return -EINVAL;
364-
365380
eax = cpuid_eax(0x00000001);
366381
eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
367382

arch/x86/kernel/cpu/mtrr/generic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
683683
}
684684

685685
/* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */
686-
count_vm_event(NR_TLB_LOCAL_FLUSH_ALL);
686+
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
687687
__flush_tlb();
688688

689689
/* Save MTRR state */
@@ -697,7 +697,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock)
697697
static void post_set(void) __releases(set_atomicity_lock)
698698
{
699699
/* Flush TLBs (no need to flush caches - they are disabled) */
700-
count_vm_event(NR_TLB_LOCAL_FLUSH_ALL);
700+
count_vm_tlb_event(NR_TLB_LOCAL_FLUSH_ALL);
701701
__flush_tlb();
702702

703703
/* Intel (P6) standard MTRRs */

arch/x86/kernel/irq.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ __visible void smp_trace_x86_platform_ipi(struct pt_regs *regs)
266266
EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
267267

268268
#ifdef CONFIG_HOTPLUG_CPU
269+
270+
/* These two declarations are only used in check_irq_vectors_for_cpu_disable()
271+
* below, which is protected by stop_machine(). Putting them on the stack
272+
* results in a stack frame overflow. Dynamically allocating could result in a
273+
* failure so declare these two cpumasks as global.
274+
*/
275+
static struct cpumask affinity_new, online_new;
276+
269277
/*
270278
* This cpu is going to be removed and its vectors migrated to the remaining
271279
* online cpus. Check to see if there are enough vectors in the remaining cpus.
@@ -277,7 +285,6 @@ int check_irq_vectors_for_cpu_disable(void)
277285
unsigned int this_cpu, vector, this_count, count;
278286
struct irq_desc *desc;
279287
struct irq_data *data;
280-
struct cpumask affinity_new, online_new;
281288

282289
this_cpu = smp_processor_id();
283290
cpumask_copy(&online_new, cpu_online_mask);

arch/x86/kernel/quirks.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,3 +571,40 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5,
571571
quirk_amd_nb_node);
572572

573573
#endif
574+
575+
#ifdef CONFIG_PCI
576+
/*
577+
* Processor does not ensure DRAM scrub read/write sequence
578+
* is atomic wrt accesses to CC6 save state area. Therefore
579+
* if a concurrent scrub read/write access is to same address
580+
* the entry may appear as if it is not written. This quirk
581+
* applies to Fam16h models 00h-0Fh
582+
*
583+
* See "Revision Guide" for AMD F16h models 00h-0fh,
584+
* document 51810 rev. 3.04, Nov 2013
585+
*/
586+
static void amd_disable_seq_and_redirect_scrub(struct pci_dev *dev)
587+
{
588+
u32 val;
589+
590+
/*
591+
* Suggested workaround:
592+
* set D18F3x58[4:0] = 00h and set D18F3x5C[0] = 0b
593+
*/
594+
pci_read_config_dword(dev, 0x58, &val);
595+
if (val & 0x1F) {
596+
val &= ~(0x1F);
597+
pci_write_config_dword(dev, 0x58, val);
598+
}
599+
600+
pci_read_config_dword(dev, 0x5C, &val);
601+
if (val & BIT(0)) {
602+
val &= ~BIT(0);
603+
pci_write_config_dword(dev, 0x5c, val);
604+
}
605+
}
606+
607+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3,
608+
amd_disable_seq_and_redirect_scrub);
609+
610+
#endif

arch/x86/mm/numa_32.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void memory_present(int nid, unsigned long start, unsigned long end)
5252
nid, start, end);
5353
printk(KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid);
5454
printk(KERN_DEBUG " ");
55+
start = round_down(start, PAGES_PER_SECTION);
56+
end = round_up(end, PAGES_PER_SECTION);
5557
for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
5658
physnode_map[pfn / PAGES_PER_SECTION] = nid;
5759
printk(KERN_CONT "%lx ", pfn);

arch/x86/mm/srat.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,25 @@ static __init inline int srat_disabled(void)
4242
return acpi_numa < 0;
4343
}
4444

45-
/* Callback for SLIT parsing */
45+
/*
46+
* Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
47+
* I/O localities since SRAT does not list them. I/O localities are
48+
* not supported at this point.
49+
*/
4650
void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
4751
{
4852
int i, j;
4953

50-
for (i = 0; i < slit->locality_count; i++)
51-
for (j = 0; j < slit->locality_count; j++)
54+
for (i = 0; i < slit->locality_count; i++) {
55+
if (pxm_to_node(i) == NUMA_NO_NODE)
56+
continue;
57+
for (j = 0; j < slit->locality_count; j++) {
58+
if (pxm_to_node(j) == NUMA_NO_NODE)
59+
continue;
5260
numa_set_distance(pxm_to_node(i), pxm_to_node(j),
5361
slit->entry[slit->locality_count * i + j]);
62+
}
63+
}
5464
}
5565

5666
/* Callback for Proximity Domain -> x2APIC mapping */

0 commit comments

Comments
 (0)