Skip to content

[BUG] 'struct ipc4_fw_registers' size and offsets varies by platform #5677

@plbossart

Description

@plbossart

Describe the bug
To read peak value and LLP information, we need to import the fw_reg.h definitions in the kernel to figure out where to read the information in SRAM windows.
However the definitions are compilation and platform dependent, so the kernel would need to do some math and have information on cores/DMA channels. That's really a poorly defined ABI!

See src/include/ipc4/fw_reg.h

struct ipc4_fw_registers {
	struct ipc4_fw_status_reg fsr;
	ipc4_last_error lec;
	struct ipc4_fw_pwr_status fps;
	uint32_t mem_status;
	uint32_t ltr;
	uint32_t rsvd0;
	union ipc4_rom_info rom_info;
	uint32_t rsvd1[5];
	uint32_t dbg_log_wp[CONFIG_MAX_CORE_COUNT]; << !!
	uint32_t rsvd2[4 - CONFIG_MAX_CORE_COUNT];

	struct ipc4_pipeline_registers pipeline_regs[PLATFORM_MAX_DMA_CHAN];          << !!
	struct ipc4_peak_volume_regs peak_vol_regs[10];                                                      << !!
	struct ipc4_llp_reading_slot llp_gpdma_reading_slots[MAX_GPDMA_COUNT * 8];    << !!
	struct ipc4_llp_reading_slot llp_sndw_reading_slots[MAX_GPDMA_COUNT * 8];       << !!
	uint32_t memory_window_2_slot_desc[IPC4_MAX_SUPPORTED_LIBRARIES];
} __attribute__((packed, aligned(4)));

The MAX_CORE_COUNT is firmware dependent.
PLATFORM_MAX_DMA_CHAN is also not-constant

src/platform/apollolake/include/platform/lib/dma.h:#define PLATFORM_MAX_DMA_CHAN        8
src/platform/cannonlake/include/platform/lib/dma.h:#define PLATFORM_MAX_DMA_CHAN        9
src/platform/tigerlake/include/platform/lib/dma.h:#define PLATFORM_MAX_DMA_CHAN 9

It's unclear why we have peak_vol_regs[10];
MAX_GPDMA_COUNT is not known to the kernel

This needs to be improved so that we have a clear and unique way of retrieving the information with a well-defined ABI.

@lgirdwood @RanderWang @mmaka1 @lbetlej @ranj063 FYI.

Metadata

Metadata

Assignees

Labels

IPC4Issues observed with IPC4 (same IPC as Windows)P1Blocker bugs or important featuresbugSomething isn't working as expectedenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions