Inline the pv_ops dom0 patch.
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 70f5ea9..b45dedf 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -188,9 +188,5 @@ static inline void probe_nr_irqs_gsi(void) { }
#endif
void xen_io_apic_init(void);
-unsigned int xen_io_apic_read(unsigned apic, unsigned reg);
-void xen_io_apic_write(unsigned int apic,
- unsigned int reg, unsigned int value);
-
#endif /* _ASM_X86_IO_APIC_H */
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d47c54f..783678c 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -954,6 +954,9 @@ int __init acpi_probe_gsi(void)
int idx;
int gsi;
int max_gsi = 0;
+
+ if (xen_initial_domain()) /* Dirty hack!! */
+ return 256;
if (acpi_disabled)
return 0;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 77151ce..0c87499 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -386,9 +386,6 @@ static inline unsigned int io_apic_read(unsigned int apic,
unsigned int reg)
{
struct io_apic __iomem *io_apic;
- if (xen_initial_domain())
- return xen_io_apic_read(apic, reg);
-
io_apic = io_apic_base(apic);
writel(reg, &io_apic->index);
return readl(&io_apic->data);
@@ -398,11 +395,6 @@ static inline void io_apic_write(unsigned int apic,
unsigned int reg, unsigned i
{
struct io_apic __iomem *io_apic;
- if (xen_initial_domain()) {
- xen_io_apic_write(apic, reg, value);
- return;
- }
-
io_apic = io_apic_base(apic);
writel(reg, &io_apic->index);
writel(value, &io_apic->data);
@@ -418,11 +410,6 @@ static inline void io_apic_modify(unsigned int apic,
unsigned int reg, unsigned
{
struct io_apic __iomem *io_apic;
- if (xen_initial_domain()) {
- xen_io_apic_write(apic, reg, value);
- return;
- }
-
io_apic = io_apic_base(apic);
if (sis_apic_bug)
@@ -3162,9 +3149,6 @@ static int __init ioapic_init_sysfs(void)
struct sys_device * dev;
int i, size, error;
- if (xen_initial_domain())
- return 0;
-
error = sysdev_class_register(&ioapic_sysdev_class);
if (error)
return error;
@@ -4183,11 +4167,6 @@ void __init ioapic_init_mappings(void)
struct resource *ioapic_res;
int i;
- if (xen_initial_domain()) {
- xen_io_apic_init();
- return;
- }
-
ioapic_res = ioapic_setup_resources();
for (i = 0; i < nr_ioapics; i++) {
if (smp_found_config) {
diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
index ee0db39..805ce70 100644
--- a/arch/x86/xen/apic.c
+++ b/arch/x86/xen/apic.c
@@ -17,31 +17,6 @@ void __init xen_io_apic_init(void)
enable_IO_APIC();
}
-unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
-{
- struct physdev_apic apic_op;
- int ret;
-
- apic_op.apic_physbase = mp_ioapics[apic].apicaddr;
- apic_op.reg = reg;
- ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
- if (ret)
- BUG();
- return apic_op.value;
-}
-
-
-void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
-{
- struct physdev_apic apic_op;
-
- apic_op.apic_physbase = mp_ioapics[apic].apicaddr;
- apic_op.reg = reg;
- apic_op.value = value;
- if (HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op))
- BUG();
-}
-
void xen_init_apic(void)
{
if (!xen_initial_domain())
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index a654a49..0ca0c2c 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1938,6 +1938,8 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
}
#endif /* CONFIG_X86_64 */
+static unsigned char dummy_ioapic_mapping[PAGE_SIZE] __page_aligned_bss;
+
static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
{
pte_t pte;
@@ -1973,7 +1975,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t
phys, pgprot_t prot)
* We just don't map the IO APIC - all access is via
* hypercalls. Keep the address in the pte for reference.
*/
- pte = pfn_pte(phys, PAGE_NONE);
+ pte = __pte(__pa(dummy_ioapic_mapping) | __PAGE_KERNEL);
break;
#endif
case FIX_PARAVIRT_BOOTMAP:
diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c
index 44d91ad..9ec0d08 100644
--- a/arch/x86/xen/pci.c
+++ b/arch/x86/xen/pci.c
@@ -15,52 +15,38 @@
#include "xen-ops.h"
-static void xen_set_io_apic_routing(int irq, int trigger, int polarity)
-{
- int ioapic, ioapic_pin;
- int vector, gsi;
- struct IO_APIC_route_entry entry;
-
- gsi = xen_gsi_from_irq(irq);
- vector = xen_vector_from_irq(irq);
-
- ioapic = mp_find_ioapic(gsi);
- if (ioapic == -1) {
- printk(KERN_WARNING "xen_set_ioapic_routing: irq %d gsi %d
ioapic %d\n",
- irq, gsi, ioapic);
- return;
- }
-
- ioapic_pin = mp_find_ioapic_pin(ioapic, gsi);
-
- printk(KERN_INFO "xen_set_ioapic_routing: irq %d gsi %d vector %d
ioapic %d pin %d triggering %d polarity %d\n",
- irq, gsi, vector, ioapic, ioapic_pin, trigger, polarity);
-
- setup_ioapic_entry(ioapic, -1, &entry, ~0, trigger, polarity, vector,
- ioapic_pin);
- ioapic_write_entry(ioapic, ioapic_pin, entry);
-}
-
int xen_register_gsi(u32 gsi, int triggering, int polarity)
{
- int irq;
+ int rc, irq;
+ struct physdev_map_pirq map_irq;
+ domid_t domid = DOMID_SELF;
if (!xen_domain())
return -1;
- printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
- gsi, triggering, polarity);
+ BUG_ON(gsi >= (1 << 16));
irq = xen_allocate_pirq(gsi, (triggering == ACPI_EDGE_SENSITIVE)
- ? "ioapic-edge" : "ioapic-level");
+ ? "ioapic-edge" : "ioapic-level");
printk(KERN_DEBUG "xen: --> irq=%d\n", irq);
- if (irq >= 0)
- xen_set_io_apic_routing(irq,
- triggering == ACPI_EDGE_SENSITIVE ? 0 :
1,
- polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
-
+ triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1);
+ polarity = (polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
+ printk( "xen: registering gsi %u triggering %d polarity %d\n",
+ gsi, triggering, polarity);
+
+ memset(&map_irq, 0, sizeof(map_irq));
+ map_irq.domid = domid;
+ map_irq.type = MAP_PIRQ_TYPE_GSI;
+ map_irq.index = gsi | (triggering << 16) | (polarity << 24);
+ map_irq.pirq = irq;
+
+ rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
+ if (rc) {
+ printk(KERN_WARNING "xen map irq failed %d\n", rc);
+ irq = -1;
+ }
return irq;
}
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 68c287c..52e4294 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -74,7 +74,7 @@ enum xen_irq_type {
* event channel - irq->event channel mapping
* cpu - cpu this event channel is bound to
* index - type-specific information:
- * PIRQ - vector, with MSB being "needs EIO"
+ * PIRQ - with MSB being "needs EIO"
* VIRQ - virq number
* IPI - IPI vector
* EVTCHN -
@@ -90,7 +90,6 @@ struct irq_info
enum ipi_vector ipi;
struct {
unsigned short nr;
- unsigned char vector;
unsigned char flags;
} pirq;
} u;
@@ -144,11 +143,10 @@ static struct irq_info mk_virq_info(unsigned short
evtchn, unsigned short virq)
.cpu = 0, .u.virq = virq };
}
-static struct irq_info mk_pirq_info(unsigned short evtchn,
- unsigned short pirq, unsigned short vector)
+static struct irq_info mk_pirq_info(unsigned short evtchn, unsigned short pirq)
{
return (struct irq_info) { .type = IRQT_PIRQ, .evtchn = evtchn,
- .cpu = 0, .u.pirq = { .nr = pirq, .vector = vector } };
+ .cpu = 0, .u.pirq = { .nr = pirq } };
}
/*
@@ -170,16 +168,6 @@ unsigned irq_from_evtchn(unsigned int evtchn)
}
EXPORT_SYMBOL_GPL(irq_from_evtchn);
-static enum ipi_vector ipi_from_irq(unsigned irq)
-{
- struct irq_info *info = info_for_irq(irq);
-
- BUG_ON(info == NULL);
- BUG_ON(info->type != IRQT_IPI);
-
- return info->u.ipi;
-}
-
static unsigned virq_from_irq(unsigned irq)
{
struct irq_info *info = info_for_irq(irq);
@@ -200,16 +188,6 @@ static unsigned gsi_from_irq(unsigned irq)
return info->u.pirq.nr;
}
-static unsigned vector_from_irq(unsigned irq)
-{
- struct irq_info *info = info_for_irq(irq);
-
- BUG_ON(info == NULL);
- BUG_ON(info->type != IRQT_PIRQ);
-
- return info->u.pirq.vector;
-}
-
static enum xen_irq_type type_from_irq(unsigned irq)
{
return info_for_irq(irq)->type;
@@ -539,14 +517,13 @@ static int find_irq_by_gsi(unsigned gsi)
}
/*
- * Allocate a physical irq, along with a vector. We don't assign an
+ * Allocate a physical irq. We don't assign an
* event channel until the irq actually started up. Return an
* existing irq if we've already got one for the gsi.
*/
int xen_allocate_pirq(unsigned gsi, char *name)
{
int irq;
- struct physdev_irq irq_op;
spin_lock(&irq_mapping_update_lock);
@@ -567,14 +544,7 @@ int xen_allocate_pirq(unsigned gsi, char *name)
set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
handle_level_irq, name);
- irq_op.irq = gsi;
- if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) {
- dynamic_irq_cleanup(irq);
- irq = -ENOSPC;
- goto out;
- }
-
- irq_info[irq] = mk_pirq_info(0, gsi, irq_op.vector);
+ irq_info[irq] = mk_pirq_info(0, gsi);
out:
spin_unlock(&irq_mapping_update_lock);
return irq;
@@ -657,7 +627,7 @@ int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc
*msidesc, int type)
goto out;
}
- irq_info[irq] = mk_pirq_info(0, map_irq.pirq, map_irq.index);
+ irq_info[irq] = mk_pirq_info(0, map_irq.pirq);
set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
handle_level_irq,
(type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
@@ -668,11 +638,6 @@ out:
}
#endif
-int xen_vector_from_irq(unsigned irq)
-{
- return vector_from_irq(irq);
-}
-
int xen_gsi_from_irq(unsigned irq)
{
return gsi_from_irq(irq);
@@ -752,6 +717,15 @@ static int bind_interdomain_evtchn_to_irq(unsigned int
remote_domain,
return err ? : bind_evtchn_to_irq(bind_interdomain.local_port);
}
+static enum ipi_vector ipi_from_irq(unsigned irq)
+{
+ struct irq_info *info = info_for_irq(irq);
+
+ BUG_ON(info == NULL);
+ BUG_ON(info->type != IRQT_IPI);
+
+ return info->u.ipi;
+}
int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
{
-----Original Message-----
From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Zhang, Xiantao
Sent: Thursday, September 24, 2009 4:15 PM
To: Jeremy Fitzhardinge; Christian Tramnitz
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx; He, Qing
Subject: RE: [Xen-devel] Re: Announcing xen/master: pvops git trees rearranged
Jeremy,
After reading your branch new_interrupt_routing, I think the main changes
about two hypercalls and their purposes maybe unnecessary. I also implemented
the similar logic to remove ioapic changes from pv_ops dom0 and just re-used
and extended existing interfaces for that. As to the new-introduced hypercall
PHYSDEVOP_route_gsi, the existing hypercall PHYSDEVOP_map_pirq can cover its
functionality through some extension. And for the hypercall
PHYSDEVOP_acpi_irq_model, seems it is redundant and unncessary, because
irq_model can be parsed through the related acpi tables, so hypervisor and dom0
can reach the agreement automatically after parsing the tables.
The attached two patches are based on latest Xen and pv_ops_dom0, and they
should works for you with latest Xen and pv_ops dom0. Since they are only for
furuther discussion, so one dirty hack about probe_gsi also exists in the
current code.
Xiantao
-----Original Message-----
From: Jeremy Fitzhardinge [mailto:jeremy@xxxxxxxx]
Sent: Thursday, September 24, 2009 4:14 AM
To: Christian Tramnitz
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx; He, Qing; Zhang, Xiantao
Subject: Re: [Xen-devel] Re: Announcing xen/master: pvops git trees rearranged
On 09/23/09 06:16, Christian Tramnitz wrote:
> are there plans to get any of the (non-bugfix) changes to upstream?
> I think the 2.6.32 merge window will close very soon right?
No plans to put anything into .32. We need to have a solid story about
how to handle IOAPIC setup before pushing the rest, I think. I've just
restarted work on that, but I need to work out how to reconcile it with
the recent MSI work.
J
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|