Commit 28f23d1f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 "urgent" leftovers from Ingo Molnar:
 "Pending x86/urgent bits that were not high prio enough to warrant
  -rc-less v3.3-final inclusion."

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, efi: Fix pointer math issue in handle_ramdisks()
  x86/ioapic: Add register level checks to detect bogus io-apic entries
  x86, mce: Fix rcu splat in drain_mce_log_buffer()
  x86, memblock: Move mem_hole_size() to .init
parents 23904815 c7b73835
...@@ -539,7 +539,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, ...@@ -539,7 +539,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
struct initrd *initrd; struct initrd *initrd;
efi_file_handle_t *h; efi_file_handle_t *h;
efi_file_info_t *info; efi_file_info_t *info;
efi_char16_t filename[256]; efi_char16_t filename_16[256];
unsigned long info_sz; unsigned long info_sz;
efi_guid_t info_guid = EFI_FILE_INFO_ID; efi_guid_t info_guid = EFI_FILE_INFO_ID;
efi_char16_t *p; efi_char16_t *p;
...@@ -552,14 +552,14 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, ...@@ -552,14 +552,14 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
str += 7; str += 7;
initrd = &initrds[i]; initrd = &initrds[i];
p = filename; p = filename_16;
/* Skip any leading slashes */ /* Skip any leading slashes */
while (*str == '/' || *str == '\\') while (*str == '/' || *str == '\\')
str++; str++;
while (*str && *str != ' ' && *str != '\n') { while (*str && *str != ' ' && *str != '\n') {
if (p >= filename + sizeof(filename)) if ((u8 *)p >= (u8 *)filename_16 + sizeof(filename_16))
break; break;
*p++ = *str++; *p++ = *str++;
...@@ -583,7 +583,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image, ...@@ -583,7 +583,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
goto free_initrds; goto free_initrds;
} }
status = efi_call_phys5(fh->open, fh, &h, filename, status = efi_call_phys5(fh->open, fh, &h, filename_16,
EFI_FILE_MODE_READ, (u64)0); EFI_FILE_MODE_READ, (u64)0);
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS)
goto close_handles; goto close_handles;
......
...@@ -3967,18 +3967,36 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi) ...@@ -3967,18 +3967,36 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi)
static __init int bad_ioapic(unsigned long address) static __init int bad_ioapic(unsigned long address)
{ {
if (nr_ioapics >= MAX_IO_APICS) { if (nr_ioapics >= MAX_IO_APICS) {
printk(KERN_WARNING "WARNING: Max # of I/O APICs (%d) exceeded " pr_warn("WARNING: Max # of I/O APICs (%d) exceeded (found %d), skipping\n",
"(found %d), skipping\n", MAX_IO_APICS, nr_ioapics); MAX_IO_APICS, nr_ioapics);
return 1; return 1;
} }
if (!address) { if (!address) {
printk(KERN_WARNING "WARNING: Bogus (zero) I/O APIC address" pr_warn("WARNING: Bogus (zero) I/O APIC address found in table, skipping!\n");
" found in table, skipping!\n");
return 1; return 1;
} }
return 0; return 0;
} }
static __init int bad_ioapic_register(int idx)
{
union IO_APIC_reg_00 reg_00;
union IO_APIC_reg_01 reg_01;
union IO_APIC_reg_02 reg_02;
reg_00.raw = io_apic_read(idx, 0);
reg_01.raw = io_apic_read(idx, 1);
reg_02.raw = io_apic_read(idx, 2);
if (reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1) {
pr_warn("I/O APIC 0x%x registers return all ones, skipping!\n",
mpc_ioapic_addr(idx));
return 1;
}
return 0;
}
void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
{ {
int idx = 0; int idx = 0;
...@@ -3995,6 +4013,12 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) ...@@ -3995,6 +4013,12 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
ioapics[idx].mp_config.apicaddr = address; ioapics[idx].mp_config.apicaddr = address;
set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
if (bad_ioapic_register(idx)) {
clear_fixmap(FIX_IO_APIC_BASE_0 + idx);
return;
}
ioapics[idx].mp_config.apicid = io_apic_unique_id(id); ioapics[idx].mp_config.apicid = io_apic_unique_id(id);
ioapics[idx].mp_config.apicver = io_apic_get_version(idx); ioapics[idx].mp_config.apicver = io_apic_get_version(idx);
...@@ -4015,10 +4039,10 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) ...@@ -4015,10 +4039,10 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
if (gsi_cfg->gsi_end >= gsi_top) if (gsi_cfg->gsi_end >= gsi_top)
gsi_top = gsi_cfg->gsi_end + 1; gsi_top = gsi_cfg->gsi_end + 1;
printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " pr_info("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, GSI %d-%d\n",
"GSI %d-%d\n", idx, mpc_ioapic_id(idx), idx, mpc_ioapic_id(idx),
mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), mpc_ioapic_ver(idx), mpc_ioapic_addr(idx),
gsi_cfg->gsi_base, gsi_cfg->gsi_end); gsi_cfg->gsi_base, gsi_cfg->gsi_end);
nr_ioapics++; nr_ioapics++;
} }
......
...@@ -191,7 +191,7 @@ static void drain_mcelog_buffer(void) ...@@ -191,7 +191,7 @@ static void drain_mcelog_buffer(void)
{ {
unsigned int next, i, prev = 0; unsigned int next, i, prev = 0;
next = rcu_dereference_check_mce(mcelog.next); next = ACCESS_ONCE(mcelog.next);
do { do {
struct mce *m; struct mce *m;
......
...@@ -28,7 +28,7 @@ static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi) ...@@ -28,7 +28,7 @@ static int __init emu_find_memblk_by_nid(int nid, const struct numa_meminfo *mi)
return -ENOENT; return -ENOENT;
} }
static u64 mem_hole_size(u64 start, u64 end) static u64 __init mem_hole_size(u64 start, u64 end)
{ {
unsigned long start_pfn = PFN_UP(start); unsigned long start_pfn = PFN_UP(start);
unsigned long end_pfn = PFN_DOWN(end); unsigned long end_pfn = PFN_DOWN(end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment