microblaze: Unprivileged stream instruction awareness
Add cpuinfo support for the new MicroBlaze option permitting userspace (unprivileged) access to the streaming instructions (FSL / AXI-stream). Emit a noisy warning at bootup if this is enabled, because bad user code can potentially lockup the CPU. Signed-off-by: John A. Williams <john.williams@petalogix.com> Signed-off-by: Michal Simek <monstr@monstr.eu>
This commit is contained in:
committed by
Michal Simek
parent
5db34eb92f
commit
8904976e8c
@@ -72,6 +72,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
|
||||
CI(pvr_user2, USER2);
|
||||
|
||||
CI(mmu, USE_MMU);
|
||||
CI(mmu_privins, MMU_PRIVINS);
|
||||
CI(endian, ENDIAN);
|
||||
|
||||
CI(use_icache, USE_ICACHE);
|
||||
|
@@ -119,6 +119,7 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
|
||||
ci->pvr_user2 = fcpu(cpu, "xlnx,pvr-user2");
|
||||
|
||||
ci->mmu = fcpu(cpu, "xlnx,use-mmu");
|
||||
ci->mmu_privins = fcpu(cpu, "xlnx,mmu-privileged-instr");
|
||||
ci->endian = fcpu(cpu, "xlnx,endianness");
|
||||
|
||||
ci->ver_code = 0;
|
||||
|
@@ -88,4 +88,8 @@ void __init setup_cpuinfo(void)
|
||||
printk(KERN_WARNING "%s: Unsupported PVR setting\n", __func__);
|
||||
set_cpuinfo_static(&cpuinfo, cpu);
|
||||
}
|
||||
|
||||
if (cpuinfo.mmu_privins)
|
||||
printk(KERN_WARNING "%s: Stream instructions enabled"
|
||||
" - USERSPACE CAN LOCK THIS KERNEL!\n", __func__);
|
||||
}
|
||||
|
@@ -97,6 +97,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
|
||||
(cpuinfo.use_exc & PVR2_FPU_EXC_MASK) ? "fpu " : "",
|
||||
(cpuinfo.use_exc & PVR2_USE_FSL_EXC) ? "fsl " : "");
|
||||
|
||||
count += seq_printf(m,
|
||||
"Stream-insns:\t%sprivileged\n",
|
||||
cpuinfo.mmu_privins ? "un" : "");
|
||||
|
||||
if (cpuinfo.use_icache)
|
||||
count += seq_printf(m,
|
||||
"Icache:\t\t%ukB\tline length:\t%dB\n",
|
||||
|
Reference in New Issue
Block a user