From patchwork Fri Jan 11 09:18:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 211254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 547CD2C01C8 for ; Fri, 11 Jan 2013 20:19:32 +1100 (EST) Received: from localhost ([::1]:50191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttalu-0002Vi-Ep for incoming@patchwork.ozlabs.org; Fri, 11 Jan 2013 04:19:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttakz-0000JH-4J for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ttakt-0005fd-9v for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ttakt-0005fO-0v for qemu-devel@nongnu.org; Fri, 11 Jan 2013 04:18:27 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0B9IPqg020770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Jan 2013 04:18:25 -0500 Received: from localhost (dhcp-64-10.muc.redhat.com [10.32.64.10]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0B9IOUi006585; Fri, 11 Jan 2013 04:18:24 -0500 From: Stefan Hajnoczi To: Date: Fri, 11 Jan 2013 10:18:06 +0100 Message-Id: <1357895886-14283-7-git-send-email-stefanha@redhat.com> In-Reply-To: <1357895886-14283-1-git-send-email-stefanha@redhat.com> References: <1357895886-14283-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Julien Grall , Anthony Liguori , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion 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: Julien Grall The commit 258711 introduced MemoryRegion to replace ioport_region* for ioport 80h and F0h. A MemoryRegion needs to have both read and write callback otherwise a segfault will occur when an access is made. The previous behaviour of this both ioport is to return 0xffffffffffffffff. So keep this behaviour. Reported-by: Adam Lackorzynski Signed-off-by: Julien Grall Tested-by: Adam Lackorzynski Signed-off-by: Stefan Hajnoczi --- hw/pc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/pc.c b/hw/pc.c index df0c48e..90b1bf7 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data, { } +static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size) +{ + return 0xffffffffffffffff; +} + /* MSDOS compatibility mode FPU exception support */ static qemu_irq ferr_irq; @@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data, qemu_irq_lower(ferr_irq); } +static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size) +{ + return 0xffffffffffffffff; +} + /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { @@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level) static const MemoryRegionOps ioport80_io_ops = { .write = ioport80_write, + .read = ioport80_read, .endianness = DEVICE_NATIVE_ENDIAN, .impl = { .min_access_size = 1, @@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = { static const MemoryRegionOps ioportF0_io_ops = { .write = ioportF0_write, + .read = ioportF0_read, .endianness = DEVICE_NATIVE_ENDIAN, .impl = { .min_access_size = 1,