Skip to content

Commit

Permalink
lguest: Override pcibios_enable_irq/pcibios_disable_irq to our stupid…
Browse files Browse the repository at this point in the history
… PIC

This lets us deliver interrupts for our emulated PCI devices using our
dumb PIC, and not emulate an 8259 and PCI irq mapping tables or whatever.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Feb 11, 2015
1 parent ee72576 commit e1b83e2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arch/x86/lguest/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <linux/virtio_console.h>
#include <linux/pm.h>
#include <linux/export.h>
#include <linux/pci.h>
#include <asm/acpi.h>
#include <asm/apic.h>
#include <asm/lguest.h>
Expand All @@ -72,6 +73,7 @@
#include <asm/stackprotector.h>
#include <asm/reboot.h> /* for struct machine_ops */
#include <asm/kvm_para.h>
#include <asm/pci_x86.h>

/*G:010
* Welcome to the Guest!
Expand Down Expand Up @@ -832,6 +834,24 @@ static struct irq_chip lguest_irq_controller = {
.irq_unmask = enable_lguest_irq,
};

static int lguest_enable_irq(struct pci_dev *dev)
{
u8 line = 0;

/* We literally use the PCI interrupt line as the irq number. */
pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
irq_set_chip_and_handler_name(line, &lguest_irq_controller,
handle_level_irq, "level");
dev->irq = line;
return 0;
}

/* We don't do hotplug PCI, so this shouldn't be called. */
static void lguest_disable_irq(struct pci_dev *dev)
{
WARN_ON(1);
}

/*
* This sets up the Interrupt Descriptor Table (IDT) entry for each hardware
* interrupt (except 128, which is used for system calls), and then tells the
Expand Down Expand Up @@ -1432,6 +1452,10 @@ __init void lguest_init(void)
/* Don't let ACPI try to control our PCI interrupts. */
disable_acpi();

/* We control them ourselves, by overriding these two hooks. */
pcibios_enable_irq = lguest_enable_irq;
pcibios_disable_irq = lguest_disable_irq;

/*
* Last of all, we set the power management poweroff hook to point to
* the Guest routine to power off, and the reboot hook to our restart
Expand Down

0 comments on commit e1b83e2

Please sign in to comment.