6

I have 5 diferent serial devices that are connected to physical serial ports on debian stretch computer and internally should be forwarded to QEMU machine. Inside qemu is QNX 6.5.0 system, so i am not sure if i can use virtio-seral drivers or similar solutions.

Linux standard limitation of 4 serial ports is solved with:

/etc/default/grub: 8250.nr_uarts=8

So the only problem now I have with QEMU max serial ports = 4.

Can this be solved by recompiling qemu, and is there some other solution?

peterh
  • 9,488
  • 16
  • 59
  • 88
MetNP
  • 500
  • 4
  • 13
  • 1
    The man page for `qemu-system-x86_64` says `This option can be used several times to simulate up to 4 serial ports` for the `serial` option, so that appears to be a hard-coded limit. Looks like recompiling is the only way. – cas Jan 08 '18 at 01:33
  • @cas ok, i see on github serial-pci.c, PCI_SERIAL_MAX_PORTS 4, hope that changing that is enough, and that compiled version should work well with kvm and virsh envelopes that i used from standard packages. – MetNP Jan 08 '18 at 02:17
  • Good luck. If it works, you should write that up as an answer and accept it. – cas Jan 08 '18 at 02:21

1 Answers1

6

recompiling seems to work for all 8 ports.

1) linux-host limitation solved by: /etc/default/grub: 8250.nr_uarts=8 ... update grub

2) qemu limitation solved by:

git clone git://git.qemu-project.org/qemu.git; cd qemu
include/sysemu/sysemu.h: changing MAX_SERIAL_PORTS 4->8
hw/char/serial-isa.c: adding 4 values to each of 2 arrays:
isa_serial_io [MAX_SERIAL_PORTS] = {0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x5f8, 0x4f8, 0x5e8, 0x4e8}
isa_serial_irq[MAX_SERIAL_PORTS] = {4,3,4,3,4,3,4,3}
...
./configure --target-list=x86_64-softmmu
make; sudo make install

3) qnx-guest limitation solved by running: devc-ser8250 5f8,4 4f8,3 5e8,4 4e8,3

notes:

  • sudo apt-get install libpixman-1-dev was the only missing dependency
  • initial make took ~10min
  • io addresses and irqs choosed randomly and tried which work (have no real knowledge about the reason, some io/irq combinations work, some not)
MetNP
  • 500
  • 4
  • 13