Skip to content

Commit 86ed81a

Browse files
committed
KVM: ARM: Update comments for kvm_handle_wfi
Update comments to reflect what is really going on and add the TWE bit to the comments in kvm_arm.h. Also renames the function to kvm_handle_wfx like is done on arm64 for consistency and uber-correctness. Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
1 parent 58d5ec8 commit 86ed81a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

arch/arm/include/asm/kvm_arm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
* TSC: Trap SMC
5858
* TSW: Trap cache operations by set/way
5959
* TWI: Trap WFI
60+
* TWE: Trap WFE
6061
* TIDCP: Trap L2CTLR/L2ECTLR
6162
* BSU_IS: Upgrade barriers to the inner shareable domain
6263
* FB: Force broadcast of all maintainance operations

arch/arm/kvm/handle_exit.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,17 @@ static int handle_dabt_hyp(struct kvm_vcpu *vcpu, struct kvm_run *run)
7373
}
7474

7575
/**
76-
* kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest
76+
* kvm_handle_wfx - handle a WFI or WFE instructions trapped in guests
7777
* @vcpu: the vcpu pointer
7878
* @run: the kvm_run structure pointer
7979
*
80-
* Simply sets the wait_for_interrupts flag on the vcpu structure, which will
81-
* halt execution of world-switches and schedule other host processes until
82-
* there is an incoming IRQ or FIQ to the VM.
80+
* WFE: Yield the CPU and come back to this vcpu when the scheduler
81+
* decides to.
82+
* WFI: Simply call kvm_vcpu_block(), which will halt execution of
83+
* world-switches and schedule other host processes until there is an
84+
* incoming IRQ or FIQ to the VM.
8385
*/
84-
static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
86+
static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
8587
{
8688
trace_kvm_wfi(*vcpu_pc(vcpu));
8789
if (kvm_vcpu_get_hsr(vcpu) & HSR_WFI_IS_WFE)
@@ -93,7 +95,7 @@ static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
9395
}
9496

9597
static exit_handle_fn arm_exit_handlers[] = {
96-
[HSR_EC_WFI] = kvm_handle_wfi,
98+
[HSR_EC_WFI] = kvm_handle_wfx,
9799
[HSR_EC_CP15_32] = kvm_handle_cp15_32,
98100
[HSR_EC_CP15_64] = kvm_handle_cp15_64,
99101
[HSR_EC_CP14_MR] = kvm_handle_cp14_access,

0 commit comments

Comments
 (0)