From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.web08.142.1612804143368342041 for ; Mon, 08 Feb 2021 09:09:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=hhtJSHpT; spf=pass (domain: akeo.ie, ip: 209.85.128.54, mailfrom: pete@akeo.ie) Received: by mail-wm1-f54.google.com with SMTP id y134so5551662wmd.3 for ; Mon, 08 Feb 2021 09:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OA5YLPbtsEB0/xC5zphpu1PZHLiK9lw7A/8liD3FoKU=; b=hhtJSHpTbB+b7Em6fg/KcaLhSiRJ3ppHvdHAWmMa+fO3Nh2+EOUf1a/LZ7Mal7xLhC qv13vLY25NJENX2uFHMsbhq3al26J7Zns3W7LO1YTcECl8slIUaNqu0nqyaGwlRorS2v jtEZGztiCu6VT4UkSNkIWIKHL/oeQspfia+9h+0M25tXpvgvnQggv499mUD17uAoaO48 ujigXUoLrE0oKJHWRXm0CG2Bkmh9lBUh6/Kzon+Dj8IrvkFY/bftv0QRugzhcdtpev8A Lo0q6zFcSYG1B7GQ/zYxXSa38X+2v9TORKSmnwIcq8apkBSV13rBzWp671jq5pJDoN1D 9OZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OA5YLPbtsEB0/xC5zphpu1PZHLiK9lw7A/8liD3FoKU=; b=fryi/Z22fVCWkeW7pEESPeS1Pa+xLfD5yyf6tVcoUxLUbX0s1lFSpbJE104/qr4vIr q2Y+ljB0kWznULC+BHR4KQLm56G0LkZu7bIMo8Jy54rwi+74Tae3kGv3W1SjiaLWy9zB dfndqzJdCqSsWFKeUJtIfX2mJkOUlr7dSiVE6HtgkUSepcCNd+guL6yTBJEUsMi0TVny JKpWdJ6fWU2sMrOF7oGyntDbvzEikeJl7POpBglebJ17j7dLWDVjwDGsyba7FebUVo5z A0qsvhZnIj0+ZH2qKuKsGQ6a8DogEpFqW47NR2K7yZuf9cwYhQoeCqiSKYyPZFJLZO8P jiCg== X-Gm-Message-State: AOAM532+VxorWJJk8UihLEgA1nOXgPz4TATdMNxXYM7OgpGViSpjewn1 vN6zgB+RmZO9edVgrEvx+CccMw== X-Google-Smtp-Source: ABdhPJxVnQeKRr0K6bL5iT8f1O+ilOkTnHh4HLiXs4ML0yMWu3gNWhuheuWOcV2s9HqnH4rf7Wo49Q== X-Received: by 2002:a1c:39d5:: with SMTP id g204mr15046777wma.127.1612804141832; Mon, 08 Feb 2021 09:09:01 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.77.31]) by smtp.googlemail.com with ESMTPSA id d10sm29404405wrn.88.2021.02.08.09.09.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Feb 2021 09:09:01 -0800 (PST) Subject: Re: [PATCH v2 3/4] Platform/RaspberryPi: User control of eMMC2 DMA To: Jeremy Linton , devel@edk2.groups.io Cc: awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org References: <20210201225343.2001835-1-jeremy.linton@arm.com> <20210201225343.2001835-4-jeremy.linton@arm.com> From: "Pete Batard" Message-ID: <05e8fe33-7599-1949-7131-ea935ca0af98@akeo.ie> Date: Mon, 8 Feb 2021 17:08:59 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210201225343.2001835-4-jeremy.linton@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit 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/Platform/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 = sizeof (UINT32); > > + Status = gRT->GetVariable (L"MmcEnableDma", > > + &gConfigDxeFormSetGuid, > > + NULL, &Size, &Var32); > > + if (EFI_ERROR (Status)) { > > + Status = PcdSet32S (PcdMmcEnableDma, PcdGet32 (PcdMmcEnableDma)); > > + ASSERT_EFI_ERROR (Status); > > + } > > + > > + Size = sizeof (UINT32); > > Status = gRT->GetVariable (L"DebugEnableJTAG", > > &gConfigDxeFormSetGuid, > > NULL, &Size, &Var32); > > @@ -730,6 +739,11 @@ STATIC CONST AML_NAME_OP_REPLACE SsdtNameOpReplace[] = { > { } > > }; > > > > +STATIC CONST AML_NAME_OP_REPLACE SsdtEmmcNameOpReplace[] = { > > + { "SDMA", PcdToken (PcdMmcEnableDma) }, > > + { } > > +}; > > + > > STATIC CONST NAMESPACE_TABLES SdtTables[] = { > > { > > SIGNATURE_64 ('R', 'P', 'I', 'T', 'H', 'F', 'A', 'N'), > > @@ -741,7 +755,7 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = { > 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/Platform/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/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 #language en-US "SD High Speed (MHz)" > > #string STR_MMC_SD_HS_HELP #language en-US "Override default 50Mhz" > > > > +#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/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 = MmcSdHighSpeedMHz, > > guid = CONFIGDXE_FORM_SET_GUID; > > > > + efivarstore MMC_EMMC_DMA_VARSTORE_DATA, > > + attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > > + name = MmcEnableDma, > > + guid = CONFIGDXE_FORM_SET_GUID; > > + > > efivarstore DEBUG_ENABLE_JTAG_VARSTORE_DATA, > > attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, > > name = DebugEnableJTAG, > > @@ -275,6 +280,18 @@ formset > maximum = 100, > > default = 50, > > endnumeric; > > +#if (RPI_MODEL == 4) > > + grayoutif ideqval SdIsArasan.Routing == 1; > > + oneof varid = MmcEnableDma.EnableDma, > > + prompt = STRING_TOKEN(STR_MMC_EMMC_PROMPT), > > + help = STRING_TOKEN(STR_MMC_EMMC_HELP), > > + flags = NUMERIC_SIZE_4 | INTERACTIVE | RESET_REQUIRED, > > + option text = STRING_TOKEN(STR_MMC_EMMC_PIO), value = 0, flags = DEFAULT; > > + option text = STRING_TOKEN(STR_MMC_EMMC_DMA), value = 1, flags = 0; > > + endoneof; > > + endif; > > +#endif > > + > > endform; > > > > form formid = 0x1004, > > diff --git a/Platform/RaspberryPi/Include/ConfigVars.h b/Platform/RaspberryPi/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.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMHz"|gConfigDxeFormSetGuid|0x0|25 > > gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|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.PcdMmcSdDefaultSpeedMHz|L"MmcSdDefaultSpeedMHz"|gConfigDxeFormSetGuid|0x0|25 > > gRaspberryPiTokenSpaceGuid.PcdMmcSdHighSpeedMHz|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/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