STRUCT FW_RSC_CARVEOUT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct fw_rsc_carveout(9) ✨

okay bestie, welcome to the Kernel API Manual πŸ’– you're about to meet struct fw_rsc_carveout β€” the "hey host, can I please get some physically contiguous memory" request. it's giving main character energy for firmware resource tables πŸ‘‘


🌸 NAME 🌸

struct fw_rsc_carveout β€” a request for physically contiguous memory, no cap πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

struct fw_rsc_carveout {
    u32 da;
    u32 pa;
    u32 len;
    u32 flags;
    u32 reserved;
    u8 name[32];
 };

πŸ¦‹ Members πŸ¦‹

  • da β€” the device address ✨
  • pa β€” the physical address πŸ“
  • len β€” the length, and yes queen, it's in bytes πŸ“
  • flags β€” the iommu protection flags πŸ”₯
  • reserved β€” reserved… and it must be zero (don't be quirky about this one, seriously) πŸ’€
  • name β€” a human-readable name for the memory region you're requesting 🏷️

🌈 Description 🌈

so basically: this resource entry asks the host to allocate a physically contiguous memory region. that's the whole vibe 🫢

these request entries should come before other firmware resource entries, because other entries might ask to place other data objects inside these very memory regions (think data/code segments, trace resource entries, ...). order matters, iykyk ⭐

allocating memory this way helps you use the reserved physical memory (like CMA, for example) more efficiently β€” slay β€” and it also minimizes the number of TLB entries you need to map it, in case rproc is using an IOMMU. reducing TLB pressure is important, like genuinely, it can have a substantial impact on performance πŸ‘‘

if the firmware is compiled with static addresses, then da should specify the expected device address of this memory region. but if da is set to FW_RSC_ADDR_ANY, the host will dynamically allocate it, and then overwrite da with the dynamically allocated address ✨

we will always use da to negotiate the device addresses β€” even if it isn't using an iommu. in that case though, it will obviously contain physical addresses πŸ™ˆ

some remote processors need to know the allocated physical address even if they do use an iommu. this is needed, e.g., if they control hardware accelerators which access the physical memory directly (this is exactly the case with OMAP4 for instance). in that case, the host will overwrite pa with the dynamically allocated physical address πŸ“

generally we don't want to expose physical addresses if we don't have to β€” remote processors are generally _not_ trusted β€” so we might want to change this to happen _only_ when explicitly required by the hardware. so, yeah, that's a whole thing 😭

flags is used to provide IOMMU protection flags, and name should (optionally) contain a human readable name of this carveout region β€” mainly for debugging purposes πŸŽ€


πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./include/linux/rsc_table.h
  • struct resource_table(9)
  • struct fw_rsc_hdr(9)
  • enum fw_resource_type(9)
  • struct fw_rsc_devmem(9)
  • struct fw_rsc_trace(9)
  • struct fw_rsc_vdev_vring(9)
  • struct fw_rsc_vdev(9)
  • rsc_table_for_each_entry(9)

that's the whole page bestie, you ate that πŸ’…βœ¨ this one lives in ./include/linux, from the October 2026 edition of the Kernel API Manual β€” go forth and carve out some memory, periodt πŸŒŸπŸ’–

πŸ“¦ where this page comes from