hv: add function to check if using posted interrupt is possible for vm

Add platform_caps.c to maintain platform related information

Set platform_caps.pi to true if all iommus are posted interrupt capable, false
otherwise

If lapic passthru is not configured and platform_caps.pi is true, the vm
may be able to use posted interrupt for a ptdev, if the ptdev's IRQ is
single-destination

Tracked-On: #4506
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@Intel.com>
This commit is contained in:
dongshen
2020-03-18 15:41:50 -07:00
committed by wenlingz
parent 47f883db30
commit 6496da7c56
6 changed files with 50 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
#include <sbuf.h>
#include <pci_dev.h>
#include <vacpi.h>
#include <platform_caps.h>
vm_sw_loader_t vm_sw_loader;
@@ -115,6 +116,20 @@ bool is_rt_vm(const struct acrn_vm *vm)
return ((vm_config->guest_flags & GUEST_FLAG_RT) != 0U);
}
/**
* @brief VT-d PI posted mode can possibly be used for PTDEVs assigned
* to this VM if platform supports VT-d PI AND lapic passthru is not configured
* for this VM.
* However, as we can only post single destination IRQ, so meeting these 2 conditions
* does not necessarily mean posted mode will be used for all PTDEVs belonging
* to the VM, unless the IRQ is single-destination for the specific PTDEV
* @pre vm != NULL
*/
bool is_pi_capable(const struct acrn_vm *vm)
{
return (platform_caps.pi && (!is_lapic_pt_configured(vm)));
}
static struct acrn_vm *get_highest_severity_vm(void)
{
uint16_t vm_id, highest_vm_id = 0U;