acrn-hypervisor/hypervisor/include/arch/x86
dongshen 00ad3863a1 hv: maintain a per-pCPU array of vCPUs and handle posted interrupt IRQs
Maintain a per-pCPU array of vCPUs (struct acrn_vcpu *vcpu_array[CONFIG_MAX_VM_NUM]),
one VM cannot have multiple vCPUs share one pcpu, so we can utilize this property
and use the containing VM's vm_id as the index to the vCPU array:

 In create_vcpu(), we simply do:
   per_cpu(vcpu_array, pcpu_id)[vm->vm_id] = vcpu;

 In offline_vcpu():
   per_cpu(vcpu_array, pcpuid_from_vcpu(vcpu))[vcpu->vm->vm_id] = NULL;

so basically we use the containing VM's vm_id as the index to the vCPU array,
as well as the index of posted interrupt IRQ/vector pair that are assigned
to this vCPU:
  0: first vCPU and first posted interrupt IRQs/vector pair
  (POSTED_INTR_IRQ/POSTED_INTR_VECTOR)
  ...
  CONFIG_MAX_VM_NUM-1: last vCPU and last posted interrupt IRQs/vector pair
  ((POSTED_INTR_IRQ + CONFIG_MAX_VM_NUM - 1U)/(POSTED_INTR_VECTOR + CONFIG_MAX_VM_NUM - 1U)

In the posted interrupt handler, it will do the following:
 Translate the IRQ into a zero based index of where the vCPU
 is located in the vCPU list for current pCPU. Once the
 vCPU is found, we wake up the waiting thread and record
 this request as ACRN_REQUEST_EVENT

Tracked-On: #4506
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@Intel.com>
Signed-off-by: dongshen <dongsheng.x.zhang@intel.com>
2020-04-15 13:47:22 +08:00
..
boot hv: fixup relocation delta for symbols belong to entry section 2020-03-06 08:27:46 +08:00
guest hv: maintain a per-pCPU array of vCPUs and handle posted interrupt IRQs 2020-04-15 13:47:22 +08:00
lib hv: Add a helper to account bitmap weight 2019-09-24 11:58:45 +08:00
apicreg.h HV: fix violations touched type conversion 2019-07-11 09:16:09 +08:00
board.h HV: move create_sos_vm_e820 to ve820.c 2020-03-12 14:56:34 +08:00
cpu_caps.h hv:enable gpu iommu except APL platforms 2020-02-24 11:47:10 +08:00
cpu.h hv: xsave: move assembler to individual function 2020-02-28 17:55:06 +08:00
cpufeatures.h HV: Generalize RDT infrastructure and fix RDT 2020-02-27 10:44:07 +08:00
cpuid.h hv: cpuid: remove cpuid() 2020-03-25 13:26:58 +08:00
default_acpi_info.h hv: emulate ACPI reset register for Service OS guest 2019-05-15 11:20:12 +08:00
e820.h hv: Reserve space for VMs' EPT 4k pages after boot 2020-04-01 21:13:37 +08:00
gdt.h hv: coding style: remove no real declaration for external variable 2018-12-20 20:20:08 +08:00
host_pm.h pm: S5: update the system shutdown logical in ACRN 2019-12-23 15:15:09 +08:00
idt.h hv:cleanup header files for arch folder 2019-02-22 13:14:36 +08:00
init.h HV: Add prefix 'p' before 'cpu' to physical cpu related functions 2019-04-24 10:50:28 +08:00
io.h hv:modulization for IO Emulation 2019-01-21 13:49:54 +08:00
ioapic.h hv: vioapic init for SOS VM on platforms with multiple IO-APICs 2020-03-25 09:36:18 +08:00
irq.h hv: define posted interrupt IRQs/vectors 2020-04-15 13:47:22 +08:00
lapic.h HV: clean up redundant macro in lapic.h 2019-12-27 12:27:08 +08:00
mmu.h HV: correct ept page array usage 2020-03-12 14:56:34 +08:00
msr.h HV: Add MBA support in ACRN 2020-03-04 17:33:50 +08:00
page.h hv: Reserve space for VMs' EPT 4k pages after boot 2020-04-01 21:13:37 +08:00
pci_dev.h hv: refine init_one_dev_config 2020-03-03 09:32:11 +08:00
per_cpu.h hv: maintain a per-pCPU array of vCPUs and handle posted interrupt IRQs 2020-04-15 13:47:22 +08:00
pgtable.h hv:change function parameter for invept 2019-09-05 16:32:30 +08:00
platform_caps.h hv: add function to check if using posted interrupt is possible for vm 2020-04-15 13:47:22 +08:00
rdt.h HV: Add MBA support in ACRN 2020-03-04 17:33:50 +08:00
security.h hv: ept: apply MCE on page size change mitigation conditionally 2019-12-03 09:17:04 +08:00
seed.h hv: seed: refine header file 2019-03-15 14:09:56 +08:00
sgx.h hv: sgx: add basic support to init sgx resource for vm 2019-05-29 11:24:13 +08:00
timer.h hv: vpci: revert do FLR and BAR restore 2019-12-30 13:43:07 +08:00
trampoline.h hv:Move severl variable declaration for boot code 2019-01-25 21:32:21 +08:00
vm_config.h hv: Fix issues with the patch to reserve EPT 4K pages after boot 2020-04-03 11:06:14 +08:00
vmx.h hv: extend struct pi_desc to support VT-d posted interrupts 2020-03-31 10:30:30 +08:00
vtd.h hv: check if the IRQ is intended for a single destination vCPU 2020-04-15 13:47:22 +08:00
zeropage.h HV: init efi info with multiboot2 2020-02-26 09:24:16 +08:00