From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E1DC5CD1292 for ; Mon, 8 Apr 2024 16:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TVwBDpzDq9kH8PYVDj1IgfJoujHmntlXjbsroGidSLw=; b=QxidUcNrz0SIOD YWMyTFf6tAEjMfQet49mlActOjdD+Xt3ps2QpDWEbWvfTmv2t/bFb8DyOfRj4tbi0yLtmGR6mno6V ARyHdzXNbYUcV0XNqCkmUngrVkZ09KEOrovdszfdUoYFCzK1Y6AdGCYOKIV+sRHL3u3sJJ9Bbu/aJ xYTCQ29rWW4PQIgSMv+i+Ff4svn6+YHKJCAbyUxIsJruZysAgUVfft377MzsDk4JaJEKvbtec3P14 XO68OSrxK0mlbipyCWjFxMfPkTAGIKOERpkRN4JSks0aOhpeAZSpk66y+/6guDO9mjLlj3w2UGzZP neDqi/8nkYY8JxTo9XBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtsJ5-0000000GGXj-3GcR; Mon, 08 Apr 2024 16:57:19 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtsJ2-0000000GGXJ-3pjF for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2024 16:57:18 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-5aa12c21ff4so1400595eaf.3 for ; Mon, 08 Apr 2024 09:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712595433; x=1713200233; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wgyyqy1B7p+bYO+oWI4e1nDbdwkGobHLTs4I40p9Z9Q=; b=WnV6rUtfzRju7ogaoaRPfi1966BH+Eul43GLjvW91EOOskNlbMQ0ucRu8DvCIdBzKj dsFecz40lIFnD2m/VnpsXIVEBOVWDeWuJ8ISnKvJw8JMC54FGHEgoCyRT2LtU2cBlRBA 5DL/5lMh2LZg9VjitmtJj21c1twnPY5G0VEqX846cpXCGvFPdP2n45xQMMLebUW2XxSm kaq1VZLkQ9Q9ggS59fE2GeMO2UUE/bEAwQ8v1hNW0h49NZNhvsus1lZjsZz6CohFba0J 6d5EoB7mhazouLApNy46pL6N26Ycd5RTK7/cbsNLwGKF8Kjji4OxLK7myMGa5YymzT0T AsGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712595434; x=1713200234; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wgyyqy1B7p+bYO+oWI4e1nDbdwkGobHLTs4I40p9Z9Q=; b=FrU6vml/o5eUbWWOduZ+T0aUF+EcB4W/MzqF4fwpYTcww+K44KalrwuHlEOg5LSep5 imygZgSudWFL94pV1nGwYn4pVa99ErWbppbekkUmnVuZB2L1B6jxVEL/zp1j7LYgjWRK hTIPZgEoHjyX6SrCjWIjNextmqeq8ASSuvHvBP8J6TrysXGM80/9X0ii3bIjBWb52eHn qv5NLc4FrRUtjwS/q4GxhtcgyVI5HqR0QTiOWJxOTXVsYyQywIHvt/lybeSHzIcNmDnJ Q7JBLV85N3WIN1qTQandSJRK3dC05t0oDalv9Z5S+B2O23AO1gCeG2PMj3jTGnFmiA7D bG0Q== X-Forwarded-Encrypted: i=1; AJvYcCWupwPKoUMLMCI9CW7JKtF//6B+iuvXAVUKy5J5C7RVOGMSPgQi1BeQzi7v/4OaOpTf4wm+z4E3UqtF8a9tD4UUOg0Cf9ITIftr/vUMT4m2Kt/XiZc= X-Gm-Message-State: AOJu0YweDLRR1GCfh2P53bb8n+8kIVyANGT8W4VgFCGn3Nc9L5UoFCsE o6UGdU6x+xcWGpnunXg2bcM5CnDE9lPlwGSRDgYwqaGtnJC/kAlMVN6ycj4v+7Y= X-Google-Smtp-Source: AGHT+IHB9dwlGwJFTZfptSMLMESDbHmgsDIGxwFs5CWxes2lp9o/0E4E2p+gTAsBFZiIGrtQroi7iw== X-Received: by 2002:a05:6870:f693:b0:22f:7513:f20a with SMTP id el19-20020a056870f69300b0022f7513f20amr1695648oab.55.1712595433743; Mon, 08 Apr 2024 09:57:13 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:a8de:8525:97f8:62d2]) by smtp.gmail.com with ESMTPSA id o32-20020a634e60000000b005dc36761ad1sm6766321pgl.33.2024.04.08.09.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:57:13 -0700 (PDT) Date: Mon, 8 Apr 2024 10:57:10 -0600 From: Mathieu Poirier To: Tanmay Shah Cc: Leonard Crestez , Bjorn Andersson , Michal Simek , Sarangdhar Joshi , Siddharth Gupta , Rishabh Bhatnagar , linux-remoteproc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] remoteproc: zynqmp: Add coredump support Message-ID: References: <6adf7a7c-c9ad-40ae-9e11-cc722c8049dd@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6adf7a7c-c9ad-40ae-9e11-cc722c8049dd@amd.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240408_095716_992318_2D2140F4 X-CRM114-Status: GOOD ( 38.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 04, 2024 at 03:14:48PM -0500, Tanmay Shah wrote: > Hello, > > Thanks for your patch. Patch looks good to me. > Please find some comments below. > > On 3/16/24 1:16 PM, Leonard Crestez wrote: > > Supporting remoteproc coredump requires the platform-specific driver to > > register coredump segments to be dumped. Do this by calling > > rproc_coredump_add_segment for every carveout. > > > > Also call rproc_coredump_set_elf_info when then rproc is created. If the > > ELFCLASS parameter is not provided then coredump fails with an error. > > Other drivers seem to pass EM_NONE for the machine argument but for me > > this shows a warning in gdb. Pass EM_ARM because this is an ARM R5. > > > > Signed-off-by: Leonard Crestez > > --- > > > > Tests were done by triggering an deliberate crash using remoteproc > > debugfs: echo 2 > /sys/kernel/debug/remoteproc/remoteproc0/crash > > > > This was tested using RPU apps which use RAM for everything so TCM dump > > was not verified. The freertos-gdb script package showed credible data: > > > > https://github.com/espressif/freertos-gdb > > Thanks for this testing. > > > > > The R5 cache is not flushed so RAM might be out of date which is > > actually very bad because information most relevant to determining the > > cause of a crash is lost. Possible workaround would be to flush caches > > in some sort of R5 crash handler? I don't think Linux can do anything > > about this limitation. > > > > Correct Linux can't. One workaround is that R5 firmware can mark > required memory regions as non-cachable in MPU setting. This way information > loss can be avoided. > > > The generated coredump doesn't contain registers, this seems to be a > > limitation shared with other rproc coredumps. It's not clear how the apu > > could access rpu registers on zynqmp, my only idea would be to use the > > coresight dap but that sounds difficult. > > Linux doesn't really have access to R5 control registers due to security. > Instead EEMI calls to platform management controller are used to control R5. > So R5 control register dump shouldn't needed. > > Mathieu, > I am okay to merge this patch. > Applied. Thanks, Mathieu > > > > --- > > drivers/remoteproc/xlnx_r5_remoteproc.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/remoteproc/xlnx_r5_remoteproc.c b/drivers/remoteproc/xlnx_r5_remoteproc.c > > index 4395edea9a64..cfbd97b89c26 100644 > > --- a/drivers/remoteproc/xlnx_r5_remoteproc.c > > +++ b/drivers/remoteproc/xlnx_r5_remoteproc.c > > @@ -484,10 +484,11 @@ static int add_mem_regions_carveout(struct rproc *rproc) > > of_node_put(it.node); > > return -ENOMEM; > > } > > > > rproc_add_carveout(rproc, rproc_mem); > > + rproc_coredump_add_segment(rproc, rmem->base, rmem->size); > > > > dev_dbg(&rproc->dev, "reserved mem carveout %s addr=%llx, size=0x%llx", > > it.node->name, rmem->base, rmem->size); > > i++; > > } > > @@ -595,10 +596,11 @@ static int add_tcm_carveout_split_mode(struct rproc *rproc) > > zynqmp_pm_release_node(pm_domain_id); > > goto release_tcm_split; > > } > > > > rproc_add_carveout(rproc, rproc_mem); > > + rproc_coredump_add_segment(rproc, da, bank_size); > > } > > > > return 0; > > > > release_tcm_split: > > @@ -674,10 +676,11 @@ static int add_tcm_carveout_lockstep_mode(struct rproc *rproc) > > goto release_tcm_lockstep; > > } > > > > /* If registration is success, add carveouts */ > > rproc_add_carveout(rproc, rproc_mem); > > + rproc_coredump_add_segment(rproc, da, bank_size); > > > > dev_dbg(dev, "TCM carveout lockstep mode %s addr=0x%llx, da=0x%x, size=0x%lx", > > bank_name, bank_addr, da, bank_size); > > } > > > > @@ -851,10 +854,12 @@ static struct zynqmp_r5_core *zynqmp_r5_add_rproc_core(struct device *cdev) > > if (!r5_rproc) { > > dev_err(cdev, "failed to allocate memory for rproc instance\n"); > > return ERR_PTR(-ENOMEM); > > } > > > > + rproc_coredump_set_elf_info(r5_rproc, ELFCLASS32, EM_ARM); > > + > > r5_rproc->auto_boot = false; > > r5_core = r5_rproc->priv; > > r5_core->dev = cdev; > > r5_core->np = dev_of_node(cdev); > > if (!r5_core->np) { > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel