[PATCH v2 4/6] hyperv: use hv_do_hypercall instead of hv_do_fast_hypercall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hv_do_hypercall can be used uniformly as code clean up because
the compiler optimizes to call hv_do_fast_hypercall directly
as typically input length is compile time constant like
sizeof(...).

Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>
---
 arch/x86/hyperv/hv_apic.c       | 5 +++--
 arch/x86/include/asm/mshyperv.h | 4 ++++
 drivers/hv/connection.c         | 3 ++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 713a4e737081..63187ffaa4c4 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -168,6 +168,7 @@ static bool __send_ipi_mask(const struct cpumask *mask, int vector)
 		goto do_ex_hypercall;
 
 	ipi_arg.vector = vector;
+	ipi_arg.reserved = 0;
 	ipi_arg.cpu_mask = 0;
 
 	for_each_cpu(cur_cpu, mask) {
@@ -185,8 +186,8 @@ static bool __send_ipi_mask(const struct cpumask *mask, int vector)
 		__set_bit(vcpu, (unsigned long *)&ipi_arg.cpu_mask);
 	}
 
-	ret = hv_do_fast_hypercall16(HVCALL_SEND_IPI, ipi_arg.vector,
-				     ipi_arg.cpu_mask);
+	ret = hv_do_hypercall(HVCALL_SEND_IPI,
+			      &ipi_arg, sizeof(ipi_arg), NULL, 0);
 	return ((ret == 0) ? true : false);
 
 do_ex_hypercall:
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 5d8acb00ab94..9845a2420497 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -396,6 +396,10 @@ static inline u64 hv_do_hypercall(
 
 	/* fast hypercall */
 	if (output == NULL && ibytes <= 16) {
+		/* Typically ibytes is compile time constant as sizeof(...).
+		 * So the code is optimized to call
+		 * hv_do_fast_hypercall directly.
+		 */
 		u64 *i = (u64*)input;
 
 		WARN_ON((varhead_code & HV_HYPERCALL_VARHEAD_MASK) != 0);
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index ced041899456..6b1021441119 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -455,6 +455,7 @@ void vmbus_set_event(struct vmbus_channel *channel)
 
 	++channel->sig_events;
 
-	hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event);
+	hv_do_hypercall(HVCALL_SIGNAL_EVENT, &channel->sig_event,
+			sizeof(channel->sig_event), NULL, 0);
 }
 EXPORT_SYMBOL_GPL(vmbus_set_event);
-- 
2.14.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux