All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Joerg Roedel <joro@8bytes.org>,
	Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Subject: [PATCH 64/93] IOMMU, AMD Family15h Model10-1Fh erratum 746 Workaround
Date: Tue,  5 Feb 2013 20:06:53 -0200	[thread overview]
Message-ID: <1360102042-10732-65-git-send-email-herton.krzesinski@canonical.com> (raw)
In-Reply-To: <1360102042-10732-1-git-send-email-herton.krzesinski@canonical.com>

3.5.7.5 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

commit 318fe782539c4150d1b8e4e6c9dc3a896512cb8a upstream.

The IOMMU may stop processing page translations due to a perceived lack
of credits for writing upstream peripheral page service request (PPR)
or event logs. If the L2B miscellaneous clock gating feature is enabled
the IOMMU does not properly register credits after the log request has
completed, leading to a potential system hang.

BIOSes are supposed to disable L2B micellaneous clock gating by setting
L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b. This
patch corrects that for those which do not enable this workaround.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/iommu/amd_iommu_init.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index a33612f..eadc6b5 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -1002,6 +1002,38 @@ static void __init free_iommu_all(void)
 }
 
 /*
+ * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations)
+ * Workaround:
+ *     BIOS should disable L2B micellaneous clock gating by setting
+ *     L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b
+ */
+static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
+{
+	u32 value;
+
+	if ((boot_cpu_data.x86 != 0x15) ||
+	    (boot_cpu_data.x86_model < 0x10) ||
+	    (boot_cpu_data.x86_model > 0x1f))
+		return;
+
+	pci_write_config_dword(iommu->dev, 0xf0, 0x90);
+	pci_read_config_dword(iommu->dev, 0xf4, &value);
+
+	if (value & BIT(2))
+		return;
+
+	/* Select NB indirect register 0x90 and enable writing */
+	pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8));
+
+	pci_write_config_dword(iommu->dev, 0xf4, value | 0x4);
+	pr_info("AMD-Vi: Applying erratum 746 workaround for IOMMU at %s\n",
+		dev_name(&iommu->dev->dev));
+
+	/* Clear the enable writing bit */
+	pci_write_config_dword(iommu->dev, 0xf0, 0x90);
+}
+
+/*
  * This function clues the initialization function for one IOMMU
  * together and also allocates the command buffer and programs the
  * hardware. It does NOT enable the IOMMU. This is done afterwards.
@@ -1062,6 +1094,8 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
 	if (iommu->cap & (1UL << IOMMU_CAP_NPCACHE))
 		amd_iommu_np_cache = true;
 
+	amd_iommu_erratum_746_workaround(iommu);
+
 	return pci_enable_device(iommu->dev);
 }
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-02-05 22:11 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 22:05 [ 3.5.y.z extended stable ] Linux 3.5.7.5 stable review Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 01/93] virtio-blk: Don't free ida when disk is in use Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 02/93] ioat: Fix DMA memory sync direction correct flag Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 03/93] PCI: pciehp: Use per-slot workqueues to avoid deadlock Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 04/93] PCI/AER: pci_get_domain_bus_and_slot() call missing required pci_dev_put() Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 05/93] PCI: Allow pcie_aspm=force even when FADT indicates it is unsupported Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 06/93] xen/grant-table: correctly initialize grant table version 1 Herton Ronaldo Krzesinski
2013-02-05 22:05 ` Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 07/93] serial:ifx6x60:Delete SPI timer when shut down port Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 08/93] tty: 8250_dw: Fix inverted arguments to serial_out in IRQ handler Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 09/93] drm/i915: Invalidate the relocation presumed_offsets along the slow path Herton Ronaldo Krzesinski
2013-02-05 22:05 ` [PATCH 10/93] ARM: 7627/1: Predicate preempt logic on PREEMP_COUNT not PREEMPT alone Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 11/93] xen: Fix stack corruption in xen_failsafe_callback for 32bit PVOPS guests Herton Ronaldo Krzesinski
2013-02-06 10:18   ` Frediano Ziglio
2013-02-06 10:18     ` Frediano Ziglio
2013-02-06 13:16     ` Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 12/93] staging: vt6656: Fix inconsistent structure packing Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 13/93] 8250/16?50: Add support for Broadcom TruManage redirected serial port Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 14/93] KVM: PPC: Emulate dcbf Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 15/93] staging: wlan-ng: Fix clamping of returned SSID length Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 16/93] USB: option: blacklist network interface on ONDA MT8205 4G LTE Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 17/93] USB: option: add TP-LINK HSUPA Modem MA180 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 18/93] ALSA: hda - Fix mute led for another HP machine Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 19/93] usb: dwc3: gadget: fix ep->maxburst for ep0 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 20/93] ACPI / cpuidle: Fix NULL pointer issues when cpuidle is disabled Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 21/93] ACPI / processor: Get power info before updating the C-states Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 22/93] ARM: DMA: Fix struct page iterator in dma_cache_maint() to work with sparsemem Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 23/93] evm: checking if removexattr is not a NULL Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 24/93] ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 25/93] ftrace: Be first to run code modification on modules Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 26/93] i2c: mxs: Fix type of error code Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 27/93] USB: UHCI: fix IRQ race during initialization Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 28/93] async: fix __lowest_in_progress() Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 29/93] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 30/93] ARM: at91: rm9200: remake the BGA as default version Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 31/93] Bluetooth: Fix sending HCI commands after reset Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 32/93] Bluetooth: Fix incorrect strncpy() in hidp_setup_hid() Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 33/93] ath9k_htc: Fix memory leak Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 34/93] ath9k: do not link receive buffers during flush Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 35/93] ath9k: add a better fix for the rx tasklet vs rx flush race Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 36/93] ath9k: fix rx flush handling Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 37/93] brcmsmac: increase timer reference count for new timers only Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 38/93] ath9k: remove sc->rx.rxbuflock to fix a deadlock Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 39/93] ath9k: disable the tasklet before taking the PCU lock Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 40/93] ASoC: wm2200: correct mixer values and text Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 41/93] mac80211: fix FT roaming Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 42/93] mac80211: synchronize scan off/on-channel and PS states Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 43/93] efi, x86: Pass a proper identity mapping in efi_call_phys_prelog Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 44/93] iwlegacy: fix IBSS cleanup Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 45/93] ath9k_hw: fix calibration issues on chainmask that don't include chain 0 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 46/93] ath9k_hw: fix chain swap setting when setting rx chainmask to 5 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 47/93] mwifiex: fix typo in PCIe adapter NULL check Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 48/93] drm/i915: Disable AsyncFlip performance optimisations Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 49/93] drm/i915: GFX_MODE Flush TLB Invalidate Mode must be '1' for scanline waits Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 50/93] iommu/intel: disable DMAR for g4x integrated gfx Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 51/93] drm/i915: dump UTS_RELEASE into the error_state Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 52/93] ALSA: hda - Add a fixup for Packard-Bell desktop with ALC880 Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 53/93] drm/radeon: fix cursor corruption on DCE6 and newer Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 54/93] radeon_display: Use pointer return error codes Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 55/93] drm/radeon: fix error path in kpage allocation Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 56/93] drm/radeon: fix a rare case of double kfree Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 57/93] x86/msr: Add capabilities check Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 58/93] x86, efi: Set runtime_version to the EFI spec revision Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 59/93] can: c_can: fix invalid error codes Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 60/93] can: ti_hecc: " Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 61/93] can: pch_can: " Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 62/93] ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 63/93] smp: Fix SMP function call empty cpu mask race Herton Ronaldo Krzesinski
2013-02-05 22:06 ` Herton Ronaldo Krzesinski [this message]
2013-02-05 22:06 ` [PATCH 65/93] xfs: Fix possible use-after-free with AIO Herton Ronaldo Krzesinski
2013-02-05 22:06   ` Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 66/93] powerpc/book3e: Disable interrupt after preempt_schedule_irq Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 67/93] ALSA: hda - Fix non-snoop page handling Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 68/93] EDAC: Test correct variable in ->store function Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 69/93] efi: Make 'efi_enabled' a function to query EFI facilities Herton Ronaldo Krzesinski
2013-02-05 22:06 ` [PATCH 70/93] samsung-laptop: Disable on EFI hardware Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 71/93] NFS: Fix error reporting in nfs_xdev_mount Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 72/93] NFS: Don't silently fail setattr() requests on mountpoints Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 73/93] NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 74/93] drivers/firmware/dmi_scan.c: check dmi version when get system uuid Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 75/93] drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 76/93] [libata] ahci: Add support for Enmotus Bobcat device Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 77/93] [libata] ahci: Fix lack of command retry after a success error handler Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 78/93] x86/Sandy Bridge: mark arrays in __init functions as __initconst Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 79/93] x86/Sandy Bridge: Sandy Bridge workaround depends on CONFIG_PCI Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 80/93] ptrace: introduce signal_wake_up_state() and ptrace_signal_wake_up() Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 81/93] ptrace: ensure arch_ptrace/ptrace_request can never race with SIGKILL Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 82/93] wake_up_process() should be never used to wakeup a TASK_STOPPED/TRACED task Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 83/93] drm/i915: Implement WaDisableHiZPlanesWhenMSAAEnabled Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 84/93] ahci: Add identifiers for ASM106x devices Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 85/93] module: fix symbol waiting when module fails before init Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 86/93] module: wait when loading a module which is currently initializing Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 87/93] module: add new state MODULE_STATE_UNFORMED Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 88/93] module: put modules in list much earlier Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 89/93] module: fix missing module_mutex unlock Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 90/93] intel_idle: Don't register CPU notifier if we are not running Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 91/93] xfs: fix periodic log flushing Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 92/93] gspca_kinect: add Kinect for Windows USB id Herton Ronaldo Krzesinski
2013-02-05 22:07 ` [PATCH 93/93] ARM: 7628/1: head.S: map one extra section for the ATAG/DTB area Herton Ronaldo Krzesinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360102042-10732-65-git-send-email-herton.krzesinski@canonical.com \
    --to=herton.krzesinski@canonical.com \
    --cc=joro@8bytes.org \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=suravee.suthikulpanit@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.