hv: GSI of hcall_set_irqline should be checked against target_vm

GSI of hcall_set_irqline should be checked against target_vm's
total GSI count instead of SOS's total GSI count.

Tracked-On: #6357
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jian Jun Chen 2021-08-23 13:07:51 +08:00 committed by wenlingz
parent a7c2739965
commit 6653ffc069
1 changed files with 3 additions and 3 deletions

View File

@ -462,15 +462,15 @@ int32_t hcall_create_vcpu(__unused struct acrn_vcpu *vcpu, __unused struct acrn_
* @pre is_sos_vm(vcpu->vm) * @pre is_sos_vm(vcpu->vm)
* @return 0 on success, non-zero on error. * @return 0 on success, non-zero on error.
*/ */
int32_t hcall_set_irqline(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm, __unused uint64_t param1, uint64_t param2) int32_t hcall_set_irqline(__unused struct acrn_vcpu *vcpu, struct acrn_vm *target_vm,
__unused uint64_t param1, uint64_t param2)
{ {
struct acrn_vm *vm = vcpu->vm;
uint32_t irq_pic; uint32_t irq_pic;
int32_t ret = -1; int32_t ret = -1;
struct acrn_irqline_ops *ops = (struct acrn_irqline_ops *)&param2; struct acrn_irqline_ops *ops = (struct acrn_irqline_ops *)&param2;
if (is_severity_pass(target_vm->vm_id) && !is_poweroff_vm(target_vm)) { if (is_severity_pass(target_vm->vm_id) && !is_poweroff_vm(target_vm)) {
if (ops->gsi < get_vm_gsicount(vm)) { if (ops->gsi < get_vm_gsicount(target_vm)) {
if (ops->gsi < vpic_pincount()) { if (ops->gsi < vpic_pincount()) {
/* /*
* IRQ line for 8254 timer is connected to * IRQ line for 8254 timer is connected to