Skip to content

Commit 1ad9bf9

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 Ingo Molnar: "Misc fixes: two EDAC driver fixes, a Xen crash fix, a HyperV log spam fix and a documentation fix" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86 EDAC, sb_edac.c: Take account of channel hashing when needed x86 EDAC, sb_edac.c: Repair damage introduced when "fixing" channel address x86/mm/xen: Suppress hugetlbfs in PV guests x86/doc: Correct limits in Documentation/x86/x86_64/mm.txt x86/hyperv: Avoid reporting bogus NMI status for Gen2 instances
2 parents 82b23cb + ea5dfb5 commit 1ad9bf9

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

Documentation/x86/x86_64/mm.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks
1919
ffffffef00000000 - ffffffff00000000 (=64 GB) EFI region mapping space
2020
... unused hole ...
2121
ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0
22-
ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping space
22+
ffffffffa0000000 - ffffffffff5fffff (=1526 MB) module mapping space
2323
ffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscalls
2424
ffffffffffe00000 - ffffffffffffffff (=2 MB) unused hole
2525

@@ -31,8 +31,8 @@ vmalloc space is lazily synchronized into the different PML4 pages of
3131
the processes using the page fault handler, with init_level4_pgt as
3232
reference.
3333

34-
Current X86-64 implementations only support 40 bits of address space,
35-
but we support up to 46 bits. This expands into MBZ space in the page tables.
34+
Current X86-64 implementations support up to 46 bits of address space (64 TB),
35+
which is our current limit. This expands into MBZ space in the page tables.
3636

3737
We map EFI runtime services in the 'efi_pgd' PGD in a 64Gb large virtual
3838
memory window (this size is arbitrary, it can be raised later if needed).

arch/x86/include/asm/hugetlb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <asm/page.h>
55
#include <asm-generic/hugetlb.h>
66

7+
#define hugepages_supported() cpu_has_pse
78

89
static inline int is_hugepage_only_range(struct mm_struct *mm,
910
unsigned long addr,

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ static struct clocksource hyperv_cs = {
152152
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
153153
};
154154

155+
static unsigned char hv_get_nmi_reason(void)
156+
{
157+
return 0;
158+
}
159+
155160
static void __init ms_hyperv_init_platform(void)
156161
{
157162
/*
@@ -191,6 +196,13 @@ static void __init ms_hyperv_init_platform(void)
191196
machine_ops.crash_shutdown = hv_machine_crash_shutdown;
192197
#endif
193198
mark_tsc_unstable("running on Hyper-V");
199+
200+
/*
201+
* Generation 2 instances don't support reading the NMI status from
202+
* 0x61 port.
203+
*/
204+
if (efi_enabled(EFI_BOOT))
205+
x86_platform.get_nmi_reason = hv_get_nmi_reason;
194206
}
195207

196208
const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {

drivers/edac/sb_edac.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ struct sbridge_pvt {
362362

363363
/* Memory type detection */
364364
bool is_mirrored, is_lockstep, is_close_pg;
365+
bool is_chan_hash;
365366

366367
/* Fifo double buffers */
367368
struct mce mce_entry[MCE_LOG_LEN];
@@ -1060,6 +1061,20 @@ static inline u8 sad_pkg_ha(u8 pkg)
10601061
return (pkg >> 2) & 0x1;
10611062
}
10621063

1064+
static int haswell_chan_hash(int idx, u64 addr)
1065+
{
1066+
int i;
1067+
1068+
/*
1069+
* XOR even bits from 12:26 to bit0 of idx,
1070+
* odd bits from 13:27 to bit1
1071+
*/
1072+
for (i = 12; i < 28; i += 2)
1073+
idx ^= (addr >> i) & 3;
1074+
1075+
return idx;
1076+
}
1077+
10631078
/****************************************************************************
10641079
Memory check routines
10651080
****************************************************************************/
@@ -1616,6 +1631,10 @@ static int get_dimm_config(struct mem_ctl_info *mci)
16161631
KNL_MAX_CHANNELS : NUM_CHANNELS;
16171632
u64 knl_mc_sizes[KNL_MAX_CHANNELS];
16181633

1634+
if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL) {
1635+
pci_read_config_dword(pvt->pci_ha0, HASWELL_HASYSDEFEATURE2, &reg);
1636+
pvt->is_chan_hash = GET_BITFIELD(reg, 21, 21);
1637+
}
16191638
if (pvt->info.type == HASWELL || pvt->info.type == BROADWELL ||
16201639
pvt->info.type == KNIGHTS_LANDING)
16211640
pci_read_config_dword(pvt->pci_sad1, SAD_TARGET, &reg);
@@ -2118,12 +2137,15 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
21182137
}
21192138

21202139
ch_way = TAD_CH(reg) + 1;
2121-
sck_way = 1 << TAD_SOCK(reg);
2140+
sck_way = TAD_SOCK(reg);
21222141

21232142
if (ch_way == 3)
21242143
idx = addr >> 6;
2125-
else
2144+
else {
21262145
idx = (addr >> (6 + sck_way + shiftup)) & 0x3;
2146+
if (pvt->is_chan_hash)
2147+
idx = haswell_chan_hash(idx, addr);
2148+
}
21272149
idx = idx % ch_way;
21282150

21292151
/*
@@ -2157,7 +2179,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
21572179
switch(ch_way) {
21582180
case 2:
21592181
case 4:
2160-
sck_xch = 1 << sck_way * (ch_way >> 1);
2182+
sck_xch = (1 << sck_way) * (ch_way >> 1);
21612183
break;
21622184
default:
21632185
sprintf(msg, "Invalid mirror set. Can't decode addr");
@@ -2193,7 +2215,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
21932215

21942216
ch_addr = addr - offset;
21952217
ch_addr >>= (6 + shiftup);
2196-
ch_addr /= ch_way * sck_way;
2218+
ch_addr /= sck_xch;
21972219
ch_addr <<= (6 + shiftup);
21982220
ch_addr |= addr & ((1 << (6 + shiftup)) - 1);
21992221

0 commit comments

Comments
 (0)