diff options
-rw-r--r-- | drivers/iommu/amd_iommu.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 08f3eecb87a2..d90a421e9cac 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -450,12 +450,27 @@ static void dump_command(unsigned long phys_addr) | |||
450 | 450 | ||
451 | static void iommu_print_event(struct amd_iommu *iommu, void *__evt) | 451 | static void iommu_print_event(struct amd_iommu *iommu, void *__evt) |
452 | { | 452 | { |
453 | u32 *event = __evt; | 453 | int type, devid, domid, flags; |
454 | int type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK; | 454 | volatile u32 *event = __evt; |
455 | int devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; | 455 | int count = 0; |
456 | int domid = (event[1] >> EVENT_DOMID_SHIFT) & EVENT_DOMID_MASK; | 456 | u64 address; |
457 | int flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK; | 457 | |
458 | u64 address = (u64)(((u64)event[3]) << 32) | event[2]; | 458 | retry: |
459 | type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK; | ||
460 | devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; | ||
461 | domid = (event[1] >> EVENT_DOMID_SHIFT) & EVENT_DOMID_MASK; | ||
462 | flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK; | ||
463 | address = (u64)(((u64)event[3]) << 32) | event[2]; | ||
464 | |||
465 | if (type == 0) { | ||
466 | /* Did we hit the erratum? */ | ||
467 | if (++count == LOOP_TIMEOUT) { | ||
468 | pr_err("AMD-Vi: No event written to event log\n"); | ||
469 | return; | ||
470 | } | ||
471 | udelay(1); | ||
472 | goto retry; | ||
473 | } | ||
459 | 474 | ||
460 | printk(KERN_ERR "AMD-Vi: Event logged ["); | 475 | printk(KERN_ERR "AMD-Vi: Event logged ["); |
461 | 476 | ||
@@ -508,6 +523,8 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) | |||
508 | default: | 523 | default: |
509 | printk(KERN_ERR "UNKNOWN type=0x%02x]\n", type); | 524 | printk(KERN_ERR "UNKNOWN type=0x%02x]\n", type); |
510 | } | 525 | } |
526 | |||
527 | memset(__evt, 0, 4 * sizeof(u32)); | ||
511 | } | 528 | } |
512 | 529 | ||
513 | static void iommu_poll_events(struct amd_iommu *iommu) | 530 | static void iommu_poll_events(struct amd_iommu *iommu) |