hv: check if the IRQ is intended for a single destination vCPU

Given the vcpumask, check if the IRQ is single destination
and return the destination vCPU if so, the address of associated PI
descriptor for this vCPU can then be passed to dmar_assign_irte() to
set up the posted interrupt IRTE for this device.

For fixed mode interrupt delivery, all vCPUs listed in vcpumask should
service the interrupt requested. But VT-d PI cannot support multicast/broadcast
IRQs, it only supports single CPU destination. So the number of vCPUs
shall be 1 in order to handle IRQ in posted mode for this device.

Add pid_paddr to struct intr_source. If platform_caps.pi is true and
the IRQ is single-destination, pass the physical address of the destination
vCPU's PID to ptirq_build_physical_msi and dmar_assign_irte

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 16:03:44 -07:00
committed by wenlingz
parent 6496da7c56
commit f7be985a23
2 changed files with 63 additions and 4 deletions

View File

@@ -67,6 +67,13 @@ union source {
struct intr_source {
bool is_msi;
union source src;
/*
* pid_paddr = 0: invalid address, indicate that remapped mode shall be used
*
* pid_paddr != 0: physical address of posted interrupt descriptor, indicate
* that posted mode shall be used
*/
uint64_t pid_paddr;
};
static inline uint8_t dmar_ver_major(uint64_t version)