linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Borislav Petkov <bp@suse.de>, Joerg Roedel <joro@8bytes.org>
Subject: [ 20/89] IOMMU, AMD Family15h Model10-1Fh erratum 746 Workaround
Date: Fri,  1 Feb 2013 14:07:35 +0100	[thread overview]
Message-ID: <20130201130208.927241627@linuxfoundation.org> (raw)
In-Reply-To: <20130201130207.444989281@linuxfoundation.org>

3.7-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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu_init.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -975,6 +975,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.
@@ -1172,6 +1204,8 @@ static int iommu_init_pci(struct amd_iom
 			iommu->stored_l2[i] = iommu_read_l2(iommu, i);
 	}
 
+	amd_iommu_erratum_746_workaround(iommu);
+
 	return pci_enable_device(iommu->dev);
 }
 



  parent reply	other threads:[~2013-02-01 13:08 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-01 13:07 [ 00/89] 3.7.6-stable review Greg Kroah-Hartman
2013-02-01 13:07 ` [ 01/89] can: c_can: fix invalid error codes Greg Kroah-Hartman
2013-02-01 13:07 ` [ 02/89] can: ti_hecc: " Greg Kroah-Hartman
2013-02-01 13:07 ` [ 03/89] can: pch_can: " Greg Kroah-Hartman
2013-02-01 13:07 ` [ 04/89] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage Greg Kroah-Hartman
2013-02-01 13:07 ` [ 05/89] KVM: PPC: Emulate dcbf Greg Kroah-Hartman
2013-02-01 13:07 ` [ 06/89] powerpc/book3e: Disable interrupt after preempt_schedule_irq Greg Kroah-Hartman
2013-02-03 13:01   ` Ben Hutchings
2013-02-01 13:07 ` [ 07/89] ARM: DMA: Fix struct page iterator in dma_cache_maint() to work with sparsemem Greg Kroah-Hartman
2013-02-01 13:07 ` [ 08/89] ARM: OMAP2+: omap4-panda: add UART2 muxing for WiLink shared transport Greg Kroah-Hartman
2013-02-01 13:07 ` [ 09/89] ARM: at91: rm9200: remake the BGA as default version Greg Kroah-Hartman
2013-02-01 13:07 ` [ 10/89] ARM: S3C64XX: Fix up IRQ mapping for balblair on Cragganmore Greg Kroah-Hartman
2013-02-01 13:07 ` [ 11/89] ARM: 7627/1: Predicate preempt logic on PREEMP_COUNT not PREEMPT alone Greg Kroah-Hartman
2013-02-01 13:07 ` [ 12/89] ARM: 7628/1: head.S: map one extra section for the ATAG/DTB area Greg Kroah-Hartman
2013-02-01 13:07 ` [ 13/89] ARM: virt: Avoid bx instruction for compatibility with <=ARMv4 Greg Kroah-Hartman
2013-02-01 13:07 ` [ 14/89] ARM: virt: boot secondary CPUs through the right entry point Greg Kroah-Hartman
2013-02-01 13:07 ` [ 15/89] ARM: virt: simplify __hyp_stub_install epilog Greg Kroah-Hartman
2013-02-01 13:07 ` [ 16/89] mfd: tc3589x: Use simple irqdomain Greg Kroah-Hartman
2013-02-01 13:07 ` [ 17/89] Bluetooth: Fix sending HCI commands after reset Greg Kroah-Hartman
2013-02-01 13:07 ` [ 18/89] drm/radeon: fix cursor corruption on DCE6 and newer Greg Kroah-Hartman
2013-02-01 13:07 ` [ 19/89] radeon_display: Use pointer return error codes Greg Kroah-Hartman
2013-02-01 13:07 ` Greg Kroah-Hartman [this message]
2013-02-01 13:07 ` [ 21/89] xfs: Fix possible use-after-free with AIO Greg Kroah-Hartman
2013-02-01 13:07 ` [ 22/89] s390/thp: implement pmdp_set_wrprotect() Greg Kroah-Hartman
2013-02-01 13:07 ` [ 23/89] drm/i915: Disable AsyncFlip performance optimisations Greg Kroah-Hartman
2013-02-01 13:07 ` [ 24/89] drm/i915: GFX_MODE Flush TLB Invalidate Mode must be 1 for scanline waits Greg Kroah-Hartman
2013-02-01 13:07 ` [ 25/89] drm/i915: dump UTS_RELEASE into the error_state Greg Kroah-Hartman
2013-02-01 13:07 ` [ 26/89] mwifiex: update config_bands during infra association Greg Kroah-Hartman
2013-02-03 13:09   ` Ben Hutchings
2013-02-04 19:37     ` Bing Zhao
2013-02-01 13:07 ` [ 27/89] mwifiex: fix typo in PCIe adapter NULL check Greg Kroah-Hartman
2013-02-01 13:07 ` [ 28/89] iwlegacy: fix IBSS cleanup Greg Kroah-Hartman
2013-02-01 13:07 ` [ 29/89] brcmsmac: increase timer reference count for new timers only Greg Kroah-Hartman
2013-02-01 13:07 ` [ 30/89] brcmsmac: handle packet drop during transmit correctly Greg Kroah-Hartman
2013-02-01 13:07 ` [ 31/89] DM-RAID: Fix RAID10s check for sufficient redundancy Greg Kroah-Hartman
2013-02-01 13:07 ` [ 32/89] mac80211: synchronize scan off/on-channel and PS states Greg Kroah-Hartman
2013-02-01 13:07 ` [ 33/89] mac80211: fix FT roaming Greg Kroah-Hartman
2013-02-01 13:07 ` [ 34/89] ath9k_htc: Fix memory leak Greg Kroah-Hartman
2013-02-01 13:07 ` [ 35/89] ath9k: do not link receive buffers during flush Greg Kroah-Hartman
2013-02-01 13:07 ` [ 36/89] ath9k: fix double-free bug on beacon generate failure Greg Kroah-Hartman
2013-02-01 13:07 ` [ 37/89] ath9k: remove the WARN_ON that triggers if generating a beacon fails Greg Kroah-Hartman
2013-02-01 13:07 ` [ 38/89] ath9k: add a better fix for the rx tasklet vs rx flush race Greg Kroah-Hartman
2013-02-03 13:15   ` Ben Hutchings
2013-02-01 13:07 ` [ 39/89] ath9k: fix rx flush handling Greg Kroah-Hartman
2013-02-01 13:07 ` [ 40/89] ath9k: remove sc->rx.rxbuflock to fix a deadlock Greg Kroah-Hartman
2013-02-01 13:07 ` [ 41/89] ath9k: disable the tasklet before taking the PCU lock Greg Kroah-Hartman
2013-02-01 13:07 ` [ 42/89] ath9k_hw: fix chain swap setting when setting rx chainmask to 5 Greg Kroah-Hartman
2013-02-01 13:07 ` [ 43/89] ath9k: allow setting arbitrary antenna masks on AR9003+ Greg Kroah-Hartman
2013-02-01 13:07 ` [ 44/89] ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devices Greg Kroah-Hartman
2013-02-01 13:08 ` [ 45/89] ALSA: hda - Add a fixup for Packard-Bell desktop with ALC880 Greg Kroah-Hartman
2013-02-01 13:08 ` [ 46/89] ALSA: hda - fix inverted internal mic on Acer AOA150/ZG5 Greg Kroah-Hartman
2013-02-01 13:08 ` [ 47/89] ALSA: hda - Fix non-snoop page handling Greg Kroah-Hartman
2013-02-01 13:08 ` [ 48/89] EDAC: Test correct variable in ->store function Greg Kroah-Hartman
2013-02-01 13:08 ` [ 49/89] ASoC: arizona: Use actual rather than desired BCLK when calculating LRCLK Greg Kroah-Hartman
2013-02-01 13:08 ` [ 50/89] ASoC: wm2200: correct mixer values and text Greg Kroah-Hartman
2013-02-01 13:08 ` [ 51/89] Bluetooth: Fix incorrect strncpy() in hidp_setup_hid() Greg Kroah-Hartman
2013-02-01 13:08 ` [ 52/89] iommu/intel: disable DMAR for g4x integrated gfx Greg Kroah-Hartman
2013-02-01 13:08 ` [ 53/89] NFS: Fix error reporting in nfs_xdev_mount Greg Kroah-Hartman
2013-02-01 13:08 ` [ 54/89] NFS: Dont silently fail setattr() requests on mountpoints Greg Kroah-Hartman
2013-02-01 13:08 ` [ 55/89] NFSv4: Fix NFSv4 reference counting for trunked sessions Greg Kroah-Hartman
2013-02-01 13:08 ` [ 56/89] NFSv4: Fix NFSv4 trunking discovery Greg Kroah-Hartman
2013-02-01 13:08 ` [ 57/89] NFSv4.1: Ensure that nfs41_walk_client_list() does start lease recovery Greg Kroah-Hartman
2013-02-01 13:08 ` [ 58/89] NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session Greg Kroah-Hartman
2013-02-01 13:08 ` [ 59/89] HID: usbhid: quirk for Formosa IR receiver Greg Kroah-Hartman
2013-02-01 13:08 ` [ 60/89] smp: Fix SMP function call empty cpu mask race Greg Kroah-Hartman
2013-02-01 13:08 ` [ 61/89] x86/msr: Add capabilities check Greg Kroah-Hartman
2013-02-01 13:08 ` [ 62/89] efi: Make efi_enabled a function to query EFI facilities Greg Kroah-Hartman
2013-02-01 13:08 ` [ 63/89] samsung-laptop: Disable on EFI hardware Greg Kroah-Hartman
2013-02-01 13:08 ` [ 64/89] x86, efi: Fix display detection in EFI boot stub Greg Kroah-Hartman
2013-02-01 13:08 ` [ 65/89] x86, efi: Fix 32-bit EFI handover protocol entry point Greg Kroah-Hartman
2013-02-01 13:08 ` [ 66/89] efi, x86: Pass a proper identity mapping in efi_call_phys_prelog Greg Kroah-Hartman
2013-02-01 13:08 ` [ 67/89] x86, efi: Set runtime_version to the EFI spec revision Greg Kroah-Hartman
2013-02-01 13:08 ` [ 68/89] xfs: fix _xfs_buf_find oops on blocks beyond the filesystem end Greg Kroah-Hartman
2013-02-13 15:30   ` Paolo Bonzini
2013-02-13 16:18     ` Greg Kroah-Hartman
2013-02-14  0:07       ` Dave Chinner
2013-02-14 19:26         ` Greg Kroah-Hartman
2013-02-14 19:55           ` Ben Myers
2013-02-14 20:05             ` Greg Kroah-Hartman
2013-02-14 20:35               ` Ben Myers
2013-02-15  1:47               ` Dave Chinner
2013-02-15 15:07                 ` Ben Myers
2013-02-01 13:08 ` [ 69/89] drm/radeon: fix error path in kpage allocation Greg Kroah-Hartman
2013-02-01 13:08 ` [ 70/89] drm/radeon: fix a rare case of double kfree Greg Kroah-Hartman
2013-02-01 13:08 ` [ 71/89] kvm: Fix irqfd resampler list walk Greg Kroah-Hartman
2013-02-01 13:08 ` [ 72/89] netfilter: ip[6]t_REJECT: fix wrong transport header pointer in TCP reset Greg Kroah-Hartman
2013-02-01 13:08 ` [ 73/89] netfilter: nf_ct_reasm: fix conntrack reassembly expire code Greg Kroah-Hartman
2013-02-01 13:08 ` [ 74/89] x86/Sandy Bridge: Sandy Bridge workaround depends on CONFIG_PCI Greg Kroah-Hartman
2013-02-01 13:08 ` [ 75/89] xfs: fix periodic log flushing Greg Kroah-Hartman
2013-02-01 13:08 ` [ 76/89] target: fix regression with dev_link_magic in target_fabric_port_link Greg Kroah-Hartman
2013-02-01 13:08 ` [ 77/89] netfilter: nfnetlink_log: fix mac address for 6in4 tunnels Greg Kroah-Hartman
2013-02-01 13:08 ` [ 78/89] netfilter: nfnetlink_log: fix possible compilation issue due to missing include Greg Kroah-Hartman
2013-02-01 13:08 ` [ 79/89] netfilter: xt_CT: recover NOTRACK target support Greg Kroah-Hartman
2013-02-01 13:08 ` [ 80/89] netfilter: fix missing dependencies for the NOTRACK target Greg Kroah-Hartman
2013-02-01 13:08 ` [ 81/89] netfilter: xt_hashlimit: fix namespace destroy path Greg Kroah-Hartman
2013-02-01 13:08 ` [ 82/89] netfilter: xt_hashlimit: fix race that results in duplicated entries Greg Kroah-Hartman
     [not found]   ` <CA+6hz4qjj3wGgo-m50=qRxAN+OGUXKfUfgRp7Pys7NixgwQ3vQ@mail.gmail.com>
2013-02-01 15:32     ` Greg Kroah-Hartman
     [not found]       ` <CA+6hz4qjJpaH4HeoQ_NWT5ZX0+1PG-O87kxPK0rKEBG9go37DQ@mail.gmail.com>
2013-02-01 16:36         ` Greg Kroah-Hartman
2013-02-01 16:34     ` Pablo Neira Ayuso
2013-02-01 16:56       ` Feng Gao
2013-02-01 17:47         ` Pablo Neira Ayuso
2013-02-01 13:08 ` [ 83/89] netfilter: xt_recent: fix namespace destroy path Greg Kroah-Hartman
2013-02-01 13:08 ` [ 84/89] netfilter: xt_recent: avoid high order page allocations Greg Kroah-Hartman
2013-02-01 13:08 ` [ 85/89] netfilter: nf_conntrack: fix BUG_ON while removing nf_conntrack with netns Greg Kroah-Hartman
2013-02-01 13:08 ` [ 86/89] netfilter: x_tables: print correct hook names for ARP Greg Kroah-Hartman
2013-02-01 13:08 ` [ 87/89] netfilter: ctnetlink: fix leak in error path of ctnetlink_create_expect Greg Kroah-Hartman
2013-02-01 13:08 ` [ 88/89] drm/i915: fix FORCEWAKE posting reads Greg Kroah-Hartman
2013-02-01 13:08 ` [ 89/89] slub: assign refcount for kmalloc_caches Greg Kroah-Hartman
2013-02-01 23:24 ` [ 00/89] 3.7.6-stable review Shuah Khan
2013-02-02 21:39 ` Satoru Takeuchi

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=20130201130208.927241627@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@suse.de \
    --cc=joro@8bytes.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).