Hi Experts,

I am working on a virtual device model that plugs in to PDM.  The model 
actually includes a PCI switch and one or more downstream end points of 
potentially different types.  These end points use MSI for interrupts, so I am 
using the ICH9 chipset.

Basic initialization goes OK.  I register the device as a PCI switch, VBox 
enumerates on the downsteam bus, and finds my end point (just one for now, I 
will add more after I get the first one working).  MSI initialization looks 
good, the config word in the MSI struct is read as 0x80 and then set to 0x81 
(64-bit addressing, no per-vector masking, MSI enabled).  The BIOS and Guest 
are able to read/write to the MMIO space of the end point.

My problem is when the end point tries to generate an interrupt.  I see the 
upstream write indicating MSI, and call PDMDevHlpPCISetIrq () to signal the 
interrupt instead of passing the write up stream.  However, I only have one 
PPDMDEVINS pDevIns handle, which had been passed to my constructor, and that 
corresponds to the switch itself.  So when I get down to 
ich9pciSetIrqInternal(), it's looking at the MSI struct of the switch when it 
really needs to be looking at the MSI struct of the end point.  And when there 
are more than one EP, it has to be the correct one.

Presumably I need to have separate device instances for the switch and each 
downstream end point, so that when I signal an interrupt it knows which end 
point it's coming from.

My question, then, is how can I allocate additional device handles?  The only 
way I know how to allocate a device handle is through the CFGM database, with 
Devices/xyz/0 entries.  But that requires knowing what end points there are in 
advance, and taking steps to configure CFGM accordingly.  What I really want to 
do is notice when the bus enumeration finds an end point, and allocate a device 
instance for it dynamically.  Is there a way to do this?  Or some other way to 
associate an interrupt request with its source?

BTW, I am using OSE 5.0.16 which I built from the tarball on the virtualbox.org 
site, running on Ubuntu 14 host with Ubuntu 14 guest (both 64 bits).

_____________________________________________

Ric Vilbig
Mentor Graphics, Emulation Division
46871 Bayside Parkway, Fremont CA, 94538
Phone:  510-354-7360
Mobile: 408-529-2365
email:  ric_vil...@mentor.com<mailto:ric_vil...@mentor.com>


_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to