mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-09 13:23:56 +00:00
dm: passthru: enable pba emulation for msix
Normally, for devices support MSI-X, PBA is passed-through to guest. However, PBA and MSI-X table share the same bar, and part of PBA and MSI-X table may share a same page for some devices. If that is the case, the part of PBA within the page should be emulated rather than passed-through. This patch adds PBA emulation support for MSI-X. Tracked-On: #1222 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
57abc88b15
commit
244bce756b
@ -46,18 +46,6 @@
|
|||||||
#include "pci_core.h"
|
#include "pci_core.h"
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
|
|
||||||
#ifndef _PATH_DEVPCI
|
|
||||||
#define _PATH_DEVPCI "/dev/pci"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _PATH_DEVIO
|
|
||||||
#define _PATH_DEVIO "/dev/io"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _PATH_MEM
|
|
||||||
#define _PATH_MEM "/dev/mem"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PCI_COMMAND_INTX_DISABLE
|
#ifndef PCI_COMMAND_INTX_DISABLE
|
||||||
#define PCI_COMMAND_INTX_DISABLE ((uint16_t)0x400)
|
#define PCI_COMMAND_INTX_DISABLE ((uint16_t)0x400)
|
||||||
#endif
|
#endif
|
||||||
@ -81,8 +69,8 @@
|
|||||||
*/
|
*/
|
||||||
#define AUDIO_NHLT_HACK 1
|
#define AUDIO_NHLT_HACK 1
|
||||||
|
|
||||||
|
/* TODO: Add support for IO BAR of PTDev */
|
||||||
static int iofd = -1;
|
static int iofd = -1;
|
||||||
static int memfd = -1;
|
|
||||||
|
|
||||||
/* reference count for libpciaccess init/deinit */
|
/* reference count for libpciaccess init/deinit */
|
||||||
static int pciaccess_ref_cnt;
|
static int pciaccess_ref_cnt;
|
||||||
@ -662,14 +650,14 @@ init_msix_table(struct vmctx *ctx, struct passthru_dev *ptdev, uint64_t base)
|
|||||||
else
|
else
|
||||||
dev->msix.pba_page_offset = table_offset +
|
dev->msix.pba_page_offset = table_offset +
|
||||||
table_size - 4096;
|
table_size - 4096;
|
||||||
dev->msix.pba_page = mmap(NULL, 4096, PROT_READ |
|
error = pci_device_map_range(ptdev->phys_dev,
|
||||||
PROT_WRITE, MAP_SHARED, memfd, start +
|
base + dev->msix.pba_page_offset, 4096,
|
||||||
dev->msix.pba_page_offset);
|
PCI_DEV_MAP_FLAG_WRITABLE, &dev->msix.pba_page);
|
||||||
if (dev->msix.pba_page == MAP_FAILED) {
|
if (error) {
|
||||||
warn(
|
warnx(
|
||||||
"Failed to map PBA page for MSI-X on %x/%x/%x",
|
"Failed to map PBA page for MSI-X on %x/%x/%x.",
|
||||||
b, s, f);
|
b, s, f);
|
||||||
return -1;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user