* [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501)
@ 2012-07-06 21:53 Hervé Poussineau
2012-07-06 21:53 ` [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports Hervé Poussineau
2012-08-01 14:30 ` [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Andreas Färber
0 siblings, 2 replies; 11+ messages in thread
From: Hervé Poussineau @ 2012-07-06 21:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Hervé Poussineau
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 <hpoussin@reactos.org>
---
hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
hw/i386/Makefile.objs | 2 +-
2 files changed, 69 insertions(+), 1 deletion(-)
create mode 100644 hw/debugexit.c
diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 0000000..72ddf31
--- /dev/null
+++ b/hw/debugexit.c
@@ -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)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index eb171b7..23be2d3 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -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
--
1.7.10
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-07-06 21:53 [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Hervé Poussineau
@ 2012-07-06 21:53 ` Hervé Poussineau
2012-07-29 11:33 ` Hervé Poussineau
2012-08-01 13:59 ` Anthony Liguori
2012-08-01 14:30 ` [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Andreas Färber
1 sibling, 2 replies; 11+ messages in thread
From: Hervé Poussineau @ 2012-07-06 21:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Hervé Poussineau
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
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
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(-)
diff --git a/hw/pc.c b/hw/pc.c
index c7e9ab3..a328fb2 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -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);
--
1.7.10
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-07-06 21:53 ` [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports Hervé Poussineau
@ 2012-07-29 11:33 ` Hervé Poussineau
2012-08-01 13:59 ` Anthony Liguori
1 sibling, 0 replies; 11+ messages in thread
From: Hervé Poussineau @ 2012-07-29 11:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori
Ping.
Hervé Poussineau a écrit :
> 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
>
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>
> 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(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index c7e9ab3..a328fb2 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -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);
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-07-06 21:53 ` [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports Hervé Poussineau
2012-07-29 11:33 ` Hervé Poussineau
@ 2012-08-01 13:59 ` Anthony Liguori
2012-08-01 15:21 ` Hervé Poussineau
1 sibling, 1 reply; 11+ messages in thread
From: Anthony Liguori @ 2012-08-01 13:59 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: qemu-devel
On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
> 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
>
> Signed-off-by: Hervé Poussineau<hpoussin@reactos.org>
> ---
>
> 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(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index c7e9ab3..a328fb2 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -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);
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501)
2012-07-06 21:53 [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Hervé Poussineau
2012-07-06 21:53 ` [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports Hervé Poussineau
@ 2012-08-01 14:30 ` Andreas Färber
2012-08-01 14:58 ` Anthony Liguori
1 sibling, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2012-08-01 14:30 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: Kevin Wolf, Anthony Liguori, qemu-devel
Am 06.07.2012 23:53, schrieb Hervé Poussineau:
> 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 <hpoussin@reactos.org>
> ---
> hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
> hw/i386/Makefile.objs | 2 +-
> 2 files changed, 69 insertions(+), 1 deletion(-)
> create mode 100644 hw/debugexit.c
>
> diff --git a/hw/debugexit.c b/hw/debugexit.c
> new file mode 100644
> index 0000000..72ddf31
> --- /dev/null
> +++ b/hw/debugexit.c
> @@ -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);
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
> +}
> +
> +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)
> diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
> index eb171b7..23be2d3 100644
> --- a/hw/i386/Makefile.objs
> +++ b/hw/i386/Makefile.objs
> @@ -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
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501)
2012-08-01 14:30 ` [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Andreas Färber
@ 2012-08-01 14:58 ` Anthony Liguori
0 siblings, 0 replies; 11+ messages in thread
From: Anthony Liguori @ 2012-08-01 14:58 UTC (permalink / raw)
To: Andreas Färber, Hervé Poussineau; +Cc: Kevin Wolf, qemu-devel
Andreas Färber <afaerber@suse.de> writes:
> Am 06.07.2012 23:53, schrieb Hervé Poussineau:
>> 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 <hpoussin@reactos.org>
>> ---
>> hw/debugexit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
>> hw/i386/Makefile.objs | 2 +-
>> 2 files changed, 69 insertions(+), 1 deletion(-)
>> create mode 100644 hw/debugexit.c
>>
>> diff --git a/hw/debugexit.c b/hw/debugexit.c
>> new file mode 100644
>> index 0000000..72ddf31
>> --- /dev/null
>> +++ b/hw/debugexit.c
>> @@ -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);
>
> 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
>
> Andreas
>
>> +}
>> +
>> +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)
>> diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
>> index eb171b7..23be2d3 100644
>> --- a/hw/i386/Makefile.objs
>> +++ b/hw/i386/Makefile.objs
>> @@ -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
>>
>
>
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-08-01 13:59 ` Anthony Liguori
@ 2012-08-01 15:21 ` Hervé Poussineau
2012-08-01 15:37 ` Anthony Liguori
0 siblings, 1 reply; 11+ messages in thread
From: Hervé Poussineau @ 2012-08-01 15:21 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
Anthony Liguori a écrit :
> On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
>> 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 triggered) 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
>>
>> Signed-off-by: Hervé Poussineau<hpoussin@reactos.org>
>> ---
>>
>> 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" ?
>>
[...]
>>
>> @@ -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);
>
> 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é
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-08-01 15:21 ` Hervé Poussineau
@ 2012-08-01 15:37 ` Anthony Liguori
2012-08-01 15:48 ` Hervé Poussineau
0 siblings, 1 reply; 11+ messages in thread
From: Anthony Liguori @ 2012-08-01 15:37 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: qemu-devel
Hervé Poussineau <hpoussin@reactos.org> writes:
> Anthony Liguori a écrit :
>> On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
>>> 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 triggered) 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
>>>
>>> Signed-off-by: Hervé Poussineau<hpoussin@reactos.org>
>>> ---
>>>
>>> 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" ?
>>>
>
> [...]
>
>>>
>>> @@ -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);
>>
>> 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" ?
Yes although I'd prefer the iobase not be required to be explicitly
specified.
Regards,
Anthony Liguori
>
> Regards,
>
> Hervé
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-08-01 15:37 ` Anthony Liguori
@ 2012-08-01 15:48 ` Hervé Poussineau
2012-09-11 14:50 ` Andreas Färber
0 siblings, 1 reply; 11+ messages in thread
From: Hervé Poussineau @ 2012-08-01 15:48 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
Anthony Liguori a écrit :
> Hervé Poussineau <hpoussin@reactos.org> writes:
>
>> Anthony Liguori a écrit :
>>> On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
>>>> QEMU exit (which can be guest triggered) 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
>>>>
[...]
>> 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é
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-08-01 15:48 ` Hervé Poussineau
@ 2012-09-11 14:50 ` Andreas Färber
2012-09-11 18:30 ` Hervé Poussineau
0 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2012-09-11 14:50 UTC (permalink / raw)
To: Hervé Poussineau; +Cc: Jan Kiszka, Anthony Liguori, qemu-devel
Am 01.08.2012 17:48, schrieb Hervé Poussineau:
> Anthony Liguori a écrit :
>> Hervé Poussineau <hpoussin@reactos.org> writes:
>>
>>> Anthony Liguori a écrit :
>>>> On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
>>>>> QEMU exit (which can be guest triggered) 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
>>>>>
>
> [...]
>
>>> 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?
This discussion seems to have died out without result... Hervé, do you
have a newer patchset with either of the two default addresses?
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports
2012-09-11 14:50 ` Andreas Färber
@ 2012-09-11 18:30 ` Hervé Poussineau
0 siblings, 0 replies; 11+ messages in thread
From: Hervé Poussineau @ 2012-09-11 18:30 UTC (permalink / raw)
To: Andreas Färber; +Cc: Jan Kiszka, Anthony Liguori, qemu-devel
Andreas Färber a écrit :
> Am 01.08.2012 17:48, schrieb Hervé Poussineau:
>> Anthony Liguori a écrit :
>>> Hervé Poussineau <hpoussin@reactos.org> writes:
>>>
>>>> Anthony Liguori a écrit :
>>>>> On 07/06/2012 04:53 PM, Hervé Poussineau wrote:
>>>>>> QEMU exit (which can be guest triggered) 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
>>>>>>
>> [...]
>>
>>>> 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?
>
> 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é
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-09-11 18:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-06 21:53 [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Hervé Poussineau
2012-07-06 21:53 ` [Qemu-devel] [PATCH 2/2] pc: remove DEBUG_BIOS define and QEMU exit I/O ports Hervé Poussineau
2012-07-29 11:33 ` Hervé Poussineau
2012-08-01 13:59 ` Anthony Liguori
2012-08-01 15:21 ` Hervé Poussineau
2012-08-01 15:37 ` Anthony Liguori
2012-08-01 15:48 ` Hervé Poussineau
2012-09-11 14:50 ` Andreas Färber
2012-09-11 18:30 ` Hervé Poussineau
2012-08-01 14:30 ` [Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (e.g LGPL'ed VGA BIOS port 0x501) Andreas Färber
2012-08-01 14:58 ` Anthony Liguori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.