Skip to content

Commit

Permalink
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Three fixes:

   - AMD microcode loading fix with randomization

   - an lguest tooling fix

   - and an APIC enumeration boundary condition fix"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/apic: Fix num_processors value in case of failure
  tools/lguest: Don't bork the terminal in case of wrong args
  x86/microcode/AMD: Fix load of builtin microcode with randomized memory
  • Loading branch information
Linus Torvalds committed Sep 13, 2016
2 parents fda6751 + c291b01 commit 5924bbe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion arch/x86/kernel/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
return -EINVAL;
}

num_processors++;
if (apicid == boot_cpu_physical_apicid) {
/*
* x86_bios_cpu_apicid is required to have processors listed
Expand All @@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)

pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n",
thiscpu, apicid);

disabled_cpus++;
return -ENOSPC;
}

num_processors++;

/*
* Validate version
*/
Expand Down
13 changes: 10 additions & 3 deletions arch/x86/kernel/cpu/microcode/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static LIST_HEAD(pcache);
*/
static u8 *container;
static size_t container_size;
static bool ucode_builtin;

static u32 ucode_new_rev;
static u8 amd_ucode_patch[PATCH_MAX_SIZE];
Expand Down Expand Up @@ -281,18 +282,22 @@ static bool __init load_builtin_amd_microcode(struct cpio_data *cp,
void __init load_ucode_amd_bsp(unsigned int family)
{
struct cpio_data cp;
bool *builtin;
void **data;
size_t *size;

#ifdef CONFIG_X86_32
data = (void **)__pa_nodebug(&ucode_cpio.data);
size = (size_t *)__pa_nodebug(&ucode_cpio.size);
builtin = (bool *)__pa_nodebug(&ucode_builtin);
#else
data = &ucode_cpio.data;
size = &ucode_cpio.size;
builtin = &ucode_builtin;
#endif

if (!load_builtin_amd_microcode(&cp, family))
*builtin = load_builtin_amd_microcode(&cp, family);
if (!*builtin)
cp = find_ucode_in_initrd();

if (!(cp.data && cp.size))
Expand Down Expand Up @@ -373,7 +378,8 @@ void load_ucode_amd_ap(void)
return;

/* Add CONFIG_RANDOMIZE_MEMORY offset. */
cont += PAGE_OFFSET - __PAGE_OFFSET_BASE;
if (!ucode_builtin)
cont += PAGE_OFFSET - __PAGE_OFFSET_BASE;

eax = cpuid_eax(0x00000001);
eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ);
Expand Down Expand Up @@ -439,7 +445,8 @@ int __init save_microcode_in_initrd_amd(void)
container = cont_va;

/* Add CONFIG_RANDOMIZE_MEMORY offset. */
container += PAGE_OFFSET - __PAGE_OFFSET_BASE;
if (!ucode_builtin)
container += PAGE_OFFSET - __PAGE_OFFSET_BASE;

eax = cpuid_eax(0x00000001);
eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
Expand Down
6 changes: 3 additions & 3 deletions tools/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -3266,6 +3266,9 @@ int main(int argc, char *argv[])
}
}

/* If we exit via err(), this kills all the threads, restores tty. */
atexit(cleanup_devices);

/* We always have a console device, and it's always device 1. */
setup_console();

Expand Down Expand Up @@ -3369,9 +3372,6 @@ int main(int argc, char *argv[])
/* Ensure that we terminate if a device-servicing child dies. */
signal(SIGCHLD, kill_launcher);

/* If we exit via err(), this kills all the threads, restores tty. */
atexit(cleanup_devices);

/* If requested, chroot to a directory */
if (chroot_path) {
if (chroot(chroot_path) != 0)
Expand Down

0 comments on commit 5924bbe

Please sign in to comment.