Skip to content

Commit

Permalink
xen: events: assume PHYSDEVOP_get_free_pirq exists
Browse files Browse the repository at this point in the history
The find_unbound_pirq is called only from xen_allocate_pirq_msi and
only if alloc_pirq is true. The only caller which does this is
xen_hvm_setup_msi_irqs. The use of this function is gated, in
pci_xen_hvm_init, on XENFEAT_hvm_pirqs.

The PHYSDEVOP_get_free_pirq interfaces was added to the hypervisor in
22410:be96f6058c05 while XENFEAT_hvm_pirqs was added a couple of
minutes prior in 22409:6663214f06ac. Therefore we do not need to
concern ourselves with hypervisors which support XENFEAT_hvm_pirqs but
not PHYSDEVOP_get_free_pirq.

This eliminates the fallback path in find_unbound_pirq which walks to
pirq_to_irq array looking for a free pirq. Unlike the
PHYSDEVOP_get_free_pirq interface this fallback only looks up a free
pirq but does not reserve it. Removing this fallback will simplify
locking in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Ian Campbell authored and Konrad Rzeszutek Wilk committed Mar 10, 2011
1 parent 9a62661 commit 5cad61a
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/xen/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,19 +649,16 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name)

static int find_unbound_pirq(int type)
{
int rc, i;
int rc;
struct physdev_get_free_pirq op_get_free_pirq;
op_get_free_pirq.type = type;

op_get_free_pirq.type = type;
rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_free_pirq, &op_get_free_pirq);
if (!rc)
return op_get_free_pirq.pirq;

for (i = 0; i < nr_irqs; i++) {
if (pirq_to_irq[i] < 0)
return i;
}
return -1;
WARN_ONCE(rc == -ENOSYS,
"hypervisor does not support the PHYSDEVOP_get_free_pirq interface\n");

return rc ? -1 : op_get_free_pirq.pirq;
}

int xen_allocate_pirq_msi(char *name, int *pirq, int alloc_pirq)
Expand Down

0 comments on commit 5cad61a

Please sign in to comment.