]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Kill arch_timer_context::direct field
authorMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 10:36:06 +0000 (11:36 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 1 Apr 2026 14:42:26 +0000 (15:42 +0100)
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>
arch/arm64/kvm/arch_timer.c
include/kvm/arm_arch_timer.h

index 67b989671b410f0b1fd4c67679acb6d039d15944..37279f87486956a0a715d7e9f7f6f9a3768d30b2 100644 (file)
@@ -183,10 +183,6 @@ void get_timer_map(struct kvm_vcpu *vcpu, struct timer_map *map)
                map->emul_ptimer = vcpu_ptimer(vcpu);
        }
 
-       map->direct_vtimer->direct = true;
-       if (map->direct_ptimer)
-               map->direct_ptimer->direct = true;
-
        trace_kvm_get_timer_map(vcpu->vcpu_id, map);
 }
 
@@ -462,8 +458,15 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
                return;
 
        /* Skip injecting on GICv5 for directly injected (DVI'd) timers */
-       if (vgic_is_v5(vcpu->kvm) && timer_ctx->direct)
-               return;
+       if (vgic_is_v5(vcpu->kvm)) {
+               struct timer_map map;
+
+               get_timer_map(vcpu, &map);
+
+               if (map.direct_ptimer == timer_ctx ||
+                   map.direct_vtimer == timer_ctx)
+                       return;
+       }
 
        kvm_vgic_inject_irq(vcpu->kvm, vcpu,
                            timer_irq(timer_ctx),
index a7754e0a2ef41f3d5b7ffde49c2bf4a214a59b44..bf8cc9589bd095ae89186f66007a7b5a7be9e058 100644 (file)
@@ -76,9 +76,6 @@ struct arch_timer_context {
 
        /* Duplicated state from arch_timer.c for convenience */
        u32                             host_timer_irq;
-
-       /* Is this a direct timer? */
-       bool                            direct;
 };
 
 struct timer_map {