From patchwork Fri Jun 20 12:11:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 362226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2EA15140086 for ; Fri, 20 Jun 2014 22:17:35 +1000 (EST) Received: from localhost ([::1]:40547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxxl6-0000Qt-P2 for incoming@patchwork.ozlabs.org; Fri, 20 Jun 2014 08:17:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxxfW-00085q-TJ for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxxfS-00025z-Nt for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:46 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:36752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxxfS-00023J-Hn for qemu-devel@nongnu.org; Fri, 20 Jun 2014 08:11:42 -0400 Received: by mail-wg0-f47.google.com with SMTP id k14so3572843wgh.6 for ; Fri, 20 Jun 2014 05:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9itm/Df5j4yplby/7oWqcusHFb3M2tvHJhiTWhsQPGA=; b=X1M/gFHANEOqOIKZmF9bI3tQEdZWBlTCsSG3NHy97vZcH4u03KFgaJlij2O9i60aYj iPPO1XwXdXk8tzGMQ65QiGgTVDyTbee9cHIByuN/23T3PJOes9bFAkZSUdSeXv4iMsWk dw5v9RYPc1nFsXS5EKvnfqAftVkHY0mRPYOsYtvA5h8/EyLLC5uUtTW8tRv4OVCcX/IY Q7FJSH7OyEVVjMadvH/ck0sZ8oah9WVw0DQ9+XM6TvIOgIO36HlQ+n7t0Lzz3GLVoc2Y 14EHgh6Xf1Lu4uvQqj7P8Gu9TLu2rV0EVYWjoPbyjC2UHaaWG+BnVz1VIwz/1EICdEmr uwjQ== X-Received: by 10.180.74.9 with SMTP id p9mr3748081wiv.39.1403266301797; Fri, 20 Jun 2014 05:11:41 -0700 (PDT) Received: from playground.station (net-37-117-140-88.cust.vodafonedsl.it. [37.117.140.88]) by mx.google.com with ESMTPSA id dj2sm4222458wib.11.2014.06.20.05.11.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jun 2014 05:11:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 20 Jun 2014 14:11:16 +0200 Message-Id: <1403266283-1517-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1403266283-1517-1-git-send-email-pbonzini@redhat.com> References: <1403266283-1517-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22f Cc: Sanjay Lal , James Hogan , Gleb Natapov , Aurelien Jarno , Peter Maydell Subject: [Qemu-devel] [PULL 07/14] kvm: Allow arch to set sigmask length X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: James Hogan MIPS/Linux is unusual in having 128 signals rather than just 64 like most other architectures. This means its sigmask is 16 bytes instead of 8, so allow arches to override the sigmask->len value passed to the KVM_SET_SIGNAL_MASK ioctl in kvm_set_signal_mask() by calling kvm_set_sigmask_len() from kvm_arch_init(). Otherwise default to 8 bytes. Signed-off-by: James Hogan Cc: Aurelien Jarno Cc: Sanjay Lal Cc: Gleb Natapov Cc: Paolo Bonzini Cc: Peter Maydell Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 2 ++ kvm-all.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index e79e92c..de4bdaa 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -325,6 +325,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension); uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, uint32_t index, int reg); +void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len); + #if !defined(CONFIG_USER_ONLY) int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, hwaddr *phys_addr); diff --git a/kvm-all.c b/kvm-all.c index 56a251b..3142335 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -99,6 +99,7 @@ struct KVMState * they're not. Linux, glibc and *BSD all treat ioctl numbers as * unsigned, and treating them as signed here can break things */ unsigned irq_set_ioctl; + unsigned int sigmask_len; #ifdef KVM_CAP_IRQ_ROUTING struct kvm_irq_routing *irq_routes; int nr_allocated_irq_routes; @@ -1397,6 +1398,8 @@ int kvm_init(MachineClass *mc) assert(TARGET_PAGE_SIZE <= getpagesize()); page_size_init(); + s->sigmask_len = 8; + #ifdef KVM_CAP_SET_GUEST_DEBUG QTAILQ_INIT(&s->kvm_sw_breakpoints); #endif @@ -1575,6 +1578,11 @@ err: return ret; } +void kvm_set_sigmask_len(KVMState *s, unsigned int sigmask_len) +{ + s->sigmask_len = sigmask_len; +} + static void kvm_handle_io(uint16_t port, void *data, int direction, int size, uint32_t count) { @@ -2095,6 +2103,7 @@ void kvm_remove_all_breakpoints(CPUState *cpu) int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset) { + KVMState *s = kvm_state; struct kvm_signal_mask *sigmask; int r; @@ -2104,7 +2113,7 @@ int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset) sigmask = g_malloc(sizeof(*sigmask) + sizeof(*sigset)); - sigmask->len = 8; + sigmask->len = s->sigmask_len; memcpy(sigmask->sigset, sigset, sizeof(*sigset)); r = kvm_vcpu_ioctl(cpu, KVM_SET_SIGNAL_MASK, sigmask); g_free(sigmask);