summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kvm
diff options
context:
space:
mode:
authorAndrew Jones <ajones@ventanamicro.com>2023-12-20 17:00:18 +0100
committerAnup Patel <anup@brainfault.org>2023-12-30 11:26:22 +0530
commit2a1f6bf079700f0f9d8045ab77b302aeb4d12c06 (patch)
tree72fd530c895a6571383541f3347933a7d40c37ca /arch/riscv/kvm
parent5fed84a800e6048656c17be6e921787db2b5c6c0 (diff)
downloadlinux-stable-2a1f6bf079700f0f9d8045ab77b302aeb4d12c06.tar.gz
linux-stable-2a1f6bf079700f0f9d8045ab77b302aeb4d12c06.tar.bz2
linux-stable-2a1f6bf079700f0f9d8045ab77b302aeb4d12c06.zip
RISC-V: KVM: Add steal-update vcpu request
Add a new vcpu request to inform a vcpu that it should record its steal-time information. The request is made each time it has been detected that the vcpu task was not assigned a cpu for some time, which is easy to do by making the request from vcpu-load. The record function is just a stub for now and will be filled in with the rest of the steal-time support functions in following patches. Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'arch/riscv/kvm')
-rw-r--r--arch/riscv/kvm/vcpu.c5
-rw-r--r--arch/riscv/kvm/vcpu_sbi_sta.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index bf3952d1a621..6995b8b641e4 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -541,6 +541,8 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
kvm_riscv_vcpu_aia_load(vcpu, cpu);
+ kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
+
vcpu->cpu = cpu;
}
@@ -614,6 +616,9 @@ static void kvm_riscv_check_vcpu_requests(struct kvm_vcpu *vcpu)
if (kvm_check_request(KVM_REQ_HFENCE, vcpu))
kvm_riscv_hfence_process(vcpu);
+
+ if (kvm_check_request(KVM_REQ_STEAL_UPDATE, vcpu))
+ kvm_riscv_vcpu_record_steal_time(vcpu);
}
}
diff --git a/arch/riscv/kvm/vcpu_sbi_sta.c b/arch/riscv/kvm/vcpu_sbi_sta.c
index 839911dcd837..e28351c9488b 100644
--- a/arch/riscv/kvm/vcpu_sbi_sta.c
+++ b/arch/riscv/kvm/vcpu_sbi_sta.c
@@ -8,6 +8,10 @@
#include <asm/kvm_vcpu_sbi.h>
#include <asm/sbi.h>
+void kvm_riscv_vcpu_record_steal_time(struct kvm_vcpu *vcpu)
+{
+}
+
static int kvm_sbi_sta_steal_time_set_shmem(struct kvm_vcpu *vcpu)
{
return SBI_ERR_FAILURE;