CPU

LS232的DI(Disable Interrupts)指令有问题,建议禁用!

https://github.com/lshw/loongson1-kernel3.18/pull/3

当内核配置设为:

CPU type (MIPS32 Release 2)
CONFIG_CPU_MIPS32_R2=y

Preemption Model (No Forced Preemption (Server))
CONFIG_PREEMPT_NONE=y

并以make CFLAGS='-mno-branch-likely'进行编译,在智龙V2.1上启动时会卡住。

经分析,是arch_local_irq_disable()里的DI指令的问题。

考虑到3A1000和3B1500的DI也存在问题,龙芯中科更新了文档禁用了该指令:
http://www.loongson.cn/uploadfile/cpu/3A1000/Loongson_3A1000_cpu_user_2.pdf
http://www.loongson.cn/uploadfile/cpu/3B1500/Loongson_3B1500_cpu_user_2.pdf

建议LS232的相关文档也进行更新,禁用DI指令。

4 个评论

应该是跟3a2000/3000一样的问题,并不是不能用,而是用法不对。
Red54

Red54 回复 lemote1

那正确的用法应该是?
去看官网内核代码,4.7以后的。
Red54

Red54 回复 lemote1

static inline void arch_local_irq_disable(void)
{
__asm__ __volatile__(
" .set push \n"
" .set noat \n"
" di \n" //LS232是这里有问题
" " __stringify(__irq_disable_hazard) " \n"
" .set pop \n"
: /* no outputs */
: /* no inputs */
: "memory");
}

static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags;

asm __volatile__(
" .set push \n"
" .set reorder \n"
" .set noat \n"
#if defined(CONFIG_CPU_LOONGSON3) //LS464是这里有问题
" mfc0 %[flags], $12 \n"
" di \n"
#else
" di %[flags] \n"
#endif
" andi %[flags], 1 \n"
" " __stringify(__irq_disable_hazard) " \n"
" .set pop \n"
: [flags] "=r" (flags)
: /* no inputs */
: "memory");

return flags;
}

要回复文章请先登录注册