diff options
| author | Daniel Henrique Barboza <[email protected]> | 2023-08-03 16:32:56 +0000 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-08-08 11:55:49 +0000 |
| commit | 432a8b35cc23d3af9c60e9c0d191d7ff737afbdc (patch) | |
| tree | eec28a0810e31ea3e9575d8517091ceae6884ebf /arch/riscv/kvm/vcpu_timer.c | |
| parent | RISC-V: KVM: do not EOPNOTSUPP in set_one_reg() zicbo(m|z) (diff) | |
| download | kernel-432a8b35cc23d3af9c60e9c0d191d7ff737afbdc.tar.gz kernel-432a8b35cc23d3af9c60e9c0d191d7ff737afbdc.zip | |
RISC-V: KVM: do not EOPNOTSUPP in set KVM_REG_RISCV_TIMER_REG
The KVM_REG_RISCV_TIMER_REG can be read via get_one_reg(). But trying to
write anything in this reg via set_one_reg() results in an EOPNOTSUPP.
Change the API to behave like cbom_block_size: instead of always
erroring out with EOPNOTSUPP, allow userspace to write the same value
(riscv_timebase) back, throwing an EINVAL if a different value is
attempted.
Signed-off-by: Daniel Henrique Barboza <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'arch/riscv/kvm/vcpu_timer.c')
| -rw-r--r-- | arch/riscv/kvm/vcpu_timer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kvm/vcpu_timer.c b/arch/riscv/kvm/vcpu_timer.c index 527d269cafff..75486b25ac45 100644 --- a/arch/riscv/kvm/vcpu_timer.c +++ b/arch/riscv/kvm/vcpu_timer.c @@ -218,7 +218,8 @@ int kvm_riscv_vcpu_set_reg_timer(struct kvm_vcpu *vcpu, switch (reg_num) { case KVM_REG_RISCV_TIMER_REG(frequency): - ret = -EOPNOTSUPP; + if (reg_val != riscv_timebase) + return -EINVAL; break; case KVM_REG_RISCV_TIMER_REG(time): gt->time_delta = reg_val - get_cycles64(); |
