Besides generic traps, we will have a bunch of RISC-V specific traps: Platform handling: - VMEXITS_SBI: Calls from the guest (VS-Mode) to the SBI firmware
IRQ handling: - VMEXITS_TIMER: Timers will arrive in S-Mode - VMEXITS_IPI: IPIs arrive in S-Mode - VMEXITS_VIRQ: external IRQs arrive in S-Mode Generally, using a simple PLIC, all IRQs will arrive in S-Mode. Signed-off-by: Ralf Ramsauer <[email protected]> --- driver/sysfs.c | 15 +++++++++++++++ include/arch/riscv/asm/jailhouse_hypercall.h | 7 ++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/driver/sysfs.c b/driver/sysfs.c index 61b851cc..5ea1a8b0 100644 --- a/driver/sysfs.c +++ b/driver/sysfs.c @@ -163,6 +163,11 @@ JAILHOUSE_CPU_STATS_ATTR(vmexits_smccc, JAILHOUSE_CPU_STAT_VMEXITS_SMCCC); #ifdef CONFIG_ARM JAILHOUSE_CPU_STATS_ATTR(vmexits_cp15, JAILHOUSE_CPU_STAT_VMEXITS_CP15); #endif +#elif CONFIG_RISCV +JAILHOUSE_CPU_STATS_ATTR(vmexits_sbi, JAILHOUSE_CPU_STAT_VMEXITS_SBI); +JAILHOUSE_CPU_STATS_ATTR(vmexits_timer, JAILHOUSE_CPU_STAT_VMEXITS_TIMER); +JAILHOUSE_CPU_STATS_ATTR(vmexits_ipi, JAILHOUSE_CPU_STAT_VMEXITS_IPI); +JAILHOUSE_CPU_STATS_ATTR(vmexits_virq, JAILHOUSE_CPU_STAT_VMEXITS_VIRQ); #endif static struct attribute *cell_stats_attrs[] = { @@ -188,6 +193,11 @@ static struct attribute *cell_stats_attrs[] = { #ifdef CONFIG_ARM &vmexits_cp15_cell_attr.kattr.attr, #endif +#elif CONFIG_RISCV + &vmexits_sbi_cell_attr.kattr.attr, + &vmexits_timer_cell_attr.kattr.attr, + &vmexits_ipi_cell_attr.kattr.attr, + &vmexits_virq_cell_attr.kattr.attr, #endif NULL }; @@ -221,6 +231,11 @@ static struct attribute *cpu_stats_attrs[] = { #ifdef CONFIG_ARM &vmexits_cp15_cpu_attr.kattr.attr, #endif +#elif CONFIG_RISCV + &vmexits_sbi_cpu_attr.kattr.attr, + &vmexits_timer_cpu_attr.kattr.attr, + &vmexits_ipi_cpu_attr.kattr.attr, + &vmexits_virq_cpu_attr.kattr.attr, #endif NULL }; diff --git a/include/arch/riscv/asm/jailhouse_hypercall.h b/include/arch/riscv/asm/jailhouse_hypercall.h index 7d54047c..1a76ba2b 100644 --- a/include/arch/riscv/asm/jailhouse_hypercall.h +++ b/include/arch/riscv/asm/jailhouse_hypercall.h @@ -36,7 +36,12 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS +/* CPU statistics, RISC-V-specific part */ +#define JAILHOUSE_CPU_STAT_VMEXITS_SBI JAILHOUSE_GENERIC_CPU_STATS +#define JAILHOUSE_CPU_STAT_VMEXITS_TIMER JAILHOUSE_GENERIC_CPU_STATS + 1 +#define JAILHOUSE_CPU_STAT_VMEXITS_IPI JAILHOUSE_GENERIC_CPU_STATS + 2 +#define JAILHOUSE_CPU_STAT_VMEXITS_VIRQ JAILHOUSE_GENERIC_CPU_STATS + 3 +#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 4 #ifndef __ASSEMBLY__ -- 2.36.1 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20220627132905.4338-3-ralf.ramsauer%40oth-regensburg.de.
