From patchwork Wed Sep 5 08:31:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 1406621 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1B87F3FC71 for ; Wed, 5 Sep 2012 08:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758176Ab2IEIgY (ORCPT ); Wed, 5 Sep 2012 04:36:24 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:40454 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758162Ab2IEIgU (ORCPT ); Wed, 5 Sep 2012 04:36:20 -0400 Received: by mail-we0-f174.google.com with SMTP id x8so223930wey.19 for ; Wed, 05 Sep 2012 01:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=qXqmZsdKx8bs/+Tizycg94tJYHneYfyKE8JzeGB17pk=; b=QrxCLMpOkEQqXu9jUqV16mOUqardFvjLPx6kyh4M55LhBf9021vn8WKPvlx7jwrfJo y9bRVAwoCkx7M0SiSSs2A3U/9Nl/UOBD9lhVJWqZh5d/XEBB0vuENx4mnUnxDh1FkI6C dWroM5Yx/7deJST1pFqk+JAAQzom7Kzv6A30FT3gJKkN1sGQohCFJaJLHoEXo5lbSoFJ KnNCKr6rOPtszPice+rhMtFJ8u1Gk1GUfx9/4iin6A8VMa02+clNrIy9oIMuwFVP6LUB HF5Lq7LSd/Fn/x4SXLPBPgnbfxLa49BhsFyzjw+NKAV4oy37VlRiY/m9RkEyMHtuMfHD jmXw== Received: by 10.180.102.136 with SMTP id fo8mr36394834wib.19.1346834179927; Wed, 05 Sep 2012 01:36:19 -0700 (PDT) Received: from lappy.capriciverd.com (20.Red-80-59-140.staticIP.rima-tde.net. [80.59.140.20]) by mx.google.com with ESMTPS id q4sm27971068wix.9.2012.09.05.01.36.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 01:36:18 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: asias.hejun@gmail.com, mingo@elte.hu, gorcunov@openvz.org, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 23/33] kvm tools: kbd initialization check Date: Wed, 5 Sep 2012 10:31:57 +0200 Message-Id: <1346833927-15740-24-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346833927-15740-1-git-send-email-levinsasha928@gmail.com> References: <1346833927-15740-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Check if i8042 is supported only within the initialization call itself, so that builtin-run won't need to know which archs are supported by it. Signed-off-by: Sasha Levin --- tools/kvm/builtin-run.c | 8 +++++--- tools/kvm/hw/i8042.c | 8 +++++++- tools/kvm/include/kvm/i8042.h | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c index ac03b75..96a3d70 100644 --- a/tools/kvm/builtin-run.c +++ b/tools/kvm/builtin-run.c @@ -818,9 +818,11 @@ static int kvm_cmd_run_init(int argc, const char **argv) kvm__init_ram(kvm); -#ifdef CONFIG_X86 - kbd__init(kvm); -#endif + r = kbd__init(kvm); + if (r < 0) { + pr_err("kbd__init() failed with error %d\n", r); + goto fail; + } r = pci_shmem__init(kvm); if (r < 0) { diff --git a/tools/kvm/hw/i8042.c b/tools/kvm/hw/i8042.c index 40f8a38..fac54ca 100644 --- a/tools/kvm/hw/i8042.c +++ b/tools/kvm/hw/i8042.c @@ -339,10 +339,16 @@ static struct ioport_operations kbd_ops = { .io_out = kbd_out, }; -void kbd__init(struct kvm *kvm) +int kbd__init(struct kvm *kvm) { +#ifndef CONFIG_X86 + return 0; +#endif + kbd_reset(); state.kvm = kvm; ioport__register(I8042_DATA_REG, &kbd_ops, 2, NULL); ioport__register(I8042_COMMAND_REG, &kbd_ops, 2, NULL); + + return 0; } diff --git a/tools/kvm/include/kvm/i8042.h b/tools/kvm/include/kvm/i8042.h index 13f18e2..3b4ab68 100644 --- a/tools/kvm/include/kvm/i8042.h +++ b/tools/kvm/include/kvm/i8042.h @@ -7,6 +7,6 @@ struct kvm; void mouse_queue(u8 c); void kbd_queue(u8 c); -void kbd__init(struct kvm *kvm); +int kbd__init(struct kvm *kvm); #endif