linux-stable/drivers/iommu/amd
Lennert Buytenhek ee974d9625 iommu/amd: Fix printing of IOMMU events when rate limiting kicks in
For the printing of RMP_HW_ERROR / RMP_PAGE_FAULT / IO_PAGE_FAULT
events, the AMD IOMMU code uses such logic:

	if (pdev)
		dev_data = dev_iommu_priv_get(&pdev->dev);

	if (dev_data && __ratelimit(&dev_data->rs)) {
		pci_err(pdev, ...
	} else {
		printk_ratelimit() / pr_err{,_ratelimited}(...
	}

This means that if we receive an event for a PCI devid which actually
does have a struct pci_dev and an attached struct iommu_dev_data, but
rate limiting kicks in, we'll fall back to the non-PCI branch of the
test, and print the event in a different format.

Fix this by changing the logic to:

	if (dev_data) {
		if (__ratelimit(&dev_data->rs)) {
			pci_err(pdev, ...
		}
	} else {
		pr_err_ratelimited(...
	}

Suggested-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/YPgk1dD1gPMhJXgY@wantstofly.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2021-07-26 14:22:40 +02:00
..
amd_iommu.h iommu/amd: Tidy up DMA ops init 2021-06-07 14:51:33 +02:00
amd_iommu_types.h iommu/amd: Remove the unused device errata code 2021-04-07 11:14:43 +02:00
debugfs.c
init.c Merge branches 'iommu/fixes', 'arm/rockchip', 'arm/smmu', 'x86/vt-d', 'x86/amd', 'virtio' and 'core' into next 2021-06-25 15:23:25 +02:00
io_pgtable.c iommu/amd: Fix sleeping in atomic in increase_address_space() 2021-03-04 13:15:56 +01:00
iommu.c iommu/amd: Fix printing of IOMMU events when rate limiting kicks in 2021-07-26 14:22:40 +02:00
iommu_v2.c iommu/amd: Convert from atomic_t to refcount_t on pasid_state->count 2021-07-26 13:46:57 +02:00
Kconfig iommu/amd: Prepare for generic IO page table framework 2021-01-28 16:51:17 +01:00
Makefile iommu/amd: Prepare for generic IO page table framework 2021-01-28 16:51:17 +01:00
quirks.c