[RFC, PATCH 15/24] i386 Vmi apic header

From: Zachary Amsden
Date: Mon Mar 13 2006 - 13:08:19 EST


Move APIC read / write accessors to sub-arch layer. Note that we
don't bother to implement apic_write_atomic any different, as it
is only present to work around old processor erratums (Pentium
Processor Spec update 11AP), and VMI kernels do not offer support
for this class of processor.

Signed-off-by: Zachary Amsden <zach@xxxxxxxxxx>
Signed-off-by: Daniel Arai <arai@xxxxxxxxxx>

Index: linux-2.6.16-rc5/include/asm-i386/apic.h
===================================================================
--- linux-2.6.16-rc5.orig/include/asm-i386/apic.h 2006-03-10 12:55:07.000000000 -0800
+++ linux-2.6.16-rc5/include/asm-i386/apic.h 2006-03-10 13:03:37.000000000 -0800
@@ -7,6 +7,7 @@
#include <asm/apicdef.h>
#include <asm/processor.h>
#include <asm/system.h>
+#include <mach_apicops.h>

#define Dprintk(x...)

@@ -45,25 +46,6 @@ static inline void lapic_enable(void)

#ifdef CONFIG_X86_LOCAL_APIC

-/*
- * Basic functions accessing APICs.
- */
-
-static __inline void apic_write(unsigned long reg, unsigned long v)
-{
- *((volatile unsigned long *)(APIC_BASE+reg)) = v;
-}
-
-static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
-{
- xchg((volatile unsigned long *)(APIC_BASE+reg), v);
-}
-
-static __inline unsigned long apic_read(unsigned long reg)
-{
- return *((volatile unsigned long *)(APIC_BASE+reg));
-}
-
static __inline__ void apic_wait_icr_idle(void)
{
while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY )
Index: linux-2.6.16-rc5/include/asm-i386/mach-vmi/mach_apicops.h
===================================================================
--- linux-2.6.16-rc5.orig/include/asm-i386/mach-vmi/mach_apicops.h 2006-03-10 13:03:37.000000000 -0800
+++ linux-2.6.16-rc5/include/asm-i386/mach-vmi/mach_apicops.h 2006-03-10 13:03:37.000000000 -0800
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2005, VMware, Inc.
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
+ * NON INFRINGEMENT. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Send feedback to arai@xxxxxxxxxx
+ *
+ */
+
+/*
+ * VMI implementation for basic functions accessing APICs. Calls into VMI
+ * to perform operations.
+ */
+
+#ifndef __ASM_MACH_APICOPS_H
+#define __ASM_MACH_APICOPS_H
+
+#ifdef CONFIG_X86_LOCAL_APIC
+#include <vmi.h>
+
+static inline void apic_write(unsigned long reg, unsigned long value)
+{
+ void *addr = (void *)(APIC_BASE + reg);
+ vmi_wrap_call(
+ APICWrite, "movl %1, (%0)",
+ VMI_NO_OUTPUT,
+ 2, XCONC(VMI_IREG1(addr), VMI_IREG2(value)),
+ VMI_CLOBBER_EXTENDED(ZERO_RETURNS, "memory"));
+}
+
+#define apic_write_atomic(r,v) apic_write(r,v)
+
+static inline unsigned long apic_read(unsigned long reg)
+{
+ unsigned long value;
+ void *addr = (void *)(APIC_BASE + reg);
+ vmi_wrap_call(
+ APICRead, "movl (%0), %%eax",
+ VMI_OREG1(value),
+ 1,VMI_IREG1(addr),
+ VMI_CLOBBER(ONE_RETURN));
+ return value;
+}
+
+
+#endif /* CONFIG_X86_LOCAL_APIC */
+
+#endif /* __ASM_MACH_APICOPS_H */
Index: linux-2.6.16-rc5/include/asm-i386/mach-default/mach_apicops.h
===================================================================
--- linux-2.6.16-rc5.orig/include/asm-i386/mach-default/mach_apicops.h 2006-03-10 13:03:37.000000000 -0800
+++ linux-2.6.16-rc5/include/asm-i386/mach-default/mach_apicops.h 2006-03-10 16:00:13.000000000 -0800
@@ -0,0 +1,29 @@
+/*
+ * Basic functions accessing APICs.
+ * These may optionally be overridden by the subarchitecture in
+ * mach_apicops.h.
+ */
+
+#ifndef __ASM_MACH_APICOPS_H
+#define __ASM_MACH_APICOPS_H
+
+
+#ifdef CONFIG_X86_LOCAL_APIC
+
+static __inline void apic_write(unsigned long reg, unsigned long v)
+{
+ *((volatile unsigned long *)(APIC_BASE+reg)) = v;
+}
+
+static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
+{
+ xchg((volatile unsigned long *)(APIC_BASE+reg), v);
+}
+static __inline unsigned long apic_read(unsigned long reg)
+{
+ return *((volatile unsigned long *)(APIC_BASE+reg));
+}
+
+#endif /* CONFIG_X86_LOCAL_APIC */
+
+#endif /* __ASM_MACH_APICOPS_H */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/