]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
AMD/iommu: SR56x0 Erratum 64 - Reset all head & tail pointers
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 22 May 2013 13:26:52 +0000 (15:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 22 May 2013 13:26:52 +0000 (15:26 +0200)
Reference at time of patch:
http://support.amd.com/us/ChipsetMotherboard_TechDocs/46303.pdf

Erratum 64 states that the head and tail pointers for the Command buffer and
Event log are only reset on a cold boot, not a warm boot.

While the erratum is limited to systems using SR56xx chipsets (such as Family
10h CPUs), resetting the pointers is a sensible action in all cases, including
the PPR log for consistency.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
xen/drivers/passthrough/amd/iommu_init.c

index abb94ece54aaf7af36f8ce9b56ef3b25bf0035ea..0bcf8d20254eebe9494f995223b9f352c6d29870 100644 (file)
@@ -154,6 +154,11 @@ static void register_iommu_cmd_buffer_in_mmio_space(struct amd_iommu *iommu)
                          IOMMU_CMD_BUFFER_LENGTH_MASK,
                          IOMMU_CMD_BUFFER_LENGTH_SHIFT, &entry);
     writel(entry, iommu->mmio_base+IOMMU_CMD_BUFFER_BASE_HIGH_OFFSET);
+
+    /* Reset head/tail pointer. SR56x0 Erratum 64 means this might not happen
+     * automatically for us. */
+    writeq(0, iommu->mmio_base + IOMMU_CMD_BUFFER_HEAD_OFFSET);
+    writeq(0, iommu->mmio_base + IOMMU_CMD_BUFFER_TAIL_OFFSET);
 }
 
 static void register_iommu_event_log_in_mmio_space(struct amd_iommu *iommu)
@@ -182,6 +187,11 @@ static void register_iommu_event_log_in_mmio_space(struct amd_iommu *iommu)
                         IOMMU_EVENT_LOG_LENGTH_MASK,
                         IOMMU_EVENT_LOG_LENGTH_SHIFT, &entry);
     writel(entry, iommu->mmio_base+IOMMU_EVENT_LOG_BASE_HIGH_OFFSET);
+
+    /* Reset head/tail pointer. SR56x0 Erratum 64 means this might not happen
+     * automatically for us. */
+    writeq(0, iommu->mmio_base + IOMMU_EVENT_LOG_HEAD_OFFSET);
+    writeq(0, iommu->mmio_base + IOMMU_EVENT_LOG_TAIL_OFFSET);
 }
 
 static void register_iommu_ppr_log_in_mmio_space(struct amd_iommu *iommu)
@@ -210,6 +220,9 @@ static void register_iommu_ppr_log_in_mmio_space(struct amd_iommu *iommu)
                         IOMMU_PPR_LOG_LENGTH_MASK,
                         IOMMU_PPR_LOG_LENGTH_SHIFT, &entry);
     writel(entry, iommu->mmio_base + IOMMU_PPR_LOG_BASE_HIGH_OFFSET);
+
+    writeq(0, iommu->mmio_base + IOMMU_PPR_LOG_HEAD_OFFSET);
+    writeq(0, iommu->mmio_base + IOMMU_PPR_LOG_TAIL_OFFSET);
 }