Commit ba082427 authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Ingo Molnar

x86: tweak io_64.h for paravirt.

We need something here because we can't call in and out instructions
directly. However, we have to be careful, because no indirections are
allowed in misc_64.c , and paravirt_ops is a kind of one. So just
call it directly there
Signed-off-by: default avatarGlauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Acked-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent ee238e5c
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
* High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
*/ */
/*
* we have to be careful, because no indirections are allowed here, and
* paravirt_ops is a kind of one. As it will only run in baremetal anyway,
* we just keep it from happening
*/
#undef CONFIG_PARAVIRT
#define _LINUX_STRING_H_ 1 #define _LINUX_STRING_H_ 1
#define __LINUX_BITMAP_H 1 #define __LINUX_BITMAP_H 1
......
...@@ -40,6 +40,10 @@ extern void native_io_delay(void); ...@@ -40,6 +40,10 @@ extern void native_io_delay(void);
extern int io_delay_type; extern int io_delay_type;
extern void io_delay_init(void); extern void io_delay_init(void);
#if defined(CONFIG_PARAVIRT)
#include <asm/paravirt.h>
#else
static inline void slow_down_io(void) static inline void slow_down_io(void)
{ {
native_io_delay(); native_io_delay();
...@@ -49,6 +53,7 @@ static inline void slow_down_io(void) ...@@ -49,6 +53,7 @@ static inline void slow_down_io(void)
native_io_delay(); native_io_delay();
#endif #endif
} }
#endif
/* /*
* Talk about misusing macros.. * Talk about misusing macros..
...@@ -57,21 +62,32 @@ static inline void slow_down_io(void) ...@@ -57,21 +62,32 @@ static inline void slow_down_io(void)
static inline void out##s(unsigned x value, unsigned short port) { static inline void out##s(unsigned x value, unsigned short port) {
#define __OUT2(s,s1,s2) \ #define __OUT2(s,s1,s2) \
__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" : : "a" (value), "Nd" (port)) __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
#ifndef REALLY_SLOW_IO
#define REALLY_SLOW_IO
#define UNSET_REALLY_SLOW_IO
#endif
#define __OUT(s,s1,x) \ #define __OUT(s,s1,x) \
__OUT1(s,x) __OUT2(s,s1,"w"); } \ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \
__OUT1(s##_p,x) __OUT2(s,s1,"w"); slow_down_io(); } __OUT1(s##_p, x) __OUT2(s, s1, "w") : : "a" (value), "Nd" (port)); \
slow_down_io(); }
#define __IN1(s) \ #define __IN1(s) \
static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; static inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v;
#define __IN2(s,s1,s2) \ #define __IN2(s,s1,s2) \
__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" : "=a" (_v) : "Nd" (port)) __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
#define __IN(s,s1,i...) \
__IN1(s) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); return _v; } \
__IN1(s##_p) __IN2(s, s1, "w") : "=a" (_v) : "Nd" (port), ##i); \
slow_down_io(); return _v; }
#define __IN(s,s1) \ #ifdef UNSET_REALLY_SLOW_IO
__IN1(s) __IN2(s,s1,"w"); return _v; } \ #undef REALLY_SLOW_IO
__IN1(s##_p) __IN2(s,s1,"w"); slow_down_io(); return _v; } #endif
#define __INS(s) \ #define __INS(s) \
static inline void ins##s(unsigned short port, void * addr, unsigned long count) \ static inline void ins##s(unsigned short port, void * addr, unsigned long count) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment