2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-01-25 09:17:21 +08:00
|
|
|
From: Kaige Fu <kaige.fu@intel.com>
|
|
|
|
Date: Thu, 6 Dec 2018 16:18:06 +0000
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] VHM: Add one hypercall to query hardware info
|
2019-01-25 09:17:21 +08:00
|
|
|
|
|
|
|
This hypercall is to query hardware info, such as physical cpu number
|
|
|
|
so that ACRN trace/log module will use to initialize it accordingly.
|
|
|
|
|
|
|
|
V1->V2: Add the EXPORT_SYMBOL for hcall_get_hw_info so
|
|
|
|
that it can be used in other modules.
|
|
|
|
Use the __aligned(X) instead of __attribute__((aligned(X)))
|
|
|
|
|
|
|
|
Change-Id: Id0342b7198ca4a1878b01bc46f86b5bc87a523b1
|
|
|
|
Tracked-On: projectacrn/acrn-hypervisor#1775
|
|
|
|
Tracked-On: projectacrn/acrn-hypervisor#1776
|
|
|
|
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
|
|
|
|
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
|
|
|
|
Tracked-On: PKT-1696
|
|
|
|
---
|
|
|
|
drivers/vhm/vhm_hypercall.c | 7 +++++++
|
|
|
|
include/linux/vhm/acrn_hv_defs.h | 18 ++++++++++++------
|
|
|
|
include/linux/vhm/vhm_hypercall.h | 1 +
|
|
|
|
3 files changed, 20 insertions(+), 6 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/drivers/vhm/vhm_hypercall.c b/drivers/vhm/vhm_hypercall.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index 8390d7f794f9..4f6a133cd6d0 100644
|
2019-01-25 09:17:21 +08:00
|
|
|
--- a/drivers/vhm/vhm_hypercall.c
|
|
|
|
+++ b/drivers/vhm/vhm_hypercall.c
|
|
|
|
@@ -49,6 +49,7 @@
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
|
|
+#include <linux/module.h>
|
|
|
|
#include <linux/vhm/acrn_hv_defs.h>
|
|
|
|
#include <linux/vhm/vhm_hypercall.h>
|
|
|
|
|
|
|
|
@@ -97,6 +98,12 @@ inline long hcall_setup_hv_npk_log(unsigned long hv_npk_log)
|
|
|
|
return acrn_hypercall1(HC_SETUP_HV_NPK_LOG, hv_npk_log);
|
|
|
|
}
|
|
|
|
|
|
|
|
+inline long hcall_get_hw_info(unsigned long hw_info)
|
|
|
|
+{
|
|
|
|
+ return acrn_hypercall1(HC_GET_HW_INFO, hw_info);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(hcall_get_hw_info);
|
|
|
|
+
|
|
|
|
inline long hcall_set_sstate_data(unsigned long sx_data_addr)
|
|
|
|
{
|
|
|
|
return acrn_hypercall1(HC_PM_SET_SSTATE_DATA, sx_data_addr);
|
|
|
|
diff --git a/include/linux/vhm/acrn_hv_defs.h b/include/linux/vhm/acrn_hv_defs.h
|
2020-10-27 02:14:06 +08:00
|
|
|
index af00025953c2..bb60888fb59e 100644
|
2019-01-25 09:17:21 +08:00
|
|
|
--- a/include/linux/vhm/acrn_hv_defs.h
|
|
|
|
+++ b/include/linux/vhm/acrn_hv_defs.h
|
|
|
|
@@ -115,6 +115,7 @@
|
|
|
|
#define HC_SETUP_SBUF _HC_ID(HC_ID, HC_ID_DBG_BASE + 0x00)
|
|
|
|
#define HC_SETUP_HV_NPK_LOG _HC_ID(HC_ID, HC_ID_DBG_BASE + 0x01)
|
|
|
|
#define HC_PROFILING_OPS _HC_ID(HC_ID, HC_ID_DBG_BASE + 0x02)
|
|
|
|
+#define HC_GET_HW_INFO _HC_ID(HC_ID, HC_ID_DBG_BASE + 0x03)
|
|
|
|
|
|
|
|
/* Power management */
|
|
|
|
#define HC_ID_PM_BASE 0x80UL
|
|
|
|
@@ -173,7 +174,7 @@ struct set_regions {
|
|
|
|
* the max buffer size is one page.
|
|
|
|
*/
|
|
|
|
uint64_t regions_gpa;
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
struct wp_data {
|
|
|
|
/** set page write protect permission.
|
|
|
|
@@ -193,7 +194,7 @@ struct sbuf_setup_param {
|
|
|
|
uint16_t reserved;
|
|
|
|
uint32_t sbuf_id;
|
|
|
|
uint64_t gpa;
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
struct hv_npk_log_param {
|
|
|
|
/* the setup command for the hypervisor NPK log */
|
|
|
|
@@ -210,12 +211,17 @@ struct hv_npk_log_param {
|
|
|
|
|
|
|
|
/* the MMIO address for the hypervisor NPK log */
|
|
|
|
uint64_t mmio_addr;
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
+
|
|
|
|
+struct acrn_hw_info {
|
|
|
|
+ uint16_t cpu_num; /* Physical CPU number */
|
|
|
|
+ uint16_t reserved[3];
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
struct vm_gpa2hpa {
|
|
|
|
uint64_t gpa; /* IN: gpa to translation */
|
|
|
|
uint64_t hpa; /* OUT: -1 means invalid gpa */
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
struct hc_ptdev_irq {
|
|
|
|
#define IRQ_INTX 0
|
|
|
|
@@ -238,12 +244,12 @@ struct hc_ptdev_irq {
|
|
|
|
uint32_t vector_cnt;
|
|
|
|
} msix;
|
|
|
|
};
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
struct hc_api_version {
|
|
|
|
uint32_t major_version;
|
|
|
|
uint32_t minor_version;
|
|
|
|
-} __attribute__((aligned(8)));
|
|
|
|
+} __aligned(8);
|
|
|
|
|
|
|
|
|
|
|
|
enum profiling_cmd_type {
|
|
|
|
diff --git a/include/linux/vhm/vhm_hypercall.h b/include/linux/vhm/vhm_hypercall.h
|
2020-10-27 02:14:06 +08:00
|
|
|
index 5041f5ace282..33acc64a4cbf 100644
|
2019-01-25 09:17:21 +08:00
|
|
|
--- a/include/linux/vhm/vhm_hypercall.h
|
|
|
|
+++ b/include/linux/vhm/vhm_hypercall.h
|
|
|
|
@@ -148,6 +148,7 @@ inline long hcall_reset_vm(unsigned long vmid);
|
|
|
|
inline long hcall_query_vm_state(unsigned long vmid);
|
|
|
|
inline long hcall_setup_sbuf(unsigned long sbuf_head);
|
|
|
|
inline long hcall_setup_hv_npk_log(unsigned long hv_npk_log);
|
|
|
|
+inline long hcall_get_hw_info(unsigned long hw_info);
|
|
|
|
inline long hcall_set_sstate_data(unsigned long sx_data_addr);
|
|
|
|
inline long hcall_get_cpu_state(unsigned long cmd, unsigned long state_pa);
|
|
|
|
inline long hcall_set_memory_regions(unsigned long pa_regions);
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2019-01-25 09:17:21 +08:00
|
|
|
|