public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI
@ 2023-02-06 16:06 ritul guru
  2023-02-06 18:16 ` [edk2-devel] " Andrew Fish
  0 siblings, 1 reply; 5+ messages in thread
From: ritul guru @ 2023-02-06 16:06 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hi,

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?
If so, where does this variable gets stored? is it in some virtualized disk
as there is no virtualized SPIROM available to VM.



https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel



*Thanks & RegardsRitul Guru+91-9916513186*

[-- Attachment #2: Type: text/html, Size: 2145 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI
  2023-02-06 16:06 regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI ritul guru
@ 2023-02-06 18:16 ` Andrew Fish
  2023-02-06 18:25   ` ritul guru
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Fish @ 2023-02-06 18:16 UTC (permalink / raw)
  To: edk2-devel-groups-io, ritul.bits

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]



> 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 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? 
> If so, where does this variable gets stored? is it in some virtualized disk as there is no virtualized SPIROM available to VM.
> 
> 

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

https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf
edk2/OvmfXen.fdf at master · tianocore/edk2
github.com

Oh looks like it uses an emulated variable store that is just memory. See ReserveEmuVariableNvStore().

https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365
edk2/Platform.c at master · tianocore/edk2
github.com

Thanks,

Andrew Fish

> 
> https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel
> 
> Thanks & Regards
> Ritul Guru
> +91-9916513186
> 


[-- Attachment #2.1: Type: text/html, Size: 8436 bytes --]

[-- Attachment #2.2: edk2.png --]
[-- Type: image/png, Size: 68939 bytes --]

[-- Attachment #2.3: edk2.png --]
[-- Type: image/png, Size: 68939 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI
  2023-02-06 18:16 ` [edk2-devel] " Andrew Fish
@ 2023-02-06 18:25   ` ritul guru
  2023-02-06 18:27     ` ritul guru
  2023-02-06 18:33     ` Andrew Fish
  0 siblings, 2 replies; 5+ messages in thread
From: ritul guru @ 2023-02-06 18:25 UTC (permalink / raw)
  To: Andrew (EFI) Fish; +Cc: edk2-devel-groups-io


[-- Attachment #1.1.1: Type: text/plain, Size: 1979 bytes --]

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



*Thanks & RegardsRitul 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 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?
> If so, where does this variable gets stored? is it in some virtualized
> disk as there is no virtualized SPIROM available to VM.
>
>
>
> I don’t know the Xen specifics, but the firmware maps in a Flash Device
> (FD) here:
>
> [image: edk2.png]
>
> edk2/OvmfXen.fdf at master · tianocore/edk2
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
> github.com
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>
> Oh looks like it uses an emulated variable store that is just memory. See
> ReserveEmuVariableNvStore().
>
> [image: edk2.png]
>
> edk2/Platform.c at master · tianocore/edk2
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
> github.com
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>
> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>
> Thanks,
>
> Andrew Fish
>
>
> https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel
>
>
>
> *Thanks & RegardsRitul Guru+91-9916513186*
> 
>
>
>

[-- Attachment #1.1.2: Type: text/html, Size: 7705 bytes --]

[-- Attachment #1.2: edk2.png --]
[-- Type: image/png, Size: 68939 bytes --]

[-- Attachment #2: edk2.png --]
[-- Type: image/png, Size: 68939 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI
  2023-02-06 18:25   ` ritul guru
@ 2023-02-06 18:27     ` ritul guru
  2023-02-06 18:33     ` Andrew Fish
  1 sibling, 0 replies; 5+ messages in thread
From: ritul guru @ 2023-02-06 18:27 UTC (permalink / raw)
  To: Andrew (EFI) Fish; +Cc: edk2-devel-groups-io


[-- Attachment #1.1: Type: text/plain, Size: 2437 bytes --]

ohh, it should retains value on VM reboot.

//
// Allocate storage for NV variables early on so it will be
// at a consistent address. Since VM memory is preserved
// across reboots, this allows the NV variable storage to survive
// a VM reboot.
//



*Thanks & RegardsRitul Guru+91-9916513186*


On Mon, Feb 6, 2023 at 11:55 PM ritul guru <ritul.bits@gmail.com> wrote:

> Thanks,
> so as it is memory, does it mean if anything written in variable store,
> and VM reboot happens then variable store will be flushed?
>
>
>
> *Thanks & RegardsRitul 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
>> 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?
>> If so, where does this variable gets stored? is it in some virtualized
>> disk as there is no virtualized SPIROM available to VM.
>>
>>
>>
>> I don’t know the Xen specifics, but the firmware maps in a Flash Device
>> (FD) here:
>>
>> [image: edk2.png]
>>
>> edk2/OvmfXen.fdf at master · tianocore/edk2
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>> github.com
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>>
>> Oh looks like it uses an emulated variable store that is just memory. See
>> ReserveEmuVariableNvStore().
>>
>> [image: edk2.png]
>>
>> edk2/Platform.c at master · tianocore/edk2
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>> github.com
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>>
>> <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>>
>> Thanks,
>>
>> Andrew Fish
>>
>>
>> https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel
>>
>>
>>
>> *Thanks & RegardsRitul Guru+91-9916513186*
>> 
>>
>>
>>

[-- Attachment #1.2: Type: text/html, Size: 14425 bytes --]

[-- Attachment #2: edk2.png --]
[-- Type: image/png, Size: 68939 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI
  2023-02-06 18:25   ` ritul guru
  2023-02-06 18:27     ` ritul guru
@ 2023-02-06 18:33     ` Andrew Fish
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Fish @ 2023-02-06 18:33 UTC (permalink / raw)
  To: ritul guru; +Cc: edk2-devel-groups-io

[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]



> 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 reboot 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 starting over.

Sorry I’ve never looked at the Xen code before so I’m sight reading.

Thanks,

Andrew Fish

> Thanks & Regards
> Ritul Guru
> +91-9916513186
> 
> 
> On Mon, Feb 6, 2023 at 11:47 PM Andrew (EFI) Fish <afish@apple.com <mailto:afish@apple.com>> wrote:
>> 
>> 
>>> On Feb 6, 2023, at 8:06 AM, ritul guru <ritul.bits@gmail.com <mailto:ritul.bits@gmail.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> 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? 
>>> If so, where does this variable gets stored? is it in some virtualized disk as there is no virtualized SPIROM available to VM.
>>> 
>>> 
>> 
>> I don’t know the Xen specifics, but the firmware maps in a Flash Device (FD) here:
>> 
>> <edk2.png>
>> edk2/OvmfXen.fdf at master · tianocore/edk2
>> github.com
>>  <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>edk2/OvmfXen.fdf at master · tianocore/edk2 <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>> github.com <https://github.com/tianocore/edk2/blob/master/OvmfPkg/OvmfXen.fdf>
>> 
>> Oh looks like it uses an emulated variable store that is just memory. See ReserveEmuVariableNvStore().
>> 
>> 
>> edk2/Platform.c at master · tianocore/edk2
>> github.com
>>  <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>edk2/Platform.c at master · tianocore/edk2 <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>> github.com <https://github.com/tianocore/edk2/blob/master/OvmfPkg/XenPlatformPei/Platform.c#L365>
>> 
>> Thanks,
>> 
>> Andrew Fish
>> 
>>> 
>>> https://wiki.osdev.org/Using_UEFI_Runtime_Services_in_your_Kernel
>>> 
>>> Thanks & Regards
>>> Ritul Guru
>>> +91-9916513186
>>> 
>> 
> <edk2.png>


[-- Attachment #2: Type: text/html, Size: 8454 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-06 18:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 16:06 regarding calling UEFI runtime services (mainly SetVariable) from linux or android OS which is running on xen+tianocore UEFI ritul guru
2023-02-06 18:16 ` [edk2-devel] " Andrew Fish
2023-02-06 18:25   ` ritul guru
2023-02-06 18:27     ` ritul guru
2023-02-06 18:33     ` Andrew Fish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox