public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] Questions regarding NVDIMM and OVMF
@ 2024-07-08 21:55 Thomas Preisner
  2024-07-09 14:48 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Preisner @ 2024-07-08 21:55 UTC (permalink / raw)
  To: devel

Hello,

I'm currently working on a research project with the goal to (mostly) 
replace
DRAM with NVRAM on the OS-side. In order to speed things up, I'm currenlty
trying to switch over to QEMU+OVMF instead of developing directly on 
hardware
(server boot times are a massive pain). However, I've noticed that QEMU 
only
announces the existence of nvdimm devices via ACPI's NFIT. As a result,
virtualized nvdimm devices neither appear in the E820 table nor in UEFI's
GetMemoryMap() and, e.g., Linux doesn't find it during its boot.

Hence, I've been trying to add support for QEMU's nvdimm devices to 
OVMF. For
this purpose, I identified `OvmfPkg/Library/PlatformInitLib/MemDetect.c` 
as the
most fitting location to query NFIT in order to create HOBs for the 
detected
nvdimms. However, ACPI, and therefore, NFIT is only available beginning 
with
the DXE phase while the PlatformInitLib  is executed during the PEI phase
according to my understanding.

Is there any other way to access the ACPI table during PEI phase? I would
assume it isn't (as it is loaded via QEMU's fw_cfg "table-loader" as 
part of
the DxeAcpiPlatformLib), but maybe I'm wrong and there is some way. Or 
is it
also sufficient to create respective HOBs during DXE phase? If so, 
where/when
would be the most fitting location for this addition?

In either case, are the HOBs at some point fed back into the E820 table 
(which
is still crucial for the Linux kernel)? Or are they strictly used by 
OVMF and
not passed on to the remaining system in one way or another? So far, 
I've only
found `OvmfPkg/Library/LoadLinuxLib/Linux.c:SetupLinuxMemmap()` to 
rewrite the
E820 table, but apparently this is only used by QemuLoadImageLib which 
is not
executed during a 'normal' boot. At least it wasn't for my case (tested by
simply adding an infinite loop). So either there is another location 
that I've
overlooked (any pointer is welcome!) or the E820 table is not updated
accordingly? Currently, I'm still trying to get a (proper) grasp of the 
entire
architecture/structure of the edk2 project.

Do you have any pointers for implementing the support of nvdimm in 
edk2/OVMF?
Or is it not feasible and I need to also look at adding it directly into 
QEMU
(I was hoping to avoid having to modify QEMU so far)?

Best regards,
Thomas Preisner



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119845): https://edk2.groups.io/g/devel/message/119845
Mute This Topic: https://groups.io/mt/107122508/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] Questions regarding NVDIMM and OVMF
  2024-07-08 21:55 [edk2-devel] Questions regarding NVDIMM and OVMF Thomas Preisner
@ 2024-07-09 14:48 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2024-07-09 14:48 UTC (permalink / raw)
  To: devel, preisner

  Hi,

> Do you have any pointers for implementing the support of nvdimm in
> edk2/OVMF?  Or is it not feasible and I need to also look at adding it
> directly into QEMU

qemu.  Add e820_add_entry() calls.

Possibly edk2 too.

Not sure how linux is supposed to figure the memory in question is
nvdimm not ram.  Is there a e820 type for nvdimm?  If so then
PlatformAddHobCB() in OvmfPkg/Library/PlatformInitLib/MemDetect.c needs
some code to handle it.

In any case you I don't think you want qemu announce the nvdimm device
twice.  So it should be registered either via acpi/nfit, or via e820
table (which gets passed from qemu to firmware via 'etc/e820' fw_cfg
file), but probably not both.

HTH & take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119850): https://edk2.groups.io/g/devel/message/119850
Mute This Topic: https://groups.io/mt/107122508/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-07-09 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 21:55 [edk2-devel] Questions regarding NVDIMM and OVMF Thomas Preisner
2024-07-09 14:48 ` Gerd Hoffmann

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