FSL-MC / DPAA2 对象总线

FSL-MC / DPAA2 对象总线

1. 定位

NXP DPAA2硬件由Management Complex(MC)固件管理。Linux不直接扫描固定MMIO外设,而是通过MC command portal发现DPRC container中的对象并创建fsl-mc设备。

1
2
3
4
5
Linux fsl-mc bus
-> MC portal command
-> Management Complex firmware
-> DPRC object container
-> DPNI/DPBP/DPCON/DPMCP等对象

2. Kconfig

FSL_MC_BUS依赖OF及Layerscape平台,select generic MSI IRQ domain。FSL_MC_UAPI_SUPPORT可额外允许用户空间通过MC portal发命令。

RK3588不满足Layerscape平台依赖,默认不会构建。

3. Bus注册

fsl_mc_bus_driver_init()

  1. 注册fsl-mc bus type;
  2. 初始化resource pools;
  3. 注册root MC platform driver;
  4. 注册platform bus notifier处理相关设备;
  5. 建立MSI domain支持。

Root probe映射MC portal,查询DPRC属性并扫描对象。

4. 对象模型

  • fsl_mc_bus:一个DPRC container;
  • fsl_mc_device:MC object;
  • fsl_mc_driver:按vendor/object type匹配;
  • fsl_mc_io:一个command portal;
  • resource pool:DPMCP、DPBP、DPCON等可分配对象;
  • MSI descriptor:对象中断。

对象ID由MC固件分配,不等同于DT unit address。

5. Command Portal

mc_send_command()通过portal MMIO发送固定command:

1
2
3
4
5
encode header/token/command ID
-> write params
-> write command header
-> poll completion
-> decode status/response

Portal访问必须序列化;命令有超时,固件错误需转换为Linux errno。不能在atomic上下文执行可能长时间轮询的MC命令。

6. DPRC扫描

dprc-driver.c查询container内对象列表:

1
2
3
4
5
get object count
-> get object descriptor
-> compare existing children
-> add new fsl_mc_device
-> remove vanished object

这支持运行时对象创建/销毁。Rescan与driver probe/remove必须避免并发引用已删除对象。

7. 资源分配

fsl-mc-allocator.c维护按type分类的resource pool。Function driver请求DPMCP/DPBP/DPCON时从pool取得对象并在remove时归还。

资源对象本身也是MC device,生命周期和所有权不能只用裸ID管理。

8. MSI

fsl-mc-msi.c为MC objects建立MSI domain,把固件描述的IRQ index映射到Linux virq。配置包括:

  • 分配MSI descriptors;
  • 写对象IRQ地址/data;
  • mask/unmask和affinity;
  • remove时释放domain资源。

9. UAPI

启用FSL_MC_UAPI_SUPPORT后,字符接口允许用户态向portal提交MC command。它扩大了固件控制面:

  • 权限必须严格限制;
  • command buffer需验证;
  • 不应让普通应用任意创建/销毁网络加速对象;
  • 容器隔离不自动等于硬件对象隔离。

10. 错误恢复

MC固件异常可能导致所有对象命令超时。恢复通常不是单一child reset,而是portal/DPRC甚至MC firmware级重建。Driver remove顺序必须先停止DPAA2网络/加速功能,再删除对象和portal。

11. RK3588结论

本模块仅作为目录完整性分析。RK3588没有FSL Management Complex、DPRC DT节点或相关defconfig,不参与该平台启动。

文章互动

阅读 --

留言

0 条留言

正在加载留言…