Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3283415ybz; Sun, 19 Apr 2020 22:58:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIf4xSztMhuZAOqILmA7GKsEdr9+5Mw/fp69AQPNpdpcYWOwtXgeM9BAaEmeLHGy16/Gi/I X-Received: by 2002:a17:906:2284:: with SMTP id p4mr13566087eja.69.1587362330824; Sun, 19 Apr 2020 22:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587362330; cv=none; d=google.com; s=arc-20160816; b=VDFadO9ZCZCG89sQUlCa2bs3scI1CjpAxEh3SOeAzXCTxeGlsuECGFwVH+2ULjsjFE TVhTeYcNiOFmmt6uKhNyDsAhQ0DOhMKr/ufSG9VEikZZJq1TN8YPmAV48jdtVZOMaKBT rv6AG0fzFUTzWMOz3klVQ3gSpMX63dQn0oqGa2HZ7FX1FTDlRi/VcS0OHkxhzVKrovU4 jgGsOEmHfcVNoUKiNauOIInZ+EFDJWOcglSt/NgSfVAOz1Dk7JceVkgpeu9UDFn0NVll jlWGxGteqHrMJblB2KFJ8Dm/Q2vgKdkAPVZdYaqYD6Femm/ZcILArSIyHMVSeysBMgcO t88g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XOlYkW/8hIDyB8VhMd7iCQpxoA6ZLYFkm9KhScpGO1k=; b=zGZ6FAkwMUwIQMTp8zBVudJkSKpsG21M37lk+gU1pE88+Et21/7D9bqfWkcg6XiqEs Y2vrmEsFex6dScwaxiajfI/6DwEzo5S2MciZpTInRG7U376crQaR11r8MhmU0QLR7WMb jIBgsn7OB1LXEB9aCbszvJyefxw6HVDpR/4/TVDRvwhfbGOjI3xHYM1ih+FfAvoVP2cA dshF2NfCV0hjCEHd11xfMb9YuGgwwt/wNhqx7XRwB4KtX6BmCOML0GxD4eL2uX+EKhpk eLg/AVsZbFAwkw1qB23/SFrk7wR6Pjd9x6YzXpdeTyQjec2OTq81ZlZPWGqyyXHKWrvp ReQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gbcpG0/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si18441206ejk.442.2020.04.19.22.58.27; Sun, 19 Apr 2020 22:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="gbcpG0/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725988AbgDTF5Z (ORCPT + 99 others); Mon, 20 Apr 2020 01:57:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725825AbgDTF5Z (ORCPT ); Mon, 20 Apr 2020 01:57:25 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E375CC061A0C for ; Sun, 19 Apr 2020 22:57:24 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id h11so3544884plr.11 for ; Sun, 19 Apr 2020 22:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=XOlYkW/8hIDyB8VhMd7iCQpxoA6ZLYFkm9KhScpGO1k=; b=gbcpG0/49M1IDeB5++xI6+56FJK32zdttZi30hnGPyU25rr/bWEFdT94Z6yncL6veO 7WI8HxA5DDsukMkqiyitufF84unLtVQoDdRfy5dyPOxqMH90gLFav3vkSd5uSFodI2BG fDiYFDsgyTG+WttIRKelT7RLgljHr3c0jPsjlaiMhFzb9er/ywYSbtVln8bO+flPb0xE CHxoZ6XmbxK3Jn6JH4eXTQC9ASCvaqp9TSLFEt5Hh+04d1p5I9ipTo2ebJ+weQAeNSUd QwbPlNxes1wukkhrlGs0O5YTrAuk3XplKr9RMgL+Hi3+rlXdIC3j/0fFc2wNK3dnM3sO INLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=XOlYkW/8hIDyB8VhMd7iCQpxoA6ZLYFkm9KhScpGO1k=; b=j81ilDDReNTFxMzstCHYVQTqUJjjNFUGacqAG9V3/0dKIcKNYL9wXjVDLle4lNc3fN WENunE1WQ1vVtS+Xcg8XsPz81aM+4T0/ccXPE+BkeAqGCDAZ51QMO8tESGJTn+8WPkm1 ldDdc+v8dbsVpCuMrZ4nvuF1uhuQw1eY7zzbi4FaDLrlyDxttLGtiiA37B+d7U6akd4x hJEwdihpV72Aa3USPkDytFtThfYnlRzghrS5T/RknwYpjZQ/ey6dFyf48nX5gMeTlzC2 xPRWkCyq98aqEYu18VPYlTlJPjbD9ubfzcViDOf01IcEIRYly+uw0btZJiJ452pS6VYd /boA== X-Gm-Message-State: AGi0PuZRtMfziNVFcDwzGVpwS0oG2tnLdGw+qDK7jLlj/y540EKQTCaX +mxPJGGpfa/MtOSbkXXiixUCuA== X-Received: by 2002:a17:902:8ec7:: with SMTP id x7mr15277533plo.3.1587362244158; Sun, 19 Apr 2020 22:57:24 -0700 (PDT) Received: from builder.lan (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id 202sm56836pgf.41.2020.04.19.22.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 22:57:23 -0700 (PDT) Date: Sun, 19 Apr 2020 22:57:46 -0700 From: Bjorn Andersson To: Cl?ment Leger Cc: Mathieu Poirier , Andy Gross , Ohad Ben-Cohen , Maxime Coquelin , Alexandre Torgue , linux-arm-msm , linux-remoteproc , linux-kernel , linux-stm32 , linux-arm-kernel Subject: Re: [PATCH 1/2] remoteproc: add rproc_coredump_set_elf_info Message-ID: <20200420055746.GJ1516868@builder.lan> References: <20200410102433.2672-1-cleger@kalray.eu> <20200410102433.2672-2-cleger@kalray.eu> <20200417193837.GB6797@xps15> <1280711269.16158926.1587152627279.JavaMail.zimbra@kalray.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1280711269.16158926.1587152627279.JavaMail.zimbra@kalray.eu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 17 Apr 12:43 PDT 2020, Cl?ment Leger wrote: > ----- On 17 Apr, 2020, at 21:38, Mathieu Poirier mathieu.poirier@linaro.org wrote: > > > On Fri, Apr 10, 2020 at 12:24:32PM +0200, Clement Leger wrote: > >> This function allows drivers to correctly setup the coredump output > >> elf information. > >> > >> Signed-off-by: Clement Leger > >> --- > >> drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++-- > >> drivers/remoteproc/remoteproc_elf_loader.c | 3 -- > >> include/linux/remoteproc.h | 2 ++ > >> 3 files changed, 32 insertions(+), 5 deletions(-) > >> > >> diff --git a/drivers/remoteproc/remoteproc_core.c > >> b/drivers/remoteproc/remoteproc_core.c > >> index a9ac1d01e09b..382443bab583 100644 > >> --- a/drivers/remoteproc/remoteproc_core.c > >> +++ b/drivers/remoteproc/remoteproc_core.c > >> @@ -1562,6 +1562,28 @@ int rproc_coredump_add_custom_segment(struct rproc > >> *rproc, > >> } > >> EXPORT_SYMBOL(rproc_coredump_add_custom_segment); > >> > >> +/** > >> + * rproc_coredump_set_elf_info() - set coredump elf information > >> + * @rproc: handle of a remote processor > >> + * @class: elf class for coredump elf file > >> + * @size: elf machine for coredump elf file > > I just noticed that there is a typo, this should be "machine" and not "size". > Let me know if you'll fix it when applying. > Thanks for noticing, I fixed this up and applied the two patches. Thanks, Bjorn > Thanks, > > Cl?ment > > >> + * > >> + * Set elf information which will be used for coredump elf file. > >> + * > >> + * Return: 0 on success, negative errno on error. > >> + */ > >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine) > >> +{ > >> + if (class != ELFCLASS64 && class != ELFCLASS32) > >> + return -EINVAL; > >> + > >> + rproc->elf_class = class; > >> + rproc->elf_machine = machine; > >> + > >> + return 0; > >> +} > >> +EXPORT_SYMBOL(rproc_coredump_set_elf_info); > >> + > >> /** > >> * rproc_coredump() - perform coredump > >> * @rproc: rproc handle > >> @@ -1584,6 +1606,11 @@ static void rproc_coredump(struct rproc *rproc) > >> if (list_empty(&rproc->dump_segments)) > >> return; > >> > >> + if (class == ELFCLASSNONE) { > >> + dev_err(&rproc->dev, "Elf class is not set\n"); > >> + return; > >> + } > >> + > >> data_size = elf_size_of_hdr(class); > >> list_for_each_entry(segment, &rproc->dump_segments, node) { > >> data_size += elf_size_of_phdr(class) + segment->size; > >> @@ -1602,7 +1629,7 @@ static void rproc_coredump(struct rproc *rproc) > >> elf_hdr_init_ident(ehdr, class); > >> > >> elf_hdr_set_e_type(class, ehdr, ET_CORE); > >> - elf_hdr_set_e_machine(class, ehdr, EM_NONE); > >> + elf_hdr_set_e_machine(class, ehdr, rproc->elf_machine); > >> elf_hdr_set_e_version(class, ehdr, EV_CURRENT); > >> elf_hdr_set_e_entry(class, ehdr, rproc->bootaddr); > >> elf_hdr_set_e_phoff(class, ehdr, elf_size_of_hdr(class)); > >> @@ -2043,7 +2070,8 @@ struct rproc *rproc_alloc(struct device *dev, const char > >> *name, > >> rproc->name = name; > >> rproc->priv = &rproc[1]; > >> rproc->auto_boot = true; > >> - rproc->elf_class = ELFCLASS32; > >> + rproc->elf_class = ELFCLASSNONE; > >> + rproc->elf_machine = EM_NONE; > >> > >> device_initialize(&rproc->dev); > >> rproc->dev.parent = dev; > >> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c > >> b/drivers/remoteproc/remoteproc_elf_loader.c > >> index 16e2c496fd45..4869fb7d8fe4 100644 > >> --- a/drivers/remoteproc/remoteproc_elf_loader.c > >> +++ b/drivers/remoteproc/remoteproc_elf_loader.c > >> @@ -248,9 +248,6 @@ int rproc_elf_load_segments(struct rproc *rproc, const > >> struct firmware *fw) > >> memset(ptr + filesz, 0, memsz - filesz); > >> } > >> > >> - if (ret == 0) > >> - rproc->elf_class = class; > >> - > >> return ret; > >> } > >> EXPORT_SYMBOL(rproc_elf_load_segments); > >> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h > >> index ed127b2d35ca..d67eb5a40476 100644 > >> --- a/include/linux/remoteproc.h > >> +++ b/include/linux/remoteproc.h > >> @@ -515,6 +515,7 @@ struct rproc { > >> struct list_head dump_segments; > >> int nb_vdev; > >> u8 elf_class; > >> + u16 elf_machine; > >> }; > > > > Reviewed-by: Mathieu Poirier > > > >> > >> /** > >> @@ -619,6 +620,7 @@ int rproc_coredump_add_custom_segment(struct rproc *rproc, > >> struct rproc_dump_segment *segment, > >> void *dest), > >> void *priv); > >> +int rproc_coredump_set_elf_info(struct rproc *rproc, u8 class, u16 machine); > >> > >> static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) > >> { > >> -- > >> 2.17.1