From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=216.205.24.162; helo=us-smtp-delivery-162.mimecast.com; envelope-from=eugene@hp.com; receiver=edk2-devel@lists.01.org Received: from us-smtp-delivery-162.mimecast.com (us-smtp-delivery-162.mimecast.com [216.205.24.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 97551208EB3F0 for ; Fri, 1 Mar 2019 03:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hp.com; s=mimecast20180716; t=1551438157; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qhkS76NY4Xq1LUIKJRVxz0wucFuLeTpmrQ0ufM/er7A=; b=WB+mT//YbWS2g3LdY6rKdzEQcEVO5d3XuYWjU+/hFu3Zjk53k9F+VCm3t8KLXThCKMDJeOa3txc6SIo6Z8N8uYvObPKG7SqUesctR57z8Cb41D3s8NLMlBGJx6DH68YkwAo0bj1xIwVdwI2GUFo6IoDLQhCgGKJi/lZd1jvJ1xI= Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02lp2050.outbound.protection.outlook.com [104.47.37.50]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-117-I5k5cnlgMWCPAVS1AUPWYg-1; Fri, 01 Mar 2019 06:02:26 -0500 Received: from CS1PR8401MB1189.NAMPRD84.PROD.OUTLOOK.COM (10.169.97.20) by CS1PR8401MB0726.NAMPRD84.PROD.OUTLOOK.COM (10.169.15.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Fri, 1 Mar 2019 11:02:23 +0000 Received: from CS1PR8401MB1189.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ec9d:c9c3:8a92:4378]) by CS1PR8401MB1189.NAMPRD84.PROD.OUTLOOK.COM ([fe80::ec9d:c9c3:8a92:4378%4]) with mapi id 15.20.1643.019; Fri, 1 Mar 2019 11:02:23 +0000 From: "Cohen, Eugene" To: Ashish Singhal , "Wu, Hao A" , "edk2-devel@lists.01.org" , Ard Biesheuvel Thread-Topic: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit systems Thread-Index: AdTOimUh6bq74L7bQyCZsF0hnADHfgAhuWlQABE+2EAAEKP68AABVU+wAANAbhAAAOJ+kAAA/hKAAAC2wPAAAuBuQAAAWehwAABoBD4AFkEtwA== Date: Fri, 1 Mar 2019 11:02:23 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [75.174.144.62] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e3ef45b1-810b-48dc-a0df-08d69e356232 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:CS1PR8401MB0726; x-ms-traffictypediagnostic: CS1PR8401MB0726: x-ms-exchange-purlcount: 7 x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; CS1PR8401MB0726; 23:jdn7mQUxjxhtpSA5VYju+FqjbSZU6fLwo0l1Tck?= =?us-ascii?Q?88qx8qK1rTSgp3Rsy0v6QhWmTLaFlvpjDMmdDNUeqi+0xke2vrDS860yah1t?= =?us-ascii?Q?PGWt80Px0SlhMGI8qg7oEac0PaHwQ8hISmqmRizLhkYizaundeMrNucx4Q0q?= =?us-ascii?Q?kYmlU4ZxrQl5GKYHVXfm/Fq+DWl3Fc072LZ1LRfDi2ghZMMHEWo8hwDfxQKT?= =?us-ascii?Q?nz9p4yA2HWfjL1N5wkFb8DHGZISR4V/2Ai0YZ5NIs56e/yJZjlDOviuC6BC5?= =?us-ascii?Q?eTVOmFLMrL2ZCZOJ73sdceYNkHUyspbzWPu7xx+aS2hPgUGfHuXCCNchG6jB?= =?us-ascii?Q?7Vumf0wRlw3tcUbs+II7C4YezXIo6pPl+zEok4bzSgGPOOfKOmNpaWzo9Xte?= =?us-ascii?Q?CsuJAQuhxzOO6a8WCDqivl7HCcHygAurTLpk5xlce7LUNtb054DQhpxiLG4i?= =?us-ascii?Q?Do21nFz6Z6ch2vDGYcBKVrEzLGZbK4bdwvVMcAdpUe66OhyOanLN6pl8Yg47?= =?us-ascii?Q?MWCiHWykzE7Wvy1FHsaiRfErTMOnTO5k+mcUapNXPi5o0CR6AcHWhBoKnnKc?= =?us-ascii?Q?L2Pa3gB5NGNM7VAfedO3DVwvkj4ZKdqFva4Wd7xsSX9IQK5d4x/TmQamABkO?= =?us-ascii?Q?BQ99XLW8urnlQkCLCjLTLBRP/kt9BLIErL30ZeNAl/EG/YnUpuO8KCvbkbKa?= =?us-ascii?Q?Efjlz5ggsQ8RFfFKoojxZam+5Y/Qv/UJvZjRBH2V4HbLeL2QH89tYC/oidiB?= =?us-ascii?Q?ukDj9NRuQc0M32rX5alJObqdZjJl3vQ3G4evJg0Es4caRxJx7KjmadYh1O2s?= =?us-ascii?Q?IZQpSZuKjqnwvv3IsusE/D3Vm0IrTP14RsBRpvQB9TQsOl4dZC9jj5c+RXOp?= =?us-ascii?Q?yJql/Os/sv95JPCTztaXyh9t6w7rBBJvt7A3Z0QIpqiZ45Q4C6jo6T+w54GR?= =?us-ascii?Q?PpkHGOVsGzdZQBqdfJc1k2cThjHmwgktPIcVrRKh5uJ/rXQfQEbY69U4a2hN?= =?us-ascii?Q?N0EtfEoM03reYVMpZ7NqyhbTeunKX83416AtqXZeSBElUtqdulVAj3XGBX3B?= =?us-ascii?Q?STxkQOtHrvqL8Qoij0vrJWSeDjJREm/bOfVTk8GsZJWWEXGsgjzWrd+JuGV6?= =?us-ascii?Q?M0kSVYPor/O2gzepRvkjDw2FSlcS9m+E+JsLuh/2hMjFkaQIZHp0pb2fgywL?= =?us-ascii?Q?KNTuYuJ01hZhzH5fwyueYkTMSYUGQx8Y/m4fj9VOxjnAGs0h3BGtcjfdGiSi?= =?us-ascii?Q?flFVU9MCr14X1wstxaTQJwM5PlViSGf7gMcrzXdXvjJ/13Nvnepe6KUigECI?= =?us-ascii?Q?GJlXC87Ebu7Ckfjvn1Tw3EVpMqSx2KIr97Sk2Efcy+0U0dM686KyxoB8WRBK?= =?us-ascii?Q?1Ys8Tbs+5o1wyEdK7TmRxpbB5iBq1DkoB24tg6xygjrg3x+xba03fIKMqkQz?= =?us-ascii?Q?xB4vqLZgujUCgVdoCo8/A/jFIWbw2OTv2S65Y5kLZHFv45k+uO4ll87t8Uyw?= =?us-ascii?Q?PsU6o7TG8bKRrEyPiTWkGe+xGyUQTRdKuAx4=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(376002)(366004)(396003)(346002)(136003)(39860400002)(6602003)(199004)(189003)(51444003)(51914003)(13464003)(11346002)(6246003)(106356001)(446003)(105586002)(74316002)(53546011)(6506007)(7736002)(966005)(186003)(8936002)(316002)(68736007)(478600001)(99286004)(76176011)(110136005)(8676002)(81166006)(81156014)(7696005)(86362001)(66066001)(26005)(93886005)(102836004)(3846002)(606006)(229853002)(25786009)(2906002)(45080400002)(256004)(97736004)(71200400001)(71190400001)(5660300002)(33656002)(14444005)(2501003)(53946003)(54896002)(6306002)(6116002)(790700001)(9686003)(236005)(476003)(30864003)(53936002)(486006)(6436002)(14454004)(55016002)(579004); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR8401MB0726; H:CS1PR8401MB1189.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 52lKEIzVgB2+LMBXk5nEKjA9efQK8oyGssOukQrGOUv6pOVNJ3mAP87g33qo9hL3w7+/XSUBGb46Sy4RWJ7eww+n/P1KThKbv+T9h3kI9rGOmUiccEr8H1uWq15ehBPFFikRr5ism4UPe+rNhiHZ/UHRYumMbTAfY4T7d22FinwNVTp3oJkE2T3lyJB/PyYlIfsCXcyFdzpyZy6Msl8lXMY8BSDejFEyHhHcqitcR1hGoFLKFe3FL/7KoBy0LG7T1K5lUcVS98k5eDT57tn8vDd6DEb76boDqjeAEbzhweRMun45TWugxYYlRiej4BciEzBw8Ssno1cbzbCRfh4CRXA8Cg14eNVCcvxTv+ASEDhGgf27LZnw+I67gCcsIRFtMByl03HF1/Gta57NkI+DQr/GDh8jBLrULfmWHm+R58I= MIME-Version: 1.0 X-OriginatorOrg: hp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3ef45b1-810b-48dc-a0df-08d69e356232 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 11:02:23.6183 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: ca7981a2-785a-463d-b82a-3db87dfc3ce6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB0726 X-MC-Unique: I5k5cnlgMWCPAVS1AUPWYg-1 X-Mimecast-Spam-Score: 0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit systems X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2019 11:02:40 -0000 Content-Language: en-US Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Ashish, Yes this issue existed before V4 support came in. The previous code would test the (V3) SysBus64 bit: https://github.com/tian= ocore/edk2/blob/7f3b0bad4bbb3cb24014d2e6216615896ea09dbf/MdeModulePkg/Bus/P= ci/SdMmcPciHcDxe/SdMmcPciHcDxe.c#L652 And then return an error building the ADMA descriptor table because the add= ress is not within 32-bit DMA range: https://github.com/tianocore/edk2/blob= /7f3b0bad4bbb3cb24014d2e6216615896ea09dbf/MdeModulePkg/Bus/Pci/SdMmcPciHcDx= e/SdMmcPciHci.c#L1295 Eugene From: Ashish Singhal Sent: Thursday, February 28, 2019 5:19 PM To: Cohen, Eugene ; Wu, Hao A ; edk2-dev= el@lists.01.org; Ard Biesheuvel Subject: Re: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Eugene, Small question. Did the issue appear after the V4 patch went in? Looking at= the code before that patch, we were enabling 64b dma in pci based on capab= ility register already despite of driver supporting only 32b dma. Thanks Ashish Get Outlook for iOS ________________________________ From: Cohen, Eugene > Sent: Thursday, February 28, 2019 5:11 PM To: Ashish Singhal; Wu, Hao A; edk2-devel@lists.01.org; Ard Biesheuvel Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Ashish, Agreed - #2 would be better in the long run since this will have better per= formance by eliminating the bounce buffering. My original intent in submit= ting the patch was to fix the logic the current implementation with minimal= impact. Thanks, Eugene From: Ashish Singhal > Sent: Thursday, February 28, 2019 4:58 PM To: Cohen, Eugene >; Wu, Hao A >; edk2-devel@lists.01.org; Ard Biesheuvel > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Eugene, Thanks for pointing that out. This is a use case we are not covering as of = now. I see two options to this: 1. Do not enable 64b DMA support in PCI based on V3 as driver does not s= upport V3 64b ADMA. This is a quick fix. 2. Enable V3 64b ADMA support to add the missing feature. This will take= maybe a day or two and can be done. Thanks Ashish From: Cohen, Eugene > Sent: Thursday, February 28, 2019 3:40 PM To: Ashish Singhal = >; Wu, Hao A >; edk2-devel@li= sts.01.org; Ard Biesheuvel > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Ashish, I think that code will still fail for our use case. We are version 3 with = 64-bit support so Private->Capability[Slot].SysBus64V3 =3D=3D 0 will evalua= te to FALSE. Since we are V3 Private->ControllerVersion[Slot] >=3D SD_MMC_= HC_CTRL_VER_400 will also evaluate to FALSE. Therefore Support64BitDma wil= l still be TRUE resulting in DUAL_ADDRESS_CYCLE being set which disables bo= unce buffering. Since no code is in place to do V3 64b DMA we will still hit the same probl= em, specifically namely that buffers that are not DMAable will be allocated= and we will still fail the check here. Until such time that V3 64b DMA support is in place I believe only the V4 b= it should be evaluated. Eugene From: Ashish Singhal > Sent: Thursday, February 28, 2019 3:21 PM To: Cohen, Eugene >; Wu, Hao A >; edk2-devel@lists.01.org; Ard Biesheuvel > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Eugene, Thanks for the explanation. The problem is valid and is more clear to me no= w. How about we do this: Instead of: if (Private->Capability[Slot].SysBus64V3 =3D=3D 0 && Private->Capability[Slot].SysBus64V4 =3D=3D 0) { Support64BitDma =3D FALSE; } What do you think about: if ((Private->ControllerVersion[Slot] =3D=3D SD_MMC_HC_CTRL_VER_300 && Private->Capability[Slot].SysBus64V3 =3D=3D 0) || (Private->ControllerVersion[Slot] >=3D SD_MMC_HC_CTRL_VER_400 && Private->Capability[Slot].SysBus64V4 =3D=3D 0)) { Support64BitDma =3D FALSE; } With this, we would be checking 64b capability based on the version we are = using and not for something we may not be using despite of being advertised= in the controller. Thanks Ashish From: Cohen, Eugene > Sent: Thursday, February 28, 2019 2:59 PM To: Ashish Singhal = >; Wu, Hao A >; edk2-devel@li= sts.01.org; Ard Biesheuvel > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Ashish, > Right now, we disable 64b DMA Support in PCI if the controller cannot su= pport 64b DMA in V3 as well as V4. If either of these support 64b DMA, we = do not disable it. In the code, we set Support64BitDma to TRUE by default a= nd change it to FALSE only if any of the controller does not support it in = V3 as well as V4. If all controllers support it in V3 or V4 we keep 64b DMA= support enabled. That is precisely the problem. An SDHC v3 controller might support 64b DMA= in V3 but not in V4 mode. The current code will leave 64b DMA support ena= bled resulting in the issuing of the PCI DUAL_ADDRESS_CYCLE attribute ( see= https://github.com/tianocore/edk2/blob/ece4c1de3e7b2340d351c2054c79ea689a9= 54ed6/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c#L738 ) which then causes buffer= s to be allocated that cannot be DMAed. For reference look at this snippet of the NonDiscoverablePciDeviceIo driver= : https://github.com/tianocore/edk2/blob/ece4c1de3e7b2340d351c2054c79ea689a= 954ed6/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciD= eviceIo.c#L622 and you can see that bounce buffering will onl= y occur if DUAL_ADDRESS_CYCLE is clear. So since we do not have V3 64b DMA (96-bit descriptor) support in place we = must not allow the DUAL_ADDRESS_CYCLE attribute to be set or we will fail w= ith this check: https://github.com/tianocore/edk2/blob/ece4c1de3e7b2340d351= c2054c79ea689a954ed6/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c#L1426= I've added Ard who updated the driver with DUAL_ADDRESS_CYCLE support. Eugene From: Ashish Singhal > Sent: Thursday, February 28, 2019 2:28 PM To: Cohen, Eugene >; Wu, Hao A >; edk2-devel@lists.01.org Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Eugene, We do not have support for V4 64b DMA right now but it can be added later i= f needed. I am trying to understand the reason behind changing the check fr= om AND to OR. Right now, we disable 64b DMA Support in PCI if the controlle= r cannot support 64b DMA in V3 as well as V4. If either of these support 64= b DMA, we do not disable it. In the code, we set Support64BitDma to TRUE by= default and change it to FALSE only if any of the controller does not supp= ort it in V3 as well as V4. If all controllers support it in V3 or V4 we ke= ep 64b DMA support enabled. // // Enable 64-bit DMA support in the PCI layer if this controller // supports it. // if (Support64BitDma) { Status =3D PciIo->Attributes ( PciIo, EfiPciIoAttributeOperationEnable, EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE, NULL ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "SdMmcPciHcDriverBindingStart: failed to enable 6= 4-bit DMA (%r)\n", Status)); } } Thanks Ashish From: Cohen, Eugene > Sent: Thursday, February 28, 2019 12:56 PM To: Ashish Singhal = >; Wu, Hao A >; edk2-devel@li= sts.01.org Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Ashish, > With my change, if any of the controller did not support 64b DMA in V3 a= s well as V4 capability, we are not enabling it in PCI layer. The logic is: if (Private->Capability[Slot].SysBus64V3 =3D=3D 0 && Private->Capability[Slot].SysBus64V4 =3D=3D 0) { Support64BitDma =3D FALSE; } which means that for a SDHC v3 controller you have SysBus64V3=3D1 and SysBu= s64V4=3D0 the FALSE assignment is never done - this is not correct. Perhap= s you intended an OR instead of an AND? Either way changing this to an || = or using my patch is the same logical result because a V3 controller will u= se 32-bit DMA and V4 controller will use 64-bit DMA (a V4 controller should= have the V3 bit set). I really saw no reason to be checking the V3 bit si= nce the driver was unprepared to do V3 64-bit DMA operations anyways. Eugene From: Ashish Singhal > Sent: Thursday, February 28, 2019 12:15 PM To: Cohen, Eugene >; Wu, Hao A >; edk2-devel@lists.01.org Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Hello Eugene, My patch enabled support for SDHC 4.0 and above in general including suppor= t for 64b ADMA descriptor. The check for V3 capability for 64b DMA was alre= ady there and similar check was implemented for V4 capability for 64b DMA. = Earlier, if any of the V3 controller did not support 64b DMA, we were not e= nabling it in PCI layer. With my change, if any of the controller did not s= upport 64b DMA in V3 as well as V4 capability, we are not enabling it in PC= I layer. This check in my opinion is better because we only disable 64b DMA PCI supp= ort when both V3 and V4 have it disabled. Thanks Ashish -----Original Message----- From: Cohen, Eugene > Sent: Thursday, February 28, 2019 4:24 AM To: Wu, Hao A >; edk2-devel@l= ists.01.org Cc: Ashish Singhal = > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Hao, > I remember the commit b5547b9ce97e80c3127682a2a5d4b9bd14af353e from > Ashish only handles the controllers with version greater or equal to 4.00= . Right - that commit added support for SDHC 4.0 and above. The original driv= er supported SDHC 3.0 albeit only with SDMA and 32-bit ADMA support. With that commit two descriptor types are supported the 32-bit ADMA descrip= tor (SD_MMC_HC_ADMA_32_DESC_LINE which is 64-bits in size) and the V4 64-bi= t ADMA descriptor (SD_MMC_HC_ADMA_64_DESC_LINE which is 128-bits in size). However the commit mistakenly added a check for the V3 capability for 64-bi= t DMA and used it to set the PCI DUAL_ADDRESS_CYCLE attributre which then d= oes not the 32-bit compatible bounce buffer mechanism. Later, when we attem= pt an ADMA data transfer we hit an ASSERT because the PCI DMA subsystem is = not using bounce buffers to provide 32-bit DMA compatible memory. So the pa= tch I submitted simply removes the unnecessary check of the V3 64-bit DMA c= apability check so the PCI DUAL_ADDRESS_CYCLE attribute is not set allowing= 32-bit DMA to succeed on these platforms. > And the ADMA2 (96-bit Descriptor) mode for V3 controllers is selected > by setting the 'DMA Select' filed in the Host Control 1 Register to > 11b. But the currently behavior of the driver is setting the field to > 10b, which I think will not switch to the ADMA2 (96-bit Descriptor) mode = for V3. Correct, right now for a V3 controller only 32-bit DMA is supported. An enh= ancement for V3 64-bit ADMA would improve performance on controllers that s= upport that mode by eliminating the bounce buffer and associated memory cop= ies. I think we should file a BZ for SD HCI V3 64-bit ADMA support - if you= agree I would be happy to do that. I should point out that we have done extensive testing of this change on ou= r host controller. Thanks, Eugene --- From: Wu, Hao A > Sent: Wednesday, February 27, 2019 8:25 PM To: Cohen, Eugene >; edk2-devel@lists.0= 1.org Cc: Ashish Singhal = > Subject: RE: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC v3 64-bit = systems Loop Ashish in. Some comments below. > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Cohen, Eugene > Sent: Wednesday, February 27, 2019 6:59 PM > To: mailto:edk2-devel@lists.01.org; Wu, Hao A > Subject: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Fix DMA on SDHC > v3 64-bit systems > > The SdMmcPciHcDriverBindingStart function was checking two different > capability bits in determining whether 64-bit DMA modes were > supported, one mode is defined in the SDHC version > 3 specification (using 96-bit descriptors) and another is defined in > the SDHC version 4 specification (using 128-bit descriptors). Since > the currently implementation of 64-bit > ADMA2 only supports the SDHC version 4 implementation it is incorrect > to check the V3 64-bit capability bit since this will activate V4 > ADMA2 on V3 controllers. I remember the commit b5547b9ce97e80c3127682a2a5d4b9bd14af353e from Ashish = only handles the controllers with version greater or equal to 4.00. And the ADMA2 (96-bit Descriptor) mode for V3 controllers is selected by se= tting the 'DMA Select' filed in the Host Control 1 Register to 11b. But the= currently behavior of the driver is setting the field to 10b, which I thin= k will not switch to the ADMA2 (96-bit Descriptor) mode for V3. Maybe there is something I miss here. Could you help to provide some more d= etail on the issue you met? Thanks. Best Regards, Hao Wu > > Cc: Hao Wu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eugene Cohen > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > index b474f8d..5bc91c5 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > @@ -666,8 +666,7 @@ SdMmcPciHcDriverBindingStart ( // If any of the > slots does not support 64b system bus // do not enable 64b DMA in the > PCI layer. > // > - if (Private->Capability[Slot].SysBus64V3 =3D=3D 0 && > - Private->Capability[Slot].SysBus64V4 =3D=3D 0) { > + if (Private->Capability[Slot].SysBus64V4 =3D=3D 0) { > Support64BitDma =3D FALSE; > } > > -- > 2.7.4 > _______________________________________________ > edk2-devel mailing list > mailto:edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ---------------------------------------------------------------------------= -------- This email message is for the sole use of the intended recipient(s) and may= contain confidential information. Any unauthorized review, use, disclosure or distr= ibution is prohibited. If you are not the intended recipient, please contact the se= nder by reply email and destroy all copies of the original message. ---------------------------------------------------------------------------= --------