Skip to content

Commit 20218e6

Browse files
committed
KVM: x86: Drop superfluous kvm_hv_set_sint() => kvm_hv_synic_set_irq() wrapper
Drop the superfluous kvm_hv_set_sint() and instead wire up ->set() directly to its final destination, kvm_hv_synic_set_irq(). Keep hv_synic_set_irq() instead of kvm_hv_set_sint() to provide some amount of consistency in the ->set() helpers, e.g. to match kvm_pic_set_irq() and kvm_ioapic_set_irq(). kvm_set_msi() is arguably the oddball, e.g. kvm_set_msi_irq() should be something like kvm_msi_to_lapic_irq() so that kvm_set_msi() can instead be kvm_set_msi_irq(), but that's a future problem to solve. No functional change intended. Cc: Vitaly Kuznetsov <vkuznets@redhat.com> Cc: Kai Huang <kai.huang@intel.com> Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Kai Huang <kai.huang@intel.com> Link: https://lore.kernel.org/r/20250611213557.294358-5-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 05dc9ea commit 20218e6

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

arch/x86/kvm/hyperv.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,15 +497,19 @@ static int synic_set_irq(struct kvm_vcpu_hv_synic *synic, u32 sint)
497497
return ret;
498498
}
499499

500-
int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vpidx, u32 sint)
500+
int kvm_hv_synic_set_irq(struct kvm_kernel_irq_routing_entry *e, struct kvm *kvm,
501+
int irq_source_id, int level, bool line_status)
501502
{
502503
struct kvm_vcpu_hv_synic *synic;
503504

504-
synic = synic_get(kvm, vpidx);
505+
if (!level)
506+
return -1;
507+
508+
synic = synic_get(kvm, e->hv_sint.vcpu);
505509
if (!synic)
506510
return -EINVAL;
507511

508-
return synic_set_irq(synic, sint);
512+
return synic_set_irq(synic, e->hv_sint.sint);
509513
}
510514

511515
void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector)

arch/x86/kvm/hyperv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ static inline bool kvm_hv_hypercall_enabled(struct kvm_vcpu *vcpu)
103103
int kvm_hv_hypercall(struct kvm_vcpu *vcpu);
104104

105105
void kvm_hv_irq_routing_update(struct kvm *kvm);
106-
int kvm_hv_synic_set_irq(struct kvm *kvm, u32 vcpu_id, u32 sint);
106+
int kvm_hv_synic_set_irq(struct kvm_kernel_irq_routing_entry *e, struct kvm *kvm,
107+
int irq_source_id, int level, bool line_status);
107108
void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int vector);
108109
int kvm_hv_activate_synic(struct kvm_vcpu *vcpu, bool dont_zero_synic_pages);
109110

arch/x86/kvm/irq_comm.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,6 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
127127
return kvm_irq_delivery_to_apic(kvm, NULL, &irq, NULL);
128128
}
129129

130-
#ifdef CONFIG_KVM_HYPERV
131-
static int kvm_hv_set_sint(struct kvm_kernel_irq_routing_entry *e,
132-
struct kvm *kvm, int irq_source_id, int level,
133-
bool line_status)
134-
{
135-
if (!level)
136-
return -1;
137-
138-
return kvm_hv_synic_set_irq(kvm, e->hv_sint.vcpu, e->hv_sint.sint);
139-
}
140-
#endif
141-
142130
int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e,
143131
struct kvm *kvm, int irq_source_id, int level,
144132
bool line_status)
@@ -149,8 +137,8 @@ int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e,
149137
switch (e->type) {
150138
#ifdef CONFIG_KVM_HYPERV
151139
case KVM_IRQ_ROUTING_HV_SINT:
152-
return kvm_hv_set_sint(e, kvm, irq_source_id, level,
153-
line_status);
140+
return kvm_hv_synic_set_irq(e, kvm, irq_source_id, level,
141+
line_status);
154142
#endif
155143

156144
case KVM_IRQ_ROUTING_MSI:
@@ -302,7 +290,7 @@ int kvm_set_routing_entry(struct kvm *kvm,
302290
break;
303291
#ifdef CONFIG_KVM_HYPERV
304292
case KVM_IRQ_ROUTING_HV_SINT:
305-
e->set = kvm_hv_set_sint;
293+
e->set = kvm_hv_synic_set_irq;
306294
e->hv_sint.vcpu = ue->u.hv_sint.vcpu;
307295
e->hv_sint.sint = ue->u.hv_sint.sint;
308296
break;

0 commit comments

Comments
 (0)