From 647c467fd9651d3fb4c7fbdccad4273497a8380a Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 10 Jan 2007 15:05:00 +0000 Subject: [HVM] Allow PV-on-HVM callback irq to be identified by PCI device. Signed-off-by: Keir Fraser --- .../linux-2.6/platform-pci/platform-pci.c | 22 +++++++++++++++------- .../linux-2.6/platform-pci/platform-pci.h | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'unmodified_drivers') diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c index 3a2453a25c..24159f2bab 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c @@ -179,7 +179,7 @@ static int get_hypercall_stubs(void) #define get_hypercall_stubs() (0) #endif -static int get_callback_irq(struct pci_dev *pdev) +static uint64_t get_callback_via(struct pci_dev *pdev) { #ifdef __ia64__ int irq; @@ -189,16 +189,24 @@ static int get_callback_irq(struct pci_dev *pdev) } return 0; #else /* !__ia64__ */ - return pdev->irq; + if (pdev->irq < 16) + return pdev->irq; /* ISA IRQ */ + /* We don't know the GSI. Specify the PCI INTx line instead. */ + return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */ + ((uint64_t)pci_domain_nr(pdev->bus) << 32) | + ((uint64_t)pdev->bus->number << 16) | + ((uint64_t)(pdev->devfn & 0xff) << 8) | + ((uint64_t)(pdev->pin - 1) & 3)); #endif } static int __devinit platform_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) { - int i, ret, callback_irq; + int i, ret; long ioaddr, iolen; long mmio_addr, mmio_len; + uint64_t callback_via; i = pci_enable_device(pdev); if (i) @@ -210,9 +218,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, mmio_addr = pci_resource_start(pdev, 1); mmio_len = pci_resource_len(pdev, 1); - callback_irq = get_callback_irq(pdev); + callback_via = get_callback_via(pdev); - if (mmio_addr == 0 || ioaddr == 0 || callback_irq == 0) { + if (mmio_addr == 0 || ioaddr == 0 || callback_via == 0) { printk(KERN_WARNING DRV_NAME ":no resources found\n"); return -ENOENT; } @@ -247,7 +255,7 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, goto out; } - if ((ret = set_callback_irq(callback_irq))) + if ((ret = set_callback_via(callback_via))) goto out; out: @@ -297,7 +305,7 @@ static void __exit platform_pci_module_cleanup(void) { printk(KERN_INFO DRV_NAME ":Do platform module cleanup\n"); /* disable hypervisor for callback irq */ - set_callback_irq(0); + set_callback_via(0); if (pci_device_registered) pci_unregister_driver(&platform_driver); } diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h index 5e10413b13..ca65358599 100644 --- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h +++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h @@ -24,13 +24,13 @@ #include #include -static inline int set_callback_irq(int irq) +static inline int set_callback_via(uint64_t via) { struct xen_hvm_param a; a.domid = DOMID_SELF; a.index = HVM_PARAM_CALLBACK_IRQ; - a.value = irq; + a.value = via; return HYPERVISOR_hvm_op(HVMOP_set_param, &a); } -- cgit v1.2.3