From patchwork Tue Dec 6 03:39:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Evans X-Patchwork-Id: 129504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3D023B6FA0 for ; Tue, 6 Dec 2011 14:39:11 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932899Ab1LFDjK (ORCPT ); Mon, 5 Dec 2011 22:39:10 -0500 Received: from ozlabs.org ([203.10.76.45]:48120 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932889Ab1LFDjJ (ORCPT ); Mon, 5 Dec 2011 22:39:09 -0500 Received: from [10.61.2.183] (ibmaus65.lnk.telstra.net [165.228.126.9]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 2F927B6F9F; Tue, 6 Dec 2011 14:39:08 +1100 (EST) Message-ID: <4EDD8E8E.9010205@ozlabs.org> Date: Tue, 06 Dec 2011 14:39:58 +1100 From: Matt Evans User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 MIME-Version: 1.0 To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Subject: [PATCH 09/28] kvm tools: Add kvm__arch_periodic_poll() References: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Currently, the SIGALRM handler calls device poll functions (for serial, virtio console) directly. Which devices are present and which require polling is a system-specific decision, so create a new function called from common code & move the x86-specific poll calls into it. Signed-off-by: Matt Evans --- tools/kvm/builtin-run.c | 3 +-- tools/kvm/include/kvm/kvm.h | 1 + tools/kvm/x86/kvm.c | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index 7cf208d..9ef331e 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -522,8 +522,7 @@ static void handle_debug(int fd, u32 type, u32 len, u8 *msg) static void handle_sigalrm(int sig) { - serial8250__inject_interrupt(kvm); - virtio_console__inject_interrupt(kvm); + kvm__arch_periodic_poll(kvm); } static void handle_stop(int fd, u32 type, u32 len, u8 *msg) diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index ca1acc0..60842d5 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -56,6 +56,7 @@ void kvm__remove_socket(const char *name); void kvm__arch_init(struct kvm *kvm, const char *kvm_dev, u64 ram_size, const char *name); void kvm__arch_setup_firmware(struct kvm *kvm); bool kvm__arch_cpu_supports_vm(void); +void kvm__arch_periodic_poll(struct kvm *kvm); int load_flat_binary(struct kvm *kvm, int fd); bool load_bzimage(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *kernel_cmdline, u16 vidmode); diff --git a/tools/kvm/x86/kvm.c b/tools/kvm/x86/kvm.c index 75e4a52..45dcb77 100644 --- a/tools/kvm/x86/kvm.c +++ b/tools/kvm/x86/kvm.c @@ -4,6 +4,8 @@ #include "kvm/interrupt.h" #include "kvm/mptable.h" #include "kvm/util.h" +#include "kvm/8250-serial.h" +#include "kvm/virtio-console.h" #include #include @@ -358,3 +360,9 @@ void kvm__arch_setup_firmware(struct kvm *kvm) /* MP table */ mptable_setup(kvm, kvm->nrcpus); } + +void kvm__arch_periodic_poll(struct kvm *kvm) +{ + serial8250__inject_interrupt(kvm); + virtio_console__inject_interrupt(kvm); +}