[PATCH RFC 3/3] RISC-V: KVM: Implement guest time scaling

2020-12-03 Thread Yifei Jiang
ther these instructions are trapped to HS-mode. Therefore, we can implement guest time scaling by setting TM bit in kvm_riscv_vcpu_timer_restore() and emulating RDTIME/RDTIMEH instruction in system_opcode_insn(). Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- arch/riscv/include

[PATCH RFC 0/3] Implement guest time scaling in RISC-V KVM

2020-12-03 Thread Yifei Jiang
lowing two main reasons: - RDTIME not only be used in linux, but also in firmware and userspace. - It is difficult to be compatible with nested virtualization. [1] https://lore.kernel.org/patchwork/cover/1288153/ Yifei Jiang (3): RISC-V: KVM: Change the method of calculating cycles to nanosecond

[PATCH RFC 2/3] RISC-V: KVM: Support dynamic time frequency from userspace

2020-12-03 Thread Yifei Jiang
ned-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- arch/riscv/include/asm/kvm_vcpu_timer.h | 9 ++ arch/riscv/kvm/vcpu_timer.c | 40 + 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/arch/riscv/include/asm/kvm_vcpu_timer.h b/arch/riscv/i

[PATCH RFC 1/3] RISC-V: KVM: Change the method of calculating cycles to nanoseconds

2020-12-03 Thread Yifei Jiang
Because we will introduce the dynamic guest frequency later, we can't use the fixed mult and shift to calculate nanoseconds. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- arch/riscv/include/asm/kvm_vcpu_timer.h | 3 --- arch/riscv/kvm/vcpu_timer.c | 3 +-- 2

[PATCH RFC 1/2] riscv/kvm: Fix use VSIP_VALID_MASK mask HIP register

2020-08-27 Thread Yifei Jiang
The correct sip/sie 0x222 could mask wrong 0x000 by VSIP_VALID_MASK, This patch fix it. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- arch/riscv/kvm/vcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index

[PATCH RFC 0/2] Add log dirty support

2020-08-27 Thread Yifei Jiang
. Yifei Jiang (2): riscv/kvm: Fix use VSIP_VALID_MASK mask HIP register target/kvm: Add interfaces needed for log dirty arch/riscv/configs/defconfig | 1 + arch/riscv/kvm/Kconfig | 1 + arch/riscv/kvm/mmu.c | 43 arch/riscv/kvm/vcpu.c

[PATCH RFC 2/2] target/kvm: Add interfaces needed for log dirty

2020-08-27 Thread Yifei Jiang
Add two interfaces of log dirty for kvm_main.c, and detele the interface kvm_vm_ioctl_get_dirty_log which is redundantly defined. CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT is added in defconfig. Signed-off-by: Yifei Jiang Signed-off-by: Yipeng Yin --- arch/riscv/configs/defconfig | 1 + arch

[RFC 1/2] RISC-V: KVM: enable ioeventfd capability and compile for risc-v

2020-07-24 Thread Yifei Jiang
Signed-off-by: Yifei Jiang Signed-off-by: Mingwang Li --- arch/riscv/kvm/Kconfig | 2 ++ arch/riscv/kvm/Makefile | 2 +- arch/riscv/kvm/vm.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kvm/Kconfig b/arch/riscv/kvm/Kconfig index 2356dc52ebb3..95d85d893ab6

[RFC 2/2] RISC-V: KVM: read\write kernel mmio device support

2020-07-24 Thread Yifei Jiang
Signed-off-by: Yifei Jiang Signed-off-by: Mingwang Li --- arch/riscv/kvm/vcpu_exit.c | 38 -- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/arch/riscv/kvm/vcpu_exit.c b/arch/riscv/kvm/vcpu_exit.c index e97ba96cb0ae..448f11179fa8 100644 --- a

[RFC 0/2] Add risc-v vhost-net support

2020-07-24 Thread Yifei Jiang
rtio: Recv SendSend Socket Socket Message Elapsed Size SizeSize Time Throughput bytes bytes bytessecs.10^6bits/sec 131072 16384 16384100.07227.02 The next step is to support irqfd on RISC-V architecture. Yife