From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.79]) by mx.groups.io with SMTP id smtpd.web08.464.1612805169380895319 for ; Mon, 08 Feb 2021 09:26:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=0KMx/YkY; spf=pass (domain: vmware.com, ip: 40.107.93.79, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coDo8B4YSQ7pVnkgS/A2R+rWYI//VpJGrv1EWBccXmGkRIKtIiAggMCNIwuv73yV7l49hWwLrwksXkXsr4S5OT4SxbVNAkF0kkJ7IpScL7h9CFUWtQGSeU3ZFOsgTw56pPr31OPpWkvucUb7Qy5NMvqU0I/2AvrmtjyWVj44kBTr22jrZUHSskvNQRwT9DT+aNpq4xPjuKdcT16vXlmCG8POy1Al4Unje2KEYA/5opT27J1DjZ9VZfPSyHgpAx+LNr38+4AGOkVzN70ULocdI/oufB2R2GSkRmJGOEi9p1A/FyrU31S9LeiDjYWEC1Lm9tYkI872okZxFb8yfM2DaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sg9Ej51zuohtBgBc6IOXnYmVy0EUydKF8LVH9cYZ4/g=; b=KuOqYK301zy0HOrS39ctD9M/4ZJIs0vH4h/FX+F9sWDwjCtUywy4dgvk4WVL8ry/P8Axx6mMnCn4K8YZ2kaOkf3RFNblA4p+NsMMdhfEtc1CpkYWZCuXIdnWfUZBuPaiibepwO7eUpPoeqc8wCvZexXS4oxcubq/vrWrTEzuDXrF4IC6EcrSeid4E+zbU+qrsKfZLJX2rYibg3YYHjPpXPethGMtRrOo3vLwsgNtwenX+/9MwtgzhkyhtW68QEuiqlkT18jYBKE7P/nijOTJSXOOrloAxwM0qk7t2TzfeOkW5k2TYh4FCGlisZb7xWjyZxa1UFZ/P9292i9GG5lpgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sg9Ej51zuohtBgBc6IOXnYmVy0EUydKF8LVH9cYZ4/g=; b=0KMx/YkYFXScESpEczmMmBdXrqxmnjT4aCDKNVzSFZooPN6Rg68z9GsT7mR+Jp/BmIcbGEOBruT29keIJHlQWWnS0x+50DYjEqmEuuBKitZZ7gOBsqtWIENLtH3iHstNClCX+qsDF5c5OP6dOPl+6aJSXHKw+x7Ppxy8YhJxwqM= Received: from (2603:10b6:806:f7::16) by SN6PR05MB4893.namprd05.prod.outlook.com (2603:10b6:805:8f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.11; Mon, 8 Feb 2021 17:26:07 +0000 Received: from SN7PR05MB7582.namprd05.prod.outlook.com ([fe80::d1f7:9f0e:9655:eadb]) by SN7PR05MB7582.namprd05.prod.outlook.com ([fe80::d1f7:9f0e:9655:eadb%4]) with mapi id 15.20.3846.025; Mon, 8 Feb 2021 17:26:07 +0000 From: "Andrei Warkentin" To: Pete Batard , Jeremy Linton , "devel@edk2.groups.io" CC: "samer.el-haj-mahmoud@arm.com" , "leif@nuviainc.com" , "ardb+tianocore@kernel.org" Subject: Re: [PATCH v2 3/4] Platform/RaspberryPi: User control of eMMC2 DMA Thread-Topic: [PATCH v2 3/4] Platform/RaspberryPi: User control of eMMC2 DMA Thread-Index: AQHW+O0cq49wy86kkUCBcyunpODW76pOiFSAgAAExQ4= Date: Mon, 8 Feb 2021 17:26:07 +0000 Message-ID: References: <20210201225343.2001835-1-jeremy.linton@arm.com> <20210201225343.2001835-4-jeremy.linton@arm.com>,<05e8fe33-7599-1949-7131-ea935ca0af98@akeo.ie> In-Reply-To: <05e8fe33-7599-1949-7131-ea935ca0af98@akeo.ie> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: akeo.ie; dkim=none (message not signed) header.d=none;akeo.ie; dmarc=none action=none header.from=vmware.com; x-originating-ip: [69.174.145.79] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ddd71689-e509-43da-dbcc-08d8cc569eb2 x-ms-traffictypediagnostic: SN6PR05MB4893: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 75gwTaIlN7LETbKdTRpiESfklG2qjzuYpfnq3LezquUFBRahqrgMyFHdNRfrcTLuIyuedlNGXTnMyw36oknWdQ9kj5uPZ0MM/tn5WJWR4LtNY9OidKqgUHd/8J+D1+GbpMpgXhOcf15HE/M2VQ7qe/aGnlUxHQYYhQ2FeI+aD0+VNvUDPmkd4pLFxJeRHTWilnvqgTR98WACn6VCzoF1sk0aj1pLMZS5FekxU5kam7vTQBQYMYlQ1kKlKBPznL/dHNTzc9/X7mF1ZZi9o2+t+5ZBbZzGSMITIrwNPyDyXUWp1Skvkad3UBuWKYXawbFh8FUEzYbdSRY/SrNJtLQpRAoTs//AHPIcHdwuPl4di4Gn5hTztodHPTRg+hY1cDIa1FS2H7Casd0W5S1AcHiFT8cOP28Q2gmxPGp7uMifVGnsB/xluLdhJwtC7qzWXcz7p789/lDF3MDXi+eU6ubYFL0tJqcdhqmwdzhLgE0GbxV1Rj0oPx17D+R+jVF9oVUMgSgHUzFM4dwTKgjlLczNCQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR05MB7582.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(396003)(376002)(366004)(346002)(136003)(2906002)(8936002)(55016002)(478600001)(9686003)(26005)(66446008)(186003)(66476007)(66556008)(64756008)(66946007)(7696005)(76116006)(71200400001)(52536014)(19627235002)(33656002)(6506007)(53546011)(5660300002)(110136005)(54906003)(86362001)(316002)(4326008)(83380400001)(8676002)(19627405001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?Smjxj+fZNCsRp9LkZmpa+O+XAys/bbF94iWopDBp9JMNymF1tPb5CLJXdRUF?= =?us-ascii?Q?AP61+YIwr4yKEtSRKYyLNAuUj03vT9+5ZvdPqAy17hUp4GBT+Ol+TbvejMPG?= =?us-ascii?Q?PIg20rZY6o3Y96Bf5LDi1uF9m3UVkLKeclwMOiIQAHcV5nrzw6DLCltEbYF1?= =?us-ascii?Q?TjkxFO1GmIeRT4fcvB4eWSuye0lX7r34Beeso/nTOR26asBISeS1somVh5P9?= =?us-ascii?Q?gk7512ErI0rXKwLd2sw6py+SV/0Ux+UBDv4Om77nu7EBSA+XK5M6txWSJHWT?= =?us-ascii?Q?XV++vyh2whhKWjwNxLLxJISG6uGPz5lu9qJHYwKeJJ+4/4i8yDX9rmIRjhva?= =?us-ascii?Q?RT2qhOuFcdW3pGG4lpI1cl23zaFDbARtzcuxOW5EJN1F5TpXZtiTmzatzVIL?= =?us-ascii?Q?ShBzrpZIN0AzCs7oljtmwOTYF1TLsfC54gfMO5OXMvUzHWBNak2qinQ6IyB6?= =?us-ascii?Q?44/ro+rwaXvc6ZL2p8fQGYSAym5y5fNa4AOu80K3kaH6yuVFQygmJeZU6wWS?= =?us-ascii?Q?U/C6uoIwIXoC5TJJZLZP9ZzNNwy/7v6Zy8y0c9CYLjhipFe69b4GxmxZSf9a?= =?us-ascii?Q?M1uR6zSTSosVgQgAuSXQEKNhabbcCdgDiyEF3BTNiiiixxwEF5fljBJjtMva?= =?us-ascii?Q?TnOFXL0eVi2pBkMq6zOG47BlFRSXAm34z9OtBafg03zAt+kBazdVQ3jMNjuz?= =?us-ascii?Q?KStSI3VqMFAjrWAudCkthw2wnkasiZWvNyd8jwfB1VTeA5gyQNPL037Kf13D?= =?us-ascii?Q?eVrhxxkuhOR7L0ck1zHN2z5+leZ2R8x7Ab99FKy8qXiE9qC8bujIgwk5b6Em?= =?us-ascii?Q?2YurDtqXHxB8mPS40/5cA8lDpmQYMmgeSqWAoiVzz/8Tdq0ncY9DDFJGzNPl?= =?us-ascii?Q?Ndn315GUMbUXwhsgcIDsOY1hGiFh5250SFK3dtTNyz6QzXplRW+dn7pFS5JC?= =?us-ascii?Q?v5se+ykiCLGYtEqQvP2K7Li5w33eOdISWU7fDBZ7HqhIQo12eQel/xV+s2In?= =?us-ascii?Q?nOo0N+A4iHzvTphQ6HJ2EzzZl8zCKWejaAVKMvfNTwMBB+bpivYbGj+6aYyP?= =?us-ascii?Q?c3ykLaPESBdoqpvjxIPYgIzSo53CsCfIvxycwBgaeki5wHFKC0dpwJ5sf82n?= =?us-ascii?Q?3z8+km+umVNKTCJEQSKYybcI3XS21ngld3LBvPk/hHSBDLtYBJ/bVVcpz8rd?= =?us-ascii?Q?fs9s0v1qUrFL77+Tb7i7DPqZlV0Go6mOy5NFI9J74fRaufqvRoTZRkZP0ioB?= =?us-ascii?Q?9+vnGLTBXemXn5ZlQUb5iivkZhUzKfSSt4Kx/41+orIHgrmVF58Uaaon2Yec?= =?us-ascii?Q?XoQ=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR05MB7582.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddd71689-e509-43da-dbcc-08d8cc569eb2 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2021 17:26:07.3565 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zGTdNH+s67Zyw5u8nI41AksFSYBxroe+1vgp07wrQvfl8fYhJyIaK/6Lezj49jGcHUeVJEZ+pIZpRaKD9GYe1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR05MB4893 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_SN7PR05MB7582994B840E44B7242AC6F5B98F9SN7PR05MB7582namp_" --_000_SN7PR05MB7582994B840E44B7242AC6F5B98F9SN7PR05MB7582namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Pete Batard Sent: Monday, February 8, 2021 11:08 AM To: Jeremy Linton ; devel@edk2.groups.io Cc: Andrei Warkentin ; samer.el-haj-mahmoud@arm.com = ; leif@nuviainc.com ; ardb= +tianocore@kernel.org Subject: Re: [PATCH v2 3/4] Platform/RaspberryPi: User control of eMMC2 DMA On 2021.02.01 22:53, Jeremy Linton wrote: > DMA translation on the eMMC2 vary based on SOC, and > this is made worse by the poor _DMA support in linux. > > For now the "safe" option is to simply run the eMMC2 > controller in PIO mode. More advanced users or !linux > operating systems may choose to enable this to gain > a perf boost. > > Signed-off-by: Jeremy Linton > --- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 16 ++++++++++= +++++- > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf | 1 + > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni | 5 +++++ > Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | 17 ++++++++++= +++++++ > Platform/RaspberryPi/Include/ConfigVars.h | 8 ++++++++ > Platform/RaspberryPi/RPi3/RPi3.dsc | 1 + > Platform/RaspberryPi/RPi4/RPi4.dsc | 1 + > Platform/RaspberryPi/RaspberryPi.dec | 1 + > 8 files changed, 49 insertions(+), 1 deletion(-) > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platfor= m/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > index 7f26f7b4be..1b8b360ddc 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c > @@ -346,6 +346,15 @@ SetupVariables ( > } > > > > Size =3D sizeof (UINT32); > > + Status =3D gRT->GetVariable (L"MmcEnableDma", > > + &gConfigDxeFormSetGuid, > > + NULL, &Size, &Var32); > > + if (EFI_ERROR (Status)) { > > + Status =3D PcdSet32S (PcdMmcEnableDma, PcdGet32 (PcdMmcEnableDma)); > > + ASSERT_EFI_ERROR (Status); > > + } > > + > > + Size =3D sizeof (UINT32); > > Status =3D gRT->GetVariable (L"DebugEnableJTAG", > > &gConfigDxeFormSetGuid, > > NULL, &Size, &Var32); > > @@ -730,6 +739,11 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtNameOpReplace[]= =3D { > { } > > }; > > > > +STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] =3D { > > + { "SDMA", PcdToken (PcdMmcEnableDma) }, > > + { } > > +}; > > + > > STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { > > { > > SIGNATURE_64 ('R', 'P', 'I', 'T', 'H', 'F', 'A', 'N'), > > @@ -741,7 +755,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { > SIGNATURE_64 ('R', 'P', 'I', '4', 'E', 'M', 'M', 'C'), > > 0, > > PcdToken(PcdSdIsArasan), > > - NULL > > + SsdtEmmcNameOpReplace > > }, > > { > > SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Platf= orm/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > index 544e3b3e10..d51e54e010 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf > @@ -84,6 +84,7 @@ > gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz > > gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz > > gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti > > + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma > > gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG > > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableScaledVModes > > gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSShot > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b/Pl= atform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > index 2afe8f32ae..6abccc1fdb 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni > @@ -94,6 +94,11 @@ > #string STR_MMC_SD_HS_PROMPT #language en-US "SD High Speed (MHz)" > > #string STR_MMC_SD_HS_HELP #language en-US "Override default 50Mh= z" > > > > +#string STR_MMC_EMMC_PROMPT #language en-US "Enable eMMC DMA modes" > > +#string STR_MMC_EMMC_PIO #language en-US "PIO" > > +#string STR_MMC_EMMC_DMA #language en-US "SDMA/ADMA2" > > +#string STR_MMC_EMMC_HELP #language en-US "Enable eMMC DMA modes = for OS's that support ACPI _DMA() translations" For consistency, since that's what we already use for other UI strings, the plural of OS should be "OSes" rather than "OS's" > > + (very minor) Extra line added here. > > > > /* > > * Display settings. > > diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b/Pl= atform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > index de5e43471a..cc7a09cfb7 100644 > --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr > @@ -96,6 +96,11 @@ formset > name =3D MmcSdHighSpeedMHz, > > guid =3D CONFIGDXE_FORM_SET_GUID; > > > > + efivarstore MMC_EMMC_DMA_VARSTORE_DATA, > > + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTI= ME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > > + name =3D MmcEnableDma, > > + guid =3D CONFIGDXE_FORM_SET_GUID; > > + > > efivarstore DEBUG_ENABLE_JTAG_VARSTORE_DATA, > > attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNT= IME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > > name =3D DebugEnableJTAG, > > @@ -275,6 +280,18 @@ formset > maximum =3D 100, > > default =3D 50, > > endnumeric; > > +#if (RPI_MODEL =3D=3D 4) > > + grayoutif ideqval SdIsArasan.Routing =3D=3D 1; > > + oneof varid =3D MmcEnableDma.EnableDma, > > + prompt =3D STRING_TOKEN(STR_MMC_EMMC_PROMPT), > > + help =3D STRING_TOKEN(STR_MMC_EMMC_HELP), > > + flags =3D NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRE= D, > > + option text =3D STRING_TOKEN(STR_MMC_EMMC_PIO), value =3D 0,= flags =3D DEFAULT; > > + option text =3D STRING_TOKEN(STR_MMC_EMMC_DMA), value =3D 1,= flags =3D 0; > > + endoneof; > > + endif; > > +#endif > > + > > endform; > > > > form formid =3D 0x1004, > > diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Raspber= ryPi/Include/ConfigVars.h > index c185bfe28b..142317985a 100644 > --- a/Platform/RaspberryPi/Include/ConfigVars.h > +++ b/Platform/RaspberryPi/Include/ConfigVars.h > @@ -135,4 +135,12 @@ typedef struct { > UINT32 MHz; > > } MMC_SD_HS_MHZ_VARSTORE_DATA; > > > > +typedef struct { > > + /* > > + * 0 - eMMC PIO mode > > + * 1 - eMMC DMA mode > > + */ > > + UINT32 EnableDma; > > +} MMC_EMMC_DMA_VARSTORE_DATA; > > + > > #endif /* CONFIG_VARS_H */ > > diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi/RP= i3/RPi3.dsc > index 530b42796a..107cbda297 100644 > --- a/Platform/RaspberryPi/RPi3/RPi3.dsc > +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc > @@ -470,6 +470,7 @@ > gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpee= dMHz"|gConfigDxeFormSetGuid|0x0|25 > > gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|= gConfigDxeFormSetGuid|0x0|50 > > gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gCon= figDxeFormSetGuid|0x0|0 > > + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gConfigDxeF= ormSetGuid|0x0|0 > > > > # > > # Debug-related. > > diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi/RP= i4/RPi4.dsc > index 5f8452aa0b..9962df0076 100644 > --- a/Platform/RaspberryPi/RPi4/RPi4.dsc > +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc > @@ -481,6 +481,7 @@ > gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpee= dMHz"|gConfigDxeFormSetGuid|0x0|25 > > gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|L"MmcSdHighSpeedMHz"|= gConfigDxeFormSetGuid|0x0|50 > > gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|L"MmcDisableMulti"|gCon= figDxeFormSetGuid|0x0|0 > > + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma"|gConfigDxeF= ormSetGuid|0x0|0 > > > > # > > # Debug-related. > > diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/RaspberryPi/= RaspberryPi.dec > index 10723036aa..08135717ed 100644 > --- a/Platform/RaspberryPi/RaspberryPi.dec > +++ b/Platform/RaspberryPi/RaspberryPi.dec > @@ -69,3 +69,4 @@ > gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT32|0x0000001C > > gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32|0x0000001D > > gRaspberryPiTokenSpaceGuid.PcdPlatformResetDelay|0|UINT32|0x0000001E > > + gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F > Reviewed-by: Pete Batard --_000_SN7PR05MB7582994B840E44B7242AC6F5B98F9SN7PR05MB7582namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>

From: Pete Batard <pete@= akeo.ie>
Sent: Monday, February 8, 2021 11:08 AM
To: Jeremy Linton <jeremy.linton@arm.com>; devel@edk2.groups.i= o <devel@edk2.groups.io>
Cc: Andrei Warkentin <awarkentin@vmware.com>; samer.el-haj-mah= moud@arm.com <samer.el-haj-mahmoud@arm.com>; leif@nuviainc.com <le= if@nuviainc.com>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.or= g>
Subject: Re: [PATCH v2 3/4] Platform/RaspberryPi: User control of eM= MC2 DMA
 
On 2021.02.01 22:53, Jeremy Linton wrote:
> DMA translation on the eMMC2 vary based on SOC, and
> this is made worse by the poor _DMA support in linux.
>
> For now the "safe" option is to simply run the eMMC2
> controller in PIO mode. More advanced users or !linux
> operating systems may choose to enable this to gain
> a perf boost.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c &n= bsp;    | 16 +++++++++++++++-
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf =    |  1 +
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni |&= nbsp; 5 +++++
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr | = 17 +++++++++++++++++
>   Platform/RaspberryPi/Include/ConfigVars.h   = ;            | = 8 ++++++++
>   Platform/RaspberryPi/RPi3/RPi3.dsc    =             &nb= sp;     |  1 +
>   Platform/RaspberryPi/RPi4/RPi4.dsc    =             &nb= sp;     |  1 +
>   Platform/RaspberryPi/RaspberryPi.dec   &nbs= p;            &= nbsp;   |  1 +
>   8 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Plat= form/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 7f26f7b4be..1b8b360ddc 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -346,6 +346,15 @@ SetupVariables (
>     }
>
>  
>
>     Size =3D sizeof (UINT32);
>
> +  Status =3D gRT->GetVariable (L"MmcEnableDma",
>
> +           &nb= sp;      &gConfigDxeFormSetGuid,
>
> +           &nb= sp;      NULL, &Size, &Var32);
>
> +  if (EFI_ERROR (Status)) {
>
> +    Status =3D PcdSet32S (PcdMmcEnableDma, PcdGet32 (P= cdMmcEnableDma));
>
> +    ASSERT_EFI_ERROR (Status);
>
> +  }
>
> +
>
> +  Size =3D sizeof (UINT32);
>
>     Status =3D gRT->GetVariable (L"DebugEn= ableJTAG",
>
>            = ;         &gConfigDxeFormSetGui= d,
>
>            = ;         NULL, &Size, &Var= 32);
>
> @@ -730,6 +739,11 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtNameOpReplac= e[] =3D {
>     { }
>
>   };
>
>  
>
> +STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] =3D {
>
> +  { "SDMA", PcdToken (PcdMmcEnableDma) },
>
> +  { }
>
> +};
>
> +
>
>   STATIC CONST NAMESPACE_TABLES SdtTables[] =3D {
>
>     {
>
>       SIGNATURE_64 ('R', 'P', 'I', 'T', = 'H', 'F', 'A', 'N'),
>
> @@ -741,7 +755,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { >       SIGNATURE_64 ('R', 'P', 'I', '4', = 'E', 'M', 'M', 'C'),
>
>       0,
>
>       PcdToken(PcdSdIsArasan),
>
> -    NULL
>
> +    SsdtEmmcNameOpReplace
>
>     },
>
>     {
>
>       SIGNATURE_64 ('R', 'P', 'I', 0, 0,= 0, 0, 0),
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf b/Pl= atform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> index 544e3b3e10..d51e54e010 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.inf
> @@ -84,6 +84,7 @@
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpee= dMHz
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMH= z
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti<= br> >
> +  gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma
>
>     gRaspberryPiTokenSpaceGuid.PcdDebugEnableJTAG<= br> >
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSca= ledVModes
>
>     gRaspberryPiTokenSpaceGuid.PcdDisplayEnableSSh= ot
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni b= /Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
> index 2afe8f32ae..6abccc1fdb 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.uni
> @@ -94,6 +94,11 @@
>   #string STR_MMC_SD_HS_PROMPT     #lang= uage en-US "SD High Speed (MHz)"
>
>   #string STR_MMC_SD_HS_HELP     &n= bsp; #language en-US "Override default 50Mhz"
>
>  
>
> +#string STR_MMC_EMMC_PROMPT      #language e= n-US "Enable eMMC DMA modes"
>
> +#string STR_MMC_EMMC_PIO       &nb= sp; #language en-US "PIO"
>
> +#string STR_MMC_EMMC_DMA       &nb= sp; #language en-US "SDMA/ADMA2"
>
> +#string STR_MMC_EMMC_HELP        #= language en-US "Enable eMMC DMA modes for OS's that support ACPI _DMA(= ) translations"

For consistency, since that's what we already use for other UI strings, the plural of OS should be "OSes" rather than "OS's"
>
> +

(very minor) Extra line added here.

>
>  
>
>   /*
>
>    * Display settings.
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr b= /Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
> index de5e43471a..cc7a09cfb7 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxeHii.vfr
> @@ -96,6 +96,11 @@ formset
>         name  =3D MmcSdHi= ghSpeedMHz,
>
>         guid  =3D CONFIGD= XE_FORM_SET_GUID;
>
>  
>
> +    efivarstore MMC_EMMC_DMA_VARSTORE_DATA,
>
> +      attribute =3D EFI_VARIABLE_BOOTSERVICE= _ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
>
> +      name  =3D MmcEnableDma,
>
> +      guid  =3D CONFIGDXE_FORM_SET_GUID= ;
>
> +
>
>       efivarstore DEBUG_ENABLE_JTAG_VARS= TORE_DATA,
>
>         attribute =3D EFI_VARI= ABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VO= LATILE,
>
>         name  =3D DebugEn= ableJTAG,
>
> @@ -275,6 +280,18 @@ formset
>            = ;    maximum =3D 100,
>
>            = ;    default =3D 50,
>
>           endnumeric= ;
>
> +#if (RPI_MODEL =3D=3D 4)
>
> +        grayoutif ideqval SdIsAras= an.Routing =3D=3D 1;
>
> +        oneof varid =3D MmcEnableD= ma.EnableDma,
>
> +            pr= ompt      =3D STRING_TOKEN(STR_MMC_EMMC_PROMPT), >
> +            he= lp        =3D STRING_TOKEN(STR_MMC_EMMC_= HELP),
>
> +            fl= ags       =3D NUMERIC_SIZE_4 | INTERACTIVE | = RESET_REQUIRED,
>
> +            op= tion text =3D STRING_TOKEN(STR_MMC_EMMC_PIO), value =3D 0, flags =3D DEFAUL= T;
>
> +            op= tion text =3D STRING_TOKEN(STR_MMC_EMMC_DMA), value =3D 1, flags =3D 0;
>
> +        endoneof;
>
> +        endif;
>
> +#endif
>
> +
>
>       endform;
>
>  
>
>       form formid =3D 0x1004,
>
> diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/Rasp= berryPi/Include/ConfigVars.h
> index c185bfe28b..142317985a 100644
> --- a/Platform/RaspberryPi/Include/ConfigVars.h
> +++ b/Platform/RaspberryPi/Include/ConfigVars.h
> @@ -135,4 +135,12 @@ typedef struct {
>     UINT32 MHz;
>
>   } MMC_SD_HS_MHZ_VARSTORE_DATA;
>
>  
>
> +typedef struct {
>
> +  /*
>
> +   * 0 - eMMC PIO mode
>
> +   * 1 - eMMC DMA mode
>
> +   */
>
> +  UINT32 EnableDma;
>
> +} MMC_EMMC_DMA_VARSTORE_DATA;
>
> +
>
>   #endif /* CONFIG_VARS_H */
>
> diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc b/Platform/RaspberryPi= /RPi3/RPi3.dsc
> index 530b42796a..107cbda297 100644
> --- a/Platform/RaspberryPi/RPi3/RPi3.dsc
> +++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
> @@ -470,6 +470,7 @@
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpee= dMHz|L"MmcSdDefaultSpeedMHz"|gConfigDxeFormSetGuid|0x0|25
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMH= z|L"MmcSdHighSpeedMHz"|gConfigDxeFormSetGuid|0x0|50
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|= L"MmcDisableMulti"|gConfigDxeFormSetGuid|0x0|0
>
> +  gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma= "|gConfigDxeFormSetGuid|0x0|0
>
>  
>
>     #
>
>     # Debug-related.
>
> diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc b/Platform/RaspberryPi= /RPi4/RPi4.dsc
> index 5f8452aa0b..9962df0076 100644
> --- a/Platform/RaspberryPi/RPi4/RPi4.dsc
> +++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
> @@ -481,6 +481,7 @@
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdDefaultSpee= dMHz|L"MmcSdDefaultSpeedMHz"|gConfigDxeFormSetGuid|0x0|25
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMH= z|L"MmcSdHighSpeedMHz"|gConfigDxeFormSetGuid|0x0|50
>
>     gRaspberryPiTokenSpaceGuid.PcdMmcDisableMulti|= L"MmcDisableMulti"|gConfigDxeFormSetGuid|0x0|0
>
> +  gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|L"MmcEnableDma= "|gConfigDxeFormSetGuid|0x0|0
>
>  
>
>     #
>
>     # Debug-related.
>
> diff --git a/Platform/RaspberryPi/RaspberryPi.dec b/Platform/Raspberry= Pi/RaspberryPi.dec
> index 10723036aa..08135717ed 100644
> --- a/Platform/RaspberryPi/RaspberryPi.dec
> +++ b/Platform/RaspberryPi/RaspberryPi.dec
> @@ -69,3 +69,4 @@
>     gRaspberryPiTokenSpaceGuid.PcdFanOnGpio|0|UINT= 32|0x0000001C
>
>     gRaspberryPiTokenSpaceGuid.PcdFanTemp|0|UINT32= |0x0000001D
>
>     gRaspberryPiTokenSpaceGuid.PcdPlatformResetDel= ay|0|UINT32|0x0000001E
>
> +  gRaspberryPiTokenSpaceGuid.PcdMmcEnableDma|0|UINT32|0x0000001F=
>

Reviewed-by: Pete Batard <pete@akeo.ie>
--_000_SN7PR05MB7582994B840E44B7242AC6F5B98F9SN7PR05MB7582namp_--