clear-pkgs-linux-iot-lts2018/0480-hypercall-refine-hyper...

730 lines
22 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 hypercall interfaces
- HC_VM_SET_MEMMAP: remove MAP_UPDATE, refine API structure
- HC_NOTIFY_REQUEST_FINISH: use vcpu_id instead of vcpu_mask
- HC_VM_GPA2HPA: refine API structure
- HC_SET_IOREQ_BUFFER: refine API structure
- IC_XXXX_IRQLINE: refine API structure
Change-Id: Ie9f6af005160a807335b2f266d7139abc06d8db9
Tracked-On: 218445
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Signed-off-by: Edwin Zhai <edwin.zhai@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/char/vhm/vhm_dev.c | 5 +-
drivers/vbs/vbs_rng.c | 3 +-
drivers/vhm/vhm_hypercall.c | 4 +-
drivers/vhm/vhm_ioreq.c | 26 ++---
drivers/vhm/vhm_mm.c | 29 ++---
include/linux/vhm/acrn_common.h | 181 ++++++++++-------------------
include/linux/vhm/acrn_hv_defs.h | 63 +++++++---
include/linux/vhm/acrn_vhm_ioreq.h | 6 +-
include/linux/vhm/acrn_vhm_mm.h | 21 +---
include/linux/vhm/vhm_hypercall.h | 3 +-
include/linux/vhm/vhm_ioctl_defs.h | 5 +
11 files changed, 152 insertions(+), 194 deletions(-)
diff --git a/drivers/char/vhm/vhm_dev.c b/drivers/char/vhm/vhm_dev.c
index ebada9a11552..e36a5e225e12 100644
--- a/drivers/char/vhm/vhm_dev.c
+++ b/drivers/char/vhm/vhm_dev.c
@@ -299,14 +299,13 @@ static long vhm_dev_ioctl(struct file *filep,
}
case IC_NOTIFY_REQUEST_FINISH: {
- struct acrn_ioreq_notify notify;
+ struct ioreq_notify notify;
if (copy_from_user(&notify, (void *)ioctl_param,
sizeof(notify)))
return -EFAULT;
- ret = acrn_ioreq_complete_request(notify.client_id,
- notify.vcpu_mask);
+ ret = acrn_ioreq_complete_request(notify.client_id, notify.vcpu);
if (ret < 0)
return -EFAULT;
break;
diff --git a/drivers/vbs/vbs_rng.c b/drivers/vbs/vbs_rng.c
index ef6f8776e71c..f2234e73034d 100644
--- a/drivers/vbs/vbs_rng.c
+++ b/drivers/vbs/vbs_rng.c
@@ -369,8 +369,7 @@ static int handle_kick(int client_id, int req_cnt)
req->reqs.pio_request.size,
req->reqs.pio_request.value);
req->processed = REQ_STATE_SUCCESS;
- acrn_ioreq_complete_request(client->vhm_client_id,
- 1 << i);
+ acrn_ioreq_complete_request(client->vhm_client_id, i);
}
}
diff --git a/drivers/vhm/vhm_hypercall.c b/drivers/vhm/vhm_hypercall.c
index 11ca6b86baed..94a95933d51e 100644
--- a/drivers/vhm/vhm_hypercall.c
+++ b/drivers/vhm/vhm_hypercall.c
@@ -87,9 +87,9 @@ inline long hcall_set_ioreq_buffer(unsigned long vmid, unsigned long buffer)
return acrn_hypercall2(HC_SET_IOREQ_BUFFER, vmid, buffer);
}
-inline long hcall_notify_req_finish(unsigned long vmid, unsigned long vcpu_mask)
+inline long hcall_notify_req_finish(unsigned long vmid, unsigned long vcpu)
{
- return acrn_hypercall2(HC_NOTIFY_REQUEST_FINISH, vmid, vcpu_mask);
+ return acrn_hypercall2(HC_NOTIFY_REQUEST_FINISH, vmid, vcpu);
}
inline long hcall_assert_irqline(unsigned long vmid, unsigned long irq)
diff --git a/drivers/vhm/vhm_ioreq.c b/drivers/vhm/vhm_ioreq.c
index 6054e3d00eb2..08826c575780 100644
--- a/drivers/vhm/vhm_ioreq.c
+++ b/drivers/vhm/vhm_ioreq.c
@@ -67,7 +67,7 @@
struct ioreq_range {
struct list_head list;
- enum request_type type;
+ uint32_t type;
long start;
long end;
};
@@ -130,7 +130,7 @@ static DECLARE_BITMAP(client_bitmap, MAX_CLIENT);
static void acrn_ioreq_notify_client(struct ioreq_client *client);
-static inline bool is_range_type(enum request_type type)
+static inline bool is_range_type(uint32_t type)
{
return (type == REQ_MMIO || type == REQ_PORTIO || type == REQ_WP);
}
@@ -335,7 +335,7 @@ static void __attribute__((unused)) dump_iorange(struct ioreq_client *client)
* NOTE: here just add iorange entry directly, no check for the overlap..
* please client take care of it
*/
-int acrn_ioreq_add_iorange(int client_id, enum request_type type,
+int acrn_ioreq_add_iorange(int client_id, uint32_t type,
long start, long end)
{
struct ioreq_client *client;
@@ -375,7 +375,7 @@ int acrn_ioreq_add_iorange(int client_id, enum request_type type,
return 0;
}
-int acrn_ioreq_del_iorange(int client_id, enum request_type type,
+int acrn_ioreq_del_iorange(int client_id, uint32_t type,
long start, long end)
{
struct ioreq_client *client;
@@ -617,13 +617,6 @@ static bool req_in_range(struct ioreq_range *range, struct vhm_request *req)
ret = true;
break;
}
- case REQ_MSR: /*TODO: add bitmap for MSR range */
- case REQ_CPUID:
- case REQ_EXIT:
- {
- ret = true;
- break;
- }
default:
ret = false;
@@ -707,7 +700,7 @@ static int handle_cf8cfc(struct vhm_vm *vm, struct vhm_request *req, int vcpu)
if (req_handled) {
req->processed = REQ_STATE_SUCCESS;
- if (hcall_notify_req_finish(vm->vmid, 1 << vcpu) < 0) {
+ if (hcall_notify_req_finish(vm->vmid, vcpu) < 0) {
pr_err("vhm-ioreq: failed to "
"notify request finished !\n");
return -EFAULT;
@@ -815,7 +808,7 @@ int acrn_ioreq_distribute_request(struct vhm_vm *vm)
return 0;
}
-int acrn_ioreq_complete_request(int client_id, uint64_t vcpu_mask)
+int acrn_ioreq_complete_request(int client_id, uint64_t vcpu)
{
struct ioreq_client *client;
int ret;
@@ -830,9 +823,8 @@ int acrn_ioreq_complete_request(int client_id, uint64_t vcpu_mask)
return -EINVAL;
}
- atomic_sub(bitmap_weight((unsigned long *)&vcpu_mask,
- VHM_REQUEST_MAX), &client->req);
- ret = hcall_notify_req_finish(client->vmid, vcpu_mask);
+ atomic_dec(&client->req);
+ ret = hcall_notify_req_finish(client->vmid, vcpu);
if (ret < 0) {
pr_err("vhm-ioreq: failed to notify request finished !\n");
return -EFAULT;
@@ -887,7 +879,7 @@ int acrn_ioreq_init(struct vhm_vm *vm, unsigned long vma)
vm->req_buf = page_address(page);
vm->pg = page;
- set_buffer.req_buf = (long) page_to_phys(page);
+ set_buffer.req_buf = page_to_phys(page);
ret = hcall_set_ioreq_buffer(vm->vmid, virt_to_phys(&set_buffer));
if (ret < 0) {
diff --git a/drivers/vhm/vhm_mm.c b/drivers/vhm/vhm_mm.c
index 61ebb8c508d2..b475aa91a348 100644
--- a/drivers/vhm/vhm_mm.c
+++ b/drivers/vhm/vhm_mm.c
@@ -152,13 +152,14 @@ int alloc_guest_memseg(struct vhm_vm *vm, struct vm_memseg *memseg)
}
static int _mem_set_memmap(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot, int type)
+ unsigned long host_gpa, unsigned long len,
+ unsigned int prot, unsigned int type)
{
struct vm_set_memmap set_memmap;
set_memmap.type = type;
- set_memmap.foreign_gpa = guest_gpa;
- set_memmap.hvm_gpa = host_gpa;
+ set_memmap.remote_gpa = guest_gpa;
+ set_memmap.vm0_gpa = host_gpa;
set_memmap.length = len;
set_memmap.prot = prot;
@@ -177,24 +178,24 @@ static int _mem_set_memmap(unsigned long vmid, unsigned long guest_gpa,
}
int set_mmio_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot)
+ unsigned long host_gpa, unsigned long len, unsigned int prot)
{
return _mem_set_memmap(vmid, guest_gpa, host_gpa, len,
prot, MAP_MMIO);
}
int unset_mmio_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot)
+ unsigned long host_gpa, unsigned long len, unsigned int prot)
{
return _mem_set_memmap(vmid, guest_gpa, host_gpa, len,
prot, MAP_UNMAP);
}
-int update_mem_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot)
+int update_mmio_map(unsigned long vmid, unsigned long guest_gpa,
+ unsigned long host_gpa, unsigned long len, unsigned int prot)
{
return _mem_set_memmap(vmid, guest_gpa, host_gpa, len,
- prot, MAP_UPDATE);
+ prot, MAP_MMIO);
}
int map_guest_memseg(struct vhm_vm *vm, struct vm_memmap *memmap)
@@ -217,18 +218,18 @@ int map_guest_memseg(struct vhm_vm *vm, struct vm_memmap *memmap)
}
seg->prot = memmap->mem.prot;
set_memmap.type = MAP_MEM;
- set_memmap.foreign_gpa = seg->gpa;
- set_memmap.hvm_gpa = seg->base;
+ set_memmap.remote_gpa = seg->gpa;
+ set_memmap.vm0_gpa = seg->base;
set_memmap.length = seg->len;
set_memmap.prot = seg->prot;
- set_memmap.prot |= MMU_MEM_ATTR_WB_CACHE;
+ set_memmap.prot |= MEM_ATTR_WB_CACHE;
} else {
set_memmap.type = MAP_MMIO;
- set_memmap.foreign_gpa = memmap->mmio.gpa;
- set_memmap.hvm_gpa = memmap->mmio.hpa;
+ set_memmap.remote_gpa = memmap->mmio.gpa;
+ set_memmap.vm0_gpa = memmap->mmio.hpa;
set_memmap.length = memmap->mmio.len;
set_memmap.prot = memmap->mmio.prot;
- set_memmap.prot |= MMU_MEM_ATTR_UNCACHED;
+ set_memmap.prot |= MEM_ATTR_UNCACHED;
}
/* hypercall to notify hv the guest EPT setting*/
diff --git a/include/linux/vhm/acrn_common.h b/include/linux/vhm/acrn_common.h
index 0e9293d08e01..aa61fbed2596 100644
--- a/include/linux/vhm/acrn_common.h
+++ b/include/linux/vhm/acrn_common.h
@@ -1,5 +1,5 @@
/*
- * virtio and hyperviosr service module (VHM): commom.h
+ * common definition
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
@@ -53,125 +53,89 @@
#define ACRN_COMMON_H
/*
- * Commmon structures for ACRN/VHM/DM
+ * Common structures for ACRN/VHM/DM
*/
-/* ISA type
- * inject interrut to both PIC and IOAPIC
- */
-enum interrupt_type {
- ACRN_INTR_TYPE_ISA,
- ACRN_INTR_TYPE_IOAPIC,
-} __attribute__((aligned(4)));
-
/*
* IO request
*/
#define VHM_REQUEST_MAX 16
-enum request_state {
- REQ_STATE_SUCCESS = 1,
- REQ_STATE_PENDING = 0,
- REQ_STATE_PROCESSING = 2,
- REQ_STATE_FAILED = -1,
-} __attribute__((aligned(4)));
-
-enum request_type {
- REQ_MSR,
- REQ_CPUID,
- REQ_PORTIO,
- REQ_MMIO,
- REQ_PCICFG,
- REQ_WP,
- REQ_EXIT,
- REQ_MAX,
-} __attribute__((aligned(4)));
-
-enum request_direction {
- REQUEST_READ,
- REQUEST_WRITE,
- DIRECTION_MAX,
-} __attribute__((aligned(4)));
+#define REQ_STATE_PENDING 0
+#define REQ_STATE_SUCCESS 1
+#define REQ_STATE_PROCESSING 2
+#define REQ_STATE_FAILED -1
-/*
- * IRQ type for ptdev
- */
-enum irq_type {
- IRQ_INTX,
- IRQ_MSI,
- IRQ_MSIX,
-} __attribute__((aligned(4)));
-
-struct msr_request {
- enum request_direction direction;
- long index;
- long value;
-} __attribute__((aligned(8)));
+#define REQ_PORTIO 0
+#define REQ_MMIO 1
+#define REQ_PCICFG 2
+#define REQ_WP 3
+#define REQUEST_READ 0
+#define REQUEST_WRITE 1
struct mmio_request {
- enum request_direction direction;
- long address;
- long size;
- long value;
+ uint32_t direction;
+ uint32_t reserved;
+ int64_t address;
+ int64_t size;
+ int64_t value;
} __attribute__((aligned(8)));
-struct io_request {
- enum request_direction direction;
- long address;
- long size;
- int value;
+struct pio_request {
+ uint32_t direction;
+ uint32_t reserved;
+ int64_t address;
+ int64_t size;
+ int32_t value;
} __attribute__((aligned(8)));
struct pci_request {
- enum request_direction direction;
- long reserve; /*io_request address*/
- long size;
- int value;
- int bus;
- int dev;
- int func;
- int reg;
+ uint32_t direction;
+ uint32_t reserved[3];/* need keep same header fields with pio_request */
+ int64_t size;
+ int32_t value;
+ int32_t bus;
+ int32_t dev;
+ int32_t func;
+ int32_t reg;
} __attribute__((aligned(8)));
/* vhm_request are 256Bytes aligned */
struct vhm_request {
/* offset: 0bytes - 63bytes */
union {
- int exitcode;
- enum request_type type;
- unsigned long rip;
- int reserved0[16];
+ uint32_t type;
+ int32_t reserved0[16];
};
/* offset: 64bytes-127bytes */
union {
- struct msr_request msr_request;
- struct io_request pio_request;
+ struct pio_request pio_request;
struct pci_request pci_request;
struct mmio_request mmio_request;
- long reserved1[8];
+ int64_t reserved1[8];
} reqs;
/* True: valid req which need VHM to process.
* ACRN write, VHM read only
**/
- int valid;
+ int32_t valid;
/* the client which is distributed to handle this request */
- int client;
+ int32_t client;
/* 1: VHM had processed and success
* 0: VHM had not yet processed
* -1: VHM failed to process. Invalid request
* VHM write, ACRN read only
**/
- enum request_state processed;
+ int32_t processed;
} __attribute__((aligned(256)));
struct vhm_request_buffer {
union {
struct vhm_request req_queue[VHM_REQUEST_MAX];
- char reserved[4096];
+ int8_t reserved[4096];
};
} __attribute__((aligned(4096)));
@@ -182,69 +146,52 @@ struct acrn_create_vm {
} __attribute__((aligned(8)));
struct acrn_create_vcpu {
- int vcpuid; /* IN: vcpu id */
+ int vcpuid; /* IN: vcpu id */
int pcpuid; /* IN: pcpu id */
} __attribute__((aligned(8)));
struct acrn_set_ioreq_buffer {
- long req_buf; /* IN: gpa of per VM request_buffer*/
+ uint64_t req_buf; /* IN: gpa of per VM request_buffer*/
} __attribute__((aligned(8)));
-struct acrn_ioreq_notify {
- int client_id;
- unsigned long vcpu_mask;
-} __attribute__((aligned(8)));
+/*
+ * intr type
+ * IOAPIC: inject interrupt to IOAPIC
+ * ISA: inject interrupt to both PIC and IOAPIC
+ */
+#define ACRN_INTR_TYPE_ISA 0
+#define ACRN_INTR_TYPE_IOAPIC 1
/* For ISA, PIC, IOAPIC etc */
struct acrn_irqline {
- enum interrupt_type intr_type;
- unsigned long pic_irq; /* IN: for ISA type */
- unsigned long ioapic_irq; /* IN: for IOAPIC type, -1 don't inject */
+ uint32_t intr_type;
+ uint32_t reserved;
+ uint64_t pic_irq; /* IN: for ISA type */
+ uint64_t ioapic_irq; /* IN: for IOAPIC type, -1 don't inject */
} __attribute__((aligned(8)));
/* For MSI type inject */
struct acrn_msi_entry {
- unsigned long msi_addr; /* IN: addr[19:12] with dest vcpu id */
- unsigned long msi_data; /* IN: data[7:0] with vector */
+ uint64_t msi_addr; /* IN: addr[19:12] with dest vcpu id */
+ uint64_t msi_data; /* IN: data[7:0] with vector */
} __attribute__((aligned(8)));
/* For NMI inject */
struct acrn_nmi_entry {
- unsigned long vcpuid; /* IN: -1 means vcpu0 */
-} __attribute__((aligned(8)));
-
-struct acrn_ptdev_irq {
- enum irq_type type;
- unsigned short virt_bdf; /* IN: Device virtual BDF# */
- unsigned short phys_bdf; /* IN: Device physical BDF# */
- union {
- struct {
- int virt_pin; /* IN: virtual IOAPIC pin */
- int phys_pin; /* IN: physical IOAPIC pin */
- bool pic_pin; /* IN: pin from PIC? */
- } intx;
- struct {
- int vector_cnt; /* IN: vector count of MSI/MSIX */
-
- /* IN: physcial address of MSI-X table */
- unsigned long table_paddr;
-
- /* IN: size of MSI-X table (round up to 4K) */
- int table_size;
- } msix;
- };
+ int64_t vcpuid; /* IN: -1 means vcpu0 */
} __attribute__((aligned(8)));
struct acrn_vm_pci_msix_remap {
- unsigned short virt_bdf; /* IN: Device virtual BDF# */
- unsigned short phys_bdf; /* IN: Device physical BDF# */
- unsigned short msi_ctl; /* IN: PCI MSI/x cap control data */
- unsigned long msi_addr; /* IN/OUT: msi address to fix */
- unsigned int msi_data; /* IN/OUT: msi data to fix */
- int msix; /* IN: 0 - MSI, 1 - MSI-X */
- int msix_entry_index; /* IN: MSI-X the entry table index */
+ uint16_t virt_bdf; /* IN: Device virtual BDF# */
+ uint16_t phys_bdf; /* IN: Device physical BDF# */
+ uint16_t msi_ctl; /* IN: PCI MSI/x cap control data */
+ uint16_t reserved;
+ uint64_t msi_addr; /* IN/OUT: msi address to fix */
+ uint32_t msi_data; /* IN/OUT: msi data to fix */
+ int32_t msix; /* IN: 0 - MSI, 1 - MSI-X */
+ int32_t msix_entry_index; /* IN: MSI-X the entry table index */
/* IN: Vector Control for MSI-X Entry, field defined in MSIX spec */
- unsigned int vector_ctl;
+ uint32_t vector_ctl;
} __attribute__((aligned(8)));
#endif /* ACRN_COMMON_H */
diff --git a/include/linux/vhm/acrn_hv_defs.h b/include/linux/vhm/acrn_hv_defs.h
index eeac0e9b4e76..fa32243a6407 100644
--- a/include/linux/vhm/acrn_hv_defs.h
+++ b/include/linux/vhm/acrn_hv_defs.h
@@ -1,5 +1,5 @@
/*
- * virtio and hyperviosr service module (VHM): hypercall header
+ * hypercall definition
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
@@ -53,12 +53,12 @@
#define ACRN_HV_DEFS_H
/*
- * Commmon structures for ACRN/VHM/DM
+ * Common structures for ACRN/VHM/DM
*/
#include "acrn_common.h"
/*
- * Commmon structures for HV/VHM
+ * Common structures for HV/VHM
*/
#define _HC_ID(x, y) (((x)<<24)|(y))
@@ -101,35 +101,59 @@
#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)
+
#define ACRN_DOM0_VMID (0UL)
#define ACRN_INVALID_VMID (-1UL)
#define ACRN_INVALID_HPA (-1UL)
-enum vm_memmap_type {
- MAP_MEM = 0,
- MAP_MMIO,
- MAP_UNMAP,
- MAP_UPDATE,
-};
+/* Generic memory attributes */
+#define MEM_ATTR_READ 0x00000001
+#define MEM_ATTR_WRITE 0x00000002
+#define MEM_ATTR_EXECUTE 0x00000004
+#define MEM_ATTR_USER 0x00000008
+#define MEM_ATTR_WB_CACHE 0x00000040
+#define MEM_ATTR_WT_CACHE 0x00000080
+#define MEM_ATTR_UNCACHED 0x00000100
+#define MEM_ATTR_WC 0x00000200
+#define MEM_ATTR_WP 0x00000400
+
+#define MEM_ATTR_ALL 0x00000007
+#define MEM_ATTR_WRITE_PROT 0x00000005
+#define MEM_ATTR_ALL_WB 0x00000047
+#define MEM_ATTR_ALL_WC 0x00000207
struct vm_set_memmap {
- enum vm_memmap_type type;
+#define MAP_MEM 0
+#define MAP_MMIO 1
+#define MAP_UNMAP 2
+ uint32_t type;
+ uint32_t reserved;
+
/* IN: beginning guest GPA to map */
- unsigned long foreign_gpa;
+ uint64_t remote_gpa;
/* IN: VM0's GPA which foreign gpa will be mapped to */
- unsigned long hvm_gpa;
+ uint64_t vm0_gpa;
/* IN: length of the range */
- unsigned long length;
+ uint64_t length;
- /* IN: not used right now */
- int prot;
+ /* IN: mem attr */
+ uint32_t prot;
+} __attribute__((aligned(8)));
+
+struct sbuf_setup_param {
+ uint32_t pcpu_id;
+ uint32_t sbuf_id;
+ uint64_t gpa;
} __attribute__((aligned(8)));
struct vm_gpa2hpa {
- unsigned long gpa; /* IN: gpa to translation */
- unsigned long hpa; /* OUT: -1 means invalid gpa */
+ uint64_t gpa; /* IN: gpa to translation */
+ uint64_t hpa; /* OUT: -1 means invalid gpa */
} __attribute__((aligned(8)));
struct hc_ptdev_irq {
@@ -152,4 +176,9 @@ struct hc_ptdev_irq {
};
} __attribute__((aligned(8)));
+struct hc_api_version {
+ uint32_t major_version;
+ uint32_t minor_version;
+} __attribute__((aligned(8)));
+
#endif /* ACRN_HV_DEFS_H */
diff --git a/include/linux/vhm/acrn_vhm_ioreq.h b/include/linux/vhm/acrn_vhm_ioreq.h
index 0daf46dcf9f7..fcec2c1e2eac 100644
--- a/include/linux/vhm/acrn_vhm_ioreq.h
+++ b/include/linux/vhm/acrn_vhm_ioreq.h
@@ -63,16 +63,16 @@ int acrn_ioreq_create_client(unsigned long vmid, ioreq_handler_t handler,
char *name);
void acrn_ioreq_destroy_client(int client_id);
-int acrn_ioreq_add_iorange(int client_id, enum request_type type,
+int acrn_ioreq_add_iorange(int client_id, uint32_t type,
long start, long end);
-int acrn_ioreq_del_iorange(int client_id, enum request_type type,
+int acrn_ioreq_del_iorange(int client_id, uint32_t type,
long start, long end);
struct vhm_request *acrn_ioreq_get_reqbuf(int client_id);
int acrn_ioreq_attach_client(int client_id, bool check_kthread_stop);
int acrn_ioreq_distribute_request(struct vhm_vm *vm);
-int acrn_ioreq_complete_request(int client_id, uint64_t vcpu_mask);
+int acrn_ioreq_complete_request(int client_id, uint64_t vcpu);
void acrn_ioreq_intercept_bdf(int client_id, int bus, int dev, int func);
void acrn_ioreq_unintercept_bdf(int client_id);
diff --git a/include/linux/vhm/acrn_vhm_mm.h b/include/linux/vhm/acrn_vhm_mm.h
index 1af6fd3aa11b..f0401ac6a942 100644
--- a/include/linux/vhm/acrn_vhm_mm.h
+++ b/include/linux/vhm/acrn_vhm_mm.h
@@ -57,19 +57,6 @@
#include <linux/vhm/vhm_ioctl_defs.h>
#include <linux/vhm/vhm_vm_mngt.h>
-#define MMU_MEM_ATTR_READ 0x00000001
-#define MMU_MEM_ATTR_WRITE 0x00000002
-#define MMU_MEM_ATTR_EXECUTE 0x00000004
-#define MMU_MEM_ATTR_WB_CACHE 0x00000040
-#define MMU_MEM_ATTR_WT_CACHE 0x00000080
-#define MMU_MEM_ATTR_UNCACHED 0x00000100
-#define MMU_MEM_ATTR_WC 0x00000200
-
-#define MMU_MEM_ATTR_ALL 0x00000007
-#define MMU_MEM_ATTR_WP 0x00000005
-#define MMU_MEM_ATTR_ALL_WB 0x00000047
-#define MMU_MEM_ATTR_ALL_WC 0x00000207
-
/* 1:1 mapping for service OS */
static inline unsigned long acrn_hpa2gpa(unsigned long hpa)
{
@@ -79,11 +66,11 @@ static inline unsigned long acrn_hpa2gpa(unsigned long hpa)
void *map_guest_phys(unsigned long vmid, u64 uos_phys, size_t size);
int unmap_guest_phys(unsigned long vmid, u64 uos_phys);
int set_mmio_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot);
+ unsigned long host_gpa, unsigned long len, unsigned int prot);
int unset_mmio_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot);
-int update_mem_map(unsigned long vmid, unsigned long guest_gpa,
- unsigned long host_gpa, unsigned long len, int prot);
+ unsigned long host_gpa, unsigned long len, unsigned int prot);
+int update_mmio_map(unsigned long vmid, unsigned long guest_gpa,
+ unsigned long host_gpa, unsigned long len, unsigned int prot);
int vhm_dev_mmap(struct file *file, struct vm_area_struct *vma);
diff --git a/include/linux/vhm/vhm_hypercall.h b/include/linux/vhm/vhm_hypercall.h
index 35bb48ae6cd3..5447e951bf4b 100644
--- a/include/linux/vhm/vhm_hypercall.h
+++ b/include/linux/vhm/vhm_hypercall.h
@@ -146,8 +146,7 @@ inline long hcall_set_memmap(unsigned long vmid,
unsigned long memmap);
inline long hcall_set_ioreq_buffer(unsigned long vmid,
unsigned long buffer);
-inline long hcall_notify_req_finish(unsigned long vmid,
- unsigned long vcpu_mask);
+inline long hcall_notify_req_finish(unsigned long vmid, unsigned long vcpu);
inline long hcall_assert_irqline(unsigned long vmid, unsigned long irq);
inline long hcall_deassert_irqline(unsigned long vmid, unsigned long irq);
inline long hcall_pulse_irqline(unsigned long vmid, unsigned long irq);
diff --git a/include/linux/vhm/vhm_ioctl_defs.h b/include/linux/vhm/vhm_ioctl_defs.h
index df07e3c93467..79d91a858226 100644
--- a/include/linux/vhm/vhm_ioctl_defs.h
+++ b/include/linux/vhm/vhm_ioctl_defs.h
@@ -156,4 +156,9 @@ struct ic_ptdev_irq {
};
};
+struct ioreq_notify {
+ int32_t client_id;
+ uint32_t vcpu;
+};
+
#endif /* VHM_IOCTL_DEFS_H */
--
https://clearlinux.org