aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/apic/apic.c4
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c13
-rw-r--r--tools/lguest/lguest.c6
3 files changed, 16 insertions, 7 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 50c95af0f017..f3e9b2df4b16 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version)
2093 return -EINVAL; 2093 return -EINVAL;
2094 } 2094 }
2095 2095
2096 num_processors++;
2097 if (apicid == boot_cpu_physical_apicid) { 2096 if (apicid == boot_cpu_physical_apicid) {
2098 /* 2097 /*
2099 * x86_bios_cpu_apicid is required to have processors listed 2098 * x86_bios_cpu_apicid is required to have processors listed
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version)
2116 2115
2117 pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", 2116 pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n",
2118 thiscpu, apicid); 2117 thiscpu, apicid);
2118
2119 disabled_cpus++; 2119 disabled_cpus++;
2120 return -ENOSPC; 2120 return -ENOSPC;
2121 } 2121 }
2122 2122
2123 num_processors++;
2124
2123 /* 2125 /*
2124 * Validate version 2126 * Validate version
2125 */ 2127 */
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index b816971f5da4..620ab06bcf45 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -54,6 +54,7 @@ static LIST_HEAD(pcache);
54 */ 54 */
55static u8 *container; 55static u8 *container;
56static size_t container_size; 56static size_t container_size;
57static bool ucode_builtin;
57 58
58static u32 ucode_new_rev; 59static u32 ucode_new_rev;
59static u8 amd_ucode_patch[PATCH_MAX_SIZE]; 60static u8 amd_ucode_patch[PATCH_MAX_SIZE];
@@ -281,18 +282,22 @@ static bool __init load_builtin_amd_microcode(struct cpio_data *cp,
281void __init load_ucode_amd_bsp(unsigned int family) 282void __init load_ucode_amd_bsp(unsigned int family)
282{ 283{
283 struct cpio_data cp; 284 struct cpio_data cp;
285 bool *builtin;
284 void **data; 286 void **data;
285 size_t *size; 287 size_t *size;
286 288
287#ifdef CONFIG_X86_32 289#ifdef CONFIG_X86_32
288 data = (void **)__pa_nodebug(&ucode_cpio.data); 290 data = (void **)__pa_nodebug(&ucode_cpio.data);
289 size = (size_t *)__pa_nodebug(&ucode_cpio.size); 291 size = (size_t *)__pa_nodebug(&ucode_cpio.size);
292 builtin = (bool *)__pa_nodebug(&ucode_builtin);
290#else 293#else
291 data = &ucode_cpio.data; 294 data = &ucode_cpio.data;
292 size = &ucode_cpio.size; 295 size = &ucode_cpio.size;
296 builtin = &ucode_builtin;
293#endif 297#endif
294 298
295 if (!load_builtin_amd_microcode(&cp, family)) 299 *builtin = load_builtin_amd_microcode(&cp, family);
300 if (!*builtin)
296 cp = find_ucode_in_initrd(); 301 cp = find_ucode_in_initrd();
297 302
298 if (!(cp.data && cp.size)) 303 if (!(cp.data && cp.size))
@@ -373,7 +378,8 @@ void load_ucode_amd_ap(void)
373 return; 378 return;
374 379
375 /* Add CONFIG_RANDOMIZE_MEMORY offset. */ 380 /* Add CONFIG_RANDOMIZE_MEMORY offset. */
376 cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; 381 if (!ucode_builtin)
382 cont += PAGE_OFFSET - __PAGE_OFFSET_BASE;
377 383
378 eax = cpuid_eax(0x00000001); 384 eax = cpuid_eax(0x00000001);
379 eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); 385 eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ);
@@ -439,7 +445,8 @@ int __init save_microcode_in_initrd_amd(void)
439 container = cont_va; 445 container = cont_va;
440 446
441 /* Add CONFIG_RANDOMIZE_MEMORY offset. */ 447 /* Add CONFIG_RANDOMIZE_MEMORY offset. */
442 container += PAGE_OFFSET - __PAGE_OFFSET_BASE; 448 if (!ucode_builtin)
449 container += PAGE_OFFSET - __PAGE_OFFSET_BASE;
443 450
444 eax = cpuid_eax(0x00000001); 451 eax = cpuid_eax(0x00000001);
445 eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); 452 eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index d9836c5eb694..11c8d9bc762e 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -3266,6 +3266,9 @@ int main(int argc, char *argv[])
3266 } 3266 }
3267 } 3267 }
3268 3268
3269 /* If we exit via err(), this kills all the threads, restores tty. */
3270 atexit(cleanup_devices);
3271
3269 /* We always have a console device, and it's always device 1. */ 3272 /* We always have a console device, and it's always device 1. */
3270 setup_console(); 3273 setup_console();
3271 3274
@@ -3369,9 +3372,6 @@ int main(int argc, char *argv[])
3369 /* Ensure that we terminate if a device-servicing child dies. */ 3372 /* Ensure that we terminate if a device-servicing child dies. */
3370 signal(SIGCHLD, kill_launcher); 3373 signal(SIGCHLD, kill_launcher);
3371 3374
3372 /* If we exit via err(), this kills all the threads, restores tty. */
3373 atexit(cleanup_devices);
3374
3375 /* If requested, chroot to a directory */ 3375 /* If requested, chroot to a directory */
3376 if (chroot_path) { 3376 if (chroot_path) {
3377 if (chroot(chroot_path) != 0) 3377 if (chroot(chroot_path) != 0)