# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224512030 -3600
# Node ID 10a2069a1edb49a8f5df97982feefca0f73deee9
# Parent e57ca7937ae8e6388c7a2ff56e3414feee9fd59e
Define a macro IO_APIC_ID() for x86.
Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx>
Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
xen/drivers/passthrough/vtd/intremap.c | 7 ++++---
xen/include/asm-x86/io_apic.h | 2 ++
2 files changed, 6 insertions(+), 3 deletions(-)
diff -r e57ca7937ae8 -r 10a2069a1edb xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c Mon Oct 20 15:13:02 2008 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c Mon Oct 20 15:13:50 2008 +0100
@@ -21,6 +21,7 @@
#include <xen/irq.h>
#include <xen/sched.h>
#include <xen/iommu.h>
+#include <asm/hvm/iommu.h>
#include <xen/time.h>
#include <xen/pci.h>
#include <xen/pci_regs.h>
@@ -179,7 +180,7 @@ unsigned int io_apic_read_remap_rte(
struct IO_xAPIC_route_entry old_rte = { 0 };
struct IO_APIC_route_remap_entry *remap_rte;
int rte_upper = (reg & 1) ? 1 : 0;
- struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
+ struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 ||
@@ -224,7 +225,7 @@ void io_apic_write_remap_rte(
struct IO_xAPIC_route_entry old_rte = { 0 };
struct IO_APIC_route_remap_entry *remap_rte;
unsigned int rte_upper = (reg & 1) ? 1 : 0;
- struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid);
+ struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic));
struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu);
int saved_mask;
@@ -253,7 +254,7 @@ void io_apic_write_remap_rte(
*(IO_APIC_BASE(apic)+4) = *(((int *)&old_rte)+0);
remap_rte->mask = saved_mask;
- if ( ioapic_rte_to_remap_entry(iommu, mp_ioapics[apic].mpc_apicid,
+ if ( ioapic_rte_to_remap_entry(iommu, IO_APIC_ID(apic),
&old_rte, rte_upper, value) )
{
*IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg;
diff -r e57ca7937ae8 -r 10a2069a1edb xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h Mon Oct 20 15:13:02 2008 +0100
+++ b/xen/include/asm-x86/io_apic.h Mon Oct 20 15:13:50 2008 +0100
@@ -19,6 +19,8 @@
#define IO_APIC_BASE(idx) \
((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \
+ (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK)))
+
+#define IO_APIC_ID(idx) (mp_ioapics[idx].mpc_apicid)
/*
* The structure of the IO-APIC:
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|