This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM62A3:有关 A53 内核的 DDR 区域的防火墙配置帮助、未使用 M4 MCU

Guru**** 2905440 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1647362/am62a3-help-on-firewall-configuration-for-ddr-region-from-a53-core-m4-mcu-is-not-being-used

器件型号: AM62A3

大家好、我是 GE Vernova 的 Siva、我们在控制平台上使用 TI 器件 AM6231。 我们不使用 M4 MCU、而是使用此处的 A53。  

我使用 QNX 构建环境中的 sciclient 库、它是从 Linux 环境构建并用作 QNX 工程的参考库。 我们的目的是使用 API 调用 Sciclient_firewallSetRegion() 和 Sciclient_firewallGetRegion() 调用从 A53 应用程序添加防火墙配置。

考虑具有权限的 DDR 存储器中的存储器区域(仅 R)、并尝试写入相同的存储器、预期写入失败(通过回读存储器保持一致)。 这正是我们的目标、它不起作用、需要了解正确的行为方式、并引导我查看一些与我的应用程序/测试用例接近的示例。

测试的观察结果/注意事项:  

1) 我开始使用 Sciclient_init (&config)

2) 后来,我无法成功执行 Sciclient_firewallSetRegion () 调用,因此我在本地初始化了更改目标和设置区域相关的请求和 res,并执行 Sciclient_service()

3) 我使用 Host_ID 作为 10、认为防火墙的所有者为 A53、因为应用程序位于 A53 内核上。

4) 防火墙 ID 为 1、符合 TRM SPRUIV7C 表 3.8.3.1(因为目标存储器来自 DDR)DDR16SS0 和测试 0x88000000 到 0x88003FFF 的相关存储器。  

5) priv-id 为 1、基于 https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/am62x/firewalls.html 

6) 控制寄存器作为 0xA(仅启用)

7) 权限数量 1 和权限寄存器 0x12000(特权 ID 为 1,非安全,用户,只读)

使用该配置后、我正在尝试执行对 0x88000000 的写入操作并确认该操作成功、预计该操作会失败、而不会将值更新到存储器位置。

请原谅我

1) 我的测试注意事项是否正确(从 A53 执行应用程序、目标存储器为 DDR)

2) 使用过的调用是否适当

3) 所使用的控制和权限配置参数是否合适。

4) 请与最接近的示例代码分享。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Siva:

    我们正在对此进行检查。

    会尽快提供反馈。

    此致、
    Vaibhav

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    以下代码快照将整个 DDR 地址空间配置为从任何启动器进行读取访问(但不进行写入)。 您可以根据需要修改地址空间。

    uint16_t fwl_id            = 1;
    uint16_t region            = 1;
    /*
     * Firewall control register layout
     * +----------+------------+------------+----------+------+--------+
     * |  31:10   |    9:9     |    8:8     |   7:5    | 4:4  |  3:0   |
     * +----------+------------+------------+----------+------+--------+
     * | RESERVED | CACHE_MODE | BACKGROUND | RESERVED | LOCK | ENABLE |
     * +----------+------------+------------+----------+------+--------+
     * 
     * CACHE_MODE : Cache mode for region. Set to 1 to check cache permissions.
     *              Set to 0 to ignore cache permissions.
     * BACKGROUND : Background enable for region. There can be 1 backgroun region per
     *              FW and foreground regions can have overlapping addresses only
     *              with the background region.
     * LOCK       : Lock region. Once set region values cannot be modified.
     * ENABLE     : Enable region. A value of 0xA enables, others disable.
     */
    uint32_t control           = 0xA;
    uint32_t n_permission_regs = 3;
    /*
     * Firewall region permission register layout
     * +----------+---------+------------------+------------------+---------------+---------------+
     * |  31:24   |  23:16  |      15:12       |       11:8       |      7:4      |      3:0      |
     * +----------+---------+------------------+------------------+---------------+---------------+
     * | RESERVED | PRIV_ID | NONSEC_USER_DCRW | NONSEC_SUPV_DCRW | SEC_USER_DCRW | SEC_SUPV_DCRW |
     * +----------+---------+------------------+------------------+---------------+---------------+
     *
     * PRIV_ID     : Privilege Id
     *               software-dl.ti.com/.../firewalls.html
     * NONSEC_USER : Non-secure User
     * NONSEC_SUPV : Non-secure Supervisor
     * SEC_USER    : Secure User
     * SEC_SUPV    : Secure Supervisor
     * DCRW        : Debug, Cache, Read, Write
     */
    uint32_t permissions[] = { 0xC32222, 0xC32222, 0xC32222 };
    uint32_t start_address = 0x80000000;
    uint32_t end_address   = 0xFFFFFFFF;
    
    /* Request & Response structures for TISCI_MSG_SET_FWL_REGION */
    struct tisci_msg_fwl_set_firewall_region_req tisci_msg_req   = {0};
    struct tisci_msg_fwl_set_firewall_region_resp tisci_msg_resp = {0};
    
    /* Fill the request structure fields */
    tisci_msg_req.fwl_id            = fwl_id;
    tisci_msg_req.region            = region;
    tisci_msg_req.control           = control;
    tisci_msg_req.n_permission_regs = n_permission_regs;
    tisci_msg_req.permissions[0]    = permissions[0];
    tisci_msg_req.permissions[1]    = permissions[1];
    tisci_msg_req.permissions[2]    = permissions[2];
    tisci_msg_req.start_address     = start_address;
    tisci_msg_req.end_address       = end_address;
    
    int32_t status = Sciclient_firewallSetRegion(&tisci_msg_req, &tisci_msg_resp, SystemP_WAIT_FOREVER);
    
    if(status == SystemP_SUCCESS) {
        DebugP_log("Firewall permissions set successfully\r\n");
        /* Response structure is empty for TISCI_MSG_SET_FWL_REGION */
    } else {
        DebugP_logError("TISCI_MSG_SET_FWL_REGION request failed!!!\r\n");
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Prashanth:

    感谢您分享示例代码。

    我在工作系统(具有引导加载/QnxOS/某些 应用程序)上运行了应用程序(此示例代码的独立进程)。

    当我使用权限 0xC32222(对每个人只读)运行时...观察到重新引导时、可能是预期的、因为我的系统逻辑肯定正在使用该 DDR 范围并破坏了防火墙规则。

    当我使用权限 0xC33333 运行应用程序时(对于每个人读/写)、可以看到“...set successfuly“消息、系统继续工作。 (无崩溃)。 这是预期的、没有违反防火墙规则。

    当我尝试对内存子集使用相同的读取/写入权限(0xC33333(适用于每个人读/写)) 时、东西无法按预期运行(预计以 R/W 权限成功运行)。 系统崩溃/重新启动似乎触发了防火墙。  

    // uint32_t start_address = 0x88000000;
    // uint32_t END_ADDRESS = 0x88003FFF;

    对最小字节数(地址范围)是否有任何限制。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    当我尝试对子内存集使用相同的读/写权限(0xC33333(适用于每个人读/写)) 时、东西无法按预期工作(预期使用 R/W 权限成功运行)。 系统崩溃/重新启动似乎已触发防火墙。

    这是因为、如果启用了任何防火墙区域、则与任何已启用区域不匹配的事务将被拒绝。 由于使用 DDR 地址空间的子集配置单个区域、因此配置的子集之外的地址的事务将被拒绝。

    这就是您需要遵循的设计

    -配置一个后台区域,启用对整个 DDR 地址空间所需的访问(至少 R/W )。

    uint16_t fwl_id            = 1;
    uint16_t region            = 0;
    /*
     * Firewall control register layout
     * +----------+------------+------------+----------+------+--------+
     * |  31:10   |    9:9     |    8:8     |   7:5    | 4:4  |  3:0   |
     * +----------+------------+------------+----------+------+--------+
     * | RESERVED | CACHE_MODE | BACKGROUND | RESERVED | LOCK | ENABLE |
     * +----------+------------+------------+----------+------+--------+
     * 
     * CACHE_MODE : Cache mode for region. Set to 1 to check cache permissions.
     *              Set to 0 to ignore cache permissions.
     * BACKGROUND : Background enable for region. There can be 1 backgroun region per
     *              FW and foreground regions can have overlapping addresses only
     *              with the background region.
     * LOCK       : Lock region. Once set region values cannot be modified.
     * ENABLE     : Enable region. A value of 0xA enables, others disable.
     */
    uint32_t control           = 0x30A;
    uint32_t n_permission_regs = 3;
    /*
     * Firewall region permission register layout
     * +----------+---------+------------------+------------------+---------------+---------------+
     * |  31:24   |  23:16  |      15:12       |       11:8       |      7:4      |      3:0      |
     * +----------+---------+------------------+------------------+---------------+---------------+
     * | RESERVED | PRIV_ID | NONSEC_USER_DCRW | NONSEC_SUPV_DCRW | SEC_USER_DCRW | SEC_SUPV_DCRW |
     * +----------+---------+------------------+------------------+---------------+---------------+
     *
     * PRIV_ID     : Privilege Id
     *               software-dl.ti.com/.../firewalls.html
     * NONSEC_USER : Non-secure User
     * NONSEC_SUPV : Non-secure Supervisor
     * SEC_USER    : Secure User
     * SEC_SUPV    : Secure Supervisor
     * DCRW        : Debug, Cache, Read, Write
     */
    uint32_t permissions[] = { 0xC3FFFF, 0xC3FFFF, 0xC3FFFF };
    uint32_t start_address = 0x80000000;
    uint32_t end_address   = 0xFFFFFFFF;
    
    /* Request & Response structures for TISCI_MSG_SET_FWL_REGION */
    struct tisci_msg_fwl_set_firewall_region_req tisci_msg_req   = {0};
    struct tisci_msg_fwl_set_firewall_region_resp tisci_msg_resp = {0};
    
    /* Fill the request structure fields */
    tisci_msg_req.fwl_id            = fwl_id;
    tisci_msg_req.region            = region;
    tisci_msg_req.control           = control;
    tisci_msg_req.n_permission_regs = n_permission_regs;
    tisci_msg_req.permissions[0]    = permissions[0];
    tisci_msg_req.permissions[1]    = permissions[1];
    tisci_msg_req.permissions[2]    = permissions[2];
    tisci_msg_req.start_address     = start_address;
    tisci_msg_req.end_address       = end_address;
    
    int32_t status = Sciclient_firewallSetRegion(&tisci_msg_req, &tisci_msg_resp, SystemP_WAIT_FOREVER);
    
    if(status == SystemP_SUCCESS) {
        DebugP_log("Firewall permissions set successfully\r\n");
        /* Response structure is empty for TISCI_MSG_SET_FWL_REGION */
    } else {
        DebugP_logError("TISCI_MSG_SET_FWL_REGION request failed!!!\r\n");
    }

    -为 DDR 地址空间的不同子集配置所需的前台区域

    uint16_t fwl_id            = 1;
    uint16_t region            = 1;
    /*
     * Firewall control register layout
     * +----------+------------+------------+----------+------+--------+
     * |  31:10   |    9:9     |    8:8     |   7:5    | 4:4  |  3:0   |
     * +----------+------------+------------+----------+------+--------+
     * | RESERVED | CACHE_MODE | BACKGROUND | RESERVED | LOCK | ENABLE |
     * +----------+------------+------------+----------+------+--------+
     * 
     * CACHE_MODE : Cache mode for region. Set to 1 to check cache permissions.
     *              Set to 0 to ignore cache permissions.
     * BACKGROUND : Background enable for region. There can be 1 backgroun region per
     *              FW and foreground regions can have overlapping addresses only
     *              with the background region.
     * LOCK       : Lock region. Once set region values cannot be modified.
     * ENABLE     : Enable region. A value of 0xA enables, others disable.
     */
    uint32_t control           = 0xA;
    uint32_t n_permission_regs = 3;
    /*
     * Firewall region permission register layout
     * +----------+---------+------------------+------------------+---------------+---------------+
     * |  31:24   |  23:16  |      15:12       |       11:8       |      7:4      |      3:0      |
     * +----------+---------+------------------+------------------+---------------+---------------+
     * | RESERVED | PRIV_ID | NONSEC_USER_DCRW | NONSEC_SUPV_DCRW | SEC_USER_DCRW | SEC_SUPV_DCRW |
     * +----------+---------+------------------+------------------+---------------+---------------+
     *
     * PRIV_ID     : Privilege Id
     *               software-dl.ti.com/.../firewalls.html
     * NONSEC_USER : Non-secure User
     * NONSEC_SUPV : Non-secure Supervisor
     * SEC_USER    : Secure User
     * SEC_SUPV    : Secure Supervisor
     * DCRW        : Debug, Cache, Read, Write
     */
    uint32_t permissions[] = { 0xC32222, 0xC32222, 0xC32222 };
    uint32_t start_address = 0x80000000;
    uint32_t end_address   = 0x80003FFF;
    
    /* Request & Response structures for TISCI_MSG_SET_FWL_REGION */
    struct tisci_msg_fwl_set_firewall_region_req tisci_msg_req   = {0};
    struct tisci_msg_fwl_set_firewall_region_resp tisci_msg_resp = {0};
    
    /* Fill the request structure fields */
    tisci_msg_req.fwl_id            = fwl_id;
    tisci_msg_req.region            = region;
    tisci_msg_req.control           = control;
    tisci_msg_req.n_permission_regs = n_permission_regs;
    tisci_msg_req.permissions[0]    = permissions[0];
    tisci_msg_req.permissions[1]    = permissions[1];
    tisci_msg_req.permissions[2]    = permissions[2];
    tisci_msg_req.start_address     = start_address;
    tisci_msg_req.end_address       = end_address;
    
    int32_t status = Sciclient_firewallSetRegion(&tisci_msg_req, &tisci_msg_resp, SystemP_WAIT_FOREVER);
    
    if(status == SystemP_SUCCESS) {
        DebugP_log("Firewall permissions set successfully\r\n");
        /* Response structure is empty for TISCI_MSG_SET_FWL_REGION */
    } else {
        DebugP_logError("TISCI_MSG_SET_FWL_REGION request failed!!!\r\n");
    }