149 lines
5.9 KiB
Diff
149 lines
5.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Chen CJ <jason.cj.chen@intel.com>
|
|
Date: Fri, 31 Aug 2018 10:58:57 +0800
|
|
Subject: [PATCH] hypercall: refine HC ID and parameter number
|
|
|
|
Change-Id: Ie5b73055add4c69b4dbf5cae1bb8bf941997ee6b
|
|
Tracked-On: 218445
|
|
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
|
|
Reviewed-on:
|
|
Reviewed-by: Chi, Mingqiang <mingqiang.chi@intel.com>
|
|
Reviewed-by: Dong, Eddie <eddie.dong@intel.com>
|
|
Tested-by: Dong, Eddie <eddie.dong@intel.com>
|
|
---
|
|
drivers/vhm/vhm_hypercall.c | 7 +++++-
|
|
include/linux/vhm/acrn_common.h | 10 ++++-----
|
|
include/linux/vhm/acrn_hv_defs.h | 36 ++++++++++++++++---------------
|
|
include/linux/vhm/vhm_hypercall.h | 1 +
|
|
4 files changed, 31 insertions(+), 23 deletions(-)
|
|
|
|
diff --git a/drivers/vhm/vhm_hypercall.c b/drivers/vhm/vhm_hypercall.c
|
|
index b273847..741b8bd 100644
|
|
--- a/drivers/vhm/vhm_hypercall.c
|
|
+++ b/drivers/vhm/vhm_hypercall.c
|
|
@@ -52,9 +52,14 @@
|
|
#include <linux/vhm/acrn_hv_defs.h>
|
|
#include <linux/vhm/vhm_hypercall.h>
|
|
|
|
+inline long hcall_get_api_version(unsigned long api_version)
|
|
+{
|
|
+ return acrn_hypercall1(HC_GET_API_VERSION, api_version);
|
|
+}
|
|
+
|
|
inline long hcall_create_vm(unsigned long vminfo)
|
|
{
|
|
- return acrn_hypercall2(HC_CREATE_VM, 0, vminfo);
|
|
+ return acrn_hypercall1(HC_CREATE_VM, vminfo);
|
|
}
|
|
|
|
inline long hcall_start_vm(unsigned long vmid)
|
|
diff --git a/include/linux/vhm/acrn_common.h b/include/linux/vhm/acrn_common.h
|
|
index 23f80ac..a6f4664 100644
|
|
--- a/include/linux/vhm/acrn_common.h
|
|
+++ b/include/linux/vhm/acrn_common.h
|
|
@@ -141,11 +141,11 @@ struct vhm_request_buffer {
|
|
|
|
/* Common API params */
|
|
struct acrn_create_vm {
|
|
- int32_t vmid; /* OUT: return vmid to VHM. Keep it first field */
|
|
- uint32_t vcpu_num; /* IN: VM vcpu number */
|
|
- uint8_t GUID[16]; /* IN: GUID of this vm */
|
|
- uint8_t trusty_enabled;/* IN: whether trusty is enabled */
|
|
- uint8_t reserved[31]; /* Reserved for future use */
|
|
+ int32_t vmid; /* OUT: return vmid to VHM. Keep it first field */
|
|
+ uint32_t vcpu_num; /* IN: VM vcpu number */
|
|
+ uint8_t GUID[16]; /* IN: GUID of this vm */
|
|
+ uint8_t trusty_enabled;/* IN: whether trusty is enabled */
|
|
+ uint8_t reserved[31]; /* Reserved for future use */
|
|
} __attribute__((aligned(8)));
|
|
|
|
struct acrn_create_vcpu {
|
|
diff --git a/include/linux/vhm/acrn_hv_defs.h b/include/linux/vhm/acrn_hv_defs.h
|
|
index eb1d4c9..bb57fb4 100644
|
|
--- a/include/linux/vhm/acrn_hv_defs.h
|
|
+++ b/include/linux/vhm/acrn_hv_defs.h
|
|
@@ -63,49 +63,51 @@
|
|
|
|
#define _HC_ID(x, y) (((x)<<24)|(y))
|
|
|
|
-#define HC_ID 0x7FUL
|
|
+#define HC_ID 0x80UL
|
|
+
|
|
+/* general */
|
|
+#define HC_ID_GEN_BASE 0x0UL
|
|
+#define HC_GET_API_VERSION _HC_ID(HC_ID, HC_ID_GEN_BASE + 0x00)
|
|
|
|
/* VM management */
|
|
-#define HC_ID_VM_BASE 0x0UL
|
|
-#define HC_GET_API_VERSION _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00)
|
|
-#define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01)
|
|
-#define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02)
|
|
-#define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03)
|
|
-#define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x04)
|
|
-#define HC_CREATE_VCPU _HC_ID(HC_ID, HC_ID_VM_BASE + 0x05)
|
|
+#define HC_ID_VM_BASE 0x10UL
|
|
+#define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00)
|
|
+#define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01)
|
|
+#define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02)
|
|
+#define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03)
|
|
+#define HC_CREATE_VCPU _HC_ID(HC_ID, HC_ID_VM_BASE + 0x04)
|
|
|
|
/* IRQ and Interrupts */
|
|
-#define HC_ID_IRQ_BASE 0x100UL
|
|
+#define HC_ID_IRQ_BASE 0x20UL
|
|
#define HC_ASSERT_IRQLINE _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x00)
|
|
#define HC_DEASSERT_IRQLINE _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x01)
|
|
#define HC_PULSE_IRQLINE _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x02)
|
|
#define HC_INJECT_MSI _HC_ID(HC_ID, HC_ID_IRQ_BASE + 0x03)
|
|
|
|
/* DM ioreq management */
|
|
-#define HC_ID_IOREQ_BASE 0x200UL
|
|
+#define HC_ID_IOREQ_BASE 0x30UL
|
|
#define HC_SET_IOREQ_BUFFER _HC_ID(HC_ID, HC_ID_IOREQ_BASE + 0x00)
|
|
#define HC_NOTIFY_REQUEST_FINISH _HC_ID(HC_ID, HC_ID_IOREQ_BASE + 0x01)
|
|
|
|
-
|
|
/* Guest memory management */
|
|
-#define HC_ID_MEM_BASE 0x300UL
|
|
+#define HC_ID_MEM_BASE 0x40UL
|
|
#define HC_VM_SET_MEMMAP _HC_ID(HC_ID, HC_ID_MEM_BASE + 0x00)
|
|
#define HC_VM_GPA2HPA _HC_ID(HC_ID, HC_ID_MEM_BASE + 0x01)
|
|
|
|
/* PCI assignment*/
|
|
-#define HC_ID_PCI_BASE 0x400UL
|
|
+#define HC_ID_PCI_BASE 0x50UL
|
|
#define HC_ASSIGN_PTDEV _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x00)
|
|
#define HC_DEASSIGN_PTDEV _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x01)
|
|
#define HC_VM_PCI_MSIX_REMAP _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x02)
|
|
#define HC_SET_PTDEV_INTR_INFO _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x03)
|
|
#define HC_RESET_PTDEV_INTR_INFO _HC_ID(HC_ID, HC_ID_PCI_BASE + 0x04)
|
|
|
|
-/* TRACE */
|
|
-#define HC_ID_TRACE_BASE 0x600UL
|
|
-#define HC_ACRN_SBUF_SETUP _HC_ID(HC_ID, HC_ID_TRACE_BASE + 0x00)
|
|
+/* DEBUG */
|
|
+#define HC_ID_DBG_BASE 0x60UL
|
|
+#define HC_SBUF_SETUP _HC_ID(HC_ID, HC_ID_DBG_BASE + 0x00)
|
|
|
|
#define ACRN_DOM0_VMID (0UL)
|
|
-#define ACRN_INVALID_VMID (-1UL)
|
|
+#define ACRN_INVALID_VMID (-1)
|
|
#define ACRN_INVALID_HPA (-1UL)
|
|
|
|
/* Generic memory attributes */
|
|
diff --git a/include/linux/vhm/vhm_hypercall.h b/include/linux/vhm/vhm_hypercall.h
|
|
index b40f8f8..f4a5793 100644
|
|
--- a/include/linux/vhm/vhm_hypercall.h
|
|
+++ b/include/linux/vhm/vhm_hypercall.h
|
|
@@ -137,6 +137,7 @@ static inline long acrn_hypercall4(unsigned long hcall_id, unsigned long param1,
|
|
return result;
|
|
}
|
|
|
|
+inline long hcall_get_api_version(unsigned long api_version);
|
|
inline long hcall_create_vm(unsigned long vminfo);
|
|
inline long hcall_start_vm(unsigned long vmid);
|
|
inline long hcall_pause_vm(unsigned long vmid);
|
|
--
|
|
https://clearlinux.org
|
|
|