Serial port limitation?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
mjfeldman
Posts: 5
Joined: 6. Nov 2018, 23:10

Serial port limitation?

Post by mjfeldman »

It appears that a windows host is limited to 2 com ports, regardless of how many physical com ports actually exist on the linux host, or how many USB-COM converters there may be that are all recognized by the host.

If someone will confirm for me that this limitation is in fact correct, then I won't bother uploading my several pages of log files, system information and diagnostics. If there is no such limitation, I'd like to pursue why I have not been successful in configuring more than this.

Thanks in advance.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Serial port limitation?

Post by socratis »

mjfeldman wrote:It appears that a windows host
Guest perhaps? Did you mean a Windows guest? And what Windows version we're talking about? Windows 2.1? Windows 10 insider build 17362.323?

As far as I can see, there are 4 serial ports that you can enable in the GUI. Did you enable all of them?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mjfeldman
Posts: 5
Joined: 6. Nov 2018, 23:10

Re: Serial port limitation?

Post by mjfeldman »

Oops, yes Guest. All ports enabled in machine settings, at most two usable in a terminal program in Windows, and these only if a USB->COM converter and only if using different IRQs. Neither of the "real" serial ports on the host have ever worked in the guest. COM1 is never available, COM2 appears in 'Devices' for the VM, but is not usable by any software.

The Debian Host has 'real' serial ports that work as expected directly in Debian, and can have a number of USB converters (I tried up to 4) that map to /dev/ttyUSBn and which also work as expected in the host.

My question is "is there a built in limitation?". If yes, I won't waste any more time trying to do the impossible.

Vbox version : 5.2.20 r125813 (Qt5.7.1)

Host info:
Memory size: 28028 MByte
Memory available: 24796 MByte
Operating system: Linux
Operating system version: 4.9.0-8-amd64

Guest:

Name: win7-RA
Guest OS: Windows 7 (64-bit)
Memory size: 2048MB
Page Fusion: off
VRAM size: 27MB
Attachments
VBox.log
(74.49 KiB) Downloaded 21 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Serial port limitation?

Post by socratis »

mjfeldman wrote:My question is "is there a built in limitation?"
Not if there are 4 ports in the GUI, don't you think? ;)

I just enabled 4 serial ports in my Win7 VM, and (after a restart, why?) it found them just fine in the Device Manager. But, it complained that Com1/3 and COM2/4 were using the same IRQ (4 and 3 respectively). So, I changed ports 3 and 4 in the VM Settings » Ports, to "User configured", and changed the IRQ to 5 and 6 (respectively). Win7 was happy...

No clue if it's going to work or not, I don't have a single serial port on my computer! ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mjfeldman
Posts: 5
Joined: 6. Nov 2018, 23:10

Re: Serial port limitation?

Post by mjfeldman »

I don't have a single serial port on my computer! ;)
So you're saying that they show up in the GUI but you have no idea whether they actually exist and work? Mine show up in the GUI too, and they definitely don't work, but I'll try fiddling with the IRQs and see if that makes a difference.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Serial port limitation?

Post by socratis »

There are several factors the way I see it:
  1. Your host and the support of multiple serial ports.
  2. The VirtualBox API/setup supporting multiple ports.
  3. Your setup parameters that tie the virtual to physical ports.
  4. Your guest and the support of multiple serial ports.
You verified 1, I verified 2 and 4. I believe that the problem may lie in part #3, but I can't help you more than that.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
andyp73
Volunteer
Posts: 1631
Joined: 25. May 2010, 23:48
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Assorted Linux, Windows Server 2012, DOS, Windows 10, BIOS/UEFI emulation

Re: Serial port limitation?

Post by andyp73 »

From the VirtualBox user manual 3.10. Serial ports
Up to four serial ports can be configured per virtual machine, but you can pick any port numbers out of the above. However, serial ports cannot reliably share interrupts; if both ports are to be used at the same time, they must use different interrupt levels, for example COM1 and COM2, but not COM1 and COM3.
If you want more serial ports than that in your guest then you will either have to use USB to serial converters and pass them through to the guest or use a network based device with the appropriate software in the guest.

-Andy.
My crystal ball is currently broken. If you want assistance you are going to have to give me all of the necessary information.
Please don't ask me to do your homework for you, I have more than enough of my own things to do.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Serial port limitation?

Post by mpack »

Be very careful about assigning interrupt numbers at random. 8259 IRQs 3 and 4 are the interrupts traditionally assigned to comm ports 1 and 2. Other IRQs are likely to be already in use (note the warnings about sharing interrupts). Happily IRQ5 was the parallel port interrupt, so that is possibly harmless in VirtualBox.

Incidentally: PCs have been practically limited to two UARTs since PCs were invented. It was always kludgy and non-reliable to add more. Typically you would buy an N port card from some OEM manufacturer, it would come with special drivers which were designed to share the interrupt(s).

I confess I don't know what happens when you have an IO APIC. By the time those were invented I was on to ARM and Blackfin.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Serial port limitation?

Post by socratis »

Where are the days that you'd have a sticker outside the box with the IRQs assigned to serial, parallel, SoundBlaster and the DEC NIC? ;)

I had completely forgotten about all the IRQs, and I thought that Win7 could work around those issues, given that IRQs were the same but the addresses were different, but no. I can't remember for the life of me if two devices could share interrupts on different I/O addresses.

Just for completion, the traditional IRQs that I found/remembered are assigned as follows:
IRQ  0    Timer channel 0
IRQ  1    Keyboard
IRQ  2    Cascade for controller 2
IRQ  3    Serial port 2
IRQ  4    Serial port 1
IRQ  5    Parallel port 2, Sound card   <-- Should be safe
IRQ  6    Floppy diskette               <-- Should be safe
IRQ  7    Parallel port 1               <-- Should be safe
IRQ  8    Real-time clock
IRQ  9    Redirected to IRQ2
IRQ 10    not assigned                  <-- Should be safe
IRQ 11    not assigned                  <-- Should be safe
IRQ 12    not assigned                  <-- Should be safe
IRQ 13    Math coprocessor
IRQ 14    Hard disk controller 1
IRQ 15    Hard disk controller 2
In any event, you can go to the Device Manager » View » Resources by type, and see what's available and what not.

I remember a long-time-ago, mailing-list co-subscriber, Mac user used to have in his signature:
I don't do IRQs and I/O. I don't do Autoexec.bat or Config.sys. I have a computer to do that...
Back to today... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Serial port limitation?

Post by mpack »

If you configure VirtualBox to simulate IRQn, then any guest device driver hanging off IRQn in the guest is going to get the interrupt, or it will be blocked from working. I don't see how Win7 could magic its way around that.
mjfeldman
Posts: 5
Joined: 6. Nov 2018, 23:10

Re: Serial port limitation?

Post by mjfeldman »

I have not had time to get back to this yet this morning (and won't for a while), but yes, I was not going to arbitrarily start assigning any old IRQ and expect good results. I do remember that from 'back in the day'. It's interesting though, that in straight WIN 7 (not a VM) I can have any number of virtual COM ports and USB->COM converters, a large number of COM ports supported by adapter cards, and in Linux I can have any number of USB->COM converters (and probably COM ports if I had the hardware).

There definitely seems to be a built-in limitation in vBox, which is not unreasonable in itself, I just want to know exactly what it is and how to actually use the maximum number of ports that are supported. I have not yet been able to do that. Thanks to all for all the input so far.
mjfeldman
Posts: 5
Joined: 6. Nov 2018, 23:10

Re: Serial port limitation?

Post by mjfeldman »

andyp73's quote from the manual suggests that, yes, there is a limit of two (simultaneous) COM ports, due to how the interrupts are used.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Serial port limitation?

Post by mpack »

USB->COM adapters are not relevant to a discussion about the max number of UARTs in a PC, since they are not UARTs in a PC. They are USB devices in a PC.

And a shortage of IRQs doesn't necessarily mean you can't use the COM ports. Some guests will be able to share IRQS, or you can assign other IRQs as discussed, or the serial ports could be polled.

Bear in mind that VirtualBox doesn't have arbitrary limits. The limits are those of the PC being emulated, and those of the guest OS, and the guest app too.
Post Reply