From nobody Fri May 17 09:37:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+86969+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86969+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1645707486; cv=none; d=zohomail.com; s=zohoarc; b=EOv28G+M+FlSd5y3KKkqcLnfrv6EsdXoGveb8dfo0TCkuaSyI9Dz6vuYk3lEIg1Ro+oFs0+1kMlEv98U6JfjKcl7FbAw8wGV5DY9ivG+/MrdHgYbnYvdIYlrp/oQXrVZWb4K4bGUWmHnK6PPA/Trx8C1+GOLF7/D3hxNp8zJp5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1645707486; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=4WyEqkHj2fv5DgOqtdH+8uqD04Ai8MLgS3qh1HuJytA=; b=lSF3xe/2INyS5pnVHqiZRhhZTl8O7x6sTXBldLtlePMAjw3Y3bMYuS4en38XmrW5CW4nZ4bRqsHJGiS/UxGbcSgGAYaTiwpmRZRdFhikcFqo3PEadJKeaIZZRqMep+5bBfmrJ/QFqxOwhBJg/RGaIKDnPpp3SQGxamZfF7W3aPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86969+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1645707486398759.864555615646; Thu, 24 Feb 2022 04:58:06 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id sKbuYY1788612xaI3w3jsEuN; Thu, 24 Feb 2022 04:58:06 -0800 X-Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by mx.groups.io with SMTP id smtpd.web10.9809.1645707485179774329 for ; Thu, 24 Feb 2022 04:58:05 -0800 X-Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-01.qualcomm.com with ESMTP; 24 Feb 2022 04:58:04 -0800 X-QCInternal: smtphost X-Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 04:58:03 -0800 X-Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Thu, 24 Feb 2022 04:58:02 -0800 X-Received: from krabica.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Thu, 24 Feb 2022 04:58:00 -0800 From: "Tomas Pilar (tpilar)" To: CC: Ray Ni , Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [PATCH v2] MdeModulePkg: Correct high-memory use in NvmExpressDxe Date: Thu, 24 Feb 2022 12:57:53 +0000 Message-ID: <20220224125753.2021633-1-quic_tpilar@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,quic_tpilar@quicinc.com X-Gm-Message-State: mNZl32SRMNMhUNG4a9Un9ljUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1645707486; bh=v4Kes4sA2NJxwFX0NbAnhzXSMJeEyi9Hjn4DAgyPr+E=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=tdVSsaehVYlYpVxJoBcW7KRQ4GJP62CaRRbJMkq/0Yla5wrEn3gBtsFgxZ3CxvJuWhm RmKPY4JyBNTc8/qNuzpqD57rL9s9bWR+XgxCoX+l/dZde140Tph9s10sf7/MHuiiCZyhB jYvf9csKCpcaVrzsBIqil2oypwJWrDEsfuM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1645707488167100002 Content-Type: text/plain; charset="utf-8" Move the logic that sets EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE Pci attribute to DriverBindingStart() before the memory that backs the DMA engine is allocated. This ensures that the DMA-backing memory is not forcibly allocated below 4G in system address map. Otherwise the allocation fails on platforms that do not have any memory below the 4G mark and the drive initialisation fails. Cc: Ray Ni Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Tomas Pilar --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 13 +++++++++++++ MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg= /Bus/Pci/NvmExpressDxe/NvmExpress.c index 9d40f67e8e..1f0fc5bb68 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c @@ -959,6 +959,19 @@ NvmExpressDriverBindingStart ( goto Exit; } =20 + // + // Enable 64-bit DMA support in the PCI layer. + // + Status =3D PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationEnable, + EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "NvmeControllerInit: failed to enable 64-bit DMA= (%r)\n", Status)); + } + // // 6 x 4kB aligned buffers will be carved out of this buffer. // 1st 4kB boundary is the start of the admin submission queue. diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModule= Pkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c index ac77afe113..748cb0ba24 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c @@ -764,19 +764,6 @@ NvmeControllerInit ( return Status; } =20 - // - // Enable 64-bit DMA support in the PCI layer. - // - Status =3D PciIo->Attributes ( - PciIo, - EfiPciIoAttributeOperationEnable, - EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE, - NULL - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "NvmeControllerInit: failed to enable 64-bit DMA (= %r)\n", Status)); - } - // // Read the Controller Capabilities register and verify that the NVM com= mand set is supported // --=20 2.30.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86969): https://edk2.groups.io/g/devel/message/86969 Mute This Topic: https://groups.io/mt/89364026/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-