parallel: Allow to disable CONFIG_PARALLEL
v3 cover parallel: Allow to disable CONFIG_PARALLEL
From: Miroslav Rezanina <[email protected]>
There's few uncoditional calls to functions in hw/char/parallel.c so disabling CONFIG_PARALLEL can cause build failure. This series allow building with CONFIG_PARALLEL disabled. In addition, it changes behavior so the run of "qemu -parallel" will abort in case target expects parallel device to exists.
Affected targets are:
- i386 (pc.c)
- mips (mips_fulong2e.c, mips_malta.c, mips_jazz.c)
- sparc64 (sun4u.c)
Miroslav Rezanina (2):
Move parallel_hds_isa_init to hw/isa/isa-bus.c
stubs: Provide parallel_mm_init stub version
hw/char/parallel.c | 25 ------------------------- hw/isa/isa-bus.c | 29 +++++++++++++++++++++++++++++ stubs/Makefile.objs | 1 + stubs/parallel.c | 8 ++++++++ 4 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 stubs/parallel.c
Signature · 1 line
2.1.0
PATCH v3 1/2 Move parallel_hds_isa_init to hw/isa/isa-bus.c
From: Miroslav Rezanina <[email protected]>
Disabling CONFIG_PARALLEL cause removing parallel_hds_isa_init defined in parallel.c. This function is called during initialization of some boards so disabling CONFIG_PARALLEL cause build failure.
This patch moves parallel_hds_isa_init to hw/isa/isa-bus.c so it is included in case of disabled CONFIG_PARALLEL. Build is successful but qemu will abort with "Unknown device" error when function is called.
--- hw/char/parallel.c | 25 ------------------------- hw/isa/isa-bus.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-)
hw/char/parallel.c +0 -25
@@ -641,28 +641,3 @@ static void parallel_register_types(void) }type_init (parallel_register_types) - -static void parallel_init(ISABus *bus, int index, CharDriverState *chr) -{ -DeviceState *dev; -ISADevice *isadev; - - isadev =isa_create (bus,"isa-parallel" ); - dev =DEVICE (isadev); -qdev_prop_set_uint32 (dev,"index" , index); -qdev_prop_set_chr (dev,"chardev" , chr); -qdev_init_nofail (dev); -} - -void parallel_hds_isa_init (ISABus *bus,int n) -{ -int i; - -assert (n <=MAX_PARALLEL_PORTS ); - -for (i =0 ; i < n; i++) { -if (parallel_hds[i]) { -parallel_init (bus, i, parallel_hds[i]); - } - } -}
hw/isa/isa-bus.c +29 -0
@@ -21,6 +21,7 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" +#include "hw/i386/pc.h" static ISABus *isabus;
@@ -267,3 +268,31 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) }type_init (isabus_register_types) + +static void parallel_init(ISABus *bus, int index, CharDriverState *chr) +{ +DeviceState *dev; +ISADevice *isadev; + + isadev =isa_try_create (bus,"isa-parallel" ); +if (!isadev) { +return ; + } + dev =DEVICE (isadev); +qdev_prop_set_uint32 (dev,"index" , index); +qdev_prop_set_chr (dev,"chardev" , chr); +qdev_init_nofail (dev); +} + +void parallel_hds_isa_init (ISABus *bus,int n) +{ +int i; + +assert (n <=MAX_PARALLEL_PORTS ); + +for (i =0 ; i < n; i++) { +if (parallel_hds[i]) { +parallel_init (bus, i, parallel_hds[i]); + } + } +}
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv3 1/2] Move parallel_hds_isa_init to hw/isa/isa-bus.c
Quoted 84 lines · On 12/05/2015 08:22, [email protected] wrote:
From: Miroslav Rezanina <[email protected]>
Disabling
CONFIG_PARALLELcause removingparallel_hds_isa_initdefined inparallel.c. This function is called during initialization of some boards so disablingCONFIG_PARALLELcause build failure.This patch moves
parallel_hds_isa_inittohw/isa/isa-bus.cso it is included in case of disabledCONFIG_PARALLEL. Build is successful but qemu will abort with "Unknown device" error when function is called.Signed-off-by Miroslav Rezanina <[email protected]>--- hw/char/parallel.c | 25 ------------------------- hw/isa/isa-bus.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-)hw/char/parallel.c +0
-25@@ -641,28 +641,3 @@ static void parallel_register_types(void) }type_init (parallel_register_types) - -static void parallel_init(ISABus *bus, int index, CharDriverState *chr) -{ -DeviceState *dev; -ISADevice *isadev; - - isadev =isa_create (bus,"isa-parallel" ); - dev =DEVICE (isadev); -qdev_prop_set_uint32 (dev,"index" , index); -qdev_prop_set_chr (dev,"chardev" , chr); -qdev_init_nofail (dev); -} - -void parallel_hds_isa_init (ISABus *bus,int n) -{ -int i; - -assert (n <=MAX_PARALLEL_PORTS ); - -for (i =0 ; i < n; i++) { -if (parallel_hds[i]) { -parallel_init (bus, i, parallel_hds[i]); - } - } -}hw/isa/isa-bus.c +19
-0@@ -21,6 +21,7 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" +#include "hw/i386/pc.h" static ISABus *isabus;@@ -267,3 +268,31 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) }type_init (isabus_register_types) + +static void parallel_init(ISABus *bus, int index, CharDriverState *chr) +{ +DeviceState *dev; +ISADevice *isadev; + + isadev =isa_try_create (bus,"isa-parallel" ); +if (!isadev) { +return ; + } + dev =DEVICE (isadev); +qdev_prop_set_uint32 (dev,"index" , index); +qdev_prop_set_chr (dev,"chardev" , chr); +qdev_init_nofail (dev); +} + +void parallel_hds_isa_init (ISABus *bus,int n) +{
hw/isa/isa-bus.c MemoryRegion *isa_address_space_io(ISADevice *dev) · line 298
Quoted 10 lines
hw/isa/isa-bus.c +10
-0+int i; + +assert (n <=MAX_PARALLEL_PORTS ); + +for (i =0 ; i < n; i++) { +if (parallel_hds[i]) { +parallel_init (bus, i, parallel_hds[i]); + } + } +}
ACK
Paolo
Re: [Qemu-devel] [PATCHv3 1/2] Move parallel_hds_isa_init to hw/isa/isa-bus.c
In reply to [email protected]Quoted 9 lines · [email protected] writes:
From: Miroslav Rezanina <[email protected]>
Disabling
CONFIG_PARALLELcause removingparallel_hds_isa_initdefined inparallel.c. This function is called during initialization of some boards so disablingCONFIG_PARALLELcause build failure.This patch moves
parallel_hds_isa_inittohw/isa/isa-bus.cso it is included in case of disabledCONFIG_PARALLEL. Build is successful but qemu will abort with "Unknown device" error when function is called.
Can't reproduce this error. Test case: compile with CONFIG_PARALLEL=y taken out, run like
$ qemu-system-x86_64 -nodefaults -S -display none -parallel stdio
Quoted 55 lines
Signed-off-by Miroslav Rezanina <[email protected]>--- hw/char/parallel.c | 25 ------------------------- hw/isa/isa-bus.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-)hw/char/parallel.c +0
-25@@ -641,28 +641,3 @@ static void parallel_register_types(void) }type_init (parallel_register_types) - -static void parallel_init(ISABus *bus, int index, CharDriverState *chr) -{ -DeviceState *dev; -ISADevice *isadev; - - isadev =isa_create (bus,"isa-parallel" ); - dev =DEVICE (isadev); -qdev_prop_set_uint32 (dev,"index" , index); -qdev_prop_set_chr (dev,"chardev" , chr); -qdev_init_nofail (dev); -} - -void parallel_hds_isa_init (ISABus *bus,int n) -{ -int i; - -assert (n <=MAX_PARALLEL_PORTS ); - -for (i =0 ; i < n; i++) { -if (parallel_hds[i]) { -parallel_init (bus, i, parallel_hds[i]); - } - } -}hw/isa/isa-bus.c +1
-0@@ -21,6 +21,7 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" +#include "hw/i386/pc.h" static ISABus *isabus;@@ -267,3 +268,31 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) }type_init (isabus_register_types)
hw/isa/isa-bus.c MemoryRegion *isa_address_space_io(ISADevice *dev) · line 280
Quoted 10 lines
hw/isa/isa-bus.c +10
-0+ +static void parallel_init (ISABus *bus,int index,CharDriverState *chr) +{ +DeviceState *dev; +ISADevice *isadev; + + isadev =isa_try_create (bus,"isa-parallel" ); +if (!isadev) { +return ; + }
Not just code motion! You change the code to ignore the error.
If that's what we want, the commit message needs fixing.
Quoted 18 lines
hw/isa/isa-bus.c +18
-0+ dev =DEVICE (isadev); +qdev_prop_set_uint32 (dev,"index" , index); +qdev_prop_set_chr (dev,"chardev" , chr); +qdev_init_nofail (dev); +} + +void parallel_hds_isa_init (ISABus *bus,int n) +{ +int i; + +assert (n <=MAX_PARALLEL_PORTS ); + +for (i =0 ; i < n; i++) { +if (parallel_hds[i]) { +parallel_init (bus, i, parallel_hds[i]); + } + } +}
Re: [Qemu-devel] [PATCHv3 1/2] Move parallel_hds_isa_init to hw/isa/isa-bus.c
Quoted 85 lines · Markus Armbruster
Quoted 9 lines · [email protected] writes:
From: Miroslav Rezanina <[email protected]>
Disabling
CONFIG_PARALLELcause removingparallel_hds_isa_initdefined inparallel.c. This function is called during initialization of some boards so disablingCONFIG_PARALLELcause build failure.This patch moves
parallel_hds_isa_inittohw/isa/isa-bus.cso it is included in case of disabledCONFIG_PARALLEL. Build is successful but qemu will abort with "Unknown device" error when function is called.Can't reproduce this error. Test case: compile with
CONFIG_PARALLEL=ytaken out, run like$ qemu-system-x86_64 -nodefaults -S -display none -parallel stdioQuoted 55 lines
Signed-off-by Miroslav Rezanina <[email protected]>--- hw/char/parallel.c | 25 ------------------------- hw/isa/isa-bus.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 25 deletions(-)hw/char/parallel.c +0
-25@@ -641,28 +641,3 @@ static void parallel_register_types(void) }type_init (parallel_register_types) - -static void parallel_init(ISABus *bus, int index, CharDriverState *chr) -{ -DeviceState *dev; -ISADevice *isadev; - - isadev =isa_create (bus,"isa-parallel" ); - dev =DEVICE (isadev); -qdev_prop_set_uint32 (dev,"index" , index); -qdev_prop_set_chr (dev,"chardev" , chr); -qdev_init_nofail (dev); -} - -void parallel_hds_isa_init (ISABus *bus,int n) -{ -int i; - -assert (n <=MAX_PARALLEL_PORTS ); - -for (i =0 ; i < n; i++) { -if (parallel_hds[i]) { -parallel_init (bus, i, parallel_hds[i]); - } - } -}hw/isa/isa-bus.c +1
-0@@ -21,6 +21,7 @@#include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" +#include "hw/i386/pc.h" static ISABus *isabus;@@ -267,3 +268,31 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) }type_init (isabus_register_types)hw/isa/isa-bus.c MemoryRegion *isa_address_space_io(ISADevice *dev) · line 280
Quoted 10 lines
hw/isa/isa-bus.c +10
-0+ +static void parallel_init (ISABus *bus,int index,CharDriverState *chr) +{ +DeviceState *dev; +ISADevice *isadev; + + isadev =isa_try_create (bus,"isa-parallel" ); +if (!isadev) { +return ; + }Not just code motion! You change the code to ignore the error.
Quoted 1 line
If that's what we want, the commit message needs fixing.
Ouch,this is mixed in change from different code version. Intention was to move code only. This is the reason to different behavior. I will send fixed version.
Mirek
Quoted 19 lines
Quoted 19 lines
hw/isa/isa-bus.c +18
-0+ dev =DEVICE (isadev); +qdev_prop_set_uint32 (dev,"index" , index); +qdev_prop_set_chr (dev,"chardev" , chr); +qdev_init_nofail (dev); +} + +void parallel_hds_isa_init (ISABus *bus,int n) +{ +int i; + +assert (n <=MAX_PARALLEL_PORTS ); + +for (i =0 ; i < n; i++) { +if (parallel_hds[i]) { +parallel_init (bus, i, parallel_hds[i]); + } + } +}
PATCH v3 2/2 stubs: Provide parallel_mm_init stub version
In reply to [email protected]From: Miroslav Rezanina <[email protected]>
mips build fail with link error in case PARALLEL_CONFIG is disabled as hw/mips/mips_jazz.c calls parallel_mm_init. Due to dependecies to content of parallel.c we can't simply move it to hw/isa/isa-devices.c.
This patch adds stubs/parallel.c file that contains stub version of parallel_mm_init. This ensure successful build with PARALLEL_CONFIG disabled.
--- stubs/Makefile.objs | 1 + stubs/parallel.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 stubs/parallel.c
stubs/Makefile.objs +1 -0
@@ -24,6 +24,7 @@ stub-obj-y += mon-printf.o stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o +stub-obj-y += parallel.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o stub-obj-y += qtest.o stub-obj-y += reset.o
stubs/parallel.c new file +8 -0
@@ -0,0 +1,8 @@ +#include "hw/i386/pc.h" + +bool parallel_mm_init (MemoryRegion *address_space, +hwaddr base,int it_shift,qemu_irq irq, +CharDriverState *chr) +{ +return false; +}
Signature · 1 line
2.1.0
Re: [Qemu-devel] [PATCHv3 2/2] stubs: Provide parallel_mm_init stub version
Quoted 35 lines · On 12/05/2015 08:22, [email protected] wrote:
From: Miroslav Rezanina <[email protected]>
mips build fail with link error in case
PARALLEL_CONFIGis disabled ashw/mips/mips_jazz.ccallsparallel_mm_init. Due to dependecies to content ofparallel.cwe can't simply move it tohw/isa/isa-devices.c.This patch adds
stubs/parallel.cfile that contains stub version ofparallel_mm_init. This ensure successful build withPARALLEL_CONFIGdisabled.Signed-off-by Miroslav Rezanina <[email protected]>--- stubs/Makefile.objs | 1 + stubs/parallel.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 stubs/parallel.cstubs/Makefile.objs +1
-0@@ -24,6 +24,7 @@ stub-obj-y += mon-printf.o stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o +stub-obj-y += parallel.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o stub-obj-y += qtest.o stub-obj-y += reset.ostubs/parallel.c new file +0
-0
stubs/parallel.c line 8
Quoted 8 lines
stubs/parallel.c new file +8
-0@@ -0,0 +1,8 @@ +#include "hw/i386/pc.h" + +bool parallel_mm_init (MemoryRegion *address_space, +hwaddr base,int it_shift,qemu_irq irq, +CharDriverState *chr) +{ +return false; +}
I think removing CONFIG_PARALLEL from a board that hardcodes its presence makes little sense, so I would just drop this patch.
Paolo
Re: [Qemu-devel] [PATCHv3 2/2] stubs: Provide parallel_mm_init stub version
Quoted 39 lines · Paolo Bonzini
Quoted 38 lines · On 12/05/2015 08:22, [email protected] wrote:
From: Miroslav Rezanina <[email protected]>
mips build fail with link error in case
PARALLEL_CONFIGis disabled ashw/mips/mips_jazz.ccallsparallel_mm_init. Due to dependecies to content ofparallel.cwe can't simply move it tohw/isa/isa-devices.c.This patch adds
stubs/parallel.cfile that contains stub version ofparallel_mm_init. This ensure successful build withPARALLEL_CONFIGdisabled.Signed-off-by Miroslav Rezanina <[email protected]>--- stubs/Makefile.objs | 1 + stubs/parallel.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 stubs/parallel.cstubs/Makefile.objs +1
-0@@ -24,6 +24,7 @@ stub-obj-y += mon-printf.o stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o +stub-obj-y += parallel.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o stub-obj-y += qtest.o stub-obj-y += reset.ostubs/parallel.c new file +4
-0@@ -0,0 +1,8 @@ +#include "hw/i386/pc.h" + +bool parallel_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, qemu_irq irq,
Quoted 8 lines
stubs/parallel.c line 8
Quoted 5 lines
stubs/parallel.c new file +4
-0+ CharDriverState *chr) +{ +return false; +}I think removing
CONFIG_PARALLELfrom a board that hardcodes its presence makes little sense, so I would just drop this patch.
I pointed Mirek to parallel_mm_init(). Second thoughts: since we don't know omitting the device breaks guests, and aren't really interested in finding out, let's leave things as they are, i.e. drop this patch.
Re: [Qemu-devel] [PATCHv3 2/2] stubs: Provide parallel_mm_init stub version
Quoted 50 lines · Markus Armbruster
Quoted 39 lines · Paolo Bonzini
Quoted 38 lines · On 12/05/2015 08:22, [email protected] wrote:
From: Miroslav Rezanina <[email protected]>
mips build fail with link error in case
PARALLEL_CONFIGis disabled ashw/mips/mips_jazz.ccallsparallel_mm_init. Due to dependecies to content ofparallel.cwe can't simply move it tohw/isa/isa-devices.c.This patch adds
stubs/parallel.cfile that contains stub version ofparallel_mm_init. This ensure successful build withPARALLEL_CONFIGdisabled.Signed-off-by Miroslav Rezanina <[email protected]>--- stubs/Makefile.objs | 1 + stubs/parallel.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 stubs/parallel.cstubs/Makefile.objs +1
-0@@ -24,6 +24,7 @@ stub-obj-y += mon-printf.o stub-obj-y += mon-set-error.o stub-obj-y += monitor-init.o stub-obj-y += notify-event.o +stub-obj-y += parallel.o stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o stub-obj-y += qtest.o stub-obj-y += reset.ostubs/parallel.c new file +4
-0@@ -0,0 +1,8 @@ +#include "hw/i386/pc.h" + +bool parallel_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, qemu_irq irq,Quoted 8 lines
stubs/parallel.c line 8
Quoted 5 lines
stubs/parallel.c new file +4
-0+ CharDriverState *chr) +{ +return false; +}I think removing
CONFIG_PARALLELfrom a board that hardcodes its presence makes little sense, so I would just drop this patch.
Quoted 3 lines
I pointed Mirek to
parallel_mm_init(). Second thoughts: since we don't know omitting the device breaks guests, and aren't really interested in finding out, let's leave things as they are, i.e. drop this patch.
Ok, v4 will be patch 1 only.
Mirek