aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-10 23:45:10 -0500
committerRusty Russell <rusty@rustcorp.com.au>2015-02-11 01:17:34 -0500
commite1b83e27881cf3153ce420aea853797fed29a9ea (patch)
tree81826521d6dfacca02c6f253df0524815ad46c44 /arch
parentee72576c143d8e9081ae1fe8644122454dd323c5 (diff)
lguest: Override pcibios_enable_irq/pcibios_disable_irq to our stupid 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 <rusty@rustcorp.com.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/lguest/boot.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index aa6e3b4ce29c..2943ab931671 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -56,6 +56,7 @@
56#include <linux/virtio_console.h> 56#include <linux/virtio_console.h>
57#include <linux/pm.h> 57#include <linux/pm.h>
58#include <linux/export.h> 58#include <linux/export.h>
59#include <linux/pci.h>
59#include <asm/acpi.h> 60#include <asm/acpi.h>
60#include <asm/apic.h> 61#include <asm/apic.h>
61#include <asm/lguest.h> 62#include <asm/lguest.h>
@@ -72,6 +73,7 @@
72#include <asm/stackprotector.h> 73#include <asm/stackprotector.h>
73#include <asm/reboot.h> /* for struct machine_ops */ 74#include <asm/reboot.h> /* for struct machine_ops */
74#include <asm/kvm_para.h> 75#include <asm/kvm_para.h>
76#include <asm/pci_x86.h>
75 77
76/*G:010 78/*G:010
77 * Welcome to the Guest! 79 * Welcome to the Guest!
@@ -832,6 +834,24 @@ static struct irq_chip lguest_irq_controller = {
832 .irq_unmask = enable_lguest_irq, 834 .irq_unmask = enable_lguest_irq,
833}; 835};
834 836
837static int lguest_enable_irq(struct pci_dev *dev)
838{
839 u8 line = 0;
840
841 /* We literally use the PCI interrupt line as the irq number. */
842 pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line);
843 irq_set_chip_and_handler_name(line, &lguest_irq_controller,
844 handle_level_irq, "level");
845 dev->irq = line;
846 return 0;
847}
848
849/* We don't do hotplug PCI, so this shouldn't be called. */
850static void lguest_disable_irq(struct pci_dev *dev)
851{
852 WARN_ON(1);
853}
854
835/* 855/*
836 * This sets up the Interrupt Descriptor Table (IDT) entry for each hardware 856 * This sets up the Interrupt Descriptor Table (IDT) entry for each hardware
837 * interrupt (except 128, which is used for system calls), and then tells the 857 * interrupt (except 128, which is used for system calls), and then tells the
@@ -1432,6 +1452,10 @@ __init void lguest_init(void)
1432 /* Don't let ACPI try to control our PCI interrupts. */ 1452 /* Don't let ACPI try to control our PCI interrupts. */
1433 disable_acpi(); 1453 disable_acpi();
1434 1454
1455 /* We control them ourselves, by overriding these two hooks. */
1456 pcibios_enable_irq = lguest_enable_irq;
1457 pcibios_disable_irq = lguest_disable_irq;
1458
1435 /* 1459 /*
1436 * Last of all, we set the power management poweroff hook to point to 1460 * Last of all, we set the power management poweroff hook to point to
1437 * the Guest routine to power off, and the reboot hook to our restart 1461 * the Guest routine to power off, and the reboot hook to our restart