[PATCH 11/17] mshv: HvClearVirtualInterrupt hypercall

From: Vineeth Pillai
Date: Wed Jun 02 2021 - 13:21:44 EST


For HvX64InterruptTypeExtInt interrupts, before asserting a new
interrupt, previous inteerupt's acknowledgment should be cleared
by this hypercall HvClearVirtualInterrupt. (TLFS 10.3.2)

This is to be used in a later patch in this series.

Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
---
drivers/hv/hv_call.c | 20 ++++++++++++++++++++
drivers/hv/mshv.h | 1 +
include/asm-generic/hyperv-tlfs.h | 1 +
3 files changed, 22 insertions(+)

diff --git a/drivers/hv/hv_call.c b/drivers/hv/hv_call.c
index 57db3a8ac94a..d5cdbe4e93da 100644
--- a/drivers/hv/hv_call.c
+++ b/drivers/hv/hv_call.c
@@ -743,6 +743,26 @@ int hv_call_translate_virtual_address(
}


+int
+hv_call_clear_virtual_interrupt(u64 partition_id)
+{
+ unsigned long flags;
+ int status;
+
+ local_irq_save(flags);
+ status = hv_do_fast_hypercall8(HVCALL_CLEAR_VIRTUAL_INTERRUPT,
+ partition_id) &
+ HV_HYPERCALL_RESULT_MASK;
+ local_irq_restore(flags);
+
+ if (status != HV_STATUS_SUCCESS) {
+ pr_err("%s: %s\n", __func__, hv_status_to_string(status));
+ return -hv_status_to_errno(status);
+ }
+
+ return 0;
+}
+
int
hv_call_create_port(u64 port_partition_id, union hv_port_id port_id,
u64 connection_partition_id,
diff --git a/drivers/hv/mshv.h b/drivers/hv/mshv.h
index 76cd00fd4b3f..404807c98512 100644
--- a/drivers/hv/mshv.h
+++ b/drivers/hv/mshv.h
@@ -117,6 +117,7 @@ int hv_call_assert_virtual_interrupt(
u32 vector,
u64 dest_addr,
union hv_interrupt_control control);
+int hv_call_clear_virtual_interrupt(u64 partition_id);
int hv_call_get_vp_state(
u32 vp_index,
u64 partition_id,
diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h
index 3ed4f532ed57..693d41192e9e 100644
--- a/include/asm-generic/hyperv-tlfs.h
+++ b/include/asm-generic/hyperv-tlfs.h
@@ -159,6 +159,7 @@ struct ms_hyperv_tsc_page {
#define HVCALL_GET_VP_REGISTERS 0x0050
#define HVCALL_SET_VP_REGISTERS 0x0051
#define HVCALL_TRANSLATE_VIRTUAL_ADDRESS 0x0052
+#define HVCALL_CLEAR_VIRTUAL_INTERRUPT 0x0056
#define HVCALL_DELETE_PORT 0x0058
#define HVCALL_DISCONNECT_PORT 0x005b
#define HVCALL_POST_MESSAGE 0x005c
--
2.25.1