forked from luck/tmp_suning_uos_patched
b5510d9b68
If the kernel detects that the s390 hardware supports the vector facility, it is enabled by default at an early stage. To force it off, use the novx kernel parameter. Note that there is a small time window, where the vector facility is enabled before it is forced to be off. With enabling the vector facility by default, the FPU save and restore functions can be improved. They do not longer require to manage expensive control register updates to enable or disable the vector enablement control for particular processes. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
76 lines
1.9 KiB
C
76 lines
1.9 KiB
C
/*
|
|
* Copyright IBM Corp. 1999, 2009
|
|
*
|
|
* Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
|
|
*/
|
|
|
|
#ifndef __ASM_CTL_REG_H
|
|
#define __ASM_CTL_REG_H
|
|
|
|
#include <linux/bug.h>
|
|
|
|
#define __ctl_load(array, low, high) { \
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
\
|
|
BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
|
|
asm volatile( \
|
|
" lctlg %1,%2,%0\n" \
|
|
: : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high));\
|
|
}
|
|
|
|
#define __ctl_store(array, low, high) { \
|
|
typedef struct { char _[sizeof(array)]; } addrtype; \
|
|
\
|
|
BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
|
|
asm volatile( \
|
|
" stctg %1,%2,%0\n" \
|
|
: "=Q" (*(addrtype *)(&array)) \
|
|
: "i" (low), "i" (high)); \
|
|
}
|
|
|
|
static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
|
|
{
|
|
unsigned long reg;
|
|
|
|
__ctl_store(reg, cr, cr);
|
|
reg |= 1UL << bit;
|
|
__ctl_load(reg, cr, cr);
|
|
}
|
|
|
|
static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
|
|
{
|
|
unsigned long reg;
|
|
|
|
__ctl_store(reg, cr, cr);
|
|
reg &= ~(1UL << bit);
|
|
__ctl_load(reg, cr, cr);
|
|
}
|
|
|
|
void smp_ctl_set_bit(int cr, int bit);
|
|
void smp_ctl_clear_bit(int cr, int bit);
|
|
|
|
union ctlreg0 {
|
|
unsigned long val;
|
|
struct {
|
|
unsigned long : 32;
|
|
unsigned long : 3;
|
|
unsigned long lap : 1; /* Low-address-protection control */
|
|
unsigned long : 4;
|
|
unsigned long edat : 1; /* Enhanced-DAT-enablement control */
|
|
unsigned long : 4;
|
|
unsigned long afp : 1; /* AFP-register control */
|
|
unsigned long vx : 1; /* Vector enablement control */
|
|
unsigned long : 17;
|
|
};
|
|
};
|
|
|
|
#ifdef CONFIG_SMP
|
|
# define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
|
|
# define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
|
|
#else
|
|
# define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
|
|
# define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
|
|
#endif
|
|
|
|
#endif /* __ASM_CTL_REG_H */
|