AMD IOMMU: Reset tail and head pointer of cmd buffer and event log
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 13 Jan 2009 15:16:46 +0000 (15:16 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 13 Jan 2009 15:16:46 +0000 (15:16 +0000)
Reset the tail and the head pointers of command buffer and event log
to zero in case that iommu does not reset them after the base
addresses of those buffers are updated.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
xen/drivers/passthrough/amd/iommu_init.c

index 18643f44c41a478524df577f5ec5d32791446f28..5b0157984533e6cbc4359bb191eba6913cd1344c 100644 (file)
@@ -195,6 +195,10 @@ static void __init set_iommu_command_buffer_control(struct amd_iommu *iommu,
                          IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_MASK,
                          IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_SHIFT, &entry);
     writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET);
+
+    /*reset head and tail pointer */
+    writel(0x0, iommu->mmio_base + IOMMU_CMD_BUFFER_HEAD_OFFSET);
+    writel(0x0, iommu->mmio_base + IOMMU_CMD_BUFFER_TAIL_OFFSET);
 }
 
 static void __init register_iommu_exclusion_range(struct amd_iommu *iommu)
@@ -259,6 +263,10 @@ static void __init set_iommu_event_log_control(struct amd_iommu *iommu,
                          IOMMU_CONTROL_COMP_WAIT_INT_MASK,
                          IOMMU_CONTROL_COMP_WAIT_INT_SHIFT, &entry);
     writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET);
+
+    /*reset head and tail pointer */
+    writel(0x0, iommu->mmio_base + IOMMU_EVENT_LOG_HEAD_OFFSET);
+    writel(0x0, iommu->mmio_base + IOMMU_EVENT_LOG_TAIL_OFFSET);
 }
 
 static int amd_iommu_read_event_log(struct amd_iommu *iommu, u32 event[])