[PATCH v2 15/15] efi/arm64: Implement ARM64 DRTM in the stub

Jason Gunthorpe jgg at nvidia.com
Fri Oct 16 09:54:03 PDT 2026


On Fri, Oct 02, 2026 at 08:31:52PM -0300, Jason Gunthorpe wrote:
> +efi_status_t efi_drtm_prepare_launch(unsigned long image_base,
> +				     unsigned long fdt_addr)
> +{
> +	const struct arm64_image_header *header = (const void *)image_base;
> +	const struct efi_image_info *info = efi_get_image_info(image_base);
> +	struct arm64_drtm_handoff *handoff =
> +		efi_get_image_symbol(image_base, arm64_drtm_handoff);
> +	struct arm_drtm_parameters *params;
> +	unsigned long measured_offset;
> +	unsigned long measured_size;
> +	unsigned long image_size;
> +	unsigned long dlme_start;
> +	unsigned long dlme_end;
> +	unsigned long dce_end;
> +	unsigned long entry;
> +
> +	if (efi_drtm_policy == EFI_DRTM_OFF)
> +		return EFI_SUCCESS;
> +
> +	image_size = le64_to_cpu(header->image_size);

We've been able to do some testing with UKIs now and this line doesn't
work with systemd's PE loader, it discards the PE headers. The stub
already has a comment about this:

	/*
	 * When built as part of the kernel, the EFI stub cannot branch to the
	 * kernel proper via the image header, as the PE/COFF header is
	 * strictly not part of the in-memory presentation of the image, only
	 * of the file representation. So instead, we need to jump to the
	 * actual entrypoint in the .text region of the image.
	 */

I will fix this by passing the image_size through the efi_image_info
instead.

Jason



More information about the linux-riscv mailing list