Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15d6aba2 authored by Avi Kivity's avatar Avi Kivity Committed by Ingo Molnar
Browse files

x86: Demacro CONFIG_PARAVIRT cpu accessors



Recently, we had a build failure on !CONFIG_PARAVIRT due to a
callback ->wbinvd() clashing with a macro wbinvd().

While we worked around the issue, avoid it in the future by
changing the macro (and a few surrounding ones) to an inline
function.

Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1303632711-21662-1-git-send-email-avi@redhat.com


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0f1d9f78
Loading
Loading
Loading
Loading
+71 −14
Original line number Original line Diff line number Diff line
@@ -303,24 +303,81 @@ static inline void native_wbinvd(void)
#ifdef CONFIG_PARAVIRT
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
#include <asm/paravirt.h>
#else
#else
#define read_cr0()	(native_read_cr0())

#define write_cr0(x)	(native_write_cr0(x))
static inline unsigned long read_cr0(void)
#define read_cr2()	(native_read_cr2())
{
#define write_cr2(x)	(native_write_cr2(x))
	return native_read_cr0();
#define read_cr3()	(native_read_cr3())
}
#define write_cr3(x)	(native_write_cr3(x))

#define read_cr4()	(native_read_cr4())
static inline void write_cr0(unsigned long x)
#define read_cr4_safe()	(native_read_cr4_safe())
{
#define write_cr4(x)	(native_write_cr4(x))
	native_write_cr0(x);
#define wbinvd()	(native_wbinvd())
}

static inline unsigned long read_cr2(void)
{
	return native_read_cr2();
}

static inline void write_cr2(unsigned long x)
{
	native_write_cr2(x);
}

static inline unsigned long read_cr3(void)
{
	return native_read_cr3();
}

static inline void write_cr3(unsigned long x)
{
	native_write_cr3(x);
}

static inline unsigned long read_cr4(void)
{
	return native_read_cr4();
}

static inline unsigned long read_cr4_safe(void)
{
	return native_read_cr4_safe();
}

static inline void write_cr4(unsigned long x)
{
	native_write_cr4(x);
}

static inline void wbinvd(void)
{
	native_wbinvd();
}

#ifdef CONFIG_X86_64
#ifdef CONFIG_X86_64
#define read_cr8()	(native_read_cr8())

#define write_cr8(x)	(native_write_cr8(x))
static inline unsigned long read_cr8(void)
#define load_gs_index   native_load_gs_index
{
	return native_read_cr8();
}

static inline void write_cr8(unsigned long x)
{
	native_write_cr8(x);
}

static inline void load_gs_index(unsigned selector)
{
	native_load_gs_index(selector);
}

#endif
#endif


/* Clear the 'TS' bit */
/* Clear the 'TS' bit */
#define clts()		(native_clts())
static inline void clts(void)
{
	native_clts();
}


#endif/* CONFIG_PARAVIRT */
#endif/* CONFIG_PARAVIRT */