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

[WIP] Testing #3

Closed
wants to merge 5 commits into from
Closed

[WIP] Testing #3

wants to merge 5 commits into from

Conversation

dupontz
Copy link

@dupontz dupontz commented Jun 20, 2023

@ellyq First of all, thanks for all the hard work. We could get this far if it was not for you. I'm speaking in the name of a small, but very enthusiast folks.

We've run some test this weekend and your build definitely brought more efficiency to the table. We are seeing something around 10~15 W on high load (sintetic benchmarks)

Our first goal is to port all fixes for the quirks that this board has on the original firmware. Second, have the ability to set custom memory profiles. We had a look on coreboot-configurator but couldn't wrap our heads on how to get it running. It's throwing this error:
nvramtool: CMOS option table not found in coreboot table. Apparently, the coreboot installed on this system was built without selecting CONFIG_USE_OPTION_TABLE.

We've also built nvramtool from source and it throws the same error.

As we couldn't get coreboot-configurator going we decided to hardcode some parameters, I left some comments in the code with our attempts. We are assuming there a issue selecting the customXmpProfile, as per your code it seems xmp1 is also not working and some issue with SA/Uncore when we set voltage (offset/voltage)

There were also some reports on USB 3.0 hub (docks) not working - Even on latest build.

We would like to help more, but don't have much expertise on how to troubleshoot/debug coreboot builds. Let us know what are your thoughts and how can we help you more (maybe a coreboot masterclass :P ?)

@ellyq
Copy link
Owner

ellyq commented Jun 20, 2023

Hi!
I'm not a guru or anything, but thank you for your kind words! I appreciate the contribution, it really surprised me how many people got interested in this project :P

I'll have a look at those patches tomorrow (it's 4AM in Europe right now) and currently testing another build.
Oddly enough it works on Windows (non-ES SKU), but in Linux it's either that this patch broke it, or drm-i915 broke since I last tested it (it seems to be related to Chromium and vaapi). I just re-compiled Linux kernel with debugging options and forced module loading/unloading enabled, hoping to RCA it.

I've created #coreboot-porting on oftc.net so we could collaborate better on this project if you're interested.
As for CMOS, I will be changing flash descriptor's binary to fmap before upstreaming, so I'll take a look at fixing CMOS as well. Baby steps :)

Mind giving some examples of USB3 docks not working? I'm typing this comment from latest coreboot build, USB3 dock in LG 27GP850 monitor (plugged into USB3 port) seem to work just fine.

Bus 002 Device 003: ID 345f:2130 MACROSILICON USB3.0 UHD
Bus 002 Device 002: ID 0bda:0411 Realtek Semiconductor Corp. Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 256c:006d HUION Huion Tablet_GS1562
Bus 001 Device 007: ID 1852:7022 GYROCOM C&C Co., LTD Fiio E10
Bus 001 Device 005: ID 1532:0084 Razer USA, Ltd RZ01-0321 Gaming Mouse [DeathAdder V2]
Bus 001 Device 003: ID 04d9:a293 Holtek Semiconductor, Inc. OBINS AnnePro2
Bus 001 Device 006: ID 043e:9a39 LG Electronics USA, Inc. LG Monitor Controls
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp. RTS5411 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

P.S: Update on iGPU situation: Reverted the patch, still crashing with VAAPI decoding.
I figured that it's a problem with DMA, so pre-production iGPU must have issues with IOMMU.
Booted with intel_iommu=on,igfx_off, seems like the problem is gone but I don't want to celebrate just yet :P

@dupontz
Copy link
Author

dupontz commented Jun 20, 2023

@ellyq here is the USB devices:

Bus 002 Device 010: ID 17e9:6000 DisplayLink USB3.0 5K Graphic Docking
Bus 002 Device 009: ID 2109:1817 VIA Labs, Inc. USB3.0 Hub
Bus 002 Device 008: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c53f Logitech, Inc. USB Receiver
Bus 001 Device 011: ID 2109:3817 VIA Labs, Inc. USB2.0 Hub
Bus 001 Device 010: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub
Bus 001 Device 003: ID 25a7:fa70 Areson Technology Corp 2.4G Wireless Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Apparently it has some functionality, it's probably those "VIA" devices but nothing connected to them seems to work. The Ethernet port and audio jack are working fine by the way.

Don't jinx it !!! I've being experiencing some freezes, couldn't pinpoint the issue yet most of time they are pretty random and usually when i'm AFK. Nothing on Windows tho, so you are probably on the right track

@dupontz
Copy link
Author

dupontz commented Jun 20, 2023

@ellyq Found this issue. Maybe that relates to the XMP profile issue?

ellyq pushed a commit that referenced this pull request Oct 12, 2023
During phase 1 of the resource allocation we gather all the size
requirements. Starting from the leafs of our devicetree, we cal-
culate the requirements per bus, until we reach the resource do-
main.

However, because alignment plays a role, we can't just accumulate
the sizes of all resources on a bus. Instead, we already sort all
the resources per bus to predict their relative placement, inclu-
ding alignment gaps. Then, phase 2 has to perform the final allo-
cations with the exact same relative placement.

This patch introduces a very simple mechanism to avoid repeating
all the calculations: In phase 1, we note the relative `base` of
each resource on a bus. And after we allocated all the resources
directly below the domain in phase 2, we add the absolute `base`
of bridge resources to the relative `base` of child resources.

This saves most of the computational complexity in phase 2. How-
ever, with a shallow devicetree with most devices directly below
the domain, this won't have a measurable impact.

Example after phase 1:

  domain
    |
    `-- bridge #0
          |   res #0, base 0x000000 (relative),
          |   size 12M, align 8M
          |
          |-- device #0
          |         res #1, base 0x800000 (relative),
          |         size 4M, align 4M
          |
          `-- bridge #1
                |   res #2, base 0x000000 (relative),
                |   size 8M, align 8M
                |
                `-- device #1
                          res #3, base 0x000000 (relative),
                          size 8M, align 8M

After phase 2 allocation at the domain level (assuming res #0 got
0xa000000 assigned):

  domain
    |
    `-- bridge #0
          |   res #0, base 0xa000000 (absolute),
          |   size 12M, align 8M
          |
          |-- device #0
          |         res #1, base 0x800000 (relative),
          |         size 4M, align 4M
          |
          `-- bridge #1
                |   res #2, base 0x000000 (relative),
                |   size 8M, align 8M
                |
                `-- device #1
                          res #3, base 0x000000 (relative),
                          size 8M, align 8M

Now, all we need to do is to add the `base` of bridge resources
recursively. Starting with resources on the bus below bridge #0:

  domain
    |
    `-- bridge #0
          |   res #0, base 0xa000000 (absolute),
          |   size 12M, align 8M
          |
          |-- device #0
          |         res #1, base 0xa800000 (absolute),
          |         size 4M, align 4M
          |
          `-- bridge #1
                |   res #2, base 0xa000000 (absolute),
                |   size 8M, align 8M
                |
                `-- device #1
                          res #3, base 0x000000 (relative),
                          size 8M, align 8M

And finally for resources on the bus below bridge #1:

  domain
    |
    `-- bridge #0
          |   res #0, base 0xa000000 (absolute),
          |   size 12M, align 8M
          |
          |-- device #0
          |         res #1, base 0xa800000 (absolute),
          |         size 4M, align 4M
          |
          `-- bridge #1
                |   res #2, base 0xa000000 (absolute),
                |   size 8M, align 8M
                |
                `-- device #1
                          res #3, base 0xa000000 (absolute),
                          size 8M, align 8M

Change-Id: I70c700318a85f6760f27597730bc9c9a86dbe6b3
Signed-off-by: Nico Huber <[email protected]>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65420
Reviewed-by: Lean Sheng Tan <[email protected]>
Reviewed-by: Arthur Heymans <[email protected]>
Tested-by: build bot (Jenkins) <[email protected]>
Reviewed-by: Felix Singer <[email protected]>
ellyq pushed a commit that referenced this pull request Oct 12, 2023
x86 pre-memory stages do not support the `.data` section and as a
result developers are required to include runtime initialization code
instead of relying on C global variable definition.

To illustrate the impact of this lack of `.data` section support, here
are two limitations I personally ran into:

1. The inclusion of libgfxinit in romstage for Raptor Lake has
   required some changes in libgfxinit to ensure data is initialized at
   runtime. In addition, we had to manually map some `.data` symbols in
   the `_bss` region.

2. CBFS cache is currently not supported in pre-memory stages and
   enabling it would require to add an initialization function and
   find a generic spot to call it.

Other platforms do not have that limitation. Hence, resolving it would
help to align code and reduce compilation based restriction (cf. the
use of `ENV_HAS_DATA_SECTION` compilation flag in various places of
coreboot code).

We identified three cases to consider:

1. eXecute-In-Place pre-memory stages
   - code is in SPINOR
   - data is also stored in SPINOR but must be linked in Cache-As-RAM
     and copied there at runtime

2. `bootblock` stage is a bit different as it uses Cache-As-Ram but
   the memory mapping and its entry code different

3. pre-memory stages loaded in and executed from
   Cache-As-RAM (cf. `CONFIG_NO_XIP_EARLY_STAGES`).

eXecute-In-Place pre-memory stages (#1) require the creation of a new
ELF segment as the code segment Virtual Memory Address and Load Memory
Address are identical but the data needs to be linked in
cache-As-RAM (VMA) but to be stored right after the code (LMA).

Here is the output `readelf --segments` on a `romstage.debug` ELF
binary.

    Program Headers:
      Type    Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
      LOAD    0x000080 0x02000000 0x02000000 0x21960 0x21960 R E 0x20
      LOAD    0x0219e0 0xfefb1640 0x02021960 0x00018 0x00018 RW  0x4

     Section to Segment mapping:
      Segment Sections...
       00     .text
       01     .data

Segment 0 `VirtAddr` and `PhysAddr` are at the same address while they
are totally different for the Segment 1 holding the `.data`
section. Since we need the data section `VirtAddr` to be in the
Cache-As-Ram and its `PhysAddr` right after the `.text` section, the
use of a new segment is mandatory.

`bootblock` (#2) also uses this new segment to store the data right
after the code and load it to Cache-As-RAM at runtime. However, the
code involved is different.

Not eXecute-In-Place pre-memory stages (#3) do not really need any
special work other than enabling a data section as the code and data
VMA / LMA translation vector is the same.

TEST=#1 and #2 verified on rex and qemu 32 and 64 bits:
     - The `bootblock.debug`, `romstage.debug` and
       `verstage.debug` all have data stored at the end of the `.text`
       section and code to copy the data content to the Cache-As-RAM.
     - The CBFS stages included in the final image has not improperly
       relocated any of the `.data` section symbol.
     - Test purposes global data symbols we added in bootblock,
       romstage and verstage are properly accessible at runtime
     #3: for "Intel Apollolake DDR3 RVP1" board, we verified that the
     generated romstage ELF includes a .data section similarly to a
     regular memory enabled stage.

Change-Id: I030407fcc72776e59def476daa5b86ad0495debe
Signed-off-by: Jeremy Compostella <[email protected]>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77289
Tested-by: build bot (Jenkins) <[email protected]>
Reviewed-by: Arthur Heymans <[email protected]>
@ellyq ellyq deleted the branch ellyq:4.20.1-unstable January 9, 2024 04:16
@ellyq ellyq closed this Jan 9, 2024
ellyq pushed a commit that referenced this pull request Jul 10, 2024
This also changes how debug messages will be printed. I focused on
reducing clutter on the screen and made the style of the messages
consistent.

Before:
azalia_audio: Initializing codec #5
  codec not ready.
azalia_audio: Initializing codec #4
  codec not valid.
azalia_audio: Initializing codec #3
azalia_audio: viddid: ffffffff
azalia_audio: verb_size: 4
azalia_audio: verb loaded.

After:
azalia_audio: codec #5 not ready
azalia_audio: codec #4 not valid
azalia_audio: initializing codec #3...
azalia_audio:  - vendor/device id: 0xffffffff
azalia_audio:  - verb size: 4
azalia_audio:  - verb loaded

Change-Id: I92b6d184abccdbe0e1bfce98a2c959a97a618a29
Signed-off-by: Nicholas Sudsgaard <[email protected]>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80332
Reviewed-by: Nico Huber <[email protected]>
Reviewed-by: Felix Singer <[email protected]>
Tested-by: build bot (Jenkins) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants