From 068a9a830d1eff7eabedd7dfbd4f00fe843f7e5f Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Fri, 6 Mar 2020 10:49:07 -0800 Subject: [PATCH] haven: rm: Allow IRQ lender to learn about the IRQ handle An IRQ lender driver will likely ought to need to use the IRQ handle to reclaim the interrupt when the lendee is done with the interrupt. Change-Id: I0b791ecfb7b169d5cf2677d324e9aceea51feb5d Signed-off-by: Elliot Berman --- drivers/virt/haven/hh_rm_iface.c | 14 ++++++++++---- include/linux/haven/hh_rm_drv.h | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/virt/haven/hh_rm_iface.c b/drivers/virt/haven/hh_rm_iface.c index 7c15dace2aef..55476458778d 100644 --- a/drivers/virt/haven/hh_rm_iface.c +++ b/drivers/virt/haven/hh_rm_iface.c @@ -314,21 +314,27 @@ static int hh_rm_vm_irq_notify(const hh_vmid_t *vmids, unsigned int num_vmids, * @vmid: VM to lend interrupt to * @virq: Virtual IRQ number to lend * @label: Label to give to VM so it may know how to associate the interrupt + * @virq_handle: vIRQ handle generated by hypervisor to reperesent the interrupt + * which can be used later to know when the interrupt has been + * released * * This function performs interrupt sharing flow for "HLOS" described in * Resource Manager High Level Design Sec. 3.3.3. */ -int hh_rm_vm_irq_lend_notify(hh_vmid_t vmid, int virq, int label) +int hh_rm_vm_irq_lend_notify(hh_vmid_t vmid, int virq, int label, + hh_virq_handle_t *virq_handle) { - hh_virq_handle_t virq_handle; int ret; - ret = hh_rm_vm_irq_lend(vmid, virq, label, &virq_handle); + if (!virq_handle) + return -EINVAL; + + ret = hh_rm_vm_irq_lend(vmid, virq, label, virq_handle); if (ret) return ret; return hh_rm_vm_irq_notify(&vmid, 1, HH_VM_IRQ_NOTIFY_FLAGS_LENT, - virq_handle); + *virq_handle); } /** diff --git a/include/linux/haven/hh_rm_drv.h b/include/linux/haven/hh_rm_drv.h index 9b3325b231c9..793e2e1b93b9 100644 --- a/include/linux/haven/hh_rm_drv.h +++ b/include/linux/haven/hh_rm_drv.h @@ -179,7 +179,8 @@ int hh_rm_unregister_notifier(struct notifier_block *nb); /* Client APIs for IRQ management */ int hh_rm_vm_irq_accept(hh_virq_handle_t virq_handle, int virq); -int hh_rm_vm_irq_lend_notify(hh_vmid_t vmid, int virq, int label); +int hh_rm_vm_irq_lend_notify(hh_vmid_t vmid, int virq, int label, + hh_virq_handle_t *virq_handle); /* Client APIs for VM management */ int hh_rm_vm_alloc_vmid(enum hh_vm_names vm_name);