• Lennert Buytenhek's avatar
    iommu/amd: Recover from event log overflow · 5ce97f4e
    Lennert Buytenhek authored
    The AMD IOMMU logs I/O page faults and such to a ring buffer in
    system memory, and this ring buffer can overflow.  The AMD IOMMU
    spec has the following to say about the interrupt status bit that
    signals this overflow condition:
    
    	EventOverflow: Event log overflow. RW1C. Reset 0b. 1 = IOMMU
    	event log overflow has occurred. This bit is set when a new
    	event is to be written to the event log and there is no usable
    	entry in the event log, causing the new event information to
    	be discarded. An interrupt is generated when EventOverflow = 1b
    	and MMIO Offset 0018h[EventIntEn] = 1b. No new event log
    	entries are written while this bit is set. Software Note: To
    	resume logging, clear EventOverflow (W1C), and write a 1 to
    	MMIO Offset 0018h[EventLogEn].
    
    The AMD IOMMU driver doesn't currently implement this recovery
    sequence, meaning that if a ring buffer overflow occurs, logging
    of EVT/PPR/GA events will cease entirely.
    
    This patch implements the spec-mandated reset sequence, with the
    minor tweak that the hardware seems to want to have a 0 written to
    MMIO Offset 0018h[EventLogEn] first, before writing an 1 into this
    field, or the IOMMU won't actually resume logging events.
    Signed-off-by: default avatarLennert Buytenhek <buytenh@arista.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/YVrSXEdW2rzEfOvk@wantstofly.orgSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    5ce97f4e
iommu.c 85.7 KB