Skip to content

AEM doesn't work on Dell Optiplex 7010 in UEFI mode #58

Open

Description

@krystian-hebel

Affected component(s) or functionality
The component or functionality of TrenchBoot that is not working as expected.

AEM

Brief summary
A clear and concise summary of the bug.

AEM does not boot on this platform in UEFI mode.

Version
The version of the component or feature if available, otherwise NA.

v0.5.0-rc3

To Reproduce
Steps to reproduce the behavior:

  1. Install AEM v0.5.0 under Qubes OS for legacy and UEFI
  2. Try to boot with AEM enabled

Expected behavior
A clear and concise description of what you expected to happen.

System boots normally.

Actual behavior
What actually happened (instead of what you expected to happen).

Platform reboots around the time when Xen is supposed to jump to slaunch stub in GRUB, no TXT error is produced. With additional debug enabled in GRUB (set debug=linux,relocator,multiboot,multiboot_loader,slaunch,chainloader), the platform hangs instead.

Screenshots
If applicable, add screenshots to help explain your problem.

Test 3501 on our internal openQA.

Additional context
Add any other context about the problem here.

Boot log with debug in GRUB: aem.log. No additional lines appear after adding debug options to xen-4.17.5.cfg.

Solutions you've tried
If applicable, any solutions or workarounds you've already tried.

  • Booting AEM entry with slaunch and slaunch_module removed: system boots, complaining about PCRs being all Fs, which is expected
  • Booting non-AEM entry with slaunch added: platform reboots, TXT reports error 0xc0140431 - I wasn't able to decode this particular minor number, but it has major type of ERR_BASIC_RANGE_CHECK
  • The same AEM version in legacy mode also reboots without the fix for AEM not booting on Intel legacy boot xen#22.

Relevant documentation you've consulted
A list of links to any relevant documentation you have consulted.

Related, non-duplicate issues
A list of links to other bug reports, feature requests, or tasks in the
trenchboot-issues tracker (or "none" if you didn't find any). Do not describe
any other unreported bugs, features, or tasks here.

Activity

  1. added
    P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.
    T: bugType: bug report. A problem or defect resulting in unintended behavior.
    W: todoWorkflow: todo. The issue is in the initial to do state.
    on Apr 9, 2025
  2. SergiiDmytruk commented on Apr 9, 2025

    @SergiiDmytruk
    Member

    With additional debug enabled in GRUB (set debug=linux,relocator,multiboot,multiboot_loader,slaunch,chainloader), the platform hangs instead.

    There seems to be something about grub_dprintf() that doesn't work when GRUB continues execution like that. Replacing such calls with grub_printf() helps to avoid the hang.

  3. SergiiDmytruk commented on Apr 10, 2025

    @SergiiDmytruk
    Member

    This seems to be the same issue as TrenchBoot/xen#22 and fix for that issue makes AEM work here in legacy mode. The platform has some really weird problems with Qubes ISO on PiKVM, so I had to make network boot work for legacy and UEFI cases to be able to test. Need to get firmware with TPM1.2 fix as I ran openQA on the version without the fix and it couldn't clear TPM.

  4. krystian-hebel commented on Apr 11, 2025

    @krystian-hebel
    MemberAuthor

    The platform has some really weird problems with Qubes ISO on PiKVM, so I had to make network boot work for legacy and UEFI cases to be able to test.

    SeaBIOS doesn't support composite USB devices, it breaks out of loop on first supported interface. Luckily, the first one is keyboard, otherwise none of our tests would work. UEFI works with the PiKVM ISO just fine for me.

    I worked around this by plugging in physical USB stick with Qubes OS installer (platform with asset ID 105), but it fails to boot the installer most of the times in legacy mode:

    Image

    dmesg shows some disturbing errors, not sure if they are related:

    Image

    I tried with different USB sticks in different ports, although always on the front panel, it didn't change the outcome. I was able to boot to the first GUI screen of the installer once by choosing kernel-latest, but I wasn't able to repeat it later.

  5. SergiiDmytruk commented on Apr 11, 2025

    @SergiiDmytruk
    Member

    UEFI works with the PiKVM ISO just fine for me.

    I haven't actually tried it because I incorrectly assumed a hardware-related issue. Network boot for UEFI doesn't work as expected though, openQA sends F12 too late for it to have an effect as if it used to boot slower or maybe something adds an extra delay now. I ended up making network boot the first boot option.

  6. SergiiDmytruk commented on Apr 11, 2025

    @SergiiDmytruk
    Member

    This seems to be the same issue as TrenchBoot/xen#22 and fix for that issue makes AEM work here in legacy mode.

    And only in legacy mode. UEFI fails before reaching Xen's code which restores MTRRs.

  7. added
    W: in progressWorkflow: in progress. The issue is actively being worked on.
    and removed
    W: todoWorkflow: todo. The issue is in the initial to do state.
    on Apr 12, 2025
  8. SergiiDmytruk commented on Apr 12, 2025

    @SergiiDmytruk
    Member

    Tried adjusting some alignment/range-related things in GRUB, but Slaunch boot still fails with 0xc0140431. It's the same error I saw on an OptiPlex earlier and suspected it to be firmware related, tried to flash original firmware and got a brick, so I don't want to repeat the test.

    I did, however, try with tboot and got the same error code, so assuming tboot does everything right for the platform either DRTM doesn't work on OptiPlex with Dasharo+UEFI or it doesn't work on OptiPlex with UEFI (need a firmware test).

    ERR_BASIC_RANGE_CHECK is described as "One of ranges in array failed the check: alignment is incorrect top address is below base Range placement is incorrect as required by its attributes" (original punctuation preserved). Possible minor errors (array elements?):

    • ERR_DMAR_TAB
    • ERR_OSSINIT_TAB
    • ERR_LAPIC
    • ERR_PMR
    • ERR_PRIMARY
    • ERR_SECONDARY
    • ERR_VTD_IA_EXC
    • ERR_VTD_GT_EXC
    • ERR_ACPI_TAB
    • ERR_MLE_PD_PAGE1
    • ERR_MLE_PD_PAGE2
    • ERR_MLE_PT_PAGE
    • ERR_MLE_PAGE

    This looks like SINIT can potentially dislike placement of ACPI tables, although since TXT works for UEFI on VP4670 maybe that's not the issue (EDK2 should behave similarly on both platforms unless coreboot causes variance). Also, the list above is incomplete and meaning of some of the fields isn't clear, so it's hard to say what SINIT could be checking.

  9. krystian-hebel commented on Apr 23, 2025

    @krystian-hebel
    MemberAuthor

    I did, however, try with tboot and got the same error code, so assuming tboot does everything right for the platform either DRTM doesn't work on OptiPlex with Dasharo+UEFI or it doesn't work on OptiPlex with UEFI (need a firmware test).

    I was convinced we had a positive test results for UEFI, but there are no such results in openQA, I must be imagining things. It is interesting that tboot has the same problem.

    This looks like SINIT can potentially dislike placement of ACPI tables, although since TXT works for UEFI on VP4670 maybe that's not the issue (EDK2 should behave similarly on both platforms unless coreboot causes variance).

    They have different ACMs, with different bugs and quirks, they may behave differently. On top of that, VP4670 has TPM2.0, and while it probably isn't the direct cause (there is a dedicated class for TPM errors), it may move something around in memory or in time. AMD was requiring some delay between INIT and SKINIT, maybe something similar happens here.

    I'm currently testing the same packages with legacy Optiplex, if it doesn't work there as well, we will know that it isn't caused by UEFI, but may still be caused by a different coreboot revision.

  10. SergiiDmytruk commented on Apr 23, 2025

    @SergiiDmytruk
    Member

    I'm currently testing the same packages with legacy Optiplex, if it doesn't work there as well, we will know that it isn't caused by UEFI, but may still be caused by a different coreboot revision.

    Legacy should work fine, it's only UEFI that had issues, but TXT has at least one UEFI-specific field, so that can be a factor. I would have checked against the stock UEFI firmware, but it requires flashing both flash chips and since I bricked OptiPlex twice already (once to do this test), I think it will happen again and won't be able to run the check anyway. If you have had success with stock <-> Dasharo transitions in the past, maybe you could try.

  11. krystian-hebel commented on Apr 24, 2025

    @krystian-hebel
    MemberAuthor

    There are 2 TCPA entries in ACPI, one made by edk2, the other by coreboot (http://192.168.4.32/tests/3815/logfile?filename=serial0.txt#line-191 and few lines below). In case of VP4670, there is only one TPM2 entry: http://192.168.4.32/tests/3446/logfile?filename=serial0.txt#line-364. FACS is also listed twice (although only in dom0 kernel output), but at least it points to the same address, and it is duplicated in UEFI and legacy alike, so probably irrelevant. TCPAs produced by each component is different:

    Image

    TPM memory also isn't reserved according to dom0 kernel in case of UEFI ([ 0.000000] Xen: [mem 0x00000000fed90000-0x00000000fed91fff] reserved, while it is for legacy ([ 0.000000] Xen: [mem 0x00000000fed20000-0x00000000fed91fff] reserved).

    I've found some old TXT error document (not sure where it comes from, it was laying on my disk as sinit_errors.txt) that have slightly different assignment of error codes. According to it, this error would mean DEF_TYPE MTRR not UC or fixed MTRRs not disabled, but those requirements are met.

    If you have had success with stock <-> Dasharo transitions in the past, maybe you could try.

    I hadn't tried it yet. According to https://docs.dasharo.com/variants/dell_optiplex/recovery/ it requires external flashing, and there is not enough space in the rack to try to attach second clip without accidentally disconnecting something. It also doesn't say how to obtain the backup, which is no longer part of initial deployment since it was obsoleted by DTS. Internal flashing is bound to fail, ME doesn't like having its flash region written at runtime.

  12. 21 remaining items

  13. SergiiDmytruk commented on Apr 27, 2025

    @SergiiDmytruk
    Member

    Dasharo/coreboot#657 makes DRTM work on OptiPlex with Dasharo+UEFI! Weird that it didn't affect SeaBIOS version.

    it explains why openqa tests boot-looped instead of getting stuck on error code.

    That part wasn't brought back after rebase and I wasn't really missing it (makes development harder). There is a need for some way (maybe new command) to disable slaunch, it could also zero the error and allow bringing back the old behaviour with aborting in a convenient way (one can just add that command to grub.cfg to always reset the error on boot or run it after a boot failure and do the boot again).

  14. SergiiDmytruk commented on Apr 27, 2025

    @SergiiDmytruk
    Member

    Sent TrenchBoot/xen#25 to make the code not BUG on AMI firmware.

    Didn't send change to do TXT reset on BUG because it somehow didn't work (TXT.ERRORCODE is still 0x8000000a). Seems like it should:

    diff --git a/xen/arch/x86/include/asm/bug.h b/xen/arch/x86/include/asm/bug.h
    index b7265bdfbe..f0d03e0d2f 100644
    --- a/xen/arch/x86/include/asm/bug.h
    +++ b/xen/arch/x86/include/asm/bug.h
    @@ -59,9 +59,18 @@ struct bug_frame {
     } while (0)
     
     
    +/*
    + * Declared here to avoid recursive header inclusion.
    + *
    + * Checks if slaunch is active and if so uses DRTM-specific method for reporting
    + * errors.
    + */
    +extern void slaunch_bug(void);
    +
     #define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, NULL)
     #define BUG() do {                                              \
         BUG_FRAME(BUGFRAME_bug,  __LINE__, __FILE__, 0, NULL);      \
    +    slaunch_bug();                                              \
         unreachable();                                              \
     } while (0)
     
    diff --git a/xen/arch/x86/include/asm/intel_txt.h b/xen/arch/x86/include/asm/intel_txt.h
    index 25c6ce819f..1f8d9f0acb 100644
    --- a/xen/arch/x86/include/asm/intel_txt.h
    +++ b/xen/arch/x86/include/asm/intel_txt.h
    @@ -71,6 +71,7 @@
     #define SLAUNCH_ERROR_TPM_NUMBER_ALGS        0xc0008020
     #define SLAUNCH_ERROR_TPM_UNKNOWN_DIGEST     0xc0008021
     #define SLAUNCH_ERROR_TPM_INVALID_EVENT      0xc0008022
    +#define SLAUNCH_ERROR_BUG                    0xc0008023
     
     #define SLAUNCH_BOOTLOADER_MAGIC             0x4c534254
     
    diff --git a/xen/arch/x86/slaunch.c b/xen/arch/x86/slaunch.c
    index 2fdcc00bad..71993c3a38 100644
    --- a/xen/arch/x86/slaunch.c
    +++ b/xen/arch/x86/slaunch.c
    @@ -22,6 +22,14 @@ static void __maybe_unused compile_time_checks(void)
         BUILD_BUG_ON(sizeof(slaunch_active) != 1);
     }
     
    +void slaunch_bug(void)
    +{
    +    if ( slaunch_active && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
    +    {
    +        txt_reset(SLAUNCH_ERROR_BUG);
    +    }
    +}
    +
     int __init map_l2(unsigned long paddr, unsigned long size)
     {
         unsigned long aligned_paddr = paddr & ~((1ULL << L2_PAGETABLE_SHIFT) - 1);
  15. miczyg1 commented on Apr 28, 2025

    @miczyg1

    Dasharo/coreboot#657 makes DRTM work on OptiPlex with Dasharo+UEFI! Weird that it didn't affect SeaBIOS version.

    @SergiiDmytruk so, did we get past SENTER already? That's great. Pushing the change upstream then... What about RSDP error?

    There is an possibility that we used different SINIT ACM?

  16. SergiiDmytruk commented on Apr 28, 2025

    @SergiiDmytruk
    Member

    so, did we get past SENTER already? That's great. Pushing the change upstream then...

    Yes, Xen boots and DRTM PCRs are initialized. Couldn't check the values against anti-evil-maid-dump-evt-log because xl dmesg buffer likely ran out of space and lost required SLAUNCH log line.

    What about RSDP error? There is an possibility that we used different SINIT ACM?

    That error was likely a bogus one caused by invalid coreboot config. SINIT ACM is from 2019 and Dasharo should be using this version all the time.

  17. krystian-hebel commented on Apr 28, 2025

    @krystian-hebel
    MemberAuthor

    Didn't send change to do TXT reset on BUG because it somehow didn't work (TXT.ERRORCODE is still 0x8000000a). Seems like it should:

    Isn't it BUG_FRAME() that does the reset, before slaunch_bug() has a chance to execute? But if they were reversed, the reason wouldn't be printed before the reset, which would be even worse. Let's leave it as it is, cleaning up in GRUB seems cleaner anyway, as long as it is possible to execute slaunch_state to get the error code.

  18. miczyg1 commented on Apr 28, 2025

    @miczyg1

    Didn't send change to do TXT reset on BUG because it somehow didn't work (TXT.ERRORCODE is still 0x8000000a).

    This maps to IllegalProcessorState per TXT MLE doc.

    A CPU reset occurs during AC-mode or post-SENTER and
    LT.E2STS[RESET.STS] == 0 (I.E. reset was not caused by an LT-
    shutdown).
    

    This may be related to what @krystian-hebel wrote above about BUG_FRAME reset.

  19. SergiiDmytruk commented on Apr 28, 2025

    @SergiiDmytruk
    Member

    Doesn't seem like BUG_FRAME does the reset, I thought that's why unreachable() is there. See https://github.com/TrenchBoot/xen/blob/aem-next/xen/arch/x86/include/asm/bug.h#L34-L59. Also,

    #define WARN() BUG_FRAME(BUGFRAME_warn, __LINE__, __FILE__, 0, NULL)

    and I don't think warnings reset the system. They are probably forcing an exception and its handler invokes panic() which prints that message and calls machine_restart().

  20. krystian-hebel commented on May 5, 2025

    @krystian-hebel
    MemberAuthor

    I've built coreboot from current dasharo branch, so it should contain Dasharo/coreboot#657. I've used config.dell_optiplex_9010_sff_uefi_txt and added both ACMs, as well as EC binary. For Xen, I'm using images produced by CI on aem-next branch, currently TrenchBoot/xen@ad7b572. With this setup on Optiplex I'm still getting bootloops, but the error code is cleared. It seems to take about 5 seconds before the reboot, so I'm assuming it still hits some BUG(), but I wasn't able to get the serial output from Xen yet.

    Am I missing something? According to the above discussion it should work just fine.

  21. SergiiDmytruk commented on May 5, 2025

    @SergiiDmytruk
    Member

    Sounds like it should work. I tested that PR on second OptiPlex and I think one is 7010 and another 9010, so something can be different.

  22. SergiiDmytruk commented on May 7, 2025

    @SergiiDmytruk
    Member

    Execution doesn't reach Xen and the platform likely just cold reboots from ACM most of the time. Sometimes it warm reboots and I see TXT.ERRORCODE: 0xc00020c1 like in #58 (comment) above. I thought that means your firmware wasn't built correctly, so I flashed the same image I used on the other OptiPlex but nothing has changed. I guess there is some other issue with Dasharo+UEFI.

    Since it did work with the stock firmware, the claim in TrenchBoot/TrenchBoot.github.io#51 about TrenchBoot not working for OptiPlex at all seems too strong, it's still some Dasharo-specific issue even though it gets in the way of testing at least on one of the two pieces of hardware.

  23. krystian-hebel commented on May 7, 2025

    @krystian-hebel
    MemberAuthor

    TrenchBoot not working for OptiPlex at all

    But it specifies in the notes that this applies to coreboot with edk2, in the same way it was specified for v0.3. Oh, and by the way, both platforms in the lab are 7010.

  24. SergiiDmytruk commented on May 7, 2025

    @SergiiDmytruk
    Member

    But it specifies in the notes that this applies to coreboot with edk2, in the same way it was specified for v0.3.

    It does, I must have actively ignored that part :)

    Oh, and by the way, both platforms in the lab are 7010.

    That's even weirder. DRTM definitely did work on asset 37 and it didn't seem random since I used it to verify code changes several times.

  25. krystian-hebel commented on May 7, 2025

    @krystian-hebel
    MemberAuthor

    Execution doesn't reach Xen and the platform likely just cold reboots from ACM most of the time. Sometimes it warm reboots and I see TXT.ERRORCODE: 0xc00020c1 like in #58 (comment) above.

    Yes, now I'm getting the same on the other Optiplex (asset 37), and one time it blanked the screen but didn't reboot at all. I didn't flash the firmware so it should be the one that worked previously.

    Were there any changes on GRUB side in the last week or so? I may be using older packages, hard to tell since they all have the same version in the name.

  26. SergiiDmytruk commented on May 7, 2025

    @SergiiDmytruk
    Member

    Were there any changes on GRUB side in the last week or so? I may be using older packages, hard to tell since they all have the same version in the name.

    No, there were no new changes in GRUB: TrenchBoot/grub@b551778

  27. changed the title [-]AEM doesn't work on Dell Optiplex 7010/9010[/-] [+]AEM doesn't work on Dell Optiplex 7010 in UEFI mode[/+] on May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.T: bugType: bug report. A problem or defect resulting in unintended behavior.W: in progressWorkflow: in progress. The issue is actively being worked on.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions