Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a39837f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branches 'stable/irq.fairness' and 'stable/irq.ween_of_nr_irqs' of...

Merge branches 'stable/irq.fairness' and 'stable/irq.ween_of_nr_irqs' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

* 'stable/irq.fairness' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen: events: Remove redundant clear of l2i at end of round-robin loop
  xen: events: Make round-robin scan fairer by snapshotting each l2 word once only
  xen: events: Clean up round-robin evtchn scan.
  xen: events: Make last processed event channel a per-cpu variable.
  xen: events: Process event channels notifications in round-robin order.

* 'stable/irq.ween_of_nr_irqs' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  xen: events: Fix compile error if CONFIG_SMP is not defined.
  xen: events: correct locking in xen_irq_from_pirq
  xen: events: propagate irq allocation failure instead of panicking
  xen: events: do not workaround too-small nr_irqs
  xen: events: remove use of nr_irqs as upper bound on number of pirqs
  xen: events: dynamically allocate irq info structures
  xen: events: maintain a list of Xen interrupts
  xen: events: push setup of irq<->{evtchn,ipi,virq,pirq} maps into irq_info init functions
  xen: events: turn irq_info constructors into initialiser functions
  xen: events: use per-cpu variable for cpu_evtchn_mask
  xen: events: refactor GSI pirq bindings functions
  xen: events: rename restore_cpu_pirqs -> restore_pirqs
  xen: events: remove unused public functions
  xen: events: fix xen_map_pirq_gsi error return
  xen: events: simplify comment
  xen: events: separate two unrelated halves of if condition

Fix up trivial conflicts in drivers/xen/events.c
Loading
Loading
Loading
Loading
+29 −12
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static int acpi_register_gsi_xen_hvm(struct device *dev, u32 gsi,
		name = "ioapic-level";
	}

	irq = xen_map_pirq_gsi(map_irq.pirq, gsi, shareable, name);
	irq = xen_bind_pirq_gsi_to_irq(gsi, map_irq.pirq, shareable, name);

	printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);

@@ -237,6 +237,7 @@ static int xen_pcifront_enable_irq(struct pci_dev *dev)
{
	int rc;
	int share = 1;
	int pirq;
	u8 gsi;

	rc = pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &gsi);
@@ -246,13 +247,21 @@ static int xen_pcifront_enable_irq(struct pci_dev *dev)
		return rc;
	}

	rc = xen_allocate_pirq_gsi(gsi);
	if (rc < 0) {
		dev_warn(&dev->dev, "Xen PCI: failed to allocate a PIRQ for GSI%d: %d\n",
			 gsi, rc);
		return rc;
	}
	pirq = rc;

	if (gsi < NR_IRQS_LEGACY)
		share = 0;

	rc = xen_allocate_pirq(gsi, share, "pcifront");
	rc = xen_bind_pirq_gsi_to_irq(gsi, pirq, share, "pcifront");
	if (rc < 0) {
		dev_warn(&dev->dev, "Xen PCI: failed to register GSI%d: %d\n",
			 gsi, rc);
		dev_warn(&dev->dev, "Xen PCI: failed to bind GSI%d (PIRQ%d) to IRQ: %d\n",
			 gsi, pirq, rc);
		return rc;
	}

@@ -309,7 +318,7 @@ int __init pci_xen_hvm_init(void)
#ifdef CONFIG_XEN_DOM0
static int xen_register_pirq(u32 gsi, int triggering)
{
	int rc, irq;
	int rc, pirq, irq = -1;
	struct physdev_map_pirq map_irq;
	int shareable = 0;
	char *name;
@@ -325,17 +334,20 @@ static int xen_register_pirq(u32 gsi, int triggering)
		name = "ioapic-level";
	}

	irq = xen_allocate_pirq(gsi, shareable, name);

	printk(KERN_DEBUG "xen: --> irq=%d\n", irq);
	pirq = xen_allocate_pirq_gsi(gsi);
	if (pirq < 0)
		goto out;

	irq = xen_bind_pirq_gsi_to_irq(gsi, pirq, shareable, name);
	if (irq < 0)
		goto out;

	printk(KERN_DEBUG "xen: --> pirq=%d -> irq=%d\n", pirq, irq);

	map_irq.domid = DOMID_SELF;
	map_irq.type = MAP_PIRQ_TYPE_GSI;
	map_irq.index = gsi;
	map_irq.pirq = irq;
	map_irq.pirq = pirq;

	rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
	if (rc) {
@@ -422,13 +434,18 @@ static int __init pci_xen_initial_domain(void)

void __init xen_setup_pirqs(void)
{
	int irq;
	int pirq, irq;

	pci_xen_initial_domain();

	if (0 == nr_ioapics) {
		for (irq = 0; irq < NR_IRQS_LEGACY; irq++)
			xen_allocate_pirq(irq, 0, "xt-pic");
		for (irq = 0; irq < NR_IRQS_LEGACY; irq++) {
			pirq = xen_allocate_pirq_gsi(irq);
			if (WARN(pirq < 0,
				 "Could not allocate PIRQ for legacy interrupt\n"))
				break;
			irq = xen_bind_pirq_gsi_to_irq(irq, pirq, 0, "xt-pic");
		}
		return;
	}

+261 −178

File changed.

Preview size limit exceeded, changes collapsed.

+10 −14
Original line number Diff line number Diff line
@@ -47,9 +47,9 @@ static inline void notify_remote_via_evtchn(int port)
	(void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
}

extern void notify_remote_via_irq(int irq);
void notify_remote_via_irq(int irq);

extern void xen_irq_resume(void);
void xen_irq_resume(void);

/* Clear an irq's pending state, in preparation for polling on it */
void xen_clear_irq_pending(int irq);
@@ -68,20 +68,22 @@ void xen_poll_irq_timeout(int irq, u64 timeout);
unsigned irq_from_evtchn(unsigned int evtchn);

/* Xen HVM evtchn vector callback */
extern void xen_hvm_callback_vector(void);
void xen_hvm_callback_vector(void);
extern int xen_have_vector_callback;
int xen_set_callback_via(uint64_t via);
void xen_evtchn_do_upcall(struct pt_regs *regs);
void xen_hvm_evtchn_do_upcall(void);

/* Allocate an irq for a physical interrupt, given a gsi.  "Legacy"
 * GSIs are identity mapped; others are dynamically allocated as
 * usual. */
int xen_allocate_pirq(unsigned gsi, int shareable, char *name);
int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name);
/* Allocate a pirq for a physical interrupt, given a gsi. */
int xen_allocate_pirq_gsi(unsigned gsi);
/* Bind a pirq for a physical interrupt to an irq. */
int xen_bind_pirq_gsi_to_irq(unsigned gsi,
			     unsigned pirq, int shareable, char *name);

#ifdef CONFIG_PCI_MSI
/* Allocate a pirq for a MSI style physical interrupt. */
int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
/* Bind an PSI pirq to an irq. */
int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
			     int pirq, int vector, const char *name);
#endif
@@ -89,12 +91,6 @@ int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
/* De-allocates the above mentioned physical interrupt. */
int xen_destroy_irq(int irq);

/* Return vector allocated to pirq */
int xen_vector_from_irq(unsigned pirq);

/* Return gsi allocated to pirq */
int xen_gsi_from_irq(unsigned pirq);

/* Return irq from pirq */
int xen_irq_from_pirq(unsigned pirq);