Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: arm64: Kill arch_timer_context::direct field

The newly introduced arch_timer_context::direct field is a bit pointless,
as it is always set on timers that are... err... direct, while
we already have a way to get to that by doing a get_map() operation.

Additionally, this field is:

- only set when get_map() is called

- never cleared

and the single point where it is actually checked doesn't call get_map()
at all.

At this stage, it is probably better to just kill it, and rely on
get_map() to give us the correct information.

Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Fixes: 9491c63b6cd7b ("KVM: arm64: gic-v5: Enlighten arch timer for GICv5")
Link: https://sashiko.dev/#/patchset/20260319154937.3619520-1-sascha.bischoff%40arm.com
Link: https://patch.msgid.link/20260401103611.357092-12-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

+9 -9
+9 -6
arch/arm64/kvm/arch_timer.c
··· 183 183 map->emul_ptimer = vcpu_ptimer(vcpu); 184 184 } 185 185 186 - map->direct_vtimer->direct = true; 187 - if (map->direct_ptimer) 188 - map->direct_ptimer->direct = true; 189 - 190 186 trace_kvm_get_timer_map(vcpu->vcpu_id, map); 191 187 } 192 188 ··· 458 462 return; 459 463 460 464 /* Skip injecting on GICv5 for directly injected (DVI'd) timers */ 461 - if (vgic_is_v5(vcpu->kvm) && timer_ctx->direct) 462 - return; 465 + if (vgic_is_v5(vcpu->kvm)) { 466 + struct timer_map map; 467 + 468 + get_timer_map(vcpu, &map); 469 + 470 + if (map.direct_ptimer == timer_ctx || 471 + map.direct_vtimer == timer_ctx) 472 + return; 473 + } 463 474 464 475 kvm_vgic_inject_irq(vcpu->kvm, vcpu, 465 476 timer_irq(timer_ctx),
-3
include/kvm/arm_arch_timer.h
··· 76 76 77 77 /* Duplicated state from arch_timer.c for convenience */ 78 78 u32 host_timer_irq; 79 - 80 - /* Is this a direct timer? */ 81 - bool direct; 82 79 }; 83 80 84 81 struct timer_map {