mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +00:00
DM: Add option of no check against ptdev reset
With '--ptdev_no_reset', DM doen not abort but warn when assign PCIe dev without reset capability. Signed-off-by: Edwin Zhai <edwin.zhai@intel.com> Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
parent
b19d936356
commit
4b4e1e1c59
@ -162,7 +162,8 @@ usage(int code)
|
|||||||
" -i: ioc boot parameters\n"
|
" -i: ioc boot parameters\n"
|
||||||
" --vsbl: vsbl file path\n"
|
" --vsbl: vsbl file path\n"
|
||||||
" --part_info: guest partition info file path\n"
|
" --part_info: guest partition info file path\n"
|
||||||
" --enable_trusty: enable trusty for guest\n",
|
" --enable_trusty: enable trusty for guest\n"
|
||||||
|
" --ptdev_no_reset: disable reset check for ptdev\n",
|
||||||
progname, (int)strlen(progname), "", (int)strlen(progname), "",
|
progname, (int)strlen(progname), "", (int)strlen(progname), "",
|
||||||
(int)strlen(progname), "");
|
(int)strlen(progname), "");
|
||||||
|
|
||||||
@ -593,6 +594,7 @@ enum {
|
|||||||
CMD_OPT_VSBL = 1000,
|
CMD_OPT_VSBL = 1000,
|
||||||
CMD_OPT_PART_INFO,
|
CMD_OPT_PART_INFO,
|
||||||
CMD_OPT_TRUSTY_ENABLE,
|
CMD_OPT_TRUSTY_ENABLE,
|
||||||
|
CMD_OPT_PTDEV_NO_RESET,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
@ -629,6 +631,8 @@ static struct option long_options[] = {
|
|||||||
{"part_info", required_argument, 0, CMD_OPT_PART_INFO},
|
{"part_info", required_argument, 0, CMD_OPT_PART_INFO},
|
||||||
{"enable_trusty", no_argument, 0,
|
{"enable_trusty", no_argument, 0,
|
||||||
CMD_OPT_TRUSTY_ENABLE},
|
CMD_OPT_TRUSTY_ENABLE},
|
||||||
|
{"ptdev_no_reset", no_argument, 0,
|
||||||
|
CMD_OPT_PTDEV_NO_RESET},
|
||||||
{0, 0, 0, 0 },
|
{0, 0, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -795,6 +799,9 @@ main(int argc, char *argv[])
|
|||||||
case CMD_OPT_TRUSTY_ENABLE:
|
case CMD_OPT_TRUSTY_ENABLE:
|
||||||
trusty_enabled = 1;
|
trusty_enabled = 1;
|
||||||
break;
|
break;
|
||||||
|
case CMD_OPT_PTDEV_NO_RESET:
|
||||||
|
ptdev_no_reset(true);
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(0);
|
usage(0);
|
||||||
default:
|
default:
|
||||||
|
@ -91,6 +91,11 @@ static pthread_mutex_t ref_cnt_mtx = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
/* Prefer MSI over INTx for ptdev */
|
/* Prefer MSI over INTx for ptdev */
|
||||||
static bool prefer_msi = true;
|
static bool prefer_msi = true;
|
||||||
|
|
||||||
|
/* Not check reset capability before assign ptdev.
|
||||||
|
* Set false by default, that is, always check.
|
||||||
|
*/
|
||||||
|
static bool no_reset = false;
|
||||||
|
|
||||||
struct passthru_dev {
|
struct passthru_dev {
|
||||||
struct pci_vdev *dev;
|
struct pci_vdev *dev;
|
||||||
struct pcibar bar[PCI_BARMAX + 1];
|
struct pcibar bar[PCI_BARMAX + 1];
|
||||||
@ -116,6 +121,11 @@ ptdev_prefer_msi(bool enable)
|
|||||||
prefer_msi = enable;
|
prefer_msi = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ptdev_no_reset(bool enable)
|
||||||
|
{
|
||||||
|
no_reset = enable;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
msi_caplen(int msgctrl)
|
msi_caplen(int msgctrl)
|
||||||
{
|
{
|
||||||
@ -846,7 +856,8 @@ cfginit(struct vmctx *ctx, struct passthru_dev *ptdev, int bus,
|
|||||||
warnx("No reset capability for PCIe %x/%x/%x, "
|
warnx("No reset capability for PCIe %x/%x/%x, "
|
||||||
"remove it from ptdev list!!\n",
|
"remove it from ptdev list!!\n",
|
||||||
bus, slot, func);
|
bus, slot, func);
|
||||||
return -1;
|
if (!no_reset)
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,4 +49,5 @@ void *paddr_guest2host(struct vmctx *ctx, uintptr_t addr, size_t len);
|
|||||||
void *dm_gpa2hva(uint64_t gpa, size_t size);
|
void *dm_gpa2hva(uint64_t gpa, size_t size);
|
||||||
int virtio_uses_msix(void);
|
int virtio_uses_msix(void);
|
||||||
void ptdev_prefer_msi(bool enable);
|
void ptdev_prefer_msi(bool enable);
|
||||||
|
void ptdev_no_reset(bool enable);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user