All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: akpm@osdl.org, ak@muc.de
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Zachary Amsden <zach@vmware.com>,
	linux-kernel@vger.kernel.org, virtualization@lists.osdl.org
Subject: [PATCH 6/7] Add APIC accessors to paravirt-ops.
Date: Sat, 28 Oct 2006 00:00:06 -0700	[thread overview]
Message-ID: <20061029024607.401333000@sous-sol.org> (raw)
In-Reply-To: 20061029024504.760769000@sous-sol.org

[-- Attachment #1: 01A-apicops.patch --]
[-- Type: text/plain, Size: 3811 bytes --]

Add APIC accessors to paravirt-ops.  Unfortunately, we need two write
functions, as some older broken hardware requires workarounds for
Pentium APIC errata - this is the purpose of apic_write_atomic.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>

---
 arch/i386/kernel/paravirt.c |   28 ++++++++++++++++++++++++++++
 include/asm-i386/apic.h     |    5 ++++-
 include/asm-i386/paravirt.h |   27 +++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)

--- linux-2.6-pv.orig/arch/i386/kernel/paravirt.c
+++ linux-2.6-pv/arch/i386/kernel/paravirt.c
@@ -28,6 +28,8 @@
 #include <asm/time.h>
 #include <asm/irq.h>
 #include <asm/delay.h>
+#include <asm/fixmap.h>
+#include <asm/apic.h>
 
 /* nop stub */
 static void native_nop(void)
@@ -382,6 +384,26 @@ static fastcall void native_io_delay(voi
 	asm volatile("outb %al,$0x80");
 }
 
+#ifdef CONFIG_X86_LOCAL_APIC
+/*
+ * Basic functions for reading and writing APIC registers
+ */
+static fastcall void native_apic_write(unsigned long reg, unsigned long v)
+{
+	*((volatile unsigned long *)(APIC_BASE+reg)) = v;
+}
+
+static fastcall void native_apic_write_atomic(unsigned long reg, unsigned long v)
+{
+	xchg((volatile unsigned long *)(APIC_BASE+reg), v);
+}
+
+static fastcall unsigned long native_apic_read(unsigned long reg)
+{
+	return *((volatile unsigned long *)(APIC_BASE+reg));
+}
+#endif /* CONFIG_X86_LOCAL_APIC */
+
 /* These are in entry.S */
 extern fastcall void native_iret(void);
 extern fastcall void native_irq_enable_sysexit(void);
@@ -452,6 +474,12 @@ struct paravirt_ops paravirt_ops = {
 	.io_delay = native_io_delay,
 	.const_udelay = __const_udelay,
 
+#ifdef CONFIG_X86_LOCAL_APIC
+	.apic_write = native_apic_write,
+	.apic_write_atomic = native_apic_write_atomic,
+	.apic_read = native_apic_read,
+#endif
+
 	.irq_enable_sysexit = native_irq_enable_sysexit,
 	.iret = native_iret,
 };
--- linux-2.6-pv.orig/include/asm-i386/apic.h
+++ linux-2.6-pv/include/asm-i386/apic.h
@@ -37,7 +37,9 @@ extern void generic_apic_probe(void);
 /*
  * Basic functions accessing APICs.
  */
-
+#ifdef CONFIG_PARAVIRT
+#include <asm/paravirt.h>
+#else
 static __inline void apic_write(unsigned long reg, unsigned long v)
 {
 	*((volatile unsigned long *)(APIC_BASE+reg)) = v;
@@ -52,6 +54,7 @@ static __inline unsigned long apic_read(
 {
 	return *((volatile unsigned long *)(APIC_BASE+reg));
 }
+#endif
 
 static __inline__ void apic_wait_icr_idle(void)
 {
--- linux-2.6-pv.orig/include/asm-i386/paravirt.h
+++ linux-2.6-pv/include/asm-i386/paravirt.h
@@ -115,6 +115,12 @@ struct paravirt_ops
 	void (fastcall *io_delay)(void);
 	void (*const_udelay)(unsigned long loops);
 
+#ifdef CONFIG_X86_LOCAL_APIC
+	void (fastcall *apic_write)(unsigned long reg, unsigned long v);
+	void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v);
+	unsigned long (fastcall *apic_read)(unsigned long reg);
+#endif
+
 	/* These two are jmp to, not actually called. */
 	void (fastcall *irq_enable_sysexit)(void);
 	void (fastcall *iret)(void);
@@ -280,6 +286,27 @@ static inline void slow_down_io(void) {
 #endif
 }
 
+#ifdef CONFIG_X86_LOCAL_APIC
+/*
+ * Basic functions accessing APICs.
+ */
+static __inline void apic_write(unsigned long reg, unsigned long v)
+{
+	paravirt_ops.apic_write(reg,v);
+}
+
+static __inline void apic_write_atomic(unsigned long reg, unsigned long v)
+{
+	paravirt_ops.apic_write_atomic(reg,v);
+}
+
+static __inline unsigned long apic_read(unsigned long reg)
+{
+	return paravirt_ops.apic_read(reg);
+}
+#endif
+
+
 /* These all sit in the .parainstructions section to tell us what to patch. */
 struct paravirt_patch {
 	u8 *instr; 		/* original instructions */

--

  parent reply	other threads:[~2006-10-28  7:00 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29  2:45 [PATCH 0/7] x86 paravirtualization infrastructure Chris Wright
2006-10-29  2:45 ` Chris Wright
2006-10-28  7:00 ` [PATCH 1/7] header and stubs for paravirtualizing critical operations Chris Wright
2006-10-29 16:40   ` Andi Kleen
2006-10-28  7:00 ` [PATCH 2/7] Patch inline replacements for common paravirt operations Chris Wright
2006-10-28  7:00 ` [PATCH 3/7] More generic paravirtualization entry point Chris Wright
2006-10-29 16:41   ` Andi Kleen
2006-10-28  7:00 ` [PATCH 4/7] Allow selected bug checks to be skipped by paravirt kernels Chris Wright
2006-11-01 12:17   ` Pavel Machek
2006-11-01 22:40     ` Dave Jones
2006-11-01 23:24     ` Zachary Amsden
2006-11-02 10:20       ` Pavel Machek
2006-11-02 10:20         ` Pavel Machek
2006-11-02 11:04         ` Zachary Amsden
2006-10-28  7:00 ` [PATCH 5/7] Allow disabling legacy power management modes with " Chris Wright
2006-10-28  7:00 ` Chris Wright [this message]
2006-10-29 16:31   ` [PATCH 6/7] Add APIC accessors to paravirt-ops Andi Kleen
2006-10-29 16:31     ` Andi Kleen
2006-10-30  3:28     ` Rusty Russell
2006-10-30  3:28       ` Rusty Russell
2006-10-30 23:11       ` Andi Kleen
2006-10-30 23:42         ` Chris Wright
2006-10-30 23:46           ` Andi Kleen
2006-10-30 23:55             ` Chris Wright
2006-10-31  1:45             ` Rusty Russell
2006-11-01 10:25         ` Rusty Russell
2006-11-01 10:27         ` [PATCH 1/7] paravirtualization: header and stubs for paravirtualizing critical operations Rusty Russell
2006-11-01 10:28           ` [PATCH 2/7] paravirtualization: Patch inline replacements for common paravirt operations Rusty Russell
2006-11-01 10:29             ` [PATCH 3/7] paravirtualization: More generic paravirtualization entry point Rusty Russell
2006-11-01 10:30               ` [PATCH 4/7] paravirtualization: Allow selected bug checks to be skipped by paravirt kernels Rusty Russell
2006-11-01 10:30                 ` Rusty Russell
2006-11-01 10:31                 ` [PATCH 5/7] paravirtualization: Allow disabling legacy power management modes with " Rusty Russell
2006-11-01 10:32                   ` [PATCH 6/7] paravirtualization: Add APIC accessors to paravirt-ops Rusty Russell
2006-11-01 10:34                     ` [PATCH 7/7] paravirtualization: Add mmu virtualization " Rusty Russell
2006-11-01 23:31                     ` [PATCH 6/7] paravirtualization: Add APIC accessors " Andrew Morton
2006-11-01 23:31                       ` Andrew Morton
2006-11-02  0:46                       ` Rusty Russell
2006-11-02  0:46                         ` Rusty Russell
2006-11-01 23:29                 ` [PATCH 4/7] paravirtualization: Allow selected bug checks to be skipped by paravirt kernels Andrew Morton
2006-11-01 23:29                   ` Andrew Morton
2006-11-01 23:58                   ` Jeremy Fitzhardinge
2006-11-01 23:58                     ` Jeremy Fitzhardinge
2006-11-02  0:01                   ` Rusty Russell
2006-11-02  0:01                     ` Rusty Russell
2006-11-01 23:27             ` [PATCH 2/7] paravirtualization: Patch inline replacements for common paravirt operations Andrew Morton
2006-11-01 23:27               ` Andrew Morton
2006-11-02  0:47               ` Rusty Russell
2006-11-02  0:47                 ` Rusty Russell
2006-11-02  0:54                 ` Zachary Amsden
2006-11-01 10:45           ` [PATCH 1/7] paravirtualization: header and stubs for paravirtualizing critical operations Arjan van de Ven
2006-11-01 10:45             ` Arjan van de Ven
2006-11-01 17:27             ` Andi Kleen
2006-11-01 23:32             ` Rusty Russell
2006-11-02  7:13           ` Andrew Morton
2006-11-02  7:13             ` Andrew Morton
2006-11-02  7:44             ` Oleg Verych
2006-11-03  2:56           ` Andi Kleen
2006-11-03  2:56             ` Andi Kleen
2006-11-03  7:26             ` [x86_64] Strange oprofile results on access to per_cpu data Eric Dumazet
2006-11-03 17:01               ` Andi Kleen
2006-11-03 20:35             ` [PATCH 1/7] paravirtualization: header and stubs for paravirtualizing critical operations Zachary Amsden
2006-11-03 21:09               ` Andi Kleen
2006-11-05  4:43                 ` Rusty Russell
2006-11-05  4:59                   ` Zachary Amsden
2006-11-05  4:59                     ` Zachary Amsden
2006-11-05  5:08                     ` Rusty Russell
2006-11-05  5:08                       ` Rusty Russell
2006-11-05  5:46                   ` Andi Kleen
2006-11-05  6:18                     ` Andrew Morton
2006-11-05  6:18                       ` Andrew Morton
2006-11-05  6:21                     ` Rusty Russell
2006-11-05  6:21                       ` Rusty Russell
2006-11-05  6:57                       ` Andi Kleen
2006-11-18  2:08           ` john stultz
2006-10-28  7:00 ` [PATCH 7/7] Add mmu virtualization to paravirt-ops Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061029024607.401333000@sous-sol.org \
    --to=chrisw@sous-sol.org \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.osdl.org \
    --cc=zach@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.