From patchwork Thu Aug 3 02:58:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13339192 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DEB07460 for ; Thu, 3 Aug 2023 02:58:49 +0000 (UTC) Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2171.outbound.protection.outlook.com [40.92.63.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126EE10A for ; Wed, 2 Aug 2023 19:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F20/KWC06ddCgj3hfiBUr3XLR2MJJClyCEj4fl4ro0pQqmy5Td8XQBTPGfAavPjmgD8J1vXUc7gQzXS+QHgHj/5Pcxb+tSp2MwEH4YTqmrH4hyg9FC7d9xb7vQQJJpZmuIrP+l8NxUPnrAtz9BMnYJuvbh+uwxKTC2XsRKzauzK5x+1PcBS2ZLoE65wzXPZHyS5gmu+6ghI8e3Ik6IKd28Brg5mz1qMYlM69Qb5g4k0TS8LI5kDdBwGXzZle/Wd1amFJfopiJGqmajt8l0V6TjrUIdWWHtFTxeU8+9jiVnTYNwMze0gT/OzIrzym5G5lNpiZNiKAZeYxnP1As02sgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OrapQZ9Ih4OGdoFEKKqr/woU2Sun4sNecZ7ducLsbWk=; b=ZWIOWc87Eaa7JGNWM/h/+6o4XHwwLojtyefKQjp9d+uaSVdt6gOIdmtnse3hFPDQhDsOgGXrcu8q27/63EGuaZHG3cuHg0WPlQQm99/xuURIG9ZONv0doRN1vgRQ5z0pjL6IJqG9BJmjr2N/yFo6R3CUOHj6qkYf6WVxY/V7JPZm+sqLBajyz1DvsN1lXBpM0Le6I6KljCoCJoCTNAm0NSqfP8tFuOFSnUIyDYEiYvOQ4Y3srditg1fneIxcNW6aFEUSHgRylkakqW9fd4EKoEvQWPZHmRKSdw8USASRwNOF74sP4tlykjZarXCLdy2OWx6t5dM2p7doRiHlnDemuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OrapQZ9Ih4OGdoFEKKqr/woU2Sun4sNecZ7ducLsbWk=; b=M9erqaiMs139moUXrkkk/zbgWMp58K0Tk5FfqIZ1hkH8cbEcaqU1hsokpwwngg9f2b703wfhwQsH0clAzhSRo7ceokMiI2hpU1le7R7PubU3KskFaI562XhtAnEdYkVMmBfnhvEPp8vK25lMAxru7kqKSC+411hlTpusqqjgeuAtEwOlS7FFEAaylVqUBw9tqpwJEtETpxmUq9Hrljr1Sk8iigDqvrTUXgnL1BYJIbrLg792YIxyuBXiVQnwrra9vVD3nVo7klmCscnF9BVYgdsnH3LyYgXLCliGWjkMkmxUMe05Gbmw7FPtv9m0r8vUCpVfaiot3j0McvADT0AjBA== Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) by SYBP282MB2963.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:156::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Thu, 3 Aug 2023 02:58:40 +0000 Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14]) by MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14%3]) with mapi id 15.20.6652.020; Thu, 3 Aug 2023 02:58:40 +0000 From: Jinjian Song To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, ilpo.jarvinen@linux.intel.com, ricardo.martinez@linux.intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, edumazet@google.com, pabeni@redhat.com, chandrashekar.devegowda@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com, linuxwwan_5g@intel.com, soumya.prakash.mishra@intel.com, jesse.brandeburg@intel.com, danielwinkler@google.com, Jinjian Song Subject: [net-next 4/6] net: wwan: t7xx: Creates region & snapshot for coredump log collection Date: Thu, 3 Aug 2023 10:58:00 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803025802.3534-1-songjinjian@hotmail.com> References: <20230803025802.3534-1-songjinjian@hotmail.com> X-TMN: [AX8AcyoJe/JAHiSPOGe+wuvxT8ox+uT9] X-ClientProxiedBy: TYAPR01CA0011.jpnprd01.prod.outlook.com (2603:1096:404::23) To MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) X-Microsoft-Original-Message-ID: <20230803025802.3534-2-songjinjian@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MEYP282MB2697:EE_|SYBP282MB2963:EE_ X-MS-Office365-Filtering-Correlation-Id: 67ed30d7-d5d7-4b80-f33d-08db93cd8a0b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O4/JEu/3c/MsH3rfesdYYogS7EVtau1z87ZwHavXG3pIpGiZUzB1cDkgGz4KlxYRBSUXCDYO2NBgN8TRoYfPlkafSNiLilu2HC0CVjlYdlmGVxy6FVigH+XkBTudNYJmpFzG1f4W7h7CAlRVuDzw+9tC1V5WnKNE0O5yUmiq4nki+vYCaU5s5Y/YrkW6N7L1Trsd06CwbDkGiQsPEMUhOPSY/hxRaFDXV0yf5vLT6LAX5CRMJqEjFSCPLILyOYreAIq5Zw3Ba98qoeHdCpn+H/olgaqHcm9dyLKvTRipK5RJ/cclgR789qZlawleeoy1J/k1C5RH4ytH5Pahgeayu0gocNGK0ldpd6J9yqzzMjaVqsF7i+IWZ0Ojmqv7peGq5ML4QaZOnHLJ7u4Kj+LBpu/0RGRQATVxdo0U+XLuDds81ci1iuUXC3kw/Q9Y/+oQqkvWdj3GgLo7zR0EG0DjlggJM0qo2Bz7Y5autjSLIvAvusTFfmJZhPhrYZAgnLkWwYXIYtJnMg7b4+FIy5Ji8Qvd0phNJ/ZDpKqdMZPukqA= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sv1QHPMZwCaIJQvKHvZbUlCbPGBgKOUsFKrOYrvdguHKjIB2GUWHO02315NqWw85Fh12njSi4ZuDPpOnY5mzXg6z8bYL7JqmAD/qdDo1VFLC9qtRaRnKdjawq2er93kripwDakvRZAv0gB801jOtqOnIxZy55gEB6sUIvCoZVrIK/INI3GsCxICXwwPNkVtpPhrYpTsYvRZIlqK+AJzPkJxVnVX7KkVTzTA+LK2neR5X1qgVLQowmzyzBLZVM+zlWxpkrfAlNt7C1ipURIJbEA0t0f+g6iZ3yJik8y7TqzHphNzIRQMXG8FftywKFnFKmqjtOkLiOqEyM9T4606TAal6N4Gadz9r5yzU9ZMGWTpOfJ1DtGs6moXduniYt1qkGlgx/WykdlY5dhLWhtnDUuT6E2hbZX17CJj0H6r1qOH5GvtIVFAuAJBFASFeMl+av9KRiSkYstOUqHKWCakUHhhlTZXwrHiQCaNgN39yJkllQysFNsIq7O9sncyHTJGRNY0QFMAdwSOHr/1YZAMszaTzwryzNBs7D4Nj/GhOpXBxXAoC9igvKqXXKI2SQ+UO8ZsnCARGhjzBhFTOPjhr0qt67A8eSf4q8xKao0n19Hfw4+TtyixPQQDNXFdhMhekG2yO7ph17TNRbvv6yLgJXEZ/XCzGeCV9SNykBFaZ1SGpBLR8D1RWA7F/AJVbZU9POxy8C6FB3a4H7k6RXuJc8FnaU7BVvDy40GbFUDE2XR7/SOiQ0NnHP87Ih+yVYha8BkTh6cyjZBnkbUzBnoAgWH47IqzwtYUcowYKxeCNZK2i3MVrh6iIZooQqA9f3vS6z2U/VpN8zHNkhyc5O0y8JGpdwLf/i/xfvJt49HVCG2MG+ih/n/Q5WyubkNGUB73vJf9P10Vunm3NVdxZiBUgJQAbUt26ZjtN0+RgDL5pYisoaegDNJMm1Rt8dGvG2M0IzSrh/Y5buRWX6o03o85C6puMI2NS5oAsWj2ZN7hSy7q8UKK7864dNExbZZxWHIv8iogiTQrxg6dHdCK0jiKfeo0AQhJLcNcDMKO9qDtxB8w3VIKj9mibhgra66XmHCEfUuKKHGAPPrMVkbHRVCrxdow5GSrqKsJXDNKKFijZjuID6f+CBd7sRgMK14q1euLPyDWVyQCd4q7dKncAqBUQakq5dNHEUsfFLeZyqn+EoBc6+vjMpXr3TT3id6Ck6ebxWyGk0YPLMLDcUAtv7CblRmSfm1I09AtS5QPRVhkW+cA= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 67ed30d7-d5d7-4b80-f33d-08db93cd8a0b X-MS-Exchange-CrossTenant-AuthSource: MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 02:58:40.1123 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SYBP282MB2963 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Jinjian Song Adds support for t7xx wwan device coredump collection using devlink. In case of coredump collection when wwan device encounters an exception it reboots & stays in fastboot mode for coredump collection by host driver. On detecting exception state driver collects the core dump, creates the devlink region & reports an event to user space application for dump collection. The user space application invokes devlink region read command for dump collection. Below are the devlink commands used for coredump collection. devlink region new pci/$BDF/mr_dump devlink region read pci/$BDF/mr_dump snapshot $ID address $ADD length $LEN devlink region del pci/$BDF/mr_dump snapshot $ID Base on the v5 patch version of follown series: 'net: wwan: t7xx: fw flashing & coredump support' (https://patchwork.kernel.org/project/netdevbpf/patch/fc8bbb0b66a5ff3a489ea9857d79b374508090ef.1674307425.git.m.chetan.kumar@linux.intel.com/) Signed-off-by: Jinjian Song --- drivers/net/wwan/t7xx/t7xx_port_devlink.c | 243 +++++++++++++++++++++ drivers/net/wwan/t7xx/t7xx_port_devlink.h | 41 +++- drivers/net/wwan/t7xx/t7xx_state_monitor.c | 2 + 3 files changed, 285 insertions(+), 1 deletion(-) diff --git a/drivers/net/wwan/t7xx/t7xx_port_devlink.c b/drivers/net/wwan/t7xx/t7xx_port_devlink.c index f10804a2c0d7..0949809aa219 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_devlink.c +++ b/drivers/net/wwan/t7xx/t7xx_port_devlink.c @@ -9,6 +9,11 @@ #include "t7xx_port_ap_msg.h" #include "t7xx_port_devlink.h" +static struct t7xx_devlink_region_info t7xx_devlink_region_infos[] = { + [T7XX_MRDUMP_INDEX] = {"mr_dump", T7XX_MRDUMP_SIZE}, + [T7XX_LKDUMP_INDEX] = {"lk_dump", T7XX_LKDUMP_SIZE}, +}; + static int t7xx_devlink_port_read(struct t7xx_port *port, char *buf, size_t count) { struct sk_buff *skb; @@ -177,6 +182,149 @@ static int t7xx_devlink_fb_flash_partition(struct t7xx_port *port, const char *p return t7xx_devlink_fb_flash(port, partition); } +static int t7xx_devlink_fb_cmd_send(struct t7xx_port *port, char *cmd) +{ + int len = strlen(cmd); + int ret; + + ret = t7xx_devlink_port_write(port, cmd, len); + if (ret == len) + return 0; + + return ret; +} + +static int t7xx_devlink_fb_get_core(struct t7xx_port *port) +{ + u32 mrd_mb = T7XX_MRDUMP_SIZE / (1024 * 1024); + struct t7xx_devlink *dl = port->t7xx_dev->dl; + char mcmd[T7XX_FB_MCMD_SIZE + 1]; + size_t offset_dlen = 0; + int clen, dlen, ret; + + dl->regions[T7XX_MRDUMP_INDEX].buf = vmalloc(dl->regions[T7XX_MRDUMP_INDEX].info->size); + if (!dl->regions[T7XX_MRDUMP_INDEX].buf) + return -ENOMEM; + + set_bit(T7XX_MRDUMP_STATUS, &dl->status); + ret = t7xx_devlink_fb_raw_command(T7XX_FB_CMD_OEM_MRDUMP, port, NULL); + if (ret) { + dev_err(port->dev, "%s command failed\n", T7XX_FB_CMD_OEM_MRDUMP); + goto free_mem; + } + + while (dl->regions[T7XX_MRDUMP_INDEX].info->size > offset_dlen) { + clen = t7xx_devlink_port_read(port, mcmd, sizeof(mcmd) - 1); + if (clen <= 0) + goto free_mem; + + mcmd[clen] = '\0'; + if (!strcmp(mcmd, T7XX_FB_CMD_RTS)) { + memset(mcmd, 0, sizeof(mcmd)); + ret = t7xx_devlink_fb_cmd_send(port, T7XX_FB_CMD_CTS); + if (ret < 0) { + dev_err(port->dev, "write for _CTS failed:%zu\n", + strlen(T7XX_FB_CMD_CTS)); + goto free_mem; + } + + dlen = t7xx_devlink_port_read(port, dl->regions[T7XX_MRDUMP_INDEX].buf + + offset_dlen, T7XX_FB_MDATA_SIZE); + if (dlen <= 0) { + dev_err(port->dev, "read data error(%d)\n", dlen); + ret = dlen; + goto free_mem; + } + offset_dlen += dlen; + + ret = t7xx_devlink_fb_cmd_send(port, T7XX_FB_CMD_FIN); + if (ret < 0) { + dev_err(port->dev, "_FIN failed, (Read %05zu:%05zu)\n", + strlen(T7XX_FB_CMD_FIN), offset_dlen); + goto free_mem; + } + continue; + } else if (!strcmp(mcmd, T7XX_FB_RESP_MRDUMP_DONE)) { + dev_dbg(port->dev, "%s! size:%zd\n", T7XX_FB_RESP_MRDUMP_DONE, offset_dlen); + clear_bit(T7XX_MRDUMP_STATUS, &dl->status); + return 0; + } + dev_err(port->dev, "getcore protocol error (read len %05d, response %s)\n", + clen, mcmd); + ret = -EPROTO; + goto free_mem; + } + + dev_err(port->dev, "mrdump exceeds %uMB size. Discarded!\n", mrd_mb); + +free_mem: + vfree(dl->regions[T7XX_MRDUMP_INDEX].buf); + clear_bit(T7XX_MRDUMP_STATUS, &dl->status); + return ret; +} + +static int t7xx_devlink_fb_dump_log(struct t7xx_port *port) +{ + struct t7xx_devlink *dl = port->t7xx_dev->dl; + struct t7xx_devlink_region *lkdump_region; + char rsp[T7XX_FB_RESPONSE_SIZE]; + int datasize = 0, ret; + size_t offset = 0; + + if (dl->status != T7XX_DEVLINK_IDLE) { + dev_err(&dl->t7xx_dev->pdev->dev, "Modem is busy!\n"); + return -EBUSY; + } + + set_bit(T7XX_LKDUMP_STATUS, &dl->status); + ret = t7xx_devlink_fb_raw_command(T7XX_FB_CMD_OEM_LKDUMP, port, rsp); + if (ret) { + dev_err(port->dev, "%s command returns failure\n", T7XX_FB_CMD_OEM_LKDUMP); + goto err_clear_bit; + } + + ret = kstrtoint(rsp, 16, &datasize); + if (ret) { + dev_err(port->dev, "bad value\n"); + goto err_clear_bit; + } + + lkdump_region = &dl->regions[T7XX_LKDUMP_INDEX]; + if (datasize > lkdump_region->info->size) { + dev_err(port->dev, "lkdump size is more than %dKB. Discarded!\n", + T7XX_LKDUMP_SIZE / 1024); + ret = -EFBIG; + goto err_clear_bit; + } + + lkdump_region->buf = vmalloc(lkdump_region->info->size); + if (!lkdump_region->buf) { + ret = -ENOMEM; + goto err_clear_bit; + } + + while (datasize > 0) { + int dlen = t7xx_devlink_port_read(port, lkdump_region->buf + offset, datasize); + + if (dlen <= 0) { + dev_err(port->dev, "lkdump read error ret = %d\n", dlen); + ret = dlen; + goto err_clear_bit; + } + + datasize -= dlen; + offset += dlen; + } + + dev_dbg(port->dev, "LKDUMP DONE! size:%zd\n", offset); + clear_bit(T7XX_LKDUMP_STATUS, &dl->status); + return t7xx_devlink_fb_handle_response(port, NULL); + +err_clear_bit: + clear_bit(T7XX_LKDUMP_STATUS, &dl->status); + return ret; +} + static int t7xx_devlink_flash_update(struct devlink *devlink, struct devlink_flash_update_params *params, struct netlink_ext_ack *extack) @@ -387,6 +535,65 @@ static const struct devlink_ops devlink_flash_ops = { .reload_up = t7xx_devlink_reload_up, }; +static int t7xx_devlink_region_snapshot(struct devlink *dl, const struct devlink_region_ops *ops, + struct netlink_ext_ack *extack, u8 **data) +{ + struct t7xx_devlink *t7xx_dl = devlink_priv(dl); + struct t7xx_devlink_region *region = ops->priv; + struct t7xx_port *port = t7xx_dl->port; + u8 *snapshot_mem; + + if (t7xx_dl->status != T7XX_DEVLINK_IDLE) + return -EBUSY; + + if (!strncmp(ops->name, "mr_dump", strlen("mr_dump"))) { + snapshot_mem = vmalloc(region->info->size); + memcpy(snapshot_mem, region->buf, region->info->size); + *data = snapshot_mem; + } else if (!strncmp(ops->name, "lk_dump", strlen("lk_dump"))) { + int ret; + + ret = t7xx_devlink_fb_dump_log(port); + if (ret) + return ret; + + *data = region->buf; + } + + return 0; +} + +static_assert(ARRAY_SIZE(t7xx_devlink_region_infos) == + ARRAY_SIZE(((struct t7xx_devlink *)NULL)->regions)); + +/* To create regions for dump files */ +static int t7xx_devlink_create_regions(struct t7xx_devlink *dl) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(t7xx_devlink_region_infos); i++) { + dl->regions[i].info = &t7xx_devlink_region_infos[i]; + dl->regions[i].ops.name = dl->regions[i].info->name; + dl->regions[i].ops.snapshot = t7xx_devlink_region_snapshot; + dl->regions[i].ops.destructor = vfree; + dl->regions[i].dlreg = devlink_region_create(dl->ctx, &dl->regions[i].ops, + T7XX_MAX_SNAPSHOTS, + t7xx_devlink_region_infos[i].size); + if (IS_ERR(dl->regions[i].dlreg)) { + ret = PTR_ERR(dl->regions[i].dlreg); + dev_err(dl->port->dev, "create devlink region failed, err %d\n", ret); + while (i >= 0) + devlink_region_destroy(dl->regions[i--].dlreg); + + return ret; + } + + dl->regions[i].ops.priv = &dl->regions[i]; + } + + return 0; +} + int t7xx_devlink_register(struct t7xx_pci_dev *t7xx_dev) { union devlink_param_value value; @@ -422,6 +629,14 @@ void t7xx_devlink_unregister(struct t7xx_pci_dev *t7xx_dev) devlink_free(dl_ctx); } +static void t7xx_devlink_work(struct work_struct *work) +{ + struct t7xx_devlink *dl; + + dl = container_of(work, struct t7xx_devlink, ws); + t7xx_devlink_fb_get_core(dl->port); +} + /** * t7xx_devlink_init - Initialize devlink to t7xx driver * @port: Pointer to port structure @@ -431,28 +646,56 @@ void t7xx_devlink_unregister(struct t7xx_pci_dev *t7xx_dev) static int t7xx_devlink_init(struct t7xx_port *port) { struct t7xx_devlink *dl = port->t7xx_dev->dl; + struct workqueue_struct *dl_wq; + int rc; + + dl_wq = create_workqueue("t7xx_devlink"); + if (!dl_wq) { + dev_err(port->dev, "create_workqueue failed\n"); + return -ENODATA; + } + INIT_WORK(&dl->ws, t7xx_devlink_work); port->rx_length_th = T7XX_MAX_QUEUE_LENGTH; dl->mode = T7XX_NORMAL_MODE; dl->status = T7XX_DEVLINK_IDLE; + dl->wq = dl_wq; dl->port = port; + rc = t7xx_devlink_create_regions(dl); + if (rc) { + destroy_workqueue(dl->wq); + dev_err(port->dev, "devlink region creation failed, rc %d\n", rc); + return -ENOMEM; + } + return 0; } static void t7xx_devlink_uninit(struct t7xx_port *port) { struct t7xx_devlink *dl = port->t7xx_dev->dl; + int i; + + vfree(dl->regions[T7XX_MRDUMP_INDEX].buf); dl->mode = T7XX_NORMAL_MODE; + destroy_workqueue(dl->wq); + + for (i = 0; i < ARRAY_SIZE(t7xx_devlink_region_infos); ++i) + devlink_region_destroy(dl->regions[i].dlreg); skb_queue_purge(&port->rx_skb_list); } static int t7xx_devlink_enable_chl(struct t7xx_port *port) { + struct t7xx_devlink *dl = port->t7xx_dev->dl; + t7xx_port_enable_chl(port); + if (dl->mode == T7XX_FB_DUMP_MODE) + queue_work(dl->wq, &dl->ws); return 0; } diff --git a/drivers/net/wwan/t7xx/t7xx_port_devlink.h b/drivers/net/wwan/t7xx/t7xx_port_devlink.h index 92f0993e7205..e01845b4f2aa 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_devlink.h +++ b/drivers/net/wwan/t7xx/t7xx_port_devlink.h @@ -12,27 +12,66 @@ #define T7XX_MAX_QUEUE_LENGTH 32 #define T7XX_FB_COMMAND_SIZE 64 #define T7XX_FB_RESPONSE_SIZE 512 +#define T7XX_FB_MCMD_SIZE 64 +#define T7XX_FB_MDATA_SIZE 1024 #define T7XX_FB_RESP_COUNT 30 +#define T7XX_FB_EVENT_SIZE 50 + +#define T7XX_MAX_SNAPSHOTS 1 +#define T7XX_MRDUMP_SIZE (160 * 1024 * 1024) +#define T7XX_LKDUMP_SIZE (256 * 1024) +#define T7XX_TOTAL_REGIONS 2 + #define T7XX_FLASH_STATUS 0 +#define T7XX_MRDUMP_STATUS 1 +#define T7XX_LKDUMP_STATUS 2 #define T7XX_GET_INFO 3 - #define T7XX_DEVLINK_IDLE 0 + #define T7XX_NORMAL_MODE 0 #define T7XX_FB_DL_MODE 1 +#define T7XX_FB_DUMP_MODE 2 +#define T7XX_FB_CMD_RTS "_RTS" +#define T7XX_FB_CMD_CTS "_CTS" +#define T7XX_FB_CMD_FIN "_FIN" +#define T7XX_FB_CMD_OEM_MRDUMP "oem mrdump" +#define T7XX_FB_CMD_OEM_LKDUMP "oem dump_pllk_log" #define T7XX_FB_CMD_DOWNLOAD "download" #define T7XX_FB_CMD_FLASH "flash" #define T7XX_FB_CMD_REBOOT "reboot" +#define T7XX_FB_RESP_MRDUMP_DONE "MRDUMP08_DONE" #define T7XX_FB_RESP_OKAY "OKAY" #define T7XX_FB_RESP_FAIL "FAIL" #define T7XX_FB_RESP_DATA "DATA" #define T7XX_FB_RESP_INFO "INFO" #define T7XX_FB_CMD_GET_VER "get_version" +/* Internal region indexes */ +enum t7xx_regions { + T7XX_MRDUMP_INDEX, + T7XX_LKDUMP_INDEX, +}; + +struct t7xx_devlink_region_info { + const char *name; + size_t size; +}; + +struct t7xx_devlink_region { + struct t7xx_devlink_region_info *info; + struct devlink_region_ops ops; + struct devlink_region *dlreg; + void *buf; +}; + struct t7xx_devlink { + struct t7xx_devlink_region regions[T7XX_TOTAL_REGIONS]; struct t7xx_pci_dev *t7xx_dev; + struct workqueue_struct *wq; struct t7xx_port *port; + struct work_struct ws; struct devlink *ctx; unsigned long status; u8 mode; diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c index a6147f2324a6..500dadaddb30 100644 --- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c +++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c @@ -244,6 +244,8 @@ static void t7xx_lk_stage_event_handling(struct t7xx_fsm_ctl *ctl, unsigned int if (lk_event == LK_EVENT_CREATE_POST_DL_PORT) md->t7xx_dev->dl->mode = T7XX_FB_DL_MODE; + else + md->t7xx_dev->dl->mode = T7XX_FB_DUMP_MODE; port->port_conf->ops->enable_chl(port); t7xx_cldma_start(md_ctrl); From patchwork Thu Aug 3 02:58:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13339193 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 051AD8475 for ; Thu, 3 Aug 2023 02:58:56 +0000 (UTC) Received: from AUS01-ME3-obe.outbound.protection.outlook.com (mail-me3aus01olkn2141.outbound.protection.outlook.com [40.92.63.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBF45139 for ; Wed, 2 Aug 2023 19:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MS6UdJyyhf8mGJBOz6PCYsUF8Oki7aiE7Oz340qnrBi+RDqpChSquPZrwaT0yG3YT7NoRqNVthOd22CWaVERAT53LG/viw2ChXjEtByrKKzwSe225QIiCcli4+sUWk4iWXUskdIYkoMdVTOvVzd1oHov+50EHtQpwBNum+i36fSoQCvqoUAVNEIS7gZR1FIm9b1vOms2JCS7ImuRDfEon0aC+dVRO/F+lHdwHtjDCzXXnPdzI1mjZbjFi5rcK0svloAfx6TjwUTZ3wc+ckzW7hIDL8O817gKkFu30/vzsjk0dUn+v47tahamHklZZMBmUtH1xKuXAAcaX+X/ZGuLkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=07O5d5GfwqZ3LC1XdbdDCYcNLN8JLw41NrQzUCcEqJ8=; b=nX79AZAAGNRhMFJQW6hVVx2R7g/KeIcmwh64hCB1C94uq58iM3wor0JbeCOafD8w+/vY2Q9VFswxjbgSFOlnS7HJfww4/JsDDk8V7AHLXVJOlxyC9PM4UxPtExt7K4unJU6qtQ8+VzOXXiQxNVuV6iOdIWZ3PRMXQScZtLqtKq/86b+1gAJfCSQtuYe0JLdjgslFdNA0xI/EpPNGNRXhOQIKpIFqzm1N849356ko5mIGKahAD1hWR4OX5gXb4XK7OntERFqVE4oAW8wEG+y1E5USPosuACjMinihKgKFDgTq+Rh67WUQ9wj4aiHwbpxzNVKY98a7UY/y2V7HfSHJEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=07O5d5GfwqZ3LC1XdbdDCYcNLN8JLw41NrQzUCcEqJ8=; b=ka2JOu8ztcBIMwqq3kN4cspumetizsEz2pS0eBf7MxTGhq+2H6wAIOzzdMVjg75X+/WObY83Azgx8Uw2JoPlXdG/65/hS11i2BeIOMO+NxekbEqlXOwribOTDNDl6T+Wt7MiZpsbc+5LY6Qb602ZKBHT8toCk7ttHi+7alJ9D78ScV+psbsW9x/+eXwbAX5MrFsxTwEBbq5sZJFWAs4A+u8oEUBy5hbCC23tc4fkkuLOl8YwBCdInGca+ljT4flRan4v+sFRONlwgX7WdOkX/fmqTTubq86B9t3F8JBjdF+VHL7WQ2CvIBiwH7F9b2PnVlA5O2tyAtvSqIOaBWtCNw== Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) by SYBP282MB2963.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:156::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Thu, 3 Aug 2023 02:58:46 +0000 Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14]) by MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14%3]) with mapi id 15.20.6652.020; Thu, 3 Aug 2023 02:58:46 +0000 From: Jinjian Song To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, ilpo.jarvinen@linux.intel.com, ricardo.martinez@linux.intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, edumazet@google.com, pabeni@redhat.com, chandrashekar.devegowda@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com, linuxwwan_5g@intel.com, soumya.prakash.mishra@intel.com, jesse.brandeburg@intel.com, danielwinkler@google.com, Jinjian Song Subject: [net-next 5/6] net: wwan: t7xx: Adds sysfs attribute of modem event Date: Thu, 3 Aug 2023 10:58:01 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803025802.3534-1-songjinjian@hotmail.com> References: <20230803025802.3534-1-songjinjian@hotmail.com> X-TMN: [aZZN4681DT6BEXPsr6E6DeFir2GnN4Qv] X-ClientProxiedBy: TYAPR01CA0011.jpnprd01.prod.outlook.com (2603:1096:404::23) To MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) X-Microsoft-Original-Message-ID: <20230803025802.3534-3-songjinjian@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MEYP282MB2697:EE_|SYBP282MB2963:EE_ X-MS-Office365-Filtering-Correlation-Id: 91c2b2a5-3e44-43f8-710c-08db93cd8de4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IXK85OGQGhn8FPhcWQW4FNTSx3UhiJDJ8FD3Cap7LuWqfzpdaqjZ5dWb+NUxh38QQH1o33D29S8k6h2Zci+rSlKPin2IgEGKOsFK3G66BFn3aQ3D/VK0lEWOnf3O9wM9ka9SZ73imJuUb0I5C0n0AxWMpPoAYLd2XGEzxRXzTO6VeA9dXe5KkwRgXh3zOX5eJWLuBC47uwH4RuaLXlhdD4zxvbKQuJYtQ1w4vvgbQEB6rBbEnsaZKnplfKuAv4HgDP6jQOF3nJfBo4lHCq9hQbJVeWAS9fSNWGFTT4Ip0GCH3s4n08simtnnihciYnLWcDc0DCmIB2FSEOY19l5iVvyxgqwMqRA0lHJ6vdOFK4W/Ce8rxNq986BTzKNQML7bkGpphfCuFrHlgP7IcShL5OF/jFr2aj5KcWiOqEZtCcVnaUS02Ur5cNro3VvNoRGMWErmyed7Ah0ZtbO4n2r/3wWtPL2LzXtDz9TQ79kB95DTFo5jaxGilKaHXQ91/tLj0SUKcAGHTmTzmUazONyZ+J33TvhKXmrjkBXa0ctrqhY= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CSMDls9ILPqp+rTxYBQFHoZyf3RNYKM3QBHLlAcjxqalPn8GzanwdSKmPSvloqo1u+Iqe5eIH7MTQVKpY8XTVTJXcXlS0K05rVERxrXRErvj8QCuZECOSHuOhkKhW9AuERF96AjjCU3cRXZSKRgS6zMKes2owLl0qOItpm6gIt7V0Mf+KBMxUmpcD9T8QUeIoLOJhCq8A6pG+fZ0iJENW9shFdwrTR/snprpn6IFoxdIcZxVw+nqJJft7cL7R7sqosfcq6mrAkjBL2xIHmf4RvCgRC5UMPiFSSZPWZCD+V35WLrBM+pblmGxM4R1VThkiT9jtFHmOo+PcSBhoGTM/lFCyetkE70RMOeE4QEXPVG7MsoQZbNq6VCep4gDC6VAxZIE/GvquxteTmtjvhETAJ4SLHdXAzCVvO3eT3I4DFjg5Mt0MdLvBk1XwBxCcSvmV9FfAgjY1gCrrpwkW2GkV2MPeVVXWHl0tbd7fhNwFG2akptZ5G/Vw2YLQDXc+cMOspnDTbN3tbVzKdjjMOsh+OCh3gDApiUESiC3iVXnfcjgGBe3X1dn9YWj1xD/b0G0AZIKmO7E9Jj351vX55TCY+jV1ahhoCBGXHS0HzPPfAuPwzJGtoKVlu7PCVkJUA4TTeGu5i9TpiA+8JtQtFItrfjswJH79Hm2Ysab6UfQntL1rNOYcOLLowVINYRlKkQZlYQjhQ+TY7EcG+PEMmOPsQz8RRbserqjp45x0QOcyjpiaM4WOHHz4o846kqZtdRjJ05DfLe9zLf4jnVnZY0RAYmbho8cOVezRgaTD2dqLzRvSt7uerjaFUiLZUZxF6XqjSZICjJmqyPhaJFb0RvZPQPtxmxk2cDx7ofHF9r+TLzCKkF+f66ngKqXy9rJ83KzgpaWGhBmDReyRYBLCnR+7l/u1DMU16z1hcfrFCfGblhN9tNfWlJMikYJSuSpPv4YyAwD3X8HKmb1Jbty/tOzCaZ29WipIEdy24j7V9B8lP7rl2wd2QHi9ZMV+5/9HvHqSZh45xBIQDUmBsu3DB1t3isByshWDmDH5TnxtyseEgaLN669mls06KR9cKJ1PgA2ElVJ6t6tSYTPChaegn5UKVP+KoiKzCxoZhkHxD5Kf3YSqi09nleNdZ8zH5mobRD2Ejx3t70mXYCwMaqaGelRb+qNE46bWgBRtqmGcQsZm7F21d6NezYwSCBQqr/cOQ7Ib+/vEY+0CUlhpO6nBfygKGxnqAbDRMZ8lJ8horHHfNY= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 91c2b2a5-3e44-43f8-710c-08db93cd8de4 X-MS-Exchange-CrossTenant-AuthSource: MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 02:58:46.4934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SYBP282MB2963 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Jinjian Song Adds support for t7xx wwan device firmware flashing & coredump collection using devlink. Provides sysfs attribute on user space to query the event from modem about flashing/coredump/reset. Base on the v5 patch version of follow series: 'net: wwan: t7xx: fw flashing & coredump support' (https://patchwork.kernel.org/project/netdevbpf/patch/fc8bbb0b66a5ff3a489ea9857d79b374508090ef.1674307425.git.m.chetan.kumar@linux.intel.com/) Signed-off-by: Jinjian Song --- drivers/net/wwan/t7xx/t7xx_modem_ops.c | 1 + drivers/net/wwan/t7xx/t7xx_pci.c | 62 ++++++++++++++++++++++ drivers/net/wwan/t7xx/t7xx_pci.h | 17 ++++++ drivers/net/wwan/t7xx/t7xx_port_devlink.c | 14 +++++ drivers/net/wwan/t7xx/t7xx_port_devlink.h | 1 + drivers/net/wwan/t7xx/t7xx_state_monitor.c | 7 +++ 6 files changed, 102 insertions(+) diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.c b/drivers/net/wwan/t7xx/t7xx_modem_ops.c index cbd65aa48721..4de75874f1b5 100644 --- a/drivers/net/wwan/t7xx/t7xx_modem_ops.c +++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.c @@ -192,6 +192,7 @@ static irqreturn_t t7xx_rgu_isr_thread(int irq, void *data) { struct t7xx_pci_dev *t7xx_dev = data; + atomic_set(&t7xx_dev->event, T7XX_RESET); msleep(RGU_RESET_DELAY_MS); t7xx_reset_device_via_pmic(t7xx_dev); return IRQ_HANDLED; diff --git a/drivers/net/wwan/t7xx/t7xx_pci.c b/drivers/net/wwan/t7xx/t7xx_pci.c index 5e9b954f39ce..f1723c02376e 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.c +++ b/drivers/net/wwan/t7xx/t7xx_pci.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2021, MediaTek Inc. * Copyright (c) 2021-2022, Intel Corporation. + * Copyright (c) 2023, Fibocom Wireless Inc. * * Authors: * Haijun Liu @@ -14,6 +15,7 @@ * Chiranjeevi Rapolu * Eliot Lee * Moises Veleta + * Jinjian Song */ #include @@ -60,6 +62,57 @@ enum t7xx_pm_state { MTK_PM_RESUMED, }; +static ssize_t t7xx_event_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + enum t7xx_event event = T7XX_UNKNOWN; + struct pci_dev *pdev; + struct t7xx_pci_dev *t7xx_dev; + + pdev = to_pci_dev(dev); + t7xx_dev = pci_get_drvdata(pdev); + if (!t7xx_dev) + return -ENODEV; + + event = atomic_read(&t7xx_dev->event); + if (event == T7XX_READY) { + return sprintf(buf, "T7XX_MODEM_READY\n"); + } else if (event == T7XX_RESET) { + return sprintf(buf, "T7XX_RESET\n"); + } else if (event == T7XX_FASTBOOT_DL_MODE) { + return sprintf(buf, "T7XX_MODEM_FASTBOOT_DL_MODE\n"); + } else if (event == T7XX_FLASH_SUCCESS) { + return sprintf(buf, "T7XX_FLASHING_SUCCESS\n"); + } else if (event == T7XX_FLASH_FAILURE) { + return sprintf(buf, "T7XX_FLASHING_FAILURE\n"); + } else if (event == T7XX_FASTBOOT_DUMP_MODE) { + return sprintf(buf, "T7XX_MODEM_FASTBOOT_DUMP_MODE\n"); + } else if (event == T7XX_MRDUMP_READY) { + return sprintf(buf, "T7XX_MRDUMP_READY size:%zu\n", + t7xx_dev->dl->regions[T7XX_MRDUMP_INDEX].info->dump_size); + } else if (event == T7XX_LKDUMP_READY) { + return sprintf(buf, "T7XX_LKDUMP_READY size:%zu\n", + t7xx_dev->dl->regions[T7XX_LKDUMP_INDEX].info->dump_size); + } else if (event == T7XX_MRDUMP_DISCARD) { + return sprintf(buf, "T7XX_MRDUMP_DISCARDED\n"); + } else if (event == T7XX_LKDUMP_DISCARD) { + return sprintf(buf, "T7XX_LKDUMP_DISCARDED\n"); + } + + return sprintf(buf, "T7XX_UNKNOWN\n"); +} + +static DEVICE_ATTR_RO(t7xx_event); + +static struct attribute *t7xx_event_attr[] = { + &dev_attr_t7xx_event.attr, + NULL +}; + +static const struct attribute_group t7xx_event_attribute_group = { + .attrs = t7xx_event_attr, +}; + static void t7xx_dev_set_sleep_capability(struct t7xx_pci_dev *t7xx_dev, bool enable) { void __iomem *ctrl_reg = IREG_BASE(t7xx_dev) + T7XX_PCIE_MISC_CTRL; @@ -734,8 +787,17 @@ static int t7xx_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) t7xx_pcie_mac_interrupts_dis(t7xx_dev); + ret = sysfs_create_group(&t7xx_dev->pdev->dev.kobj, + &t7xx_event_attribute_group); + if (ret) { + t7xx_md_exit(t7xx_dev); + goto err_devlink_unregister; + } + ret = t7xx_interrupt_init(t7xx_dev); if (ret) { + sysfs_remove_group(&t7xx_dev->pdev->dev.kobj, + &t7xx_event_attribute_group); t7xx_md_exit(t7xx_dev); goto err_devlink_unregister; } diff --git a/drivers/net/wwan/t7xx/t7xx_pci.h b/drivers/net/wwan/t7xx/t7xx_pci.h index 6777581cd540..0d82f9e99243 100644 --- a/drivers/net/wwan/t7xx/t7xx_pci.h +++ b/drivers/net/wwan/t7xx/t7xx_pci.h @@ -2,6 +2,7 @@ * * Copyright (c) 2021, MediaTek Inc. * Copyright (c) 2021-2022, Intel Corporation. + * Copyright (c) 2023, Fibocom Wireless Inc. * * Authors: * Haijun Liu @@ -12,6 +13,7 @@ * Amir Hanania * Chiranjeevi Rapolu * Moises Veleta + * Jinjian Song */ #ifndef __T7XX_PCI_H__ @@ -84,6 +86,7 @@ struct t7xx_pci_dev { struct dentry *debugfs_dir; #endif struct t7xx_devlink *dl; + atomic_t event; }; enum t7xx_pm_id { @@ -115,6 +118,20 @@ struct md_pm_entity { void *entity_param; }; +enum t7xx_event { + T7XX_UNKNOWN, + T7XX_READY, + T7XX_RESET, + T7XX_FASTBOOT_DL_MODE, + T7XX_FLASH_SUCCESS, + T7XX_FLASH_FAILURE, + T7XX_FASTBOOT_DUMP_MODE, + T7XX_MRDUMP_READY, + T7XX_LKDUMP_READY, + T7XX_MRDUMP_DISCARD, + T7XX_LKDUMP_DISCARD, +}; + void t7xx_pci_disable_sleep(struct t7xx_pci_dev *t7xx_dev); void t7xx_pci_enable_sleep(struct t7xx_pci_dev *t7xx_dev); int t7xx_pci_sleep_disable_complete(struct t7xx_pci_dev *t7xx_dev); diff --git a/drivers/net/wwan/t7xx/t7xx_port_devlink.c b/drivers/net/wwan/t7xx/t7xx_port_devlink.c index 0949809aa219..5d2c81a29ab5 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_devlink.c +++ b/drivers/net/wwan/t7xx/t7xx_port_devlink.c @@ -246,11 +246,14 @@ static int t7xx_devlink_fb_get_core(struct t7xx_port *port) continue; } else if (!strcmp(mcmd, T7XX_FB_RESP_MRDUMP_DONE)) { dev_dbg(port->dev, "%s! size:%zd\n", T7XX_FB_RESP_MRDUMP_DONE, offset_dlen); + dl->regions[T7XX_MRDUMP_INDEX].info->dump_size = offset_dlen; + atomic_set(&port->t7xx_dev->event, T7XX_MRDUMP_READY); clear_bit(T7XX_MRDUMP_STATUS, &dl->status); return 0; } dev_err(port->dev, "getcore protocol error (read len %05d, response %s)\n", clen, mcmd); + atomic_set(&port->t7xx_dev->event, T7XX_MRDUMP_DISCARD); ret = -EPROTO; goto free_mem; } @@ -293,6 +296,7 @@ static int t7xx_devlink_fb_dump_log(struct t7xx_port *port) if (datasize > lkdump_region->info->size) { dev_err(port->dev, "lkdump size is more than %dKB. Discarded!\n", T7XX_LKDUMP_SIZE / 1024); + atomic_set(&port->t7xx_dev->event, T7XX_LKDUMP_DISCARD); ret = -EFBIG; goto err_clear_bit; } @@ -317,6 +321,8 @@ static int t7xx_devlink_fb_dump_log(struct t7xx_port *port) } dev_dbg(port->dev, "LKDUMP DONE! size:%zd\n", offset); + lkdump_region->info->dump_size = offset; + atomic_set(&port->t7xx_dev->event, T7XX_LKDUMP_READY); clear_bit(T7XX_LKDUMP_STATUS, &dl->status); return t7xx_devlink_fb_handle_response(port, NULL); @@ -360,6 +366,10 @@ static int t7xx_devlink_flash_update(struct devlink *devlink, sprintf(flash_status, "%s %s", "flashing", !ret ? "success" : "failure"); devlink_flash_update_status_notify(devlink, flash_status, params->component, 0, 0); + if (ret) + atomic_set(&port->t7xx_dev->event, T7XX_FLASH_FAILURE); + else + atomic_set(&port->t7xx_dev->event, T7XX_FLASH_SUCCESS); clear_bit(T7XX_FLASH_STATUS, &dl->status); err_out: @@ -414,9 +424,13 @@ static int t7xx_devlink_reload_up(struct devlink *devlink, u32 *actions_performed, struct netlink_ext_ack *extack) { + struct t7xx_devlink *dl = devlink_priv(devlink); + *actions_performed = BIT(action); switch (action) { case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: + atomic_set(&dl->t7xx_dev->event, T7XX_RESET); + return 0; case DEVLINK_RELOAD_ACTION_FW_ACTIVATE: return 0; default: diff --git a/drivers/net/wwan/t7xx/t7xx_port_devlink.h b/drivers/net/wwan/t7xx/t7xx_port_devlink.h index e01845b4f2aa..f5442a7f3431 100644 --- a/drivers/net/wwan/t7xx/t7xx_port_devlink.h +++ b/drivers/net/wwan/t7xx/t7xx_port_devlink.h @@ -57,6 +57,7 @@ enum t7xx_regions { struct t7xx_devlink_region_info { const char *name; size_t size; + size_t dump_size; }; struct t7xx_devlink_region { diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c index 500dadaddb30..db76bc6fe660 100644 --- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c +++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c @@ -249,6 +249,12 @@ static void t7xx_lk_stage_event_handling(struct t7xx_fsm_ctl *ctl, unsigned int port->port_conf->ops->enable_chl(port); t7xx_cldma_start(md_ctrl); + + if (lk_event == LK_EVENT_CREATE_POST_DL_PORT) + atomic_set(&md->t7xx_dev->event, T7XX_FASTBOOT_DL_MODE); + else + atomic_set(&md->t7xx_dev->event, T7XX_FASTBOOT_DUMP_MODE); + break; default: @@ -332,6 +338,7 @@ static void fsm_routine_ready(struct t7xx_fsm_ctl *ctl) ctl->curr_state = FSM_STATE_READY; t7xx_fsm_broadcast_ready_state(ctl); + atomic_set(&md->t7xx_dev->event, T7XX_READY); t7xx_md_event_notify(md, FSM_READY); } From patchwork Thu Aug 3 02:58:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjian Song X-Patchwork-Id: 13339194 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E6456105 for ; Thu, 3 Aug 2023 02:59:02 +0000 (UTC) Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2160.outbound.protection.outlook.com [40.92.62.160]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB1A10A for ; Wed, 2 Aug 2023 19:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/tVOSNKTuyWqsg5/kIfiGMGL+OikpJe3cRGttEJ0wuxmUdnUHf7uqUyWH/pkKoWW+6BbI/5GsWGeSh0HFORNbhWMNANuDh+ajkoRD+3a6fZLQYZS7bZU8/NIdgtSw3tyozg/r9mqi1TZ/u3Pm4Sz6Z6uFNBHRo0fTqu7OoaM0LEKR/zTiqmDtbGnAbffMKxP8mwSM5dLZvZodIxzp7Vjecs+Ez+bsyB7V07xel1i3r99js8qZ7IDDBJcGsjTMOEVRwEzZuTegf0g1HUQhtfMIYnQr1pPsrSejiTm96T8evPxyIkmZfrDBG2ttGhttN616DZCsevfC9/g8coQulxBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Kbb2137+Um2SBCJLfyA8j7g0pN7Kfw2jjoEAmW+S5/4=; b=Cg6Bi600uucawNhT+ImgMP96HgG8myai7SCmrz/dfUc/JpN5cmD+JskujKC051fQOo1Sh8Fx4JZ2jneXiK1cx0D2h+iZilRNxUPQlGe6Ag318leIF0BCAQiwE2vixj/f/fCQlq1SnwxPFK305glnGlz5RV3rYNiIDsyJmlHyX/sseIDEi4VU5N3q9hULK9ZdczLQCfON3TwDVBOWYfSGxzQtYIQ6ppvxGuygUilzLgRNMn8JbgV3HhClG8pTbmiFZ5FdoIT7X7khvR9GH3e77+lu6mERAugRP6Duq7BmMEmYx/5/88etea95V3J8CaKTSS51OoYow+ODEem9EhdzHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kbb2137+Um2SBCJLfyA8j7g0pN7Kfw2jjoEAmW+S5/4=; b=NPFm+Tsve7R6vC7AWGziV3vqzWYb0cpt1KoUuGtC41uviEPLm3pjiAtT+EmUn3mDba7Nw7Px2HusZl8GLBFAfNG/MHC+f0r5O/0nry2m/nTEpNMquD0BgHbFyXRRrWFW9w4kbpqr3Psh5p5M+tGMd0qvCxyYuiaU/uZF3jKSYmyA3SoWH7XLtHGyuGjITOExqZVj+lLC+wQBgmSHkSTyslgo0SDeZC1ZApgv/PbhFZJQ/gEzQMq2mW2Mffja8Ha+GySWzpME+DNXH8gPt8utBzLMRFkwts5djIy//lEtfhoHsEFiwXUMIou91jnA3ZGqww9woUpsXNYdZ7lp5mZ0rg== Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) by SYBP282MB2963.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:156::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.45; Thu, 3 Aug 2023 02:58:53 +0000 Received: from MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14]) by MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM ([fe80::826:d9a5:23be:3b14%3]) with mapi id 15.20.6652.020; Thu, 3 Aug 2023 02:58:52 +0000 From: Jinjian Song To: netdev@vger.kernel.org Cc: kuba@kernel.org, davem@davemloft.net, johannes@sipsolutions.net, ryazanov.s.a@gmail.com, loic.poulain@linaro.org, ilpo.jarvinen@linux.intel.com, ricardo.martinez@linux.intel.com, chiranjeevi.rapolu@linux.intel.com, haijun.liu@mediatek.com, edumazet@google.com, pabeni@redhat.com, chandrashekar.devegowda@intel.com, m.chetan.kumar@linux.intel.com, linuxwwan@intel.com, linuxwwan_5g@intel.com, soumya.prakash.mishra@intel.com, jesse.brandeburg@intel.com, danielwinkler@google.com, Jinjian Song Subject: [net-next 6/6] net: wwan: t7xx: Devlink documentation Date: Thu, 3 Aug 2023 10:58:02 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803025802.3534-1-songjinjian@hotmail.com> References: <20230803025802.3534-1-songjinjian@hotmail.com> X-TMN: [2naFLzHyfuYpjV931z+Y3cc1cJ1qqRmQ] X-ClientProxiedBy: TYAPR01CA0011.jpnprd01.prod.outlook.com (2603:1096:404::23) To MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:14c::12) X-Microsoft-Original-Message-ID: <20230803025802.3534-4-songjinjian@hotmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MEYP282MB2697:EE_|SYBP282MB2963:EE_ X-MS-Office365-Filtering-Correlation-Id: 7435e630-cd3e-4738-3f1c-08db93cd91ac X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XYXwLAqa9mejhPwuhgkDIGB0mHBHOHMonU3B2DRG2nJV7UAdhP1+Zqt0CH76w/NH+QO5QSP/1pj/1bEKt8DC9hFLt78yKGIMMpNSvoRO5xhJp8Php96d7VY+7l0d0AcWQcjOX23NJAyvJyBWCYkx3FjylcpRd7stXU5Bcx+22vrGCcV8QNW3z0XPRg5VRtrteV7q7jv/WgdG6RLugkzBrn0mx7WfCFWAgYmMuood7vRtm7sC93k5cFYMtzyLHcS/eY0fMrD2jSNS8Ot+k0Zi/SBKodmRoXcw+ZjRrEJAWowO85FZ8/6muROhqfEhm05czz7cTKoOQy7iHMl7jLZQHdPspM51MIE8/XdCKtP0qOz7VRfz/Y3lLUXfz83+lQyTgWsa1i0eapqiIVlGe26qe0yDY/vA97/vDeSdlnvtPZEWw6/UKYIzymhGxeEyNKnRKvQ805ONLDHw9N5iUQeR4dRoWhvG9inD60o/YvVlelFVy2AihlaSHsmK3hJ0qXh0Zl8pYubpv/+vOKo5zqYozXlrhfKJ3aNXfTa9xPuIH/g= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JXuJcYcBp78AkUbzc7RVxdLtQ1IWj1/F0Km2KuQhKa1sTFaKea7ngUvhOziy4QIddJhx0E1IKM/ZaJMCHV9Jk5LyuSK3MZWJOTfl8pPyjEZq9aBkFgOMuYA+hpH6xU1ROFnOkj8+XlrK/f5GC6T0H+/mWrWhqG0v9BKv1012Tg5EjLn6ZOqd+ZnzDb79PF6FQdcf4kj9sZQupPh/ErpUta8wpFY3QNDETNjWP/+KfYwI0LvYmgFOv6AeIPN+bLNkhRS9Q4wkN9MG3q/pJ4p+cZ6TK9be5BGgB56JLpQeqYBF8kMOjsubacK98y5T+lSaTtc+GiVVP53XtYL9V/RST9ufCMud+h9+c79h1U/+zZzisfo4uo1KrwsWjO2Q8eBo1WKJ1xEffRCIIWCzqDo9gbZj0DUj3znB+Q8CCl3KlseaWqoIT25rCQfyqIGVpYfVc+s3rESYaEQHTu+lEWUOxDMXRN8bKVR2FUAW/DxP6WDCCoOVqDYJTOYylHNdANYIT5eKvXuiJkg2G2kRVZ0czyTLu2gRWYs7PnOvnShHmzQOlxPd9kIGvSt9RvFXQFXDzdVWowZt4hWUcnj/uYxI+87lFErAIx9gm2KYJ/ljUrr5vlc8edGAX2Q7oXglfxHE9iifa1yf/Liu2ZTpOW8SBL6OJcvc+44HcTYXbJFgqbijGcFKfjGISPZjivhETfysKNMrrE9++UzxxgiaWd/uqLSrMbJSoUZEDZo92A2mjNO4D4RaQNT1jQAND/wi/3LYsTtcVzVPY5zZ2JA35d1Js/G016wDa7rIsQFs7rN7eHINXmT8XWP73qZdg4zDlbRPm35Xn6DtJzX0KPQTvqrVYIvAYtFy0/2xdPqrbwCvCm1O6sJvx0yFXmRdtbE/SedyMJMjkmiqKSe9Jy7XxxIsCP3ZJ795GDaOR9SgprdR+qBViDFoFev/7ICpQKIFwBkOIljcYHzj7VNgcsrgXIP8JqcxwR+AzWFiY4w1CdO+qUfgu3ImzhZFddou/9Rxm0ylgVLSIClBTADY6wj49i7Sd0J5MW7x0jCbLgcnvjm5Ize/LqSMfWENWungWWLO9rJOyhx3XicQyw0zUY8V4kqgo5Tn1mO8tWgeBJPQLzmAHUZ4PfDPPnbJ1Rujqq1ANZpRazr5JlwDxOoISWAdVj+3ItMVxFrgsvpJhuNrswp5csxLgY0C7pS3NkA/QQn/GFh1msAuMCQAMfoGeXQR20liAu6nak9vjrP6wCZrawLuA+g= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 7435e630-cd3e-4738-3f1c-08db93cd91ac X-MS-Exchange-CrossTenant-AuthSource: MEYP282MB2697.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 02:58:52.9343 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SYBP282MB2963 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Jinjian Song Document the t7xx devlink commands usage for firmware flashing & coredump collection. Base on the v5 patch version of follow series: 'net: wwan: t7xx: fw flashing & coredump support' (https://patchwork.kernel.org/project/netdevbpf/patch/f902d4a0cb807a205687f7e693079fba72ca7341.1674307425.git.m.chetan.kumar@linux.intel.com/) Signed-off-by: Jinjian Song --- Documentation/networking/devlink/index.rst | 1 + Documentation/networking/devlink/t7xx.rst | 232 +++++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 Documentation/networking/devlink/t7xx.rst diff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst index b49749e2b9a6..f101781105ca 100644 --- a/Documentation/networking/devlink/index.rst +++ b/Documentation/networking/devlink/index.rst @@ -67,3 +67,4 @@ parameters, info versions, and other features it supports. iosm octeontx2 sfc + mtk_t7xx diff --git a/Documentation/networking/devlink/t7xx.rst b/Documentation/networking/devlink/t7xx.rst new file mode 100644 index 000000000000..1f5108338ef0 --- /dev/null +++ b/Documentation/networking/devlink/t7xx.rst @@ -0,0 +1,232 @@ +.. SPDX-License-Identifier: GPL-2.0 + +==================== +t7xx devlink support +==================== + +This document describes the devlink features implemented by the ``t7xx`` +device driver. + +Parameters +========== +The ``t7xx`` driver implements the following driver-specific parameters. + +.. list-table:: Driver-specific parameters + :widths: 5 5 5 85 + + * - Name + - Type + - Mode + - Description + * - ``fastboot`` + - boolean + - driverinit + - Set this param to enter fastboot mode. + +Flash Update +============ + +The ``t7xx`` driver implements the flash update using the ``devlink-flash`` +interface. + +The driver uses ``DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK`` to identify the type of +firmware image that need to be programmed upon the request by user space application. + +``t7xx`` driver uses fastboot protocol for firmware flashing. In the firmware +flashing procedure, fastboot command & response are exchanged between driver +and wwan device. + +:: + + $ devlink dev param set pci/0000:bdf name fastboot value 1 cmode driverinit + +The devlink param fastboot is set to true via devlink param command, by +passing name ``fastboot``, value ``1`` and cmode ``driverinit``. + +:: + + $ devlink dev reload pci/0000:$bdf action driver_reinit + +The wwan device is put into fastboot mode via devlink reload command, by +passing ``driver_reinit`` action. + +:: + + $ devlink dev reload pci/0000:$bdf action fw_activate + +Upon completion of firmware flashing or coredump collection the wwan device is +reset to normal mode using devlink reload command, by passing ``fw_activate`` +action. + +Flash Commands +-------------- + +:: + + $ devlink dev flash pci/0000:$bdf file preloader_k6880v1_mdot2_datacard.bin component "preloader" + +:: + + $ devlink dev flash pci/0000:$bdf file loader_ext-verified.img component "loader_ext1" + +:: + + $ devlink dev flash pci/0000:$bdf file tee-verified.img component "tee1" + +:: + + $ devlink dev flash pci/0000:$bdf file lk-verified.img component "lk" + +:: + + $ devlink dev flash pci/0000:$bdf file spmfw-verified.img component "spmfw" + +:: + + $ devlink dev flash pci/0000:$bdf file sspm-verified.img component "sspm_1" + +:: + + $ devlink dev flash pci/0000:$bdf file mcupm-verified.img component "mcupm_1" + +:: + + $ devlink dev flash pci/0000:$bdf file dpm-verified.img component "dpm_1" + +:: + + $ devlink dev flash pci/0000:$bdf file boot-verified.img component "boot" + +:: + + $ devlink dev flash pci/0000:$bdf file root.squashfs component "rootfs" + +:: + + $ devlink dev flash pci/0000:$bdf file modem-verified.img component "md1img" + +:: + + $ devlink dev flash pci/0000:$bdf file dsp-verified.bin component "md1dsp" + +:: + + $ devlink dev flash pci/0000:$bdf file OP_OTA.img component "mcf1" + +:: + + $ devlink dev flash pci/0000:$bdf file OEM_OTA.img component "mcf2" + +:: + + $ devlink dev flash pci/0000:$bdf file DEV_OTA.img component "mcf3" + +Note: Component selects the partition type to be programmed. + + +The supported list of firmware image types is described below. + +.. list-table:: Firmware Image types + :widths: 15 85 + + * - Name + - Description + * - ``preloader`` + - The first-stage bootloader image + * - ``loader_ext1`` + - Preloader extension image + * - ``tee1`` + - ARM trusted firmware and TEE (Trusted Execution Environment) image + * - ``lk`` + - The second-stage bootloader image + * - ``spmfw`` + - MediaTek in-house ASIC for power management image + * - ``sspm_1`` + - MediaTek in-house ASIC for power management under secure world image + * - ``mcupm_1`` + - MediaTek in-house ASIC for cpu power management image + * - ``dpm_1`` + - MediaTek in-house ASIC for dram power management image + * - ``boot`` + - The kernel and dtb image + * - ``rootfs`` + - Root filesystem image + * - ``md1img`` + - Modem image + * - ``md1dsp`` + - Modem DSP image + * - ``mcf1`` + - Modem OTA image (Modem Configuration Framework) for operators + * - ``mcf2`` + - Modem OTA image (Modem Configuration Framework) for OEM vendors + * - ``mcf3`` + - Modem OTA image (other usage) for OEM configurations + + +Regions +======= + +The ``t7xx`` driver supports core dump collection in exception state and second +stage bootloader log collection in fastboot mode. The log snapshot is taken by +the driver using fastboot commands. + +Region commands +--------------- + +:: + + $ devlink region show + +This command list the regions implemented by driver. These regions are accessed +for device internal data. Below table describes the regions. + +.. list-table:: Regions + :widths: 15 85 + + * - Name + - Description + * - ``mr_dump`` + - The detailed modem component logs are captured in this region + * - ``lk_dump`` + - This region dumps the current snapshot of lk + +Coredump Collection +~~~~~~~~~~~~~~~~~~ + +:: + + $ devlink region new mr_dump + +:: + + $ devlink region read mr_dump snapshot 0 address 0 length $len + +:: + + $ devlink region del mr_dump snapshot 0 + +Note: $len is actual len to be dumped. + +The userspace application uses these commands for obtaining the modem component +logs when device encounters an exception. + +Second Stage Bootloader dump +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + + $ devlink region new lk_dump + +:: + + $ devlink region read lk_dump snapshot 0 address 0 length $len + +:: + + $ devlink region del lk_dump snapshot 0 + +Note: $len is actual len to be dumped. + +In fastboot mode the userspace application uses these commands for obtaining the +current snapshot of second stage bootloader. +