From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from rn-mailsvcp-mx-lapp02.apple.com (rn-mailsvcp-mx-lapp02.apple.com [17.179.253.23]) by mx.groups.io with SMTP id smtpd.web11.62071.1675708401260608370 for ; Mon, 06 Feb 2023 10:33:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=ZKl4zgwh; spf=pass (domain: apple.com, ip: 17.179.253.23, mailfrom: afish@apple.com) Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by rn-mailsvcp-mx-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.20.20220923 64bit (built Sep 23 2022)) with ESMTPS id <0RPO009G58VKC400@rn-mailsvcp-mx-lapp02.rno.apple.com> for devel@edk2.groups.io; Mon, 06 Feb 2023 10:33:21 -0800 (PST) X-Proofpoint-ORIG-GUID: sx-SfFlqT2XT1Qjr_-LesTd0j4zDazmd X-Proofpoint-GUID: sx-SfFlqT2XT1Qjr_-LesTd0j4zDazmd X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.562,18.0.930 definitions=2023-02-06_07:2023-02-06,2023-02-06 signatures=0 X-Proofpoint-Spam-Details: rule=interactive_user_notspam policy=interactive_user score=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302060161 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=BnbuDfe6whhC36hY7VRL2CtPZGw7sk3UuNlYZR+1Buc=; b=ZKl4zgwh2vqFUtwzbqoKODfuUkff4lJ7GkqZYHNeb5A2gnZltYm7tWVS2VP+AB7Zx+qT z6nHUe/Foz8TzfOTIMamq0vyxw5YbRxFppNfGOwxjs8swWDWIXi0rrHVBBReJRPOOkqJ 4JWrj/EFema3cv6sdaMz6eV6MdqjfTv6nPZaj3kemEZjK68QoFZXI1MoweHSrZvr3J6T uxtoenFH4gGZP6VuZODSRDr2fnHTpsnKBL7Z9/TiIL97vCwJJgsVqLqeJdjztvFxVWJN mGd4Z8QWZUp4OMG/o4CzUpnNMkjpRfPxxwetScpOCzd+uHdyqYUettORwkRSC0daQZwo bw== Received: from rn-mailsvcp-mmp-lapp02.rno.apple.com (rn-mailsvcp-mmp-lapp02.rno.apple.com [17.179.253.15]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.20.20220923 64bit (built Sep 23 2022)) with ESMTPS id <0RPO00ABA8VJ5J30@rn-mailsvcp-mta-lapp02.rno.apple.com>; Mon, 06 Feb 2023 10:33:19 -0800 (PST) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp02.rno.apple.com by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.20.20220923 64bit (built Sep 23 2022)) id <0RPO008008VHZ600@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Mon, 06 Feb 2023 10:33:19 -0800 (PST) X-Va-A: X-Va-T-CD: 9878d5f7524249f95b59225b6763fa12 X-Va-E-CD: a1363a443a30899cc5bcb8275954b69a X-Va-R-CD: 9998be59743d26e10aa65f18273f75de X-Va-ID: 5891a0ee-dd62-4020-95ef-0a304dcace62 X-Va-CD: 0 X-V-A: X-V-T-CD: 9878d5f7524249f95b59225b6763fa12 X-V-E-CD: a1363a443a30899cc5bcb8275954b69a X-V-R-CD: 9998be59743d26e10aa65f18273f75de X-V-ID: 9891f454-8c41-4866-9357-436402bbf8dc X-V-CD: 0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.562,18.0.930 definitions=2023-02-06_07:2023-02-06,2023-02-06 signatures=0 Received: from smtpclient.apple (unknown [17.234.72.46]) by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.20.20220923 64bit (built Sep 23 2022)) with ESMTPSA id <0RPO0014R8VE5R00@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Mon, 06 Feb 2023 10:33:15 -0800 (PST) From: "Andrew Fish" Message-id: <71408315-B855-475B-80AA-C2FC6B665D72@apple.com> MIME-version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [edk2-devel] regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI Date: Mon, 06 Feb 2023 10:33:04 -0800 In-reply-to: Cc: edk2-devel-groups-io To: ritul guru References: X-Mailer: Apple Mail (2.3731.400.51.1.1) Content-type: multipart/alternative; boundary="Apple-Mail=_727656A1-C721-498D-82EC-4DFF885D62FB" --Apple-Mail=_727656A1-C721-498D-82EC-4DFF885D62FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Feb 6, 2023, at 10:25 AM, ritul guru wrote: >=20 > Thanks, > so as it is memory, does it mean if anything written in variable store, a= nd VM reboot happens then variable store will be flushed? >=20 It looks like it is saved if you do an S3. S3 is ACPI speak for a sleep sta= te that puts RAM into self refresh. On a cold boot it allocates the memory,= so you are starting over. Sorry I=E2=80=99ve never looked at the Xen code before so I=E2=80=99m sight= reading. Thanks, Andrew Fish > Thanks & Regards > Ritul Guru > +91-9916513186 >=20 >=20 > On Mon, Feb 6, 2023 at 11:47 PM Andrew (EFI) Fish > wrote: >>=20 >>=20 >>> On Feb 6, 2023, at 8:06 AM, ritul guru > wrote: >>>=20 >>> Hi, >>>=20 >>> I have been using xen hypervisor and tianocore uefi BIOS on xen to boot= to ubuntu OS on virtualized disk. >>> and want to set a UEFI variable with UEFI runtime service SetVariable()= to a value and the same wants to read from UEFI bootloader either grubx64.= efi or botmgfw.efi, >>> So, Is it possible to use runtime services to do such an operation for = OS running on VM when booted with OVMF/tianocore BIOS on VM guest?=20 >>> If so, where does this variable gets stored? is it in some virtualized = disk as there is no virtualized SPIROM available to VM. >>>=20 >>>=20 >>=20 >> I don=E2=80=99t know the Xen specifics, but the firmware maps in a Flash= Device (FD) here: >>=20 >> >> edk2/OvmfXen.fdf at master =C2=B7 tianocore/edk2 >> github.com >> edk2= /OvmfXen.fdf at master =C2=B7 tianocore/edk2 >> github.com >>=20 >> Oh looks like it uses an emulated variable store that is just memory. Se= e ReserveEmuVariableNvStore(). >>=20 >>=20 >> edk2/Platform.c at master =C2=B7 tianocore/edk2 >> github.com >> edk2/Platform.c at master =C2=B7 tianocore/edk2 >> github.com >>=20 >> Thanks, >>=20 >> Andrew Fish >>=20 >>>=20 >>> https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel >>>=20 >>> Thanks & Regards >>> Ritul Guru >>> +91-9916513186 >>>=20 >>=20 > --Apple-Mail=_727656A1-C721-498D-82EC-4DFF885D62FB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Feb 6, 2023, at 10:25 AM, ritul guru <ritul.bits@gmail.com= > wrote:

Thanks,
so as it= is memory, does it mean if anything written in variable store, and VM rebo= ot happens then variable store will be flushed?


It looks like it = is saved if you do an S3. S3 is ACPI speak for a sleep state that puts RAM = into self refresh. On a cold boot it allocates the memory, so you are start= ing over.

Sorry I=E2=80=99ve never looked at the X= en code before so I=E2=80=99m sight reading.

Thank= s,

Andrew Fish

=
Thanks & Regard= s
Ritul Guru
+91-9916513186
=


On Mon, Feb 6, 2023 at 11:47 PM Andrew (EFI) Fish <= ;afish@apple.com> wrote:


On Feb 6, 2023, at 8:06 AM, ritul guru <ritul.bits@gmail.com= > wrote:

Hi= ,

I have been using xen hypervisor and tianocore uefi BIOS on xen to boot t= o ubuntu OS on virtualized disk.
and wan= t to set a UEFI variable with UEFI runtime service SetVariable() to a value= and the same wants to read from UEFI bootloader either grubx64.efi or botm= gfw.efi,
So, Is it possible to use runti= me services to do such an operation for OS running on VM when booted w= ith OVMF/tianocore BIOS on VM guest? 
If so, where does this variable gets stored? is it in some virtualized d= isk as there is no virtualized SPIROM available to VM.



I don=E2=80=99t know the Xen specifics, = but the firmware maps in a Flash Device (FD) here:


Oh looks like it uses an emulated vari= able store that is just memory. See ReserveEmuVariableNvStore().
<edk2.png> --Apple-Mail=_727656A1-C721-498D-82EC-4DFF885D62FB--