mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
riscv: abstract out CSR names for supervisor vs machine mode
Many of the privileged CSRs exist in a supervisor and machine version that are used very similarly. Provide versions of the CSR names and fields that map to either the S-mode or M-mode variant depending on a new CONFIG_RISCV_M_MODE kconfig symbol. Contains contributions from Damien Le Moal <Damien.LeMoal@wdc.com> and Paul Walmsley <paul.walmsley@sifive.com>. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> # for drivers/clocksource, drivers/irqchip [paul.walmsley@sifive.com: updated to apply] Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
This commit is contained in:
committed by
Paul Walmsley
parent
0c3ac28931
commit
a4c3733d32
@@ -35,8 +35,8 @@ void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
show_regs_print_info(KERN_DEFAULT);
|
||||
|
||||
pr_cont("sepc: " REG_FMT " ra : " REG_FMT " sp : " REG_FMT "\n",
|
||||
regs->sepc, regs->ra, regs->sp);
|
||||
pr_cont("epc: " REG_FMT " ra : " REG_FMT " sp : " REG_FMT "\n",
|
||||
regs->epc, regs->ra, regs->sp);
|
||||
pr_cont(" gp : " REG_FMT " tp : " REG_FMT " t0 : " REG_FMT "\n",
|
||||
regs->gp, regs->tp, regs->t0);
|
||||
pr_cont(" t1 : " REG_FMT " t2 : " REG_FMT " s0 : " REG_FMT "\n",
|
||||
@@ -58,23 +58,23 @@ void show_regs(struct pt_regs *regs)
|
||||
pr_cont(" t5 : " REG_FMT " t6 : " REG_FMT "\n",
|
||||
regs->t5, regs->t6);
|
||||
|
||||
pr_cont("sstatus: " REG_FMT " sbadaddr: " REG_FMT " scause: " REG_FMT "\n",
|
||||
regs->sstatus, regs->sbadaddr, regs->scause);
|
||||
pr_cont("status: " REG_FMT " badaddr: " REG_FMT " cause: " REG_FMT "\n",
|
||||
regs->status, regs->badaddr, regs->cause);
|
||||
}
|
||||
|
||||
void start_thread(struct pt_regs *regs, unsigned long pc,
|
||||
unsigned long sp)
|
||||
{
|
||||
regs->sstatus = SR_SPIE;
|
||||
regs->status = SR_PIE;
|
||||
if (has_fpu) {
|
||||
regs->sstatus |= SR_FS_INITIAL;
|
||||
regs->status |= SR_FS_INITIAL;
|
||||
/*
|
||||
* Restore the initial value to the FP register
|
||||
* before starting the user program.
|
||||
*/
|
||||
fstate_restore(current, regs);
|
||||
}
|
||||
regs->sepc = pc;
|
||||
regs->epc = pc;
|
||||
regs->sp = sp;
|
||||
set_fs(USER_DS);
|
||||
}
|
||||
@@ -110,7 +110,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
|
||||
const register unsigned long gp __asm__ ("gp");
|
||||
memset(childregs, 0, sizeof(struct pt_regs));
|
||||
childregs->gp = gp;
|
||||
childregs->sstatus = SR_SPP | SR_SPIE; /* Supervisor, irqs on */
|
||||
/* Supervisor/Machine, irqs on: */
|
||||
childregs->status = SR_PP | SR_PIE;
|
||||
|
||||
p->thread.ra = (unsigned long)ret_from_kernel_thread;
|
||||
p->thread.s[0] = usp; /* fn */
|
||||
|
||||
Reference in New Issue
Block a user