Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS-level access to CBMEM #69

Closed
krystian-hebel opened this issue Apr 11, 2022 · 14 comments
Closed

OS-level access to CBMEM #69

krystian-hebel opened this issue Apr 11, 2022 · 14 comments

Comments

@krystian-hebel
Copy link

The problem you're addressing (if any)
After fixing memory reservation in the device tree generation code, CBMEM is no longer accessible from operating system. Previously it was marked as usable, non-reserved RAM and could be read as long as nothing overwrote it.

Describe the solution you'd like
It is mainly required by cbmem util from coreboot. This utility should be able to access CBMEM region either by mmaping it directly or by accessing some file exposed by kernel.

Where is the value to a user, and who might that user be?
CBMEM holds various pieces of information about firmware, like console log or timestamps.

Describe alternatives you've considered

  • it may be possible to mark this range as “reserved but mmapable” memory in device tree (note that skiboot, skiroot and final OS' kernel may modify it)
  • Creating new kernel driver
  • Enabling Google’s driver for other platforms, additional changes may be required
@sulewskiprzemyslaw
Copy link

@SergiiDmytruk I see, that CBMEM currently works on the platform flashed with v0.6.0 binary. I have one question: if the coreboot timestamps should be available?

When I execute the following command:

./git/coreboot/util/cbmem/cbmem -T

In the output I see:
No timestamps found in coreboot table

@SergiiDmytruk
Copy link
Member

@sulewskiprzemyslaw No, timestamps aren't enabled. .config has this line:

# CONFIG_COLLECT_TIMESTAMPS is not set

@sulewskiprzemyslaw
Copy link

@SergiiDmytruk ok, thank you for the information.

@tlaurion
Copy link

CONFIG_COLLECT_TIMESTAMPS=y

Should be set otherwise speed comparison will not be possible.

@miczyg1
Copy link
Contributor

miczyg1 commented Oct 13, 2022

Definition from Kconfig:

config COLLECT_TIMESTAMPS
	bool "Create a table of timestamps collected during boot"
	default y if ARCH_X86

So all x86 boards will have it. Is there a reason why POWER would not want to select it?

@krystian-hebel
Copy link
Author

I don't know if QEMU would support timer in current state, this would need testing. Other than that, we can enable it.

@miczyg1
Copy link
Contributor

miczyg1 commented Mar 2, 2023

We can either make it read-write and not reserve it or reserve it and do not let any access. Possible ideas

  1. Adding some entry in DT
  2. Modifying skiboot

@SergiiDmytruk
Copy link
Member

SergiiDmytruk commented Apr 4, 2023

Dasharo/coreboot#197 was fixing this (although not in .../develop), but it's still open.

@tlaurion
Copy link

tlaurion commented Apr 4, 2023

I think a different approach was taken since then? Confused but I think its now correctly exposed in read only now

@SergiiDmytruk
Copy link
Member

The commit that excludes cbmem from available memory is there, so it basically works the same. Endianness and DT stuff is done differently, but looks like the kernel can now see TPM log which used to cause issues.

@krystian-hebel
Copy link
Author

Dasharo/coreboot#197 was fixing this (although not in .../develop), but it's still open.

@SergiiDmytruk you are correct. For some reason I think I saw it just added entries to FDT "memreserve" fields instead of creating DT "/reserved-memory/coreboot@%llx" nodes, in which case Skiboot wouldn't mark it as reserved and OS would be allowed to overwrite it. Maybe it was on develop 🤔

@SergiiDmytruk
Copy link
Member

but looks like the kernel can now see TPM log which used to cause issues.

Nope, the necessary changes seem to be there, some commits just got squashed.

@miczyg1
Copy link
Contributor

miczyg1 commented Apr 27, 2023

Awaiting for the automated tests to be ready to close the issue

@artur-rs artur-rs added this to the Raptor CS Talos II v0.7.0 milestone Jun 30, 2023
@BeataZdunczyk
Copy link
Member

This issue is fixed with linuxboot/heads#1313 and is part of the 0.7.0 release, which was published here: https://docs.dasharo.com/variants/talos_2/releases/#v070-2023-07-26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants