Skip to content

Commit

Permalink
Fix nvme virq bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huaicheng committed Apr 22, 2022
1 parent 1cfe618 commit 9f5123c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions hw/femu/intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ static int nvme_add_kvm_msi_virq(FemuCtrl *n, NvmeCQueue *cq)
{
int virq;
int vector_n;
KVMRouteChange c;

if (!msix_enabled(&(n->parent_obj))) {
femu_err("MSIX is mandatory for the device");
Expand All @@ -18,12 +19,14 @@ static int nvme_add_kvm_msi_virq(FemuCtrl *n, NvmeCQueue *cq)

vector_n = cq->vector;

virq = kvm_irqchip_add_msi_route(kvm_state, vector_n, &n->parent_obj);
c = kvm_irqchip_begin_route_changes(kvm_state);
virq = kvm_irqchip_add_msi_route(&c, vector_n, &n->parent_obj);
if (virq < 0) {
femu_err("Route MSIX vector to KVM failed");
event_notifier_cleanup(&cq->guest_notifier);
return -1;
}
kvm_irqchip_commit_route_changes(&c);
cq->virq = virq;
femu_debug("%s,cq[%d]->virq=%d\n", __func__, cq->cqid, virq);

Expand Down Expand Up @@ -191,10 +194,6 @@ void nvme_isr_notify_io(void *opaque)

int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
{

/* Disable virq for now, TOFIX later on */
return 0;

int ret;

if (cq->irq_enabled) {
Expand Down Expand Up @@ -225,9 +224,7 @@ int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)

int nvme_clear_virq(FemuCtrl *n)
{
#if 0
nvme_clear_guest_notifier(n);
#endif

return 0;
}

0 comments on commit 9f5123c

Please sign in to comment.