[xenial][SRU] kvm/irqchip: kvm_arch_irq_routing_update renaming split

Luis Henriques luis.henriques at canonical.com
Tue Nov 29 14:38:19 UTC 2016

From: Andrey Smetanin <asmetanin at virtuozzo.com>

BugLink: https://bugs.launchpad.net/bugs/1644394

Actually kvm_arch_irq_routing_update() should be
kvm_arch_post_irq_routing_update() as it's called at the end
of irq routing update.

This renaming frees kvm_arch_irq_routing_update function name.
kvm_arch_irq_routing_update() weak function which will be used
to update mappings for arch-specific irq routing entries
(in particular, the upcoming Hyper-V synthetic interrupts).

Signed-off-by: Andrey Smetanin <asmetanin at virtuozzo.com>
Reviewed-by: Roman Kagan <rkagan at virtuozzo.com>
Signed-off-by: Denis V. Lunev <den at openvz.org>
CC: Gleb Natapov <gleb at kernel.org>
CC: Paolo Bonzini <pbonzini at redhat.com>
CC: Roman Kagan <rkagan at virtuozzo.com>
CC: Denis V. Lunev <den at openvz.org>
CC: qemu-devel at nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
(cherry picked from commit abdb080f7ac8a85547f5e0246362790043bbd3f2)
Signed-off-by: Steve Rutherford <srutherford at google.com>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 arch/x86/kvm/irq_comm.c  | 7 +++++++
 include/linux/kvm_host.h | 5 +++--
 virt/kvm/irqchip.c       | 7 ++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
index 0083ab876170..8fc89efb5250 100644
--- a/arch/x86/kvm/irq_comm.c
+++ b/arch/x86/kvm/irq_comm.c
@@ -349,6 +349,13 @@ int kvm_setup_empty_irq_routing(struct kvm *kvm)
 	return kvm_set_irq_routing(kvm, empty_routing, 0, 0);
+void kvm_arch_post_irq_routing_update(struct kvm *kvm)
+	if (ioapic_in_kernel(kvm) || !irqchip_in_kernel(kvm))
+		return;
+	kvm_make_scan_ioapic_request(kvm);
 void kvm_scan_ioapic_routes(struct kvm_vcpu *vcpu,
 			    ulong *ioapic_handled_vectors)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 9e79145afada..da7a7e4ee737 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -494,12 +494,12 @@ void vcpu_put(struct kvm_vcpu *vcpu);
 void kvm_vcpu_request_scan_ioapic(struct kvm *kvm);
-void kvm_arch_irq_routing_update(struct kvm *kvm);
+void kvm_arch_post_irq_routing_update(struct kvm *kvm);
 static inline void kvm_vcpu_request_scan_ioapic(struct kvm *kvm)
-static inline void kvm_arch_irq_routing_update(struct kvm *kvm)
+static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm)
@@ -1101,6 +1101,7 @@ static inline void kvm_irq_routing_update(struct kvm *kvm)
+void kvm_arch_irq_routing_update(struct kvm *kvm);
 static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 7d31d8c5b9ea..8db197bb6c7a 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -166,6 +166,10 @@ out:
 	return r;
+void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm)
 int kvm_set_irq_routing(struct kvm *kvm,
 			const struct kvm_irq_routing_entry *ue,
 			unsigned nr,
@@ -219,9 +223,10 @@ int kvm_set_irq_routing(struct kvm *kvm,
 	old = kvm->irq_routing;
 	rcu_assign_pointer(kvm->irq_routing, new);
+	kvm_arch_irq_routing_update(kvm);
-	kvm_arch_irq_routing_update(kvm);
+	kvm_arch_post_irq_routing_update(kvm);

More information about the kernel-team mailing list