From: "Jan Beulich" Subject: [PATCH] linux/x86: don't build cstate.o and wakeup.o Date: Thu, 22 Nov 2007 13:09:32 +0000 Message-ID: <47458D9C.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org The code in arch/i386/kernel/acpi/cstate.c is (at best) irrelevant for VMs. The code in arch/{i386,x86_64}/kernel/acpi/wakeup.S is even dangerous; while not being actively used, its inadvertant use would go unnoticed. As usual, written and tested against 2.6.23 and made apply against 2.6.18 without further testing. Signed-off-by: Jan Beulich Index: head-2007-10-26/arch/i386/kernel/acpi/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-26.orig/arch/i386/kernel/acpi/Makefile 2007-11-13 = 09:29:24.000000000 +0100 +++ head-2007-10-26/arch/i386/kernel/acpi/Makefile 2007-11-13 = 11:19:08.000000000 +0100 @@ -6,3 +6,4 @@ ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y +=3D cstate.o processor.o endif =20 +disabled-obj-$(CONFIG_XEN) :=3D cstate.o wakeup.o Index: sle10sp2-2007-11-14/arch/i386/kernel/acpi/sleep-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sle10sp2-2007-11-14.orig/arch/i386/kernel/acpi/sleep-xen.c 2007-11-19 = 10:55:39.000000000 +0100 +++ sle10sp2-2007-11-14/arch/i386/kernel/acpi/sleep-xen.c 2007-11-16 = 13:26:42.000000000 +0100 @@ -12,12 +12,14 @@ =20 #include =20 +#ifndef CONFIG_ACPI_PV_SLEEP /* address in low memory of the wakeup routine. */ unsigned long acpi_wakeup_address =3D 0; unsigned long acpi_video_flags; extern char wakeup_start, wakeup_end; =20 extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); +#endif =20 /** * acpi_save_state_mem - save kernel state @@ -54,6 +56,7 @@ void acpi_restore_state_mem(void) */ void __init acpi_reserve_bootmem(void) { +#ifndef CONFIG_ACPI_PV_SLEEP if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) { printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n"); @@ -63,8 +66,10 @@ void __init acpi_reserve_bootmem(void) acpi_wakeup_address =3D (unsigned long)alloc_bootmem_low(PAGE_SIZE)= ; if (!acpi_wakeup_address) printk(KERN_ERR "ACPI: Cannot allocate lowmem, S3 = disabled.\n"); +#endif } =20 +#ifndef CONFIG_ACPI_PV_SLEEP static int __init acpi_sleep_setup(char *str) { while ((str !=3D NULL) && (*str !=3D '\0')) { @@ -106,7 +111,7 @@ static int __init acpisleep_dmi_init(voi =20 core_initcall(acpisleep_dmi_init); =20 -#ifdef CONFIG_ACPI_PV_SLEEP +#else /* CONFIG_ACPI_PV_SLEEP */ #include #include int acpi_notify_hypervisor_state(u8 sleep_state, Index: head-2007-10-26/arch/x86_64/kernel/acpi/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-26.orig/arch/x86_64/kernel/acpi/Makefile 2007-11-13 = 09:29:24.000000000 +0100 +++ head-2007-10-26/arch/x86_64/kernel/acpi/Makefile 2007-11-13 = 11:19:08.000000000 +0100 @@ -5,4 +5,7 @@ obj-$(CONFIG_ACPI_SLEEP) +=3D sleep.o wake ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y +=3D processor.o processor-y :=3D ../../../i386/kernel/acpi/processor.o = ../../../i386/kernel/acpi/cstate.o +processor-$(CONFIG_XEN) :=3D ../../../i386/kernel/acpi/processor.o endif + +disabled-obj-$(CONFIG_XEN) :=3D wakeup.o Index: sle10sp2-2007-11-14/arch/x86_64/kernel/acpi/sleep-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sle10sp2-2007-11-14.orig/arch/x86_64/kernel/acpi/sleep-xen.c = 2007-08-06 15:10:49.000000000 +0200 +++ sle10sp2-2007-11-14/arch/x86_64/kernel/acpi/sleep-xen.c 2007-11-16 = 13:30:38.000000000 +0100 @@ -53,6 +53,7 @@ =20 #ifdef CONFIG_ACPI_SLEEP =20 +#ifndef CONFIG_ACPI_PV_SLEEP /* address in low memory of the wakeup routine. */ unsigned long acpi_wakeup_address =3D 0; unsigned long acpi_video_flags; @@ -70,6 +71,7 @@ static void init_low_mapping(void) WARN_ON(num_online_cpus() !=3D 1); local_flush_tlb(); } +#endif =20 /** * acpi_save_state_mem - save kernel state @@ -110,12 +112,15 @@ void acpi_restore_state_mem(void) */ void __init acpi_reserve_bootmem(void) { +#ifndef CONFIG_ACPI_PV_SLEEP acpi_wakeup_address =3D (unsigned long)alloc_bootmem_low(PAGE_SIZE)= ; if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on = attempt to suspend\n"); +#endif } =20 +#ifndef CONFIG_ACPI_PV_SLEEP static int __init acpi_sleep_setup(char *str) { while ((str !=3D NULL) && (*str !=3D '\0')) { @@ -133,7 +138,7 @@ static int __init acpi_sleep_setup(char=20 =20 __setup("acpi_sleep=3D", acpi_sleep_setup); =20 -#ifdef CONFIG_ACPI_PV_SLEEP +#else /* CONFIG_ACPI_PV_SLEEP */ #include #include int acpi_notify_hypervisor_state(u8 sleep_state, Index: head-2007-10-26/include/asm-i386/acpi.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-26.orig/include/asm-i386/acpi.h 2007-10-15 = 16:36:04.000000000 +0200 +++ head-2007-10-26/include/asm-i386/acpi.h 2007-11-13 11:19:08.0000000= 00 +0100 @@ -185,7 +185,9 @@ static inline void disable_acpi(void) {=20 =20 extern u8 x86_acpiid_to_apicid[]; =20 +#ifndef CONFIG_XEN #define ARCH_HAS_POWER_INIT 1 +#endif =20 #endif /*__KERNEL__*/ =20 Index: head-2007-10-26/include/asm-x86_64/acpi.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-10-26.orig/include/asm-x86_64/acpi.h 2007-10-15 = 16:44:51.000000000 +0200 +++ head-2007-10-26/include/asm-x86_64/acpi.h 2007-11-13 11:19:08.0000000= 00 +0100 @@ -166,7 +166,9 @@ extern int acpi_scan_nodes(unsigned long =20 extern u8 x86_acpiid_to_apicid[]; =20 +#ifndef CONFIG_XEN #define ARCH_HAS_POWER_INIT 1 +#endif =20 extern int acpi_skip_timer_override; =20 Index: sle10sp2-2007-11-14/kernel/sysctl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sle10sp2-2007-11-14.orig/kernel/sysctl.c 2007-11-20 08:46:16.0000000= 00 +0100 +++ sle10sp2-2007-11-14/kernel/sysctl.c 2007-11-19 18:01:23.000000000 = +0100 @@ -661,7 +661,7 @@ static ctl_table kern_table[] =3D { .proc_handler =3D &proc_dointvec, }, #endif -#ifdef CONFIG_ACPI_SLEEP +#if defined(CONFIG_ACPI_SLEEP) && !defined(CONFIG_ACPI_PV_SLEEP) { .ctl_name =3D KERN_ACPI_VIDEO_FLAGS, .procname =3D "acpi_video_flags",