qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	Avi Kivity <avi@redhat.com>,
	"afaerber@suse.de" <afaerber@suse.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] pc: Don't listen on debug ports by default
Date: Tue, 11 Sep 2012 13:14:40 +0100	[thread overview]
Message-ID: <504F2B30.80306@citrix.com> (raw)
In-Reply-To: <504F273B.4050602@siemens.com>

On 09/11/2012 12:57 PM, Jan Kiszka wrote:

> 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 <jan.kiszka@siemens.com>
>>
>> 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 <jan.kiszka@siemens.com>
> ---
>  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]) {


Is it possible to modify this part:

> @@ -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);


by something like that:

--------------------------
@@ -592,7 +592,9 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
 
 static const MemoryRegionPortio bochs_bios_portio_list[] = {
     { 0x400, 2, 2, .write = bochs_bios_write, }, /* 0x400 */
+#ifdef DEBUG_BIOS
     { 0x402, 2, 1, .write = bochs_bios_write, }, /* 0x402 */
+#endif
     { 0x500, 1, 1, .write = bochs_bios_write, }, /* 0x500 */
     { 0x501, 1, 1, .write = bochs_bios_write, }, /* 0x501 */
     { 0x501, 2, 2, .write = bochs_bios_write, }, /* 0x501 */

---------------------------
So it can be applied just after: "memory: unify ioport registration"
patch series.Otherwise, I will modify my patch series.

--
Julien Grall

  reply	other threads:[~2012-09-11 12:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 15:13 [Qemu-devel] [PATCH V9 0/8] memory: unify ioport registration Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 1/8] isa: add isa_address_space_io Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 2/8] hw/apm.c: replace register_ioport* Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 3/8] smb: replace_register_ioport* Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 4/8] hw/acpi_piix4.c: replace register_ioport* Julien Grall
2012-09-09 14:22   ` Avi Kivity
2012-09-10 10:37     ` Julien Grall
2012-09-10 10:44       ` Avi Kivity
2012-09-10 17:27         ` Julien Grall
2012-09-10 17:29           ` Jan Kiszka
2012-09-10 17:41             ` Stefano Stabellini
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 5/8] hw/cirrus_vga.c: " Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 6/8] hw/serial.c: " Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 7/8] hw/pc.c: " Julien Grall
2012-09-04 15:13 ` [Qemu-devel] [PATCH V9 8/8] hw/dma.c: " Julien Grall
2012-09-04 22:04 ` [Qemu-devel] [PATCH V9 0/8] memory: unify ioport registration Julien Grall
2012-09-10 17:53 ` [Qemu-devel] [PATCH V9 4/8] hw/acpi_piix4.c: replace register_ioport* Julien Grall
2012-09-11  9:15 ` [Qemu-devel] [PATCH V9 0/8] memory: unify ioport registration Avi Kivity
2012-09-11  9:25   ` Avi Kivity
2012-09-11 11:27     ` Julien Grall
2012-09-11 11:48       ` Jan Kiszka
2012-09-11 11:57         ` [Qemu-devel] [PATCH] pc: Don't listen on debug ports by default Jan Kiszka
2012-09-11 12:14           ` Julien Grall [this message]
2012-09-11 12:19             ` Jan Kiszka
2012-09-11 12:53           ` Avi Kivity
2012-09-11 14:11             ` Jan Kiszka
2012-09-11 14:19               ` Avi Kivity
2012-09-11 14:26                 ` Jan Kiszka
2012-09-11 14:34                   ` Andreas Färber
2012-09-19 10:08 ` [Qemu-devel] [PATCH V9 0/8] memory: unify ioport registration Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504F2B30.80306@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=afaerber@suse.de \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).