﻿id	summary	reporter	owner	description	type	status	component	version	resolution	keywords	cc	guest	host
16385	PCI passthrought works incorrectly with I/O ports	Matwey V. Kornilov		"Hello,

I am using virtualBox 5.0.20 OSS with extension pack

# VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      5.0.20
Revision:     106931
Edition:      
Description:  USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption.
VRDE Module:  VBoxVRDP
Usable:       true 
Why unusable:

Host kernel is 3.16.7
Guest kernel is 4.9.0

On the host machine I have the following PCI device:

04:00.0 0700: 1393:1320 (rev 02) (prog-if 80)
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 19
        Region 1: I/O ports at e080 [size=128]
        Region 2: I/O ports at e100 [size=64]
        Region 3: I/O ports at e140 [size=16]
        Kernel driver in use: pci-stub
        Kernel modules: mxser

When passed into the guest system it looks like the following:

03:00.0 0700: 1393:1320 (rev 02) (prog-if 80)
        Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 17
        Region 1: I/O ports at e000 [size=128]
        Region 2: I/O ports at e080 [size=64]
        Region 3: I/O ports at e0c0 [size=16]

However, access to I/O ports doesn't work in guest system.

To test I/O ports the following simple code snipped is used: https://gist.github.com/matwey/b42f8b9fb50ab8c603d120c54d04c9be

On the host (when accessed to 0xe100) result is the following:

# ./a.out 
64: FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00 FF 00 01 00 00 60 90 00

On the guest (when accessed to 0xe080) result is the following:

# ./a.out 
64: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"	defect	new	other	VirtualBox 5.0.20				Linux	Linux
