Remove struct debug_cmd and use kvm_ipc__send_msg().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
static int do_debug(const char *name, int sock)
{
char buff[BUFFER_SIZE];
- struct debug_cmd cmd = {KVM_IPC_DEBUG, 2 * sizeof(u32)};
+ struct debug_cmd_params cmd = {.dbg_type = 0};
int r;
if (dump)
- cmd.params.dbg_type |= KVM_DEBUG_CMD_TYPE_DUMP;
+ cmd.dbg_type |= KVM_DEBUG_CMD_TYPE_DUMP;
if (nmi != -1) {
- cmd.params.dbg_type |= KVM_DEBUG_CMD_TYPE_NMI;
- cmd.params.cpu = nmi;
+ cmd.dbg_type |= KVM_DEBUG_CMD_TYPE_NMI;
+ cmd.cpu = nmi;
}
- r = xwrite(sock, &cmd, sizeof(cmd));
+ r = kvm_ipc__send_msg(sock, KVM_IPC_DEBUG, sizeof(cmd), (u8 *)&cmd);
if (r < 0)
return r;
static void handle_debug(int fd, u32 type, u32 len, u8 *msg)
{
int i;
- struct debug_cmd_params *params = (void *)msg;
- u32 dbg_type = params->dbg_type;
- u32 vcpu = params->cpu;
+ struct debug_cmd_params *params;
+ u32 dbg_type;
+ u32 vcpu;
+
+ if (WARN_ON(type != KVM_IPC_DEBUG || len != sizeof(*params)))
+ return;
+
+ params = (void *)msg;
+ dbg_type = params->dbg_type;
+ vcpu = params->cpu;
if (dbg_type & KVM_DEBUG_CMD_TYPE_NMI) {
if ((int)vcpu >= kvm->nrcpus)
u32 cpu;
};
-struct debug_cmd {
- u32 type;
- u32 len;
- struct debug_cmd_params params;
-};
-
int kvm_cmd_debug(int argc, const char **argv, const char *prefix);
void kvm_debug_help(void) NORETURN;