mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
	"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<linux-kernel@vger.kernel.org>,
	"open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)"
	<linux-ide@vger.kernel.org>,
	david.laight.linux@gmail.com,
	John Smith <imjohnsmith4000@gmail.com>,
	Lennert Buytenhek <kernel@wantstofly.org>,
	Roland Waltersson <roland.waltersson@netinsight.net>,
	Mikael Etienne <mikael1022bzh@gmail.com>,
	Arthur Husband <artmoty@gmail.com>,
	Alvin Lim <alvinwylim@gmail.com>,
	Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>
Subject: Re: [PATCH v2 1/2] x86/PCI: Disable enhanced atomics on some AMD PCIe ports
Date: Tue, 22 Sep 2026 10:35:49 -0500	[thread overview]
Message-ID: <4e2ac992-bbaf-4412-ab71-182b0b1abc79@amd.com> (raw)
In-Reply-To: <ed334568-d741-4374-b953-29a97a82963c@amd.com>



On 9/14/26 11:57, Mario Limonciello wrote:
> 
> 
> On 9/8/26 14:05, Mario Limonciello wrote:
>> There have been multiple reports of data corruption that can occur
>> with 64-bit DMA when the IOMMU is enabled. This occurs due to some
>> BIOSes enabling enhanced atomic operations on PCIe ports.
>>
>> When enhanced atomic operations are enabled on PCIe ports for some
>> models, data corruption occurs when the 32-bit IOVA space is exhausted.
>> The problem is reported on storage devices, but can affect any device
>> that uses 64 bit DMA.
>>
>> Disable enhanced atomics using SMN for NBIO 7.7 and 7.11 based models.
>>
>> Cc: david.laight.linux@gmail.com
>> Cc: John Smith <imjohnsmith4000@gmail.com>
>> Cc: Lennert Buytenhek <kernel@wantstofly.org>
>> Cc: Niklas Cassel <cassel@kernel.org>
>> Cc: Roland Waltersson <roland.waltersson@netinsight.net>
>> Reported-by: Mikael Etienne <mikael1022bzh@gmail.com>
>> Closes: https://lore.kernel.org/ 
>> all/178789300872.392066.15963676631650361573@gmail.com/
>> Reported-by: Arthur Husband <artmoty@gmail.com>
>> Closes: https://lore.kernel.org/linux-ide/20260406222335.379935-1- 
>> artmoty@gmail.com/
>> Reported-by: Alvin Lim <alvinwylim@gmail.com>
>> Closes: https://lore.kernel.org/linux-ide/20260621100844.1224301-1- 
>> alvinwylim@gmail.com/
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
> 
> There was a contingent of eager responders on the original issue added 
> to CC.
> 
> Those of you on CC - any progress with testing this?  Does it help you?
> 
> Internal AMD team did come up with a reproducer workload that we have 
> confirmed it helps.
> 
>> v2:
>>   * Apply to suspend/resume as well.
>> ---
>>   arch/x86/pci/fixup.c | 99 ++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 99 insertions(+)
>>
>> diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
>> index b301c6c8df753..79e4338e4b876 100644
>> --- a/arch/x86/pci/fixup.c
>> +++ b/arch/x86/pci/fixup.c
>> @@ -886,6 +886,105 @@ static void 
>> quirk_clear_strap_no_soft_reset_dev2_f0(struct pci_dev *dev)
>>       }
>>   }
>>   DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b8, 
>> quirk_clear_strap_no_soft_reset_dev2_f0);
>> +
>> +/*
>> + * Enhanced atomic operations can cause corruption with 64-bit IOVA
>> + * on these devices.
>> + */
>> +#define RX_ENH_ATOMIC_EN        BIT(8)
>> +
>> +static const u32 nbio_7_7_pcie_smn_addrs[] = {
>> +    0x111401d0,
>> +    0x111411d0,
>> +    0x111421d0,
>> +    0x111431d0,
>> +    0x111441d0,
>> +    0x112401d0,
>> +    0x112411d0,
>> +    0x112421d0,
>> +    0x112431d0,
>> +    0x112441d0,
>> +    0x112451d0,
>> +    0x113401d0,
>> +    0x114401d0,
>> +};
>> +
>> +static const u32 nbio_7_11_pcie_smn_addrs[] = {
>> +    0x112401d0,
>> +    0x112411d0,
>> +    0x112421d0,
>> +    0x112431d0,
>> +    0x112441d0,
>> +    0x112451d0,
>> +    0x113401d0,
>> +    0x113411d0,
>> +    0x113421d0,
>> +    0x113431d0,
>> +    0x113441d0,
>> +    0x113451d0,
>> +};
>> +
>> +static void quirk_amd_nbio_enhanced_atomic(struct pci_dev *host_bridge,
>> +                       const u32 *smn_addrs,
>> +                       size_t nr_smn_addrs)
>> +{
>> +    bool changed = false;
>> +    size_t i;
>> +    u32 data;
>> +    int ret;
>> +
>> +    for (i = 0; i < nr_smn_addrs; i++) {
>> +        ret = amd_smn_read(0, smn_addrs[i], &data);
>> +        if (ret)
>> +            continue;
>> +        if (!(data & RX_ENH_ATOMIC_EN))
>> +            continue;
>> +        data = data & ~RX_ENH_ATOMIC_EN;
>> +        ret = amd_smn_write(0, smn_addrs[i], data);
>> +        if (ret)
>> +            continue;
>> +        if (changed)
>> +            continue;
>> +        ret = amd_smn_read(0, smn_addrs[i], &data);
>> +        if (ret)
>> +            continue;
>> +        if (data & RX_ENH_ATOMIC_EN)
>> +            continue;
>> +        changed = true;
>> +    }
>> +
>> +    if (changed)
>> +        pci_info(host_bridge, "enhanced atomics disabled\n");
>> +}
>> +
>> +static void quirk_amd_nbio_7_7_disable_enhanced_atomic(struct pci_dev 
>> *dev)
>> +{
>> +    quirk_amd_nbio_enhanced_atomic(dev, nbio_7_7_pcie_smn_addrs,
>> +                       ARRAY_SIZE(nbio_7_7_pcie_smn_addrs));
>> +}
>> +
>> +static void quirk_amd_nbio_7_11_disable_enhanced_atomic(struct 
>> pci_dev *dev)
>> +{
>> +    quirk_amd_nbio_enhanced_atomic(dev, nbio_7_11_pcie_smn_addrs,
>> +                       ARRAY_SIZE(nbio_7_11_pcie_smn_addrs));
>> +}
>> +
>> +/* Phoenix, Hawk Point (NBIO 7.7) */
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x14E8,
>> +            quirk_amd_nbio_7_7_disable_enhanced_atomic);
>> +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x14E8,
>> +            quirk_amd_nbio_7_7_disable_enhanced_atomic);
>> +
>> +/* Strix, Krackan, Strix Halo (NBIO 7.11) */
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1507,
>> +            quirk_amd_nbio_7_11_disable_enhanced_atomic);
>> +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1507,
>> +            quirk_amd_nbio_7_11_disable_enhanced_atomic);
>> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1122,
>> +            quirk_amd_nbio_7_11_disable_enhanced_atomic);
>> +DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1122,
>> +            quirk_amd_nbio_7_11_disable_enhanced_atomic);
>> +
>>   #endif
>>   /*
> 

Bjorn,

Ping on this patch.  There are active reports of data loss from this 
BIOS bug, so I would like to get the W/A merged soon if we can.

We have an A-b from Niklas on 2/2.

Thanks,


  reply	other threads:[~2026-09-22 15:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 19:05 [PATCH v2 0/2] Fix for storage corruption w/ AMD IOMMU on 64-bit addressing Mario Limonciello
2026-09-08 19:05 ` [PATCH v2 1/2] x86/PCI: Disable enhanced atomics on some AMD PCIe ports Mario Limonciello
2026-09-14 16:57   ` Mario Limonciello
2026-09-22 15:35     ` Mario Limonciello [this message]
2026-09-23 17:12   ` Bjorn Helgaas
2026-09-23 17:30     ` Mario Limonciello
2026-09-23 18:05       ` Bjorn Helgaas
2026-09-23 18:25         ` Mario Limonciello
2026-09-08 19:06 ` [PATCH v2 2/2] Revert "ata: ahci: force 32-bit DMA for JMicron JMB582/JMB585" Mario Limonciello
2026-09-22 12:52   ` Niklas Cassel
2026-09-21  4:52 ` [PATCH v2 0/2] Fix for storage corruption w/ AMD IOMMU on 64-bit addressing Mario Limonciello
2026-09-22  9:49   ` Niklas Cassel
2026-09-22 10:44     ` Mario Limonciello
2026-09-22 15:46   ` Mario Limonciello
2026-09-23 18:36 ` Bjorn Helgaas
2026-09-23 18:39   ` Mario Limonciello
2026-09-23 18:46     ` Bjorn Helgaas

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=4e2ac992-bbaf-4412-ab71-182b0b1abc79@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=alvinwylim@gmail.com \
    --cc=artmoty@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=cassel@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.laight.linux@gmail.com \
    --cc=dlemoal@kernel.org \
    --cc=hpa@zytor.com \
    --cc=imjohnsmith4000@gmail.com \
    --cc=kernel@wantstofly.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mikael1022bzh@gmail.com \
    --cc=mingo@redhat.com \
    --cc=roland.waltersson@netinsight.net \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®