Skip to content

Commit d34e14f

Browse files
committed
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: MIPS: Oprofile: Fix Loongson irq handler MIPS: N32: Use compat version for sys_ppoll. MIPS FPU emulator: allow Cause bits of FCSR to be writeable by ctc1
2 parents 18e41da + 4e73238 commit d34e14f

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

arch/mips/include/asm/mipsregs.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@
134134
#define FPU_CSR_COND6 0x40000000 /* $fcc6 */
135135
#define FPU_CSR_COND7 0x80000000 /* $fcc7 */
136136

137+
/*
138+
* Bits 18 - 20 of the FPU Status Register will be read as 0,
139+
* and should be written as zero.
140+
*/
141+
#define FPU_CSR_RSVD 0x001c0000
142+
137143
/*
138144
* X the exception cause indicator
139145
* E the exception enable
@@ -161,7 +167,8 @@
161167
#define FPU_CSR_UDF_S 0x00000008
162168
#define FPU_CSR_INE_S 0x00000004
163169

164-
/* rounding mode */
170+
/* Bits 0 and 1 of FPU Status Register specify the rounding mode */
171+
#define FPU_CSR_RM 0x00000003
165172
#define FPU_CSR_RN 0x0 /* nearest */
166173
#define FPU_CSR_RZ 0x1 /* towards zero */
167174
#define FPU_CSR_RU 0x2 /* towards +Infinity */

arch/mips/kernel/scall64-n32.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ EXPORT(sysn32_call_table)
385385
PTR sys_fchmodat
386386
PTR sys_faccessat
387387
PTR compat_sys_pselect6
388-
PTR sys_ppoll /* 6265 */
388+
PTR compat_sys_ppoll /* 6265 */
389389
PTR sys_unshare
390390
PTR sys_splice
391391
PTR sys_sync_file_range

arch/mips/math-emu/cp1emu.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
7878
#define FPCREG_RID 0 /* $0 = revision id */
7979
#define FPCREG_CSR 31 /* $31 = csr */
8080

81+
/* Determine rounding mode from the RM bits of the FCSR */
82+
#define modeindex(v) ((v) & FPU_CSR_RM)
83+
8184
/* Convert Mips rounding mode (0..3) to IEEE library modes. */
8285
static const unsigned char ieee_rm[4] = {
8386
[FPU_CSR_RN] = IEEE754_RN,
@@ -384,10 +387,14 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
384387
(void *) (xcp->cp0_epc),
385388
MIPSInst_RT(ir), value);
386389
#endif
387-
value &= (FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03);
388-
ctx->fcr31 &= ~(FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03);
389-
/* convert to ieee library modes */
390-
ctx->fcr31 |= (value & ~0x3) | ieee_rm[value & 0x3];
390+
391+
/*
392+
* Don't write reserved bits,
393+
* and convert to ieee library modes
394+
*/
395+
ctx->fcr31 = (value &
396+
~(FPU_CSR_RSVD | FPU_CSR_RM)) |
397+
ieee_rm[modeindex(value)];
391398
}
392399
if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) {
393400
return SIGFPE;

arch/mips/oprofile/op_model_loongson2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static irqreturn_t loongson2_perfcount_handler(int irq, void *dev_id)
122122
*/
123123

124124
/* Check whether the irq belongs to me */
125-
enabled = read_c0_perfcnt() & LOONGSON2_PERFCNT_INT_EN;
125+
enabled = read_c0_perfctrl() & LOONGSON2_PERFCNT_INT_EN;
126126
if (!enabled)
127127
return IRQ_NONE;
128128
enabled = reg.cnt1_enabled | reg.cnt2_enabled;

0 commit comments

Comments
 (0)