debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501)
PATCH 1/2 debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501)
Add generic support for simple I/O port which, when written to, cause QEMU to exit with the given written value.
There is no vmstate associated with the debugging port, simply because the entire interface is a single, stateless, write-only port.
--- hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/Makefile.objs | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 hw/debugexit.c
hw/debugexit.c new file +68 -0
@@ -0,0 +1,68 @@ +/* +* QEMU debug exit port ("LGPL'ed-VGA-BIOS-style port 501/502") emulation +* +* Copyright (c) 2012 Herve Poussineau +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "isa.h" + +typedef struct ISADebugExitState { +ISADevice dev; +uint32_t iobase; +uint8_t access_size; +}ISADebugExitState ; + +static void debugexit_ioport_write (void *opaque,uint32_t addr,uint32_t val) +{ +exit ((val <<1 ) |1 ); +} + +static int debugexit_isa_initfn (ISADevice *dev) +{ +ISADebugExitState *isa =DO_UPCAST (ISADebugExitState, dev, dev); + +register_ioport_write (isa->iobase,1 , isa->access_size, + debugexit_ioport_write,NULL ); +return 0 ; +} + +static Property debugexit_isa_properties[] = { +DEFINE_PROP_HEX32 ("iobase" , ISADebugExitState, iobase,0x501 ), +DEFINE_PROP_UINT8 ("access-size" , ISADebugExitState, access_size,1 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void debugexit_isa_class_initfn (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *ic =ISA_DEVICE_CLASS (klass); + ic->init = debugexit_isa_initfn; + dc->props = debugexit_isa_properties; +} + +static TypeInfo debugexit_isa_info = { + .name ="isa-debugexit" , + .parent =TYPE_ISA_DEVICE , + .instance_size =sizeof (ISADebugExitState), + .class_init = debugexit_isa_class_initfn, +}; + +static void debugexit_register_types (void ) +{ +type_register_static (&debugexit_isa_info); +} + +type_init (debugexit_register_types)
hw/i386/Makefile.objs +1 -1
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o obj-y += vmport.o obj-y += pci-hotplug.o smbios.o wdt_ib700.o -obj-y += debugcon.o multiboot.o +obj-y += debugcon.o debugexit.o multiboot.o obj-y += pc_piix.o obj-y += pc_sysfw.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
Signature · 1 line
1.7.10
PATCH 2/2 pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Debug output ports (enabled by DEBUG_BIOS define) can be replaced by:
-chardev stdio,id=debugcon,mux=on
-device isa-debugcon,iobase=0x402,chardev=debugcon
-device isa-debugcon,iobase=0x403,chardev=debugcon
-device isa-debugcon,iobase=0x500,chardev=debugcon
-device isa-debugcon,iobase=0x503,chardev=debugcon
QEMU exit (which can be guest trigged) can be replaced by:
-device isa-debugexit,iobase=0x501
-device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2
---
Anthony, this patch is a follow-up of a patch I sent in March 2012:
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg00031.html
Will you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
hw/pc.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)
hw/pc.c +0 -35
@@ -49,9 +49,6 @@#include "exec-memory.h" #include "arch_init.h" -/* output Bochs bios info messages */ -//#define DEBUG_BIOS -/* debug PC/ISA interrupts */ //#define DEBUG_IRQ
@@ -540,17 +537,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)static int shutdown_index =0 ;switch (addr) { -/* Bochs BIOS messages */ -case 0x400 : -case 0x401 : -/* used to be panic, now unused */ -break ; -case 0x402 : -case 0x403 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ;case 0x8900 :/* same as Bochs power off */ if (val == shutdown_str[shutdown_index]) {
@@ -563,17 +549,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) shutdown_index =0 ; }break ; - -/* LGPL'ed VGA BIOS messages */ -case 0x501 : -case 0x502 : -exit ((val <<1 ) |1 ); -case 0x500 : -case 0x503 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ; } }
@@ -602,18 +577,8 @@ static void *bochs_bios_init(void)uint64_t *numa_fw_cfg;int i, j; -register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x402 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x403 ,1 ,1 , bochs_bios_write,NULL );register_ioport_write (0x8900 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x502 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x500 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x503 ,1 ,1 , bochs_bios_write,NULL ); - fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );
Signature · 1 line
1.7.10
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Ping.
Quoted 93 lines · Hervé Poussineau
Debug output ports (enabled by
DEBUG_BIOSdefine) can be replaced by:(quoted diff) +0
-5-chardev stdio,id=debugcon,mux=on -device isa-debugcon,iobase=0x402,chardev=debugcon -device isa-debugcon,iobase=0x403,chardev=debugcon -device isa-debugcon,iobase=0x500,chardev=debugcon -device isa-debugcon,iobase=0x503,chardev=debugconQEMU exit (which can be guest trigged) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2Signed-off-by Hervé Poussineau <[email protected]>---
Anthony, this patch is a follow-up of a patch I sent in March 2012:
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg00031.htmlWill you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
hw/pc.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)hw/pc.c +0
-35@@ -49,9 +49,6 @@#include "exec-memory.h" #include "arch_init.h" -/* output Bochs bios info messages */ -//#define DEBUG_BIOS -/* debug PC/ISA interrupts */ //#define DEBUG_IRQ @@ -540,17 +537,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)static int shutdown_index =0 ;switch (addr) { -/* Bochs BIOS messages */ -case 0x400 : -case 0x401 : -/* used to be panic, now unused */ -break ; -case 0x402 : -case 0x403 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ;case 0x8900 :/* same as Bochs power off */ if (val == shutdown_str[shutdown_index]) {@@ -563,17 +549,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) shutdown_index =0 ; }break ; - -/* LGPL'ed VGA BIOS messages */ -case 0x501 : -case 0x502 : -exit ((val <<1 ) |1 ); -case 0x500 : -case 0x503 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ; } }@@ -602,18 +577,8 @@ static void *bochs_bios_init(void)uint64_t *numa_fw_cfg;int i, j; -register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x402 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x403 ,1 ,1 , bochs_bios_write,NULL );register_ioport_write (0x8900 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x502 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x500 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x503 ,1 ,1 , bochs_bios_write,NULL ); - fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
In reply to Hervé PoussineauQuoted 83 lines · Hervé Poussineau
Debug output ports (enabled by
DEBUG_BIOSdefine) can be replaced by:(quoted diff) +0
-5-chardev stdio,id=debugcon,mux=on -device isa-debugcon,iobase=0x402,chardev=debugcon -device isa-debugcon,iobase=0x403,chardev=debugcon -device isa-debugcon,iobase=0x500,chardev=debugcon -device isa-debugcon,iobase=0x503,chardev=debugconQEMU exit (which can be guest trigged) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2Signed-off-by Hervé Poussineau<[email protected]>---
Anthony, this patch is a follow-up of a patch I sent in March 2012:
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg00031.htmlWill you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
hw/pc.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)hw/pc.c +0
-29@@ -49,9 +49,6 @@#include "exec-memory.h" #include "arch_init.h" -/* output Bochs bios info messages */ -//#define DEBUG_BIOS -/* debug PC/ISA interrupts */ //#define DEBUG_IRQ @@ -540,17 +537,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val)static int shutdown_index =0 ;switch (addr) { -/* Bochs BIOS messages */ -case 0x400 : -case 0x401 : -/* used to be panic, now unused */ -break ; -case 0x402 : -case 0x403 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ;case 0x8900 :/* same as Bochs power off */ if (val == shutdown_str[shutdown_index]) {@@ -563,17 +549,6 @@ static void bochs_bios_write(void *opaque, uint32_t addr, uint32_t val) shutdown_index =0 ; }break ; - -/* LGPL'ed VGA BIOS messages */ -case 0x501 : -case 0x502 : -exit ((val<<1 ) |1 ); -case 0x500 : -case 0x503 : -#ifdef DEBUG_BIOS -fprintf (stderr,"%c" , val); -#endif -break ; } }@@ -602,18 +577,8 @@ static void *bochs_bios_init(void)uint64_t *numa_fw_cfg;int i, j; -register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x402 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x403 ,1 ,1 , bochs_bios_write,NULL );register_ioport_write (0x8900 ,1 ,1 , bochs_bios_write,NULL );
hw/pc.c static void *bochs_bios_init(void) · line 584
Quoted 10 lines
hw/pc.c +0
-6-register_ioport_write (0x501 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x502 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x500 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x503 ,1 ,1 , bochs_bios_write,NULL ); - fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );
Removing this from the default PC breaks compatibility. I don't mind having a way to disable it but it needs to be there by default.
Among other things, my test suite depends on these ports.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Quoted 22 lines · Anthony Liguori
Quoted 21 lines · Hervé Poussineau
Debug output ports (enabled by
DEBUG_BIOSdefine) can be replaced by:(quoted diff) +0
-5-chardev stdio,id=debugcon,mux=on -device isa-debugcon,iobase=0x402,chardev=debugcon -device isa-debugcon,iobase=0x403,chardev=debugcon -device isa-debugcon,iobase=0x500,chardev=debugcon -device isa-debugcon,iobase=0x503,chardev=debugconQEMU exit (which can be guest triggered) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2Signed-off-by Hervé Poussineau<[email protected]>---
Anthony, this patch is a follow-up of a patch I sent in March 2012:
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg00031.htmlWill you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
[...]
Quoted 19 lines
Quoted 19 lines
hw/pc.c +0
-10@@ -602,18 +577,8 @@ static void *bochs_bios_init(void)uint64_t *numa_fw_cfg;int i, j; -register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x402 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x403 ,1 ,1 , bochs_bios_write,NULL );register_ioport_write (0x8900 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x502 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x500 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x503 ,1 ,1 , bochs_bios_write,NULL ); - fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );
Quoted 6 lines
hw/pc.c static void *bochs_bios_init(void) · line 584
Quoted 1 line
hw/pc.c +0
-0fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );Removing this from the default PC breaks compatibility. I don't mind having a way to disable it but it needs to be there by default.
Among other things, my test suite depends on these ports.
OK for keeping them on compat PC machines.
However, for current ones (1.2 or later), I don't want to have them by default as it is an QEMU exit which is guest triggerable. Will you accept this approach, where your regression suite will require
a new parameter "-device isa-debugexit,iobase=0x501" ?
Regards,
Hervé
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Quoted 50 lines · Hervé Poussineau
Quoted 22 lines · Anthony Liguori
Quoted 21 lines · Hervé Poussineau
Debug output ports (enabled by
DEBUG_BIOSdefine) can be replaced by:(quoted diff) +0
-5-chardev stdio,id=debugcon,mux=on -device isa-debugcon,iobase=0x402,chardev=debugcon -device isa-debugcon,iobase=0x403,chardev=debugcon -device isa-debugcon,iobase=0x500,chardev=debugcon -device isa-debugcon,iobase=0x503,chardev=debugconQEMU exit (which can be guest triggered) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2Signed-off-by Hervé Poussineau<[email protected]>---
Anthony, this patch is a follow-up of a patch I sent in March 2012:
http://lists.gnu.org/archive/html/qemu-devel/2012-03/msg00031.htmlWill you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
[...]
Quoted 24 lines
Quoted 10 lines
hw/pc.c +0
-4@@ -602,18 +577,8 @@ static void *bochs_bios_init(void)uint64_t *numa_fw_cfg;int i, j; -register_ioport_write (0x400 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x401 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x402 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x403 ,1 ,1 , bochs_bios_write,NULL );register_ioport_write (0x8900 ,1 ,1 , bochs_bios_write,NULL );hw/pc.c static void *bochs_bios_init(void) · line 584
Quoted 10 lines
hw/pc.c +0
-6-register_ioport_write (0x501 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x501 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x502 ,1 ,2 , bochs_bios_write,NULL ); -register_ioport_write (0x500 ,1 ,1 , bochs_bios_write,NULL ); -register_ioport_write (0x503 ,1 ,1 , bochs_bios_write,NULL ); - fw_cfg =fw_cfg_init (BIOS_CFG_IOPORT ,BIOS_CFG_IOPORT +1 ,0 ,0 );fw_cfg_add_i32 (fw_cfg,FW_CFG_ID ,1 );Removing this from the default PC breaks compatibility. I don't mind having a way to disable it but it needs to be there by default.
Quoted 8 lines
Quoted 2 lines
Among other things, my test suite depends on these ports.
OK for keeping them on compat PC machines.
However, for current ones (1.2 or later), I don't want to have them by default as it is an QEMU exit which is guest triggerable. Will you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
Yes although I'd prefer the iobase not be required to be explicitly specified.
Regards,
Anthony Liguori
Quoted 4 lines
Regards,
Hervé
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Hervé Poussineau
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Hervé Poussineau
QEMU exit (which can be guest triggered) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2
[...]
Quoted 6 lines
Quoted 3 lines
However, for current ones (1.2 or later), I don't want to have them by default as it is an QEMU exit which is guest triggerable. Will you accept this approach, where your regression suite will require
a new parameter "-device isa-debugexit,iobase=0x501" ?Yes although I'd prefer the iobase not be required to be explicitly specified.
Which one are you using? iobase 0x501 or 0x502? And with access size 1 or 2?
Regards,
Hervé
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Am 01.08.2012 17:48, schrieb Hervé Poussineau:
Quoted 18 lines
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Hervé Poussineau
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Hervé Poussineau
QEMU exit (which can be guest triggered) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2[...]
Quoted 5 lines
Quoted 4 lines
However, for current ones (1.2 or later), I don't want to have them by default as it is an QEMU exit which is guest triggerable. Will you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
Quoted 5 lines
Quoted 2 lines
Yes although I'd prefer the iobase not be required to be explicitly specified.
Which one are you using? iobase
0x501or0x502? And with access size 1 or 2?
This discussion seems to have died out without result... Hervé, do you have a newer patchset with either of the two default addresses?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
Quoted 19 lines · Andreas Färber
Am 01.08.2012 17:48, schrieb Hervé Poussineau:
Quoted 18 lines
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Hervé Poussineau
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Hervé Poussineau
QEMU exit (which can be guest triggered) can be replaced by:
(quoted diff) +0
-3-device isa-debugexit,iobase=0x501 -device isa-debugexit,iobase=0x501,access-size=2 -device isa-debugexit,iobase=0x502,access-size=2[...]
Quoted 6 lines
Quoted 4 lines
However, for current ones (1.2 or later), I don't want to have them by default as it is an QEMU exit which is guest triggerable. Will you accept this approach, where your regression suite will require a new parameter "-device isa-debugexit,iobase=0x501" ?
Yes although I'd prefer the iobase not be required to be explicitly specified.
Quoted 8 lines
Quoted 2 lines
Which one are you using? iobase
0x501or0x502? And with access size 1 or 2?This discussion seems to have died out without result... Hervé, do you have a newer patchset with either of the two default addresses?
Andreas
I may only need to change the default iobase and access-size values in first patch. They are currently at 0x501 with an access size of 1, but I got no answer from Anthony if those are the values he wants.
Hervé
Am 06.07.2012 23:53, schrieb Hervé Poussineau:
Quoted 39 lines
Add generic support for simple I/O port which, when written to, cause QEMU to exit with the given written value.
There is no vmstate associated with the debugging port, simply because the entire interface is a single, stateless, write-only port.
Signed-off-by Hervé Poussineau <[email protected]>--- hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/Makefile.objs | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 hw/debugexit.chw/debugexit.c new file +20
-0@@ -0,0 +1,68 @@ +/* +* QEMU debug exit port ("LGPL'ed-VGA-BIOS-style port 501/502") emulation +* +* Copyright (c) 2012 Herve Poussineau +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "isa.h"
hw/debugexit.c line 30
Quoted 10 lines
hw/debugexit.c new file +10
-0+ +typedef struct ISADebugExitState { +ISADevice dev; +uint32_t iobase; +uint8_t access_size; +}ISADebugExitState ; + +static void debugexit_ioport_write (void *opaque,uint32_t addr,uint32_t val) +{ +exit ((val <<1 ) |1 );
I understand you're just moving code from patch 2/2 here, but in another thread it was stated that exit()ing from such writes can do bad things to the block layer (cleanups not happening) and should be replaced by qemu_request_shutdown() or something like that...
Andreas
Quoted 52 lines
hw/debugexit.c new file +38
-0+} + +static int debugexit_isa_initfn (ISADevice *dev) +{ +ISADebugExitState *isa =DO_UPCAST (ISADebugExitState, dev, dev); + +register_ioport_write (isa->iobase,1 , isa->access_size, + debugexit_ioport_write,NULL ); +return 0 ; +} + +static Property debugexit_isa_properties[] = { +DEFINE_PROP_HEX32 ("iobase" , ISADebugExitState, iobase,0x501 ), +DEFINE_PROP_UINT8 ("access-size" , ISADebugExitState, access_size,1 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void debugexit_isa_class_initfn (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *ic =ISA_DEVICE_CLASS (klass); + ic->init = debugexit_isa_initfn; + dc->props = debugexit_isa_properties; +} + +static TypeInfo debugexit_isa_info = { + .name ="isa-debugexit" , + .parent =TYPE_ISA_DEVICE , + .instance_size =sizeof (ISADebugExitState), + .class_init = debugexit_isa_class_initfn, +}; + +static void debugexit_register_types (void ) +{ +type_register_static (&debugexit_isa_info); +} + +type_init (debugexit_register_types)hw/i386/Makefile.objs +1
-1@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o obj-y += vmport.o obj-y += pci-hotplug.o smbios.o wdt_ib700.o -obj-y += debugcon.o multiboot.o +obj-y += debugcon.o debugexit.o multiboot.o obj-y += pc_piix.o obj-y += pc_sysfw.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 47 lines · Andreas Färber
Am 06.07.2012 23:53, schrieb Hervé Poussineau:
Quoted 46 lines
Add generic support for simple I/O port which, when written to, cause QEMU to exit with the given written value.
There is no vmstate associated with the debugging port, simply because the entire interface is a single, stateless, write-only port.
Signed-off-by Hervé Poussineau <[email protected]>--- hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/Makefile.objs | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 hw/debugexit.chw/debugexit.c new file +27
-0@@ -0,0 +1,68 @@ +/* +* QEMU debug exit port ("LGPL'ed-VGA-BIOS-style port 501/502") emulation +* +* Copyright (c) 2012 Herve Poussineau +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* See the GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "isa.h" + +typedef struct ISADebugExitState { +ISADevice dev; +uint32_t iobase; +uint8_t access_size; +}ISADebugExitState ; +
Quoted 8 lines
hw/debugexit.c line 30
Quoted 3 lines
hw/debugexit.c new file +3
-0+static void debugexit_ioport_write (void *opaque,uint32_t addr,uint32_t val) +{ +exit ((val <<1 ) |1 );I understand you're just moving code from patch 2/2 here, but in another thread it was stated that exit()ing from such writes can do bad things to the block layer (cleanups not happening) and should be replaced by
qemu_request_shutdown()or something like that...
Not really. This is the right behavior for this port.
Regards,
Anthony Liguori
Quoted 60 lines
Andreas
Quoted 52 lines
hw/debugexit.c new file +38
-0+} + +static int debugexit_isa_initfn (ISADevice *dev) +{ +ISADebugExitState *isa =DO_UPCAST (ISADebugExitState, dev, dev); + +register_ioport_write (isa->iobase,1 , isa->access_size, + debugexit_ioport_write,NULL ); +return 0 ; +} + +static Property debugexit_isa_properties[] = { +DEFINE_PROP_HEX32 ("iobase" , ISADebugExitState, iobase,0x501 ), +DEFINE_PROP_UINT8 ("access-size" , ISADebugExitState, access_size,1 ), +DEFINE_PROP_END_OF_LIST (), +}; + +static void debugexit_isa_class_initfn (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); +ISADeviceClass *ic =ISA_DEVICE_CLASS (klass); + ic->init = debugexit_isa_initfn; + dc->props = debugexit_isa_properties; +} + +static TypeInfo debugexit_isa_info = { + .name ="isa-debugexit" , + .parent =TYPE_ISA_DEVICE , + .instance_size =sizeof (ISADebugExitState), + .class_init = debugexit_isa_class_initfn, +}; + +static void debugexit_register_types (void ) +{ +type_register_static (&debugexit_isa_info); +} + +type_init (debugexit_register_types)hw/i386/Makefile.objs +1
-1@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o obj-y += vmport.o obj-y += pci-hotplug.o smbios.o wdt_ib700.o -obj-y += debugcon.o multiboot.o +obj-y += debugcon.o debugexit.o multiboot.o obj-y += pc_piix.o obj-y += pc_sysfw.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.oSignature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg