Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43076
b: refs/heads/master
c: 13623d7
h: refs/heads/master
v: v3
  • Loading branch information
Rusty Russell authored and Andi Kleen committed Dec 7, 2006
1 parent 0a4f40d commit 74d2ff2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6020c8f315709a508b027ef6749e85b125190947
refs/heads/master: 13623d79309dd82e1964458fa017979d16f33fa8
8 changes: 8 additions & 0 deletions trunk/arch/i386/kernel/paravirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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)
Expand Down Expand Up @@ -446,6 +448,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,
};
Expand Down
15 changes: 12 additions & 3 deletions trunk/include/asm-i386/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,27 @@ extern void generic_apic_probe(void);
/*
* Basic functions accessing APICs.
*/
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#else
#define apic_write native_apic_write
#define apic_write_atomic native_apic_write_atomic
#define apic_read native_apic_read
#endif

static __inline void apic_write(unsigned long reg, unsigned long v)
static __inline fastcall void native_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)
static __inline fastcall void native_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)
static __inline fastcall unsigned long native_apic_read(unsigned long reg)
{
return *((volatile unsigned long *)(APIC_BASE+reg));
}
Expand Down
27 changes: 27 additions & 0 deletions trunk/include/asm-i386/paravirt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -270,6 +276,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 */
Expand Down

0 comments on commit 74d2ff2

Please sign in to comment.