mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-01 17:06:51 +00:00
DM: make removing vGSI capability option as local
Current option of removing vGSI capability is global, which exposes vIOAPIC link for all ptdev even only one need this. This patch makes it as ptdev local option to lower the system level impact. To keep vGSI for MSI capable ptdev, just explicitly append ",keep_gsi" in option list, like "-s 14,passthru,0/e/0,keep_gsi" Signed-off-by: Edwin Zhai <edwin.zhai@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -85,9 +85,6 @@ static int memfd = -1;
|
||||
static int pciaccess_ref_cnt;
|
||||
static pthread_mutex_t ref_cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* Prefer MSI over INTx for ptdev */
|
||||
static bool prefer_msi = true;
|
||||
|
||||
/* Not check reset capability before assign ptdev.
|
||||
* Set false by default, that is, always check.
|
||||
*/
|
||||
@@ -112,12 +109,6 @@ struct passthru_dev {
|
||||
struct pci_device *phys_dev;
|
||||
};
|
||||
|
||||
void
|
||||
ptdev_prefer_msi(bool enable)
|
||||
{
|
||||
prefer_msi = enable;
|
||||
}
|
||||
|
||||
void ptdev_no_reset(bool enable)
|
||||
{
|
||||
no_reset = enable;
|
||||
@@ -937,16 +928,28 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
struct passthru_dev *ptdev;
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_device *phys_dev;
|
||||
char *opt;
|
||||
bool keep_gsi = false;
|
||||
|
||||
ptdev = NULL;
|
||||
error = -EINVAL;
|
||||
|
||||
if (opts == NULL ||
|
||||
sscanf(opts, "%x/%x/%x", &bus, &slot, &func) != 3) {
|
||||
warnx("invalid passthru options, %s", opts);
|
||||
if (opts == NULL) {
|
||||
warnx("Empty passthru options\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
opt = strsep(&opts, ",");
|
||||
if (sscanf(opt, "%x/%x/%x", &bus, &slot, &func) != 3) {
|
||||
warnx("Invalid passthru options, %s", opt);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
while ((opt = strsep(&opts, ",")) != NULL) {
|
||||
if (!strncmp(opt, "keep_gsi", 8))
|
||||
keep_gsi = true;
|
||||
}
|
||||
|
||||
if (vm_assign_ptdev(ctx, bus, slot, func) != 0) {
|
||||
warnx("PCI device at %x/%x/%x is not using the pt(4) driver",
|
||||
bus, slot, func);
|
||||
@@ -1012,7 +1015,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
* Forge Guest to use MSI/MSIX in this case to mitigate IRQ sharing
|
||||
* issue
|
||||
*/
|
||||
if (error == IRQ_MSI && prefer_msi)
|
||||
if (error == IRQ_MSI && !keep_gsi)
|
||||
return 0;
|
||||
|
||||
/* Allocates the virq if ptdev only support INTx */
|
||||
|
Reference in New Issue
Block a user