Skip to content

Drtm payload 25.12#926

Open
hanetzer wants to merge 21 commits into
Dasharo:dasharo-25.12from
hanetzer:drtm_payload-25.12
Open

Drtm payload 25.12#926
hanetzer wants to merge 21 commits into
Dasharo:dasharo-25.12from
hanetzer:drtm_payload-25.12

Conversation

@hanetzer

Copy link
Copy Markdown
Contributor

Replacement of #916, can't change my branch, just the target. Hoping to avoid losing the comments there. Sorry for the noise.

miczyg1 and others added 21 commits June 18, 2026 16:25
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…r IOMMU

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Move the GNB IOAPIC enabling to northbridge init where the IOAPIC is
initialized.

Remove the comment about IoapicSbFeatureEn, this bit is not touched
here.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
… register

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Introduce PCI_DEVID macro which allows to construct PCI device
addresses or range with bus numbers.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
…e area

Use the IORESOURCE_SOFT_RESERVE attribute to reserve CC6 save state DRAM.
Using regualr reserved memory makes it hard on EDK2 to detect if it is MMIO
or reserved DRAM, as TOM2 is equal to the base of the CC6 save state area,
not its limit.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Per family 16h models 30h-3fh BKDG the IoapicSbFeatureEn must be
configured according to the interrupt routing mode selecte by OS.
If OS chose APIC mode, the IoapicSbFeatureEn must be cleared.
Otherwise, it must be set, meaning PIC mode is used.

Add a hook to _PIC method to call SoC/northbridge specific code to
set/clear the bit to configure GNB IOAPIC properly.

ACPI specification says that _PIC method is optional and can be
called by OSPM to provide the interrupt routing mode information to
the firmware. However, if the method is not called, the firmware
must assume PIC mode is used. AGESA sets the IoapicSbFeatureEn
already to be compliant with ACPI. Previously, coreboot cleared the
bit unconditionally and left a comment to move that part to DSDT.
The hook allows to clear the IoapicSbFeatureEn bit if OS chooses APIC
mode for interrupt routing.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Needed early in build to use sklt.h header

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Modeled after BL31's code from arm64

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
@hanetzer hanetzer force-pushed the drtm_payload-25.12 branch from 8abdcd7 to a2678b4 Compare June 19, 2026 20:55

@SergiiDmytruk SergiiDmytruk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes in more detail.

Comment thread src/acpi/dsdt_top.asl
#endif

External (\_SB.NAPE, MethodObj)
External (\_SB.PCI0.NAPE, MethodObj)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't simply rename this, the change is in upstream and will break AMD Turin (see soc/amd/turin_poc/acpi/ioapic_routing.asl).

Getting rid of PCI0 will affect other methods, so maybe permit both names and pick one via CondRefOf.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled it from apu2_fix_iommu and rebased it as-is, in fact everything before the drtm stuff is from that branch. if its not needed at all I could just drop those commits.

Comment thread src/acpi/dsdt_top.asl
If (CondRefOf (\_SB.PCI0.NAPE))
{
\_SB.NAPE()
\_SB.PCI0.NAPE(Arg0 & 1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For compatibility, the parameter should be dropped in favour of using PICM.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

#define CAP_OFFSET_10_MSI_NUM_PPR_SHIFT 27
#define CAP_OFFSET_10_MSI_NUM_PPR (0x1f << CAP_OFFSET_10_MSI_NUM_PPR_SHIFT)

#define PCI_DEVID(BUS, DEV, FN) ( \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/include/device/pci_def.h seems like a better place for this macro, that's where PCI_DEVFN is defined.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly unsure if I even need the stuff before the drtm commits at this point. I should give that a test, try to focus effort in one area.

Comment on lines +59 to +61
slrt->magic = 0x4452544d;
slrt->revision = 0x1;
slrt->architecture = 0x2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah definitely, was mostly just 'banging it out' to get it to actually start talking to me.

Comment on lines +62 to +63
slrt->size = 16;
slrt->max_size = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slrt->size is sizeof(*slrt) and slrt->max_size should be 64*KiB - bootloader_data_offset (64*KiB - (skl - (void *)slrt) above is a more complicated way of computing the same).

*/
_Static_assert(sizeof(skl) == 4);

hexdump(prog, sizeof(*prog));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see a need to keep this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the assert or the hexdump?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hexdump() invocation. The lines above it are shown by GitHub as a context.

Comment on lines +50 to +52
skl = memalign(64*KiB, 64*KiB);

cbfs_load(CONFIG_CBFS_PREFIX "/drtm_payload", skl, 64*KiB);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both functions can fail. This function should die() in such cases, because simply returning will apparently result in repeated invocation with possibly weird side-effects.

Comment thread .gitmodules
Comment on lines +88 to +90
[submodule "3rdparty/secure-kernel-loader"]
path = 3rdparty/secure-kernel-loader
url = https://github.com/hanetzer/trenchboot-secure-kernel-loader

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need to have SKL as a submodule, I think it's worth avoiding adding one. Adding submodules results in them being checked out for no use and also require setting up a mirror in upstream coreboot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I can probably drop this and some related bits, this was when I was trying for explicitly using slrt.h from skl itself; when its done via payloads/external it doesn't exist early enough for compiling the ramstage.

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.

4 participants