diff options
| author | Richard Henderson <rth@twiddle.net> | 2011-04-28 10:29:27 -0400 |
|---|---|---|
| committer | Matt Turner <mattst88@gmail.com> | 2013-11-16 19:33:12 -0500 |
| commit | 994dcf7055df88623d25f3593b931a018a76b502 (patch) | |
| tree | c3708ed5b2558e82b88ef15e533797a400b361e5 | |
| parent | a47e5bb5764f029f989a182b0dd2d4cce69f8b14 (diff) | |
alpha: Notice if we're being run under QEMU
When building a generic kernel, do a run-time check on the serial
number, like we do for MILO. When building a custom kernel, make
this a configure-time check.
Signed-off-by: Richard Henderson <rth@twiddle.net>
| -rw-r--r-- | arch/alpha/Kconfig | 14 | ||||
| -rw-r--r-- | arch/alpha/include/asm/machvec.h | 18 | ||||
| -rw-r--r-- | arch/alpha/kernel/setup.c | 13 |
3 files changed, 38 insertions, 7 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 135c674eaf9e..51cc8c353164 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
| @@ -488,6 +488,20 @@ config VGA_HOSE | |||
| 488 | which always have multiple hoses, and whose consoles support it. | 488 | which always have multiple hoses, and whose consoles support it. |
| 489 | 489 | ||
| 490 | 490 | ||
| 491 | config ALPHA_QEMU | ||
| 492 | bool "Run under QEMU emulation" | ||
| 493 | depends on !ALPHA_GENERIC | ||
| 494 | ---help--- | ||
| 495 | Assume the presence of special features supported by QEMU PALcode | ||
| 496 | that reduce the overhead of system emulation. | ||
| 497 | |||
| 498 | Generic kernels will auto-detect QEMU. But when building a | ||
| 499 | system-specific kernel, the assumption is that we want to | ||
| 500 | elimiate as many runtime tests as possible. | ||
| 501 | |||
| 502 | If unsure, say N. | ||
| 503 | |||
| 504 | |||
| 491 | config ALPHA_SRM | 505 | config ALPHA_SRM |
| 492 | bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME | 506 | bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME |
| 493 | depends on TTY | 507 | depends on TTY |
diff --git a/arch/alpha/include/asm/machvec.h b/arch/alpha/include/asm/machvec.h index 72dbf2359270..4ac90167d346 100644 --- a/arch/alpha/include/asm/machvec.h +++ b/arch/alpha/include/asm/machvec.h | |||
| @@ -126,13 +126,19 @@ extern struct alpha_machine_vector alpha_mv; | |||
| 126 | 126 | ||
| 127 | #ifdef CONFIG_ALPHA_GENERIC | 127 | #ifdef CONFIG_ALPHA_GENERIC |
| 128 | extern int alpha_using_srm; | 128 | extern int alpha_using_srm; |
| 129 | extern int alpha_using_qemu; | ||
| 129 | #else | 130 | #else |
| 130 | #ifdef CONFIG_ALPHA_SRM | 131 | # ifdef CONFIG_ALPHA_SRM |
| 131 | #define alpha_using_srm 1 | 132 | # define alpha_using_srm 1 |
| 132 | #else | 133 | # else |
| 133 | #define alpha_using_srm 0 | 134 | # define alpha_using_srm 0 |
| 134 | #endif | 135 | # endif |
| 136 | # ifdef CONFIG_ALPHA_QEMU | ||
| 137 | # define alpha_using_qemu 1 | ||
| 138 | # else | ||
| 139 | # define alpha_using_qemu 0 | ||
| 140 | # endif | ||
| 135 | #endif /* GENERIC */ | 141 | #endif /* GENERIC */ |
| 136 | 142 | ||
| 137 | #endif | 143 | #endif /* __KERNEL__ */ |
| 138 | #endif /* __ALPHA_MACHVEC_H */ | 144 | #endif /* __ALPHA_MACHVEC_H */ |
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 9e3107cc5ebb..c38d6a1b9066 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
| @@ -115,10 +115,17 @@ unsigned long alpha_agpgart_size = DEFAULT_AGP_APER_SIZE; | |||
| 115 | 115 | ||
| 116 | #ifdef CONFIG_ALPHA_GENERIC | 116 | #ifdef CONFIG_ALPHA_GENERIC |
| 117 | struct alpha_machine_vector alpha_mv; | 117 | struct alpha_machine_vector alpha_mv; |
| 118 | #endif | ||
| 119 | |||
| 120 | #ifndef alpha_using_srm | ||
| 118 | int alpha_using_srm; | 121 | int alpha_using_srm; |
| 119 | EXPORT_SYMBOL(alpha_using_srm); | 122 | EXPORT_SYMBOL(alpha_using_srm); |
| 120 | #endif | 123 | #endif |
| 121 | 124 | ||
| 125 | #ifndef alpha_using_qemu | ||
| 126 | int alpha_using_qemu; | ||
| 127 | #endif | ||
| 128 | |||
| 122 | static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, | 129 | static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, |
| 123 | unsigned long); | 130 | unsigned long); |
| 124 | static struct alpha_machine_vector *get_sysvec_byname(const char *); | 131 | static struct alpha_machine_vector *get_sysvec_byname(const char *); |
| @@ -529,11 +536,15 @@ setup_arch(char **cmdline_p) | |||
| 529 | atomic_notifier_chain_register(&panic_notifier_list, | 536 | atomic_notifier_chain_register(&panic_notifier_list, |
| 530 | &alpha_panic_block); | 537 | &alpha_panic_block); |
| 531 | 538 | ||
| 532 | #ifdef CONFIG_ALPHA_GENERIC | 539 | #ifndef alpha_using_srm |
| 533 | /* Assume that we've booted from SRM if we haven't booted from MILO. | 540 | /* Assume that we've booted from SRM if we haven't booted from MILO. |
| 534 | Detect the later by looking for "MILO" in the system serial nr. */ | 541 | Detect the later by looking for "MILO" in the system serial nr. */ |
| 535 | alpha_using_srm = strncmp((const char *)hwrpb->ssn, "MILO", 4) != 0; | 542 | alpha_using_srm = strncmp((const char *)hwrpb->ssn, "MILO", 4) != 0; |
| 536 | #endif | 543 | #endif |
| 544 | #ifndef alpha_using_qemu | ||
| 545 | /* Similarly, look for QEMU. */ | ||
| 546 | alpha_using_qemu = strstr((const char *)hwrpb->ssn, "QEMU") != 0; | ||
| 547 | #endif | ||
| 537 | 548 | ||
| 538 | /* If we are using SRM, we want to allow callbacks | 549 | /* If we are using SRM, we want to allow callbacks |
| 539 | as early as possible, so do this NOW, and then | 550 | as early as possible, so do this NOW, and then |
