From patchwork Tue Sep 11 11:57:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 183085 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 B927D2C007E for ; Tue, 11 Sep 2012 21:58:16 +1000 (EST) Received: from localhost ([::1]:48426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBP6c-00050R-SH for incoming@patchwork.ozlabs.org; Tue, 11 Sep 2012 07:58:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBP6P-0004zX-GJ for qemu-devel@nongnu.org; Tue, 11 Sep 2012 07:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBP6J-0002BN-B6 for qemu-devel@nongnu.org; Tue, 11 Sep 2012 07:58:01 -0400 Received: from goliath.siemens.de ([192.35.17.28]:22344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBP6J-0002B8-1V for qemu-devel@nongnu.org; Tue, 11 Sep 2012 07:57:55 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id q8BBvm1J000635; Tue, 11 Sep 2012 13:57:48 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q8BBvl4c001489; Tue, 11 Sep 2012 13:57:47 +0200 Message-ID: <504F273B.4050602@siemens.com> Date: Tue, 11 Sep 2012 13:57:47 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Julien Grall References: <504F0131.6090501@redhat.com> <504F037D.7020207@redhat.com> <504F2009.9040900@citrix.com> <504F24F8.5080600@siemens.com> In-Reply-To: <504F24F8.5080600@siemens.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.28 Cc: Stefano Stabellini , "kraxel@redhat.com" , Avi Kivity , "afaerber@suse.de" , "qemu-devel@nongnu.org" Subject: [Qemu-devel] [PATCH] pc: Don't listen on debug ports by default 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 On 2012-09-11 13:48, Jan Kiszka wrote: > On 2012-09-11 13:27, Julien Grall wrote: >> On 09/11/2012 10:25 AM, Avi Kivity wrote: >>> On 09/11/2012 12:15 PM, Avi Kivity wrote: >>> >>>> On 09/04/2012 06:13 PM, Julien Grall wrote: >>>> >>>>> This is the nineth version of patch series about ioport registration. >>>>> >>>>> Some part of QEMU still use register_ioport* functions to register ioport. >>>>> These functions doesn't allow to use Memory Listener on it. >>>>> >>>> Thanks, applied all (w/ updated patch 4), will push shortly. >>>> >>>> >>>> >>> Aborts with the command line >>> >>> qemu-system-x86_64 -device isa-debugcon,iobase=0x402,chardev=stdio -chardev stdio,id=stdio >>> >>> >>> >> >> I have bisected and found the problem with bochs_bios_init in hw/pc.c. >> Bosch already register the iport 0x402. I'm not sure that it's a bug. >> In fact register_ioport_read/write check if the current ioport is used >> with the opaque variable. >> Before my patch, bochs_bios_init registered it's ioport with opaque >> NULL, so if someone (like debugcon) wants to use the ioport there is >> no problem. But now, I used portio_list_init to register bochs ioport, >> so the opaque is not NULL. >> I don't really know how to resolve this problem. Perhaps we could >> just improve the debug message. > > My suggestion: > > pc: Don't listen on debug ports by default > > Only listen on debug ports when we also handle them. They are better > handled by debugcon these days which is runtime configurable. > > Signed-off-by: Jan Kiszka > > diff --git a/hw/pc.c b/hw/pc.c > index 112739a..70abf0e 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -539,9 +539,9 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) > case 0x401: > /* used to be panic, now unused */ > break; > +#ifdef DEBUG_BIOS > case 0x402: > case 0x403: > -#ifdef DEBUG_BIOS > fprintf(stderr, "%c", val); > #endif > break; > OK, ket's try properly again: ----8<----- Only listen on debug ports when we also handle them. They are better handled by debugcon these days which is runtime configurable. Signed-off-by: Jan Kiszka --- hw/pc.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 112739a..134d5f7 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -539,12 +539,12 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) case 0x401: /* used to be panic, now unused */ break; +#ifdef DEBUG_BIOS case 0x402: case 0x403: -#ifdef DEBUG_BIOS fprintf(stderr, "%c", val); -#endif break; +#endif case 0x8900: /* same as Bochs power off */ if (val == shutdown_str[shutdown_index]) { @@ -598,8 +598,10 @@ static void *bochs_bios_init(void) register_ioport_write(0x400, 1, 2, bochs_bios_write, NULL); register_ioport_write(0x401, 1, 2, bochs_bios_write, NULL); +#ifdef DEBUG_BIOS register_ioport_write(0x402, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x403, 1, 1, bochs_bios_write, NULL); +#endif register_ioport_write(0x8900, 1, 1, bochs_bios_write, NULL); register_ioport_write(0x501, 1, 1, bochs_bios_write, NULL);