Rename interrupt APIs to adhere to hf_noun_verb convention.

Change-Id: Iff781fdbbe6d7cc60d1ecf8b124a9cfe8fed44a7
diff --git a/driver/linux b/driver/linux
index 89d0e47..e75db9d 160000
--- a/driver/linux
+++ b/driver/linux
@@ -1 +1 @@
-Subproject commit 89d0e473d2532bc82ca7e2c594492b1dae194c54
+Subproject commit e75db9d5030f29707901aac011bacf6ffd1f0d1b
diff --git a/inc/hf/api.h b/inc/hf/api.h
index b4bbbf7..1bf9c92 100644
--- a/inc/hf/api.h
+++ b/inc/hf/api.h
@@ -42,8 +42,8 @@
 struct vcpu *api_wait_for_interrupt(struct vcpu *current);
 struct vcpu *api_yield(struct vcpu *current);
 
-int64_t api_enable_interrupt(uint32_t intid, bool enable, struct vcpu *current);
-uint32_t api_get_and_acknowledge_interrupt(struct vcpu *current);
-int64_t api_inject_interrupt(uint32_t target_vm_id, uint32_t target_vcpu_idx,
+int64_t api_interrupt_enable(uint32_t intid, bool enable, struct vcpu *current);
+uint32_t api_interrupt_get(struct vcpu *current);
+int64_t api_interrupt_inject(uint32_t target_vm_id, uint32_t target_vcpu_idx,
 			     uint32_t intid, struct vcpu *current,
 			     struct vcpu **next);
diff --git a/inc/vmapi/hf/call.h b/inc/vmapi/hf/call.h
index d059196..6466b15 100644
--- a/inc/vmapi/hf/call.h
+++ b/inc/vmapi/hf/call.h
@@ -23,18 +23,18 @@
 /* clang-format off */
 
 /* TODO: Define constants below according to spec. */
-#define HF_VM_GET_ID                     0xff00
-#define HF_VM_GET_COUNT                  0xff01
-#define HF_VCPU_GET_COUNT                0xff02
-#define HF_VCPU_RUN                      0xff03
-#define HF_VCPU_YIELD                    0xff04
-#define HF_VM_CONFIGURE                  0xff05
-#define HF_MAILBOX_SEND                  0xff06
-#define HF_MAILBOX_RECEIVE               0xff07
-#define HF_MAILBOX_CLEAR                 0xff08
-#define HF_ENABLE_INTERRUPT              0xff09
-#define HF_GET_AND_ACKNOWLEDGE_INTERRUPT 0xff0a
-#define HF_INJECT_INTERRUPT              0xff0b
+#define HF_VM_GET_ID        0xff00
+#define HF_VM_GET_COUNT     0xff01
+#define HF_VCPU_GET_COUNT   0xff02
+#define HF_VCPU_RUN         0xff03
+#define HF_VCPU_YIELD       0xff04
+#define HF_VM_CONFIGURE     0xff05
+#define HF_MAILBOX_SEND     0xff06
+#define HF_MAILBOX_RECEIVE  0xff07
+#define HF_MAILBOX_CLEAR    0xff08
+#define HF_INTERRUPT_ENABLE 0xff09
+#define HF_INTERRUPT_GET    0xff0a
+#define HF_INTERRUPT_INJECT 0xff0b
 
 /** The amount of data that can be sent to a mailbox. */
 #define HF_MAILBOX_SIZE 4096
@@ -147,9 +147,9 @@
  *
  * Returns 0 on success, or -1 if the intid is invalid.
  */
-static inline int64_t hf_enable_interrupt(uint32_t intid, bool enable)
+static inline int64_t hf_interrupt_enable(uint32_t intid, bool enable)
 {
-	return hf_call(HF_ENABLE_INTERRUPT, intid, enable, 0);
+	return hf_call(HF_INTERRUPT_ENABLE, intid, enable, 0);
 }
 
 /**
@@ -157,9 +157,9 @@
  *
  * Returns HF_INVALID_INTID if there are no pending interrupts.
  */
-static inline uint32_t hf_get_and_acknowledge_interrupt(void)
+static inline uint32_t hf_interrupt_get(void)
 {
-	return hf_call(HF_GET_AND_ACKNOWLEDGE_INTERRUPT, 0, 0, 0);
+	return hf_call(HF_INTERRUPT_GET, 0, 0, 0);
 }
 
 /**
@@ -175,10 +175,10 @@
  *  - 1 if it was called by the primary VM and the primary VM now needs to wake
  *    up or kick the target vCPU.
  */
-static inline int64_t hf_inject_interrupt(uint32_t target_vm_id,
+static inline int64_t hf_interrupt_inject(uint32_t target_vm_id,
 					  uint32_t target_vcpu_idx,
 					  uint32_t intid)
 {
-	return hf_call(HF_INJECT_INTERRUPT, target_vm_id, target_vcpu_idx,
+	return hf_call(HF_INTERRUPT_INJECT, target_vm_id, target_vcpu_idx,
 		       intid);
 }
diff --git a/src/api.c b/src/api.c
index e1d36ae..74c45c7 100644
--- a/src/api.c
+++ b/src/api.c
@@ -618,7 +618,7 @@
  *
  * Returns 0 on success, or -1 if the intid is invalid.
  */
-int64_t api_enable_interrupt(uint32_t intid, bool enable, struct vcpu *current)
+int64_t api_interrupt_enable(uint32_t intid, bool enable, struct vcpu *current)
 {
 	uint32_t intid_index = intid / INTERRUPT_REGISTER_BITS;
 	uint32_t intid_mask = 1u << (intid % INTERRUPT_REGISTER_BITS);
@@ -662,7 +662,7 @@
  * acknowledges it (i.e. marks it as no longer pending). Returns
  * HF_INVALID_INTID if there are no pending interrupts.
  */
-uint32_t api_get_and_acknowledge_interrupt(struct vcpu *current)
+uint32_t api_interrupt_get(struct vcpu *current)
 {
 	uint8_t i;
 	uint32_t first_interrupt = HF_INVALID_INTID;
@@ -725,7 +725,7 @@
  *  - 1 if it was called by the primary VM and the primary VM now needs to wake
  *    up or kick the target vCPU.
  */
-int64_t api_inject_interrupt(uint32_t target_vm_id, uint32_t target_vcpu_idx,
+int64_t api_interrupt_inject(uint32_t target_vm_id, uint32_t target_vcpu_idx,
 			     uint32_t intid, struct vcpu *current,
 			     struct vcpu **next)
 {
diff --git a/src/arch/aarch64/handler.c b/src/arch/aarch64/handler.c
index d341580..c43759e 100644
--- a/src/arch/aarch64/handler.c
+++ b/src/arch/aarch64/handler.c
@@ -290,16 +290,16 @@
 		ret.user_ret = api_mailbox_clear(current());
 		break;
 
-	case HF_ENABLE_INTERRUPT:
-		ret.user_ret = api_enable_interrupt(arg1, arg2, current());
+	case HF_INTERRUPT_ENABLE:
+		ret.user_ret = api_interrupt_enable(arg1, arg2, current());
 		break;
 
-	case HF_GET_AND_ACKNOWLEDGE_INTERRUPT:
-		ret.user_ret = api_get_and_acknowledge_interrupt(current());
+	case HF_INTERRUPT_GET:
+		ret.user_ret = api_interrupt_get(current());
 		break;
 
-	case HF_INJECT_INTERRUPT:
-		ret.user_ret = api_inject_interrupt(arg1, arg2, arg3, current(),
+	case HF_INTERRUPT_INJECT:
+		ret.user_ret = api_interrupt_inject(arg1, arg2, arg3, current(),
 						    &ret.new);
 		break;
 
diff --git a/test/vmapi/primary_with_secondaries/services/interruptible.c b/test/vmapi/primary_with_secondaries/services/interruptible.c
index 1eaa521..879567b 100644
--- a/test/vmapi/primary_with_secondaries/services/interruptible.c
+++ b/test/vmapi/primary_with_secondaries/services/interruptible.c
@@ -32,7 +32,7 @@
 
 void irq_current(void)
 {
-	uint32_t interrupt_id = hf_get_and_acknowledge_interrupt();
+	uint32_t interrupt_id = hf_interrupt_get();
 	char buffer[] = "Got IRQ xx.";
 	int size = sizeof(buffer);
 	dlog("IRQ %d from current\n", interrupt_id);
@@ -63,9 +63,9 @@
 	uint32_t this_vm_id = hf_vm_get_id();
 
 	exception_setup();
-	hf_enable_interrupt(SELF_INTERRUPT_ID, true);
-	hf_enable_interrupt(EXTERNAL_INTERRUPT_ID_A, true);
-	hf_enable_interrupt(EXTERNAL_INTERRUPT_ID_B, true);
+	hf_interrupt_enable(SELF_INTERRUPT_ID, true);
+	hf_interrupt_enable(EXTERNAL_INTERRUPT_ID_A, true);
+	hf_interrupt_enable(EXTERNAL_INTERRUPT_ID_B, true);
 	arch_irq_enable();
 
 	for (;;) {
@@ -78,13 +78,13 @@
 		    memcmp(SERVICE_RECV_BUFFER(), ping_message,
 			   sizeof(ping_message)) == 0) {
 			/* Interrupt ourselves */
-			hf_inject_interrupt(this_vm_id, 0, SELF_INTERRUPT_ID);
+			hf_interrupt_inject(this_vm_id, 0, SELF_INTERRUPT_ID);
 		} else if (received_message.vm_id == HF_PRIMARY_VM_ID &&
 			   received_message.size == sizeof(enable_message) &&
 			   memcmp(SERVICE_RECV_BUFFER(), enable_message,
 				  sizeof(enable_message)) == 0) {
 			/* Enable interrupt ID C. */
-			hf_enable_interrupt(EXTERNAL_INTERRUPT_ID_C, true);
+			hf_interrupt_enable(EXTERNAL_INTERRUPT_ID_C, true);
 		} else {
 			dlog("Got unexpected message from VM %d, size %d.\n",
 			     received_message.vm_id, received_message.size);
diff --git a/test/vmapi/primary_with_secondaries/with_services.c b/test/vmapi/primary_with_secondaries/with_services.c
index 384597d..2ffa40c 100644
--- a/test/vmapi/primary_with_secondaries/with_services.c
+++ b/test/vmapi/primary_with_secondaries/with_services.c
@@ -207,7 +207,7 @@
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_WAIT_FOR_INTERRUPT);
 
 	/* Inject the interrupt and wait for a message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_MESSAGE);
 	EXPECT_EQ(run_res.message.size, sizeof(expected_response));
@@ -216,7 +216,7 @@
 	EXPECT_EQ(hf_mailbox_clear(), 0);
 
 	/* Inject the interrupt again, and wait for the same message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_MESSAGE);
 	EXPECT_EQ(run_res.message.size, sizeof(expected_response));
@@ -242,7 +242,7 @@
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_WAIT_FOR_INTERRUPT);
 
 	/* Inject the interrupt and wait for a message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_MESSAGE);
 	EXPECT_EQ(run_res.message.size, sizeof(expected_response));
@@ -251,7 +251,7 @@
 	EXPECT_EQ(hf_mailbox_clear(), 0);
 
 	/* Inject a different interrupt and wait for a different message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_B);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_B);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_MESSAGE);
 	EXPECT_EQ(run_res.message.size, sizeof(expected_response_2));
@@ -280,7 +280,7 @@
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_WAIT_FOR_INTERRUPT);
 
 	/* Inject the interrupt and wait for a message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_A);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_MESSAGE);
 	EXPECT_EQ(run_res.message.size, sizeof(expected_response));
@@ -318,7 +318,7 @@
 	SERVICE_SELECT(SERVICE_VM0, "interruptible", mb.send);
 
 	/* Inject the interrupt and expect not to get a message. */
-	hf_inject_interrupt(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_C);
+	hf_interrupt_inject(SERVICE_VM0, 0, EXTERNAL_INTERRUPT_ID_C);
 	run_res = hf_vcpu_run(SERVICE_VM0, 0);
 	EXPECT_EQ(run_res.code, HF_VCPU_RUN_WAIT_FOR_INTERRUPT);
 	EXPECT_EQ(hf_mailbox_clear(), -1);