[Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports

Peter Maydell posted 13 patches 5 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180420145249.32435-1-peter.maydell@linaro.org
Test checkpatch failed
Test docker-build@min-glib passed
Test docker-mingw@fedora passed
Test s390x passed
include/hw/char/serial.h                 |  3 +++
include/hw/isa/superio.h                 |  4 +++-
include/sysemu/sysemu.h                  |  9 +++++---
hw/arm/allwinner-a10.c                   |  4 ++--
hw/arm/aspeed_soc.c                      |  4 ++--
hw/arm/bcm2835_peripherals.c             |  4 ++--
hw/arm/digic.c                           |  2 +-
hw/arm/fsl-imx25.c                       | 14 +-----------
hw/arm/fsl-imx31.c                       | 14 +-----------
hw/arm/fsl-imx6.c                        | 17 ++-------------
hw/arm/fsl-imx7.c                        |  4 +---
hw/arm/highbank.c                        |  2 +-
hw/arm/integratorcp.c                    |  4 ++--
hw/arm/kzm.c                             |  4 ++--
hw/arm/mps2-tz.c                         |  3 +--
hw/arm/mps2.c                            |  6 ++----
hw/arm/msf2-soc.c                        |  4 ++--
hw/arm/musicpal.c                        |  8 +++----
hw/arm/omap1.c                           |  6 +++---
hw/arm/omap2.c                           | 10 ++++-----
hw/arm/pxa2xx.c                          | 16 +++++++-------
hw/arm/realview.c                        |  8 +++----
hw/arm/stellaris.c                       |  2 +-
hw/arm/stm32f205_soc.c                   |  3 +--
hw/arm/strongarm.c                       |  2 +-
hw/arm/versatilepb.c                     |  8 +++----
hw/arm/vexpress.c                        |  8 +++----
hw/arm/virt.c                            |  4 ++--
hw/arm/xilinx_zynq.c                     |  4 ++--
hw/arm/xlnx-zynqmp.c                     |  2 +-
hw/char/exynos4210_uart.c                | 20 ------------------
hw/char/serial-isa.c                     | 14 ++++++------
hw/char/serial.c                         |  5 -----
hw/char/xen_console.c                    |  2 +-
hw/cris/axis_dev88.c                     |  2 +-
hw/hppa/machine.c                        |  4 ++--
hw/i386/pc.c                             |  2 +-
hw/isa/isa-superio.c                     |  4 ++--
hw/lm32/lm32_boards.c                    |  8 +++----
hw/lm32/milkymist.c                      |  4 ++--
hw/m68k/mcf5206.c                        |  4 ++--
hw/m68k/mcf5208.c                        |  6 +++---
hw/microblaze/petalogix_ml605_mmu.c      |  2 +-
hw/microblaze/petalogix_s3adsp1800_mmu.c |  2 +-
hw/mips/boston.c                         |  6 +-----
hw/mips/mips_jazz.c                      |  8 +++----
hw/mips/mips_malta.c                     |  7 +-----
hw/mips/mips_mipssim.c                   |  4 ++--
hw/mips/mips_r4k.c                       |  2 +-
hw/misc/macio/macio.c                    |  4 ++--
hw/moxie/moxiesim.c                      |  4 ++--
hw/nios2/10m50_devboard.c                |  2 +-
hw/openrisc/openrisc_sim.c               |  2 +-
hw/ppc/e500.c                            | 12 +++++------
hw/ppc/pnv.c                             |  2 +-
hw/ppc/ppc405_uc.c                       | 16 +++++++-------
hw/ppc/ppc440_bamboo.c                   |  8 +++----
hw/ppc/sam460ex.c                        |  8 +++----
hw/ppc/spapr.c                           |  6 +++---
hw/ppc/virtex_ml507.c                    |  2 +-
hw/riscv/sifive_e.c                      |  4 ++--
hw/riscv/sifive_u.c                      |  4 ++--
hw/riscv/spike.c                         |  4 ++--
hw/riscv/virt.c                          |  2 +-
hw/sh4/r2d.c                             |  2 +-
hw/sh4/sh7750.c                          |  4 ++--
hw/sparc/leon3.c                         |  4 ++--
hw/sparc/sun4m.c                         |  4 ++--
hw/sparc64/niagara.c                     |  4 ++--
hw/sparc64/sun4u.c                       |  4 ++--
hw/xtensa/sim.c                          |  4 ++--
hw/xtensa/xtfpga.c                       |  6 +-----
vl.c                                     | 27 ++++++++++++++++++------
73 files changed, 184 insertions(+), 244 deletions(-)
[Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports
Posted by Peter Maydell 5 years, 11 months ago
For many years, QEMU has had a compile time restriction on how
many serial port devices you can create and configure with the
-serial argument. This is 4, largely because for x86 PC the
traditional number of ISA serial devices is 4, and nobody's
ever changed the limit since.

This patchset drops the compile time limit.

The first patch removes an unnecessary check in hw/char/serial
that insisted that it was not talking to a NULL chardev.
Our newly set direction is that we want to allow NULL chardev
pointers, rather than requiring UARTs and boards to create
"null" backends, so drop the check. (I have looked at the code
and it should all be fine with a NULL pointer here, including
the tricky bit where qemu_chr_fe_add_watch() returns 0 and
the required behaviour is "insta-drain the FIFO".)

The next 4 patches drop unnecessary creations of "null" chardevs.
These have to go here because in most cases they were writing
back to the serial_hds[] array, which is about to go away.

Patch 6 implements an accessor function serial_hd() which can
be used to replace direct reads of serial_hds[].

Patch 7 is purely mechanical and replaces serial_hds[x]
with serial_hd(x).

Patches 8 through 11 remove or rename various uses of the
MAX_SERIAL_PORTS #define that shouldn't really be using it.

Patch 12 then makes the serial_hds array be dynamically
reallocated.

Patch 13 adds a "what actually is the highest serial_hds entry"
function for the benefit of spapr, which is the only remaining
user of MAX_SERIAL_PORTS.

Testing: I tested mips-malta and imx6 by hand; others are only
tested via 'make check' (which did find some bugs for me!)

thanks
-- PMM

Peter Maydell (13):
  hw/char/serial: Allow disconnected chardevs
  hw/arm/fsl-imx*: Don't create "null" chardevs for serial devices
  hw/mips/boston.c: Don't create "null" chardevs for serial devices
  hw/mips/mips_malta: Don't create "null" chardevs for serial devices
  hw/xtensa/xtfpga.c: Don't create "null" chardevs for serial devices
  vl.c: Provide accessor function serial_hd() for serial_hds[] array
  Change references to serial_hds[] to serial_hd()
  Remove checks on MAX_SERIAL_PORTS that are just bounds checks
  hw/char/exynos4210_uart.c: Remove unneeded handling of NULL chardev
  serial-isa: Use MAX_ISA_SERIAL_PORTS instead of MAX_SERIAL_PORTS
  superio: Don't use MAX_SERIAL_PORTS for serial port limit
  vl.c: Remove compile time limit on number of serial ports
  vl.c: new function max_serial_hds()

 include/hw/char/serial.h                 |  3 +++
 include/hw/isa/superio.h                 |  4 +++-
 include/sysemu/sysemu.h                  |  9 +++++---
 hw/arm/allwinner-a10.c                   |  4 ++--
 hw/arm/aspeed_soc.c                      |  4 ++--
 hw/arm/bcm2835_peripherals.c             |  4 ++--
 hw/arm/digic.c                           |  2 +-
 hw/arm/fsl-imx25.c                       | 14 +-----------
 hw/arm/fsl-imx31.c                       | 14 +-----------
 hw/arm/fsl-imx6.c                        | 17 ++-------------
 hw/arm/fsl-imx7.c                        |  4 +---
 hw/arm/highbank.c                        |  2 +-
 hw/arm/integratorcp.c                    |  4 ++--
 hw/arm/kzm.c                             |  4 ++--
 hw/arm/mps2-tz.c                         |  3 +--
 hw/arm/mps2.c                            |  6 ++----
 hw/arm/msf2-soc.c                        |  4 ++--
 hw/arm/musicpal.c                        |  8 +++----
 hw/arm/omap1.c                           |  6 +++---
 hw/arm/omap2.c                           | 10 ++++-----
 hw/arm/pxa2xx.c                          | 16 +++++++-------
 hw/arm/realview.c                        |  8 +++----
 hw/arm/stellaris.c                       |  2 +-
 hw/arm/stm32f205_soc.c                   |  3 +--
 hw/arm/strongarm.c                       |  2 +-
 hw/arm/versatilepb.c                     |  8 +++----
 hw/arm/vexpress.c                        |  8 +++----
 hw/arm/virt.c                            |  4 ++--
 hw/arm/xilinx_zynq.c                     |  4 ++--
 hw/arm/xlnx-zynqmp.c                     |  2 +-
 hw/char/exynos4210_uart.c                | 20 ------------------
 hw/char/serial-isa.c                     | 14 ++++++------
 hw/char/serial.c                         |  5 -----
 hw/char/xen_console.c                    |  2 +-
 hw/cris/axis_dev88.c                     |  2 +-
 hw/hppa/machine.c                        |  4 ++--
 hw/i386/pc.c                             |  2 +-
 hw/isa/isa-superio.c                     |  4 ++--
 hw/lm32/lm32_boards.c                    |  8 +++----
 hw/lm32/milkymist.c                      |  4 ++--
 hw/m68k/mcf5206.c                        |  4 ++--
 hw/m68k/mcf5208.c                        |  6 +++---
 hw/microblaze/petalogix_ml605_mmu.c      |  2 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |  2 +-
 hw/mips/boston.c                         |  6 +-----
 hw/mips/mips_jazz.c                      |  8 +++----
 hw/mips/mips_malta.c                     |  7 +-----
 hw/mips/mips_mipssim.c                   |  4 ++--
 hw/mips/mips_r4k.c                       |  2 +-
 hw/misc/macio/macio.c                    |  4 ++--
 hw/moxie/moxiesim.c                      |  4 ++--
 hw/nios2/10m50_devboard.c                |  2 +-
 hw/openrisc/openrisc_sim.c               |  2 +-
 hw/ppc/e500.c                            | 12 +++++------
 hw/ppc/pnv.c                             |  2 +-
 hw/ppc/ppc405_uc.c                       | 16 +++++++-------
 hw/ppc/ppc440_bamboo.c                   |  8 +++----
 hw/ppc/sam460ex.c                        |  8 +++----
 hw/ppc/spapr.c                           |  6 +++---
 hw/ppc/virtex_ml507.c                    |  2 +-
 hw/riscv/sifive_e.c                      |  4 ++--
 hw/riscv/sifive_u.c                      |  4 ++--
 hw/riscv/spike.c                         |  4 ++--
 hw/riscv/virt.c                          |  2 +-
 hw/sh4/r2d.c                             |  2 +-
 hw/sh4/sh7750.c                          |  4 ++--
 hw/sparc/leon3.c                         |  4 ++--
 hw/sparc/sun4m.c                         |  4 ++--
 hw/sparc64/niagara.c                     |  4 ++--
 hw/sparc64/sun4u.c                       |  4 ++--
 hw/xtensa/sim.c                          |  4 ++--
 hw/xtensa/xtfpga.c                       |  6 +-----
 vl.c                                     | 27 ++++++++++++++++++------
 73 files changed, 184 insertions(+), 244 deletions(-)

-- 
2.17.0


Re: [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports
Posted by no-reply@patchew.org 5 years, 11 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180420145249.32435-1-peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20180420145249.32435-1-peter.maydell@linaro.org -> patchew/20180420145249.32435-1-peter.maydell@linaro.org
Switched to a new branch 'test'
96dfccb00b vl.c: new function max_serial_hds()
3e71fd34eb vl.c: Remove compile time limit on number of serial ports
c43b9fdfc2 superio: Don't use MAX_SERIAL_PORTS for serial port limit
b770c540a9 serial-isa: Use MAX_ISA_SERIAL_PORTS instead of MAX_SERIAL_PORTS
038ffe574e hw/char/exynos4210_uart.c: Remove unneeded handling of NULL chardev
813b6d6287 Remove checks on MAX_SERIAL_PORTS that are just bounds checks
066f676d66 Change references to serial_hds[] to serial_hd()
ede9de0c27 vl.c: Provide accessor function serial_hd() for serial_hds[] array
bfbf0f20cb hw/xtensa/xtfpga.c: Don't create "null" chardevs for serial devices
d31d02cbd8 hw/mips/mips_malta: Don't create "null" chardevs for serial devices
32216ce5e5 hw/mips/boston.c: Don't create "null" chardevs for serial devices
364918ebd9 hw/arm/fsl-imx*: Don't create "null" chardevs for serial devices
4a5a612b77 hw/char/serial: Allow disconnected chardevs

=== OUTPUT BEGIN ===
Checking PATCH 1/13: hw/char/serial: Allow disconnected chardevs...
Checking PATCH 2/13: hw/arm/fsl-imx*: Don't create "null" chardevs for serial devices...
Checking PATCH 3/13: hw/mips/boston.c: Don't create "null" chardevs for serial devices...
Checking PATCH 4/13: hw/mips/mips_malta: Don't create "null" chardevs for serial devices...
Checking PATCH 5/13: hw/xtensa/xtfpga.c: Don't create "null" chardevs for serial devices...
Checking PATCH 6/13: vl.c: Provide accessor function serial_hd() for serial_hds[] array...
Checking PATCH 7/13: Change references to serial_hds[] to serial_hd()...
WARNING: line over 80 characters
#581: FILE: hw/cris/axis_dev88.c:340:
+        etraxfs_ser_create(0x30026000 + i * 0x2000, irq[0x14 + i], serial_hd(i));

ERROR: spaces required around that '/' (ctx:VxV)
#824: FILE: hw/moxie/moxiesim.c:146:
+                       8000000/16, serial_hd(0), DEVICE_LITTLE_ENDIAN);
                               ^

total: 1 errors, 1 warnings, 852 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 8/13: Remove checks on MAX_SERIAL_PORTS that are just bounds checks...
Checking PATCH 9/13: hw/char/exynos4210_uart.c: Remove unneeded handling of NULL chardev...
Checking PATCH 10/13: serial-isa: Use MAX_ISA_SERIAL_PORTS instead of MAX_SERIAL_PORTS...
Checking PATCH 11/13: superio: Don't use MAX_SERIAL_PORTS for serial port limit...
Checking PATCH 12/13: vl.c: Remove compile time limit on number of serial ports...
ERROR: do not initialise statics to 0 or NULL
#35: FILE: vl.c:157:
+static int num_serial_hds = 0;

ERROR: do not initialise statics to 0 or NULL
#36: FILE: vl.c:158:
+static Chardev **serial_hds = NULL;

total: 2 errors, 0 warnings, 52 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 13/13: vl.c: new function max_serial_hds()...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports
Posted by Peter Maydell 5 years, 11 months ago
On 20 April 2018 at 16:10,  <no-reply@patchew.org> wrote:

> Checking PATCH 7/13: Change references to serial_hds[] to serial_hd()...
> WARNING: line over 80 characters
> #581: FILE: hw/cris/axis_dev88.c:340:
> +        etraxfs_ser_create(0x30026000 + i * 0x2000, irq[0x14 + i], serial_hd(i));
>
> ERROR: spaces required around that '/' (ctx:VxV)
> #824: FILE: hw/moxie/moxiesim.c:146:
> +                       8000000/16, serial_hd(0), DEVICE_LITTLE_ENDIAN);
>                                ^
>
> total: 1 errors, 1 warnings, 852 lines checked

These are in the "mechanical change only" patch, so I didn't
want to change anything else there.

> Checking PATCH 12/13: vl.c: Remove compile time limit on number of serial ports...
> ERROR: do not initialise statics to 0 or NULL
> #35: FILE: vl.c:157:
> +static int num_serial_hds = 0;
>
> ERROR: do not initialise statics to 0 or NULL
> #36: FILE: vl.c:158:
> +static Chardev **serial_hds = NULL;

I'd forgotten checkpatch had this requirement; easy to fix.

thanks
-- PMM

Re: [Qemu-devel] [PATCH 00/13] Drop compile time limit on number of serial ports
Posted by Peter Maydell 5 years, 11 months ago
On 20 April 2018 at 15:52, Peter Maydell <peter.maydell@linaro.org> wrote:
> For many years, QEMU has had a compile time restriction on how
> many serial port devices you can create and configure with the
> -serial argument. This is 4, largely because for x86 PC the
> traditional number of ISA serial devices is 4, and nobody's
> ever changed the limit since.
>
> This patchset drops the compile time limit.

Applied to master, with minor tweak in patch 13.

I only realised when I came back to here that I'd forgotten
about checkpatch's preference for not zero-initializing
static globals; I'll send a fixup patch for that.

thanks
-- PMM