From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0050.outbound.protection.outlook.com [104.47.2.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EB35B21ECCB15 for ; Wed, 20 Sep 2017 07:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=urSWJf+u7U1i3AXFTXrw7qKvH8/kJbLd0h3taSzw8iA=; b=nUCMo9yRI7MNi6LqG+Cje2R/CEOiGLho1yDz73rCYMQL5hlv5DSfUM4fdnOlSUXYWCuW/EBuMcX7LtWowBbIfKUfISC6ZRhStnFSC6EK0nYxdGcDEL4cy+lJPxTy0IrAdK0OW8bE2/v+Sesc60OLAPK3Ws0bjDlWo+k7blAF0VY= Received: from AM0PR0402MB3940.eurprd04.prod.outlook.com (52.133.40.140) by AM0PR0402MB3428.eurprd04.prod.outlook.com (52.133.45.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Wed, 20 Sep 2017 14:51:33 +0000 Received: from AM0PR0402MB3940.eurprd04.prod.outlook.com ([fe80::d0d3:8e74:b9b0:d4af]) by AM0PR0402MB3940.eurprd04.prod.outlook.com ([fe80::d0d3:8e74:b9b0:d4af%13]) with mapi id 15.20.0056.018; Wed, 20 Sep 2017 14:51:32 +0000 From: Pankaj Bansal To: Andrew Fish , Udit Kumar , "edk2-devel@lists.01.org" CC: Vladimir Olovyannikov , "Olivier.Martin@arm.com" , Ard Biesheuvel Thread-Topic: [edk2] Storing Non volatile variables on SD/NAND Thread-Index: AdMwhGas4HV30Cb6RHux5gL+cq9qtgAEHTUAAAJm0wAAGXHS4AAYW1AAABfKRvAAAbCQAAAAEh/QAAD7vYAAE55LQA== Date: Wed, 20 Sep 2017 14:51:32 +0000 Message-ID: References: <4CC33CC2-86D1-490E-A67E-12D751745121@apple.com> In-Reply-To: <4CC33CC2-86D1-490E-A67E-12D751745121@apple.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@nxp.com; x-originating-ip: [192.88.169.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM0PR0402MB3428; 6:p5km4YEm/1MN0ta513mVJKdwgmAWwjSLk6FoS9G7tOyzNojvnINeaO7cCIZR4k+P97FDHbNCh1XitGlOfJUANifxmG0IeYGUNSGB9z23JIwTafQVcTsDu9pDok9LVN21yDIcOl2gMYqrArwqfxYSl/3UYJvuJE5rB5UmfE3p8xDJBJHImL4eUVCxZo/ceJN/ykakLphZ6XdfJ3MxLWNuZIAoyPHmUNTLdtIy8Zm40SJux13uYwW3nF9sf6LvUV2rkz8T/0hbIcNalciPJGGI1bT7cBrtKn3NWDsuj1ZdMWgrGJ45i3zxx0LaoZcxxtWY5oQ/DlU/O0hhyRlH+qEmdw==; 5:4vBpDZ4RfEe4r3wVyFTBl1aa7OeLuHL+IRRsv3KnEigcSXdMgG+nQ581c7scx8hK6E+/Y/gMYoI5NfzUOPbMFqu+UhjeZa209wCsJVKoXjFzgRPIUpb82Xa/1RlAL6hEsdQsveYAiYwm/mAvmIyqdw==; 24:/62XJH5gyNcekCmajkcnErf2g/zqZWm2M+ZXL3foJ9Dt3g6tqImPW5R+QYCyk/wrwnK9RIp/8UcqIj9FF8ZBwzWmc6a7ep/N0jH3lAmYK6Y=; 7:XfDvB7IGxAUwgHr3GPaJGFSO+7a6uvjBTwGyvL9i32AkqavlmbDYpKgWt6p5uJM2ozK9n8ulL7ZEIhD6YdE53O0WYS+zBaAYGfcvu2kV+qoC/sPCLhjtI6KPwc3QvHf4X46DUY6W77/nVJ04E1S9OmSjaI81QXD3oPpx1vjnA7hXzsyFVNgR7tddFX9zgWaj6ig6TR4Dtt1VfISXMb7tse5oCBIk340SqkUUHg1f31g= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(24454002)(189002)(13464003)(377454003)(199003)(66066001)(68736007)(54906003)(2900100001)(86362001)(6506006)(8936002)(6436002)(33656002)(5250100002)(99286003)(3280700002)(55016002)(8666007)(6306002)(9686003)(2950100002)(53936002)(189998001)(3660700001)(229853002)(14454004)(102836003)(101416001)(97736004)(106356001)(105586002)(7736002)(74316002)(305945005)(110136005)(3846002)(6116002)(25786009)(81156014)(53546010)(81166006)(8676002)(5660300001)(316002)(93886005)(4326008)(966005)(6246003)(2906002)(478600001)(76176999)(2501003)(54356999)(50986999)(7696004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0402MB3428; H:AM0PR0402MB3940.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: 8564bd6b-c691-4a4d-78ad-08d50037159c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:AM0PR0402MB3428; x-ms-traffictypediagnostic: AM0PR0402MB3428: x-exchange-antispam-report-test: UriScan:(180628864354917)(192374486261705)(185117386973197)(162533806227266); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM0PR0402MB3428; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM0PR0402MB3428; x-forefront-prvs: 04362AC73B received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2017 14:51:32.6695 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3428 Subject: Re: Storing Non volatile variables on SD/NAND 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, 20 Sep 2017 14:48:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This use case also arises for single-board systems like raspberry-pi, which= do not have an onboard flash. The boot firmware/bootloader as well as operating system are loaded from SD= card. https://www.raspberrypi.org/documentation/configuration/config-txt/ Thanks & Regards, Pankaj Bansal -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Andr= ew Fish Sent: Wednesday, September 20, 2017 10:48 AM To: Udit Kumar Cc: edk2-devel@lists.01.org; Vladimir Olovyannikov ; Olivier.Martin@arm.com; Ard Biesheuvel Subject: Re: [edk2] Storing Non volatile variables on SD/NAND > On Sep 19, 2017, at 10:09 PM, Udit Kumar wrote: >=20 >>> On Sep 19, 2017, at 9:27 PM, Udit Kumar wrote: >>>=20 >>>=20 >>>> On 18 September 2017 at 22:28, Udit Kumar wrote: >>>>> Thanks Vladimir, >>>>> With your design, you did delayed write to eMMC due to sharing=20 >>>>> with OS. But it works for you:) Say if eMMC controllers offers=20 >>>>> you a status bit, if eMMC storage is being used for not. Then this=20 >>>>> could be possible to >>>> update at run time, both OS/UEFI needs to check and wait if=20 >>>> controller is being used. >>>>=20 >>>> That is the problem right there. The nice thing about a firmware=20 >>>> spec is that you don't have to care about how it was implemented if=20 >>>> you adhere to >> the API rules. >>>=20 >>> Yup, we are fine as long as long UEFI firmware is stored on dedicated m= edia. >>>=20 >>>> Imposing additional restrictions (such as requiring the OS to be=20 >>>> careful about not using the eMMC when it may be in use by the >>>> firmware) defeats the purpose of using UEFI, since you won't be=20 >>>> able to use a >> generic OS anyway. >>>>=20 >>>=20 >>> Hmm, so far, I haven't come across where UEFI specs says, we need a=20 >>> separate Storage for firmware. (May be I missed some part of specs)=20 >>> Irrespective of storage media, we have this problem if OS and UEFI=20 >>> shares same storage. >>>=20 >>=20 >> Udit, >>=20 >> Can you point out the spec that states you can't boot Linux and=20 >> Windows at the same time on a PC? :) >>=20 >> When you write a spec it is not practical do document what is not=20 >> possible, you can only document the API the rest is implied by the=20 >> implementation. So for example the UEFI spec does not document why=20 >> the firmware and OS can't share a hardware device, just like you=20 >> can't have 2 operating systems running on bare metal at the same=20 >> time. It is a little like Occam's Razor the reason that the firmware=20 >> and the OS can not share a hardware device is the mechanics of how to=20 >> share a hardware device is not defined in the spec, thus it is not part = of the API and not possible. >=20 > Right, This is left on implementation how to put firmware and OS. > Ideally, keeping both storage separate is best case, no need to sync bet= ween two. >=20 > My reply to Ard, was to highlight that in any case (NOR or eMMC /NAND)=20 > if we are keeping OS and firmware on same storage, we will have same=20 > issue not limited to eMMC. >=20 > For some requirement, if we need to keep firmware and OS on same=20 > media, Then implementation should make sure there is exclusive access=20 > (be it NOR controller, SD controller etc). >=20 Udit, Sorry I'm a little swamped on my email right now and might be a little behi= nd on the thread.... Yea the only way to realistically Implement an EFI runtime service in UEFI = is to have UEFI own the hardware device. There is no architecture for shari= ng the device, and the type of device is not really relevant.=20 Thanks, Andrew Fish > Thanks > Udit >=20 >> Thanks, >>=20 >> Andrew Fish >>=20 >>>>> For sure, some synchronization issues need to be ironed out (or=20 >>>>> maybe I am >>>> just dreaming here). >>>>>=20 >>>>> On part 2) where you forked VariableRuntime driver , could we=20 >>>>> think of updating VariableRuntime driver, to support non-XIP or=20 >>>>> memory mapped >>>> devices. >>>>>=20 >>>>=20 >>>> I think being able to support non-memorymapped FV volumes for the=20 >>>> variable store would be a big improvement. This does require=20 >>>> changes to both the FaultTolerantWrite drivers and the=20 >>>> VariableRuntime drivers, which both appear in PEI, DXE and SMM=20 >>>> flavors, and require thorough review due to the security impact=20 >>>> bugs have in this layer, so this is a >> rather large chunk of work to take on. >>>=20 >>> Thanks, your list is longer than what I was thinking :-) I think,=20 >>> for embedded world with UEFI, later or sooner, this will be required. >>>=20 >>> Thanks >>> Udit >>> _______________________________________________ >>> edk2-devel mailing list >>> edk2-devel@lists.01.org >>> https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel