From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=216.228.121.64; helo=hqemgate15.nvidia.com; envelope-from=jbrasen@nvidia.com; receiver=edk2-devel@lists.01.org Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) (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 CD30221B02822 for ; Fri, 1 Feb 2019 09:52:57 -0800 (PST) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 01 Feb 2019 09:52:27 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 01 Feb 2019 09:52:56 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 01 Feb 2019 09:52:56 -0800 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 17:52:56 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 17:52:56 +0000 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (104.47.33.57) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 17:52:56 +0000 Received: from CY4PR12MB1143.namprd12.prod.outlook.com (10.168.164.135) by CY4PR12MB1317.namprd12.prod.outlook.com (10.168.168.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.21; Fri, 1 Feb 2019 17:52:54 +0000 Received: from CY4PR12MB1143.namprd12.prod.outlook.com ([fe80::38ac:21c4:fd2a:a748]) by CY4PR12MB1143.namprd12.prod.outlook.com ([fe80::38ac:21c4:fd2a:a748%7]) with mapi id 15.20.1558.021; Fri, 1 Feb 2019 17:52:54 +0000 From: Jeff Brasen To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: Edgar Handal Thread-Topic: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widths Thread-Index: AQHUuPfLY5mdfCmEik2mnlTW7spHbqXKc4+AgAATmBCAAA2IAIAApWv4 Date: Fri, 1 Feb 2019 17:52:53 +0000 Message-ID: References: <7a0d5c95fdeee0e68f54c8a6a0fbe37c85e76774.1548892644.git.jbrasen@nvidia.com> , In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jbrasen@nvidia.com; x-originating-ip: [216.228.112.22] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR12MB1317; 6:duBiAZQzSWnxB4qqBcRFnp6m7v7PXJ4ZtGez3MjIRxiBm3mz339nidKe8uUAGTd6/sv+DZ5FYKp3/PxZCpBoLmXAylBPuQcQAbVq4fAZZCMFNniNauVOlE9geomTj8YXeMh0jAdLcS2nN4PWUXnzJ/57pbpNBM4CU1TF7qeGUbzdgvgAxP1f0xMCh9EFq5sAfhhL/A9tpJTUZvVpbi1GVbguChLr/9hI8AQHk4au2PTHn3RuQSY0GuObagO9LTtomect2hzNKARqjp0Ff8GEHiNf9YOtYj4hcmmcPyx2T0Wg+4ObeBgMh7HzWm79qBZMqsbh6GDxkXZDw5Wn5vsbVV24DlRzfGX78RwrpJUH2JGjFNbXTaPsPq/nqB3sUW9FO9A5nPxZw0GtrNzeEybtrPkDPAnHxceB02wtPLHb0S2djOcBN120CZo6ePeJi6x/OkuDgmecR+2kTY503sx1HQ==; 5:E5jQ4xmXcEZKmjkTUQSHUUZlw7F05ZmLjduux0FclEJZbS5SNGz/H484yzqHmVvPF/SKtKypGW0D7QlK9Da0ZXP0lFCpFLErRMEc0WsuYj2MMy+TpHyR3xsoPSK4uqck2ZGdKhs62zngIhpy93GG8qgBdWvw+y1jviOz6808G5xKTqvg8/SiqdYSIdPZA9mKPkTO+zBn5vBtIKwEl/uvGg==; 7:Nyw120yNLYnR3dDiFmhEEZon9Q6F8ey6pN7h0Ka6ql/jX9xU9Bnh1Ca71rLxRJsC/iOm5KHF5leOgJqEMNeiQC9roJD5cPfxXJVg5UEdslyf1k/h3xYbyQbUEs6nRYsV5/we9Bfp+ZnqmVRnJATbUA== x-ms-office365-filtering-correlation-id: 01247159-6bfd-4329-b178-08d6886e1769 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020); SRVR:CY4PR12MB1317; x-ms-traffictypediagnostic: CY4PR12MB1317: x-microsoft-antispam-prvs: x-forefront-prvs: 09352FD734 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6029001)(346002)(39860400002)(396003)(376002)(366004)(136003)(199004)(189003)(13464003)(51914003)(33656002)(105586002)(256004)(8936002)(6436002)(606006)(11346002)(8676002)(446003)(68736007)(71190400001)(97736004)(486006)(106356001)(71200400001)(81156014)(19627405001)(6606003)(316002)(14454004)(229853002)(93886005)(110136005)(53936002)(81166006)(476003)(2501003)(966005)(186003)(6506007)(54896002)(7696005)(4326008)(26005)(236005)(99286004)(66066001)(14444005)(53546011)(478600001)(102836004)(76176011)(86362001)(74316002)(1015004)(3846002)(6306002)(6116002)(2906002)(6246003)(107886003)(9686003)(7736002)(25786009)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1317; H:CY4PR12MB1143.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3voTrSvpbofFfOvtd60Ux5ADGu8Idzrz0Kea1dlldyXm01Gj0aT7Of20cNo2ww31xBjwklxkkrO8YwXAcCMi0J2DtghUzKp3c9njUD8LxXX7TKdZCp6ity5wOITGNsB/uWzCjtlGM9Pf5q5gOXrCvzdeijZdA+vFbPrlQpj+Tq5zzvuvts+yCLZyhs6e4OSJ4CDU0p9Cb42i0O4XYcJJ3y6lGc7thRBn4BQQzlvOp4OyE/yr4tHSS9f8B5tp1mruwWx6lG2MmSHfG12HQe5GzEQgx4mRz11+bRC1y8FaoPWp/14jIFIMzlQYmjrsOKsb6rouAqM6zmAHmpA0Kkv+ttclwjmdlu14/H0LHdbMnjf6OJ8vCX9oW7omijE4upRIvLEzy9AYQbeKuM4jWhKrRrxic2ET/RT8+vUQSsdRoEw= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 01247159-6bfd-4329-b178-08d6886e1769 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Feb 2019 17:52:53.8680 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1317 X-OriginatorOrg: Nvidia.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1549043547; bh=p+rwPsEauAKKf0Om35r0ftUxnu5R3/U5ETrRhES9BSU=; h=X-PGP-Universal:From:To:CC:Subject:Thread-Topic:Thread-Index:Date: Message-ID:References:In-Reply-To:Accept-Language:X-MS-Has-Attach: X-MS-TNEF-Correlator:authentication-results:x-originating-ip: x-ms-publictraffictype:x-microsoft-exchange-diagnostics: x-ms-office365-filtering-correlation-id:x-microsoft-antispam: x-ms-traffictypediagnostic:x-microsoft-antispam-prvs: x-forefront-prvs:x-forefront-antispam-report:received-spf: x-ms-exchange-senderadcheck:x-microsoft-antispam-message-info: MIME-Version:X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg: Content-Language:Content-Type; b=iOZ+ZGL2TB6clcIbsVHsx3JwmKoiRFD5OZW1ysFumS033tnaYrMDcLK5MsC0hVfE+ VC9wi/n0ccoJei7Wc3/i0f/KR6BY32Ks5ktfvgFaYmcGpgqFypyXDjvrEOLyzpvbNI Tdg0ep/lDy/1gVIwUt4UIH47YA1S69ckgmP4Gh3A1sVXvmWL/gde0a0bBnWDyjMW8a agsfCdzXMW2XW6OU4u2iR9QBOQMyzosfc41yFxpDhq7Ul6IuvzEIRwijb0smElxT5T 1+BYczGSpMXZ33jpadt2GQs8xjCLgCaEHDicC/SlUfHP3Yhjgywz0inC2oZoXE54RF 0eHqosd8W7rEA== X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO widths 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 Feb 2019 17:52:58 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ________________________________ From: Wu, Hao A Sent: Friday, February 1, 2019 12:54 AM To: Jeff Brasen; edk2-devel@lists.01.org Cc: Edgar Handal Subject: RE: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO wi= dths > -----Original Message----- > From: Jeff Brasen [mailto:jbrasen@nvidia.com] > Sent: Friday, February 01, 2019 3:12 PM > To: Wu, Hao A; edk2-devel@lists.01.org > Cc: Edgar Handal > Subject: RE: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO > widths > > > > -----Original Message----- > From: Wu, Hao A > Sent: Thursday, January 31, 2019 10:56 PM > To: Jeff Brasen ; edk2-devel@lists.01.org > Cc: Edgar Handal > Subject: RE: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO > widths > > > -----Original Message----- > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > > Jeff Brasen > > Sent: Thursday, January 31, 2019 7:59 AM > > To: edk2-devel@lists.01.org > > Cc: Edgar Handal; Jeff Brasen > > Subject: [edk2] [PATCH] MdeModulePkg/SdMmcPciHcDxe: Use 16/32-bit IO > > widths > > > > From: Edgar Handal > > > > Use 16-bit and 32-bit IO widths for SDMMC MMIO to prevent all register > > accesses from being split up into 8-bit accesses. > > > > The SDHCI specification states that the registers shall be accessable > > in byte, word, and double word accesses. > > Hi, > > Thanks for the contribution. The change seems good to me. > > Just curious, if the accesses are always slit into byte(8-bit), is there = any issue or > performance impact is encountered during your usage? > > It will be helpful to get more information on the purpose of the patch. > Thanks. > > Best Regards, > Hao Wu > > [JMB] We were working with a simulation module that has some issues when > accessing 16 or 32 bit registers by byte (This should be supported per th= e SDHCI > specification.), and this patch resolves this while we work on getting th= e model > fixed. This should also optimize performance as there will less read/writ= e > instructions (My guess is this is a marginal improvement as most of the S= D > access time would be DMA operations.) Thanks Jeff, Got it. May I know is it possible for you to collect some performance data for the change? [JMB] Sure, did a several boots on silicon platform and see an average boot= time improvement of 15ms. With a range of 10-20ms and never saw the perfor= mance get worse. Meanwhile, I will test this patch with the boards I own and try to collect some data. Please grant me some time for this. Since the current implementation does not violate the spec, let us evaluate whether better performance will be brought. Best Regards, Hao Wu > > Thanks, > Jeff > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Jeff Brasen > > --- > > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 25 > > ++++++++++++++++++++---- > > 1 file changed, 21 insertions(+), 4 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > index 5aec8c6..82f4493 100644 > > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > > @@ -152,19 +152,36 @@ SdMmcHcRwMmio ( > > ) > > { > > EFI_STATUS Status; > > + EFI_PCI_IO_PROTOCOL_WIDTH Width; > > > > if ((PciIo =3D=3D NULL) || (Data =3D=3D NULL)) { > > return EFI_INVALID_PARAMETER; > > } > > > > - if ((Count !=3D 1) && (Count !=3D 2) && (Count !=3D 4) && (Count != =3D 8)) { > > - return EFI_INVALID_PARAMETER; > > + switch (Count) { > > + case 1: > > + Width =3D EfiPciIoWidthUint8; > > + break; > > + case 2: > > + Width =3D EfiPciIoWidthUint16; > > + Count =3D 1; > > + break; > > + case 4: > > + Width =3D EfiPciIoWidthUint32; > > + Count =3D 1; > > + break; > > + case 8: > > + Width =3D EfiPciIoWidthUint32; > > + Count =3D 2; > > + break; > > + default: > > + return EFI_INVALID_PARAMETER; > > } > > > > if (Read) { > > Status =3D PciIo->Mem.Read ( > > PciIo, > > - EfiPciIoWidthUint8, > > + Width, > > BarIndex, > > (UINT64) Offset, > > Count, > > @@ -173,7 +190,7 @@ SdMmcHcRwMmio ( > > } else { > > Status =3D PciIo->Mem.Write ( > > PciIo, > > - EfiPciIoWidthUint8, > > + Width, > > BarIndex, > > (UINT64) Offset, > > Count, > > -- > > 2.7.4 > > > > _______________________________________________ > > edk2-devel mailing list > > 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 m= ay > contain > confidential information. Any unauthorized review, use, disclosure or > distribution > is prohibited. If you are not the intended recipient, please contact the= sender > by > reply email and destroy all copies of the original message. > -------------------------------------------------------------------------= ----------