From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4EF0C220C1602 for ; Wed, 22 Nov 2017 02:21:58 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2017 02:26:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,436,1505804400"; d="scan'208";a="176505757" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 22 Nov 2017 02:26:13 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Nov 2017 02:26:13 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 22 Nov 2017 02:26:12 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Wed, 22 Nov 2017 18:26:11 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , Laszlo Ersek , edk2-devel-01 CC: Ard Biesheuvel , "Dong, Eric" , Dann Frazier , "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdeModulePkg/AtaAtapiPassThru: disable only BM-DMA at ExitBootServices() Thread-Index: AQHTTnHmsNyTTWAjwEWWKz5G8qhC8KL3WQMAgCh24QCAAIqXAA== Date: Wed, 22 Nov 2017 10:26:10 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B9BABBA@shsmsx102.ccr.corp.intel.com> References: <20171026154819.20865-1-lersek@redhat.com> <734D49CCEBEEF84792F5B80ED585239D5BACC0A1@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BACC0A1@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/AtaAtapiPassThru: disable only BM-DMA at ExitBootServices() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Nov 2017 10:21:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray, You may explain more why Win10 S4 resume fails with only BM disabled, then = Laszlo can know the issue well. Thanks, Star -----Original Message----- From: Ni, Ruiyu=20 Sent: Wednesday, November 22, 2017 6:06 PM To: Laszlo Ersek ; edk2-devel-01 Cc: Ard Biesheuvel ; Dong, Eric ; Zeng, Star ; Dann Frazier Subject: RE: [edk2] [PATCH] MdeModulePkg/AtaAtapiPassThru: disable only BM-= DMA at ExitBootServices() Laszlo, Our QA found Win10 S4 resume fails due to your change. As you might notice that I just rolled back the BM disabling patches in Pci= Bus module, I am thinking about maybe you need to rollback the whole ExitBo= otServices callback as well to fix the compatibility issue. Thanks/Ray > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Laszlo Ersek > Sent: Saturday, October 28, 2017 12:10 AM > To: edk2-devel-01 > Cc: Ard Biesheuvel ; Dong, Eric=20 > ; Zeng, Star ; Dann Frazier=20 > > Subject: Re: [edk2] [PATCH] MdeModulePkg/AtaAtapiPassThru: disable=20 > only BM-DMA at ExitBootServices() >=20 > On 10/26/17 17:48, Laszlo Ersek wrote: > > Clearing I/O port decoding in the PCI command register at > > ExitBootServices() breaks IDE boot in Windows, on QEMU's "pc"=20 > > (i440fx) machine type. (AHCI boot on "q35" is unaffected.) Windows=20 > > seems repeatedly stuck, apparently waiting for a timeout of sorts. > > > > This is arguably a Windows bug; a native OS driver should not expect=20 > > the firmware to leave the PCI command register in any particular state. > > > > Strictly speaking, we only need to disable BM-DMA at=20 > > ExitBootServices(), in order to abort pending transfers to/from RAM,=20 > > which is soon to be owned by the OS. BM-DMA is also the only bit=20 > > that's explicitly named by the UEFI Driver Writers' Guide, for=20 > > clearing at > ExitBootServices(). > > > > I've verified that clearing only BM-DMA fixes the isse (boot time)=20 > > on i440fx, and does not regress q35/AHCI. > > > > Cc: Aleksei Kovura > > Cc: Ard Biesheuvel > > Cc: Dann Frazier > > Cc: Eric Dong > > Cc: Star Zeng > > Reported-by: Aleksei Kovura > > Reported-by: Dann Frazier > > Reported-by: https://launchpad.net/~cjkrupp > > Bisected-by: Dann Frazier > > Bisected-by: https://launchpad.net/~cjkrupp > > Suggested-by: Ard Biesheuvel > > Suggested-by: Star Zeng > > Ref: https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/1725560 > > Fixes: 6fb8ddd36bde45614b0a069528cdc97077835a74 > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Laszlo Ersek > > --- > > > > Notes: > > Repo: https://github.com/lersek/edk2.git > > Branch: ata_disable_only_bmdma > > > > MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 3 +--=20 > > MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 5 ++--- > > 2 files changed, 3 insertions(+), 5 deletions(-) > > > > diff --git=20 > > a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h > > b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h > > index 8d6eac706c0b..92c5bf2001cd 100644 > > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h > > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h > > @@ -123,8 +123,7 @@ typedef struct { > > LIST_ENTRY NonBlockingTaskList; > > > > // > > - // For disabling the device (especially Bus Master DMA) at > > - // ExitBootServices(). > > + // For disabling Bus Master DMA on the device at ExitBootServices(). > > // > > EFI_EVENT ExitBootEvent; > > } ATA_ATAPI_PASS_THRU_INSTANCE; > > diff --git=20 > > a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c > > b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c > > index 09064dda18b7..e10e0d4e65f6 100644 > > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c > > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c > > @@ -480,8 +480,7 @@ InitializeAtaAtapiPassThru ( } > > > > /** > > - Disable the device (especially Bus Master DMA) when exiting the=20 > > boot > > - services. > > + Disable Bus Master DMA on the device when exiting the boot services. > > > > @param[in] Event Event for which this notification function is be= ing > > called. > > @@ -506,7 +505,7 @@ AtaPassThruExitBootServices ( > > PciIo->Attributes ( > > PciIo, > > EfiPciIoAttributeOperationDisable, > > - Instance->EnabledPciAttributes, > > + Instance->EnabledPciAttributes &=20 > > + EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, > > NULL > > ); > > } > > >=20 > Thanks Everyone for the feedback; I fixed the typo pointed out by Star=20 > and pushed the patch as commit 76fd5a660d70. >=20 > Cheers > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel