Compiling VirtualBox for MSI Interrupts

Discussions related to using the OSE version of VirtualBox.
Post Reply
Dhaks
Posts: 43
Joined: 26. Feb 2015, 07:52

Compiling VirtualBox for MSI Interrupts

Post by Dhaks »

Hello,

I have been trying to get/ run VirtualBox compiled for Interrupts (MSI). Looking through the source code I found MSI specific source code is ifdef'ed out under defines PCI_INCLUDE_PRIVATE, PCIDEVICEINT_DECLARED. Trying to check if there are any other known defines ? and if there is a way to use command line options to add these defines.

Thanks.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by michaln »

Why not start by explaining what it is you're trying to achieve in the end...

I don't really understand the question because regular VirtualBox releases have supported MSIs (with appropriate devices and ICH9 chipset) for years.
Dhaks
Posts: 43
Joined: 26. Feb 2015, 07:52

Re: Compiling VirtualBox for MSI Interrupts

Post by Dhaks »

I am adding an extension (new) device to the VirtualBox setup, which works quite right with registration, transfer between this device <-> VirtualBox etc. Device on the other side is connected to custom architectural model.
Now I am looking to add MSI support into this new device. Custom model generates necessary MSI request, but that request apparently doesn't seem to be reaching VirtualBox.

I greped for current MSI support from other devices and found these examples viz, USB/DevOHCI.cpp, Storage/DevAHCI.cpp and replicated Interrupt specific code which implies I am not doing something right. Hence the question.

Return code "rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);" returns false. So, can't start the Virtual machine (with the new device)

If there is source code specific document for interrupts that would really really help.

Thanks.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by michaln »

Dhaks wrote:Return code "rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);" returns false.
No, it doesn't, because it doesn't return a bool value. It returns a VBox error code. See VINF_SUCCESS.
If there is source code specific document for interrupts that would really really help.
You have the full source code to your own project and to VirtualBox. We only have the source code to VirtualBox. I'm afraid only you have the data to figure out the problem.

What sort of device are you implementing?
Dhaks
Posts: 43
Joined: 26. Feb 2015, 07:52

Re: Compiling VirtualBox for MSI Interrupts

Post by Dhaks »

Understand. My comment was, do you (or any expert) by chance can isolate MSI implementation specific code ? or if there is any spec available.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by michaln »

I'm not sure what the question is exactly. MSI documentation in general, or VirtualBox specific implementation? The former can be found in PCI specifications and to some extent Intel CPU documentation, the latter is in the VirtualBox source code.

Again, what are you trying to implement, and what is it you don't understand exactly? You're asking very vague questions.
Dhaks
Posts: 43
Joined: 26. Feb 2015, 07:52

Re: Compiling VirtualBox for MSI Interrupts

Post by Dhaks »

VirtualBox specific implementation?
Yes I do understand the actual MSI interrupts but it is VirtualBox implementation, that isn't working for me. Device is a custom device meant to do something specific for inhouse implementation.

As far as I understand from examples, implementation from other devices, I added all the defines, header files, specific code but YET invoking " rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);" returns

ERROR: Failed to map MSI register space
00:01:39.627348 PDM: Failed to construct '..../0! VERR_NOT_IMPLEMENTED (-12) - The request function is not implemented.
00:01:39.632739 AIOMgr: Flush failed with VERR_INVALID_PARAMETER, disabling async flushes
00:01:39.640547 NamedPipe0: accept failed, rc=VERR_INVALID_PARAMETER

First part of ERROR message is something I wrote right after reading rc

rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);
if (RT_FAILURE(rc)) {
LogRel(("ERROR: Failed to map MSI register space \n"));
return rc;
}

It's obvious I am not doing the configuration right as since other devices are functional with MSI. So trying to get the expert advice on specific code (or documentation) of VirtualBox MSI implementation.
Last edited by Dhaks on 29. Jul 2015, 23:33, edited 1 time in total.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by michaln »

Dhaks wrote:It's obvious I am not doing the configuration right as since other devices are functional with MSI. So trying to get the expert advice on specific code (or documentation) of VirtualBox MSI implementation.
Are you building with VBOX_WITH_MSI_DEVICES defined? Is your VM configured with the ICH9 chipset? Asking just in case.

Obviously without seeing the arguments you're passing to PDMDevHlpPCIRegisterMsi(), there's not a lot else I can say... but you can trace through the PDMDevHlpPCIRegisterMsi call and see what really happens.

And one miscellaneous note: VirtualBox 5.0 contains several MSI-related fixes which may or may not be relevant to you.
Dhaks
Posts: 43
Joined: 26. Feb 2015, 07:52

Re: Compiling VirtualBox for MSI Interrupts

Post by Dhaks »

Do you please mind editing the first line in your previous response :)
Are you building with VBOX_WITH_MSI_DEVICES defined? Is your VM configured with the ICH9 chipset? Asking just in case.
Yes, I am compiling using define VBOX_WITH_MSI_DEVICES. But, where do I set this ICH9 in VM ?
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by michaln »

Dhaks wrote:Do you please mind editing the first line in your previous response :)
I see :) I just did...
Yes, I am compiling using define VBOX_WITH_MSI_DEVICES. But, where do I set this ICH9 in VM ?
It's the "chipset" configuration option in the System/Motherboard VM settings. Not a compile-time thing at all.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Compiling VirtualBox for MSI Interrupts

Post by noteirak »

Moved to "VirtualBox OSE", forum fitting for the discussion :)
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply