Attach-detach Feature in the remoteproc Subsystem - Attach-detach Feature in the remoteproc Subsystem - 2026.1 English - UG1186

Libmetal and OpenAMP User Guide (UG1186)

Document ID
UG1186
Release Date
2026-06-24
Version
2026.1 English

Introduction

  • There is a use case where RPU is already running firmware before the Linux kernel boot. In this case, Linux cannot load firmware in the RPU. Instead, Linux connects to the running firmware through a special operation in the remoteproc framework called attach. Implementation of attach and detach is platform-specific.
  • To perform the attach operation, the remoteproc driver needs to retrieve the resource table runtime from the firmware. This RPU firmware requires a special metadata that holds the resource table address and size.
  • This resource table metadata structure is pre-defined and the RPU firmware is expected to provide a specific location. This specific location is the start address of the first element of the memory-regions property list in the Linux remoteproc device-tree node.

Resource Table Metadata Structure

The firmware is expected to provide the resource table metadata through the following data structure:

struct remote_resource_table_metadata {
    const int version;  /* version of this data structure */
    const u32 magic_num;  /* 32-bit magic number constant to 78616d70 i.e. 'xamp' characters */
    const u32 comp_magic_num; /* complement of magic number */
    const u32 rsc_tbl_size;  /* size of resource table */
    const uintptr_t rsc_tbl; /* address of resource table */
}__attribute__((packed));

The version of this structure is 1, and it maps to the order of the structure fields. The magic_num field has the constant value 78616d70. Right after it, expect the constant ~(magic_num) to be 879e928f.

Linux Driver Parsing

  • During boot, the Linux driver looks for the magic number and the ~(magic number) at the pre-defined memory location. If found, it's assumed that the RPU firmware is loaded.
  • In this case, the attach operation executes and if the resource table was parsed successfully and if RPU node is in the running state then, the remoteproc state is moved from OFFLINE to ATTACHED.
  • CAUTION:
    Starting with the 2026.1 release, the Linux kernel calls the platform management firmware to check whether the remote processor is running. The attach call succeeds only if the remote processor is running. If you use a Linux kernel from 2026.1 or later, you must also update the platform management firmware to 2026.1 or later.

After RPMsg communication finishes, you can either stop the remote processor or detach from the remote processor. If you stop it, the RPU powers down and Linux reloads the firmware and restarts the RPU. If you detach, Linux tells the RPU that RPMsg communication is finished. You can attach again later because the RPU firmware keeps running.