Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753985AbdFVXif (ORCPT ); Thu, 22 Jun 2017 19:38:35 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33958 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752714AbdFVXie (ORCPT ); Thu, 22 Jun 2017 19:38:34 -0400 Date: Thu, 22 Jun 2017 16:38:28 -0700 From: Benson Leung To: Enric Balletbo i Serra Cc: olof@lixom.net, bleung@chromium.org, linux-kernel@vger.kernel.org, lee.jones@linaro.org, Nicolas Boichat , bleung@google.com Subject: Re: [PATCH RESEND 04/13] mfd: cros_ec: Add support for dumping panic information Message-ID: <20170622233828.GA125744@decatoncale.mtv.corp.google.com> References: <20170516161319.13257-1-enric.balletbo@collabora.com> <20170516161319.13257-5-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <20170516161319.13257-5-enric.balletbo@collabora.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4442 Lines: 155 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Enric, On Tue, May 16, 2017 at 06:13:10PM +0200, Enric Balletbo i Serra wrote: > From: Nicolas Boichat >=20 > This dumps the EC panic information from the previous reboot. >=20 > Similar to the information presented by ectool panicinfo, except > that we do not bother doing any parsing (we should write a small > offline tool for that). >=20 > Signed-off-by: Nicolas Boichat > Reviewed-by: Guenter Roeck > Tested-by: Enric Balletbo i Serra Signed-off-by: Benson Leung Applied. Thanks. > --- > drivers/platform/chrome/cros_ec_debugfs.c | 54 +++++++++++++++++++++++++= ++++++ > 1 file changed, 54 insertions(+) >=20 > diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform= /chrome/cros_ec_debugfs.c > index f8195bb..8133c33 100644 > --- a/drivers/platform/chrome/cros_ec_debugfs.c > +++ b/drivers/platform/chrome/cros_ec_debugfs.c > @@ -47,15 +47,19 @@ > * @log_mutex: mutex to protect circular buffer > * @log_wq: waitqueue for log readers > * @log_poll_work: recurring task to poll EC for new console log data > + * @panicinfo_blob: panicinfo debugfs blob > */ > struct cros_ec_debugfs { > struct cros_ec_dev *ec; > struct dentry *dir; > + /* EC log */ > struct circ_buf log_buffer; > struct cros_ec_command *read_msg; > struct mutex log_mutex; > wait_queue_head_t log_wq; > struct delayed_work log_poll_work; > + /* EC panicinfo */ > + struct debugfs_blob_wrapper panicinfo_blob; > }; > =20 > /* > @@ -308,6 +312,52 @@ static void cros_ec_cleanup_console_log(struct cros_= ec_debugfs *debug_info) > } > } > =20 > +static int cros_ec_create_panicinfo(struct cros_ec_debugfs *debug_info) > +{ > + struct cros_ec_device *ec_dev =3D debug_info->ec->ec_dev; > + int ret; > + struct cros_ec_command *msg; > + int insize; > + > + insize =3D ec_dev->max_response; > + > + msg =3D devm_kzalloc(debug_info->ec->dev, > + sizeof(*msg) + insize, GFP_KERNEL); > + if (!msg) > + return -ENOMEM; > + > + msg->command =3D EC_CMD_GET_PANIC_INFO; > + msg->insize =3D insize; > + > + ret =3D cros_ec_cmd_xfer(ec_dev, msg); > + if (ret < 0) { > + dev_warn(debug_info->ec->dev, "Cannot read panicinfo.\n"); > + ret =3D 0; > + goto free; > + } > + > + /* No panic data */ > + if (ret =3D=3D 0) > + goto free; > + > + debug_info->panicinfo_blob.data =3D msg->data; > + debug_info->panicinfo_blob.size =3D ret; > + > + if (!debugfs_create_blob("panicinfo", > + S_IFREG | S_IRUGO, > + debug_info->dir, > + &debug_info->panicinfo_blob)) { > + ret =3D -ENOMEM; > + goto free; > + } > + > + return 0; > + > +free: > + devm_kfree(debug_info->ec->dev, msg); > + return ret; > +} > + > int cros_ec_debugfs_init(struct cros_ec_dev *ec) > { > struct cros_ec_platform *ec_platform =3D dev_get_platdata(ec->dev); > @@ -324,6 +374,10 @@ int cros_ec_debugfs_init(struct cros_ec_dev *ec) > if (!debug_info->dir) > return -ENOMEM; > =20 > + ret =3D cros_ec_create_panicinfo(debug_info); > + if (ret) > + goto remove_debugfs; > + > ret =3D cros_ec_create_console_log(debug_info); > if (ret) > goto remove_debugfs; > --=20 > 2.9.3 >=20 --=20 Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJZTFT0AAoJEB8J9XsKL+ZYcEkP/RJm7QnMjmyPjL56U0WDzCvt ITsWIM0XM73hOHMwKXZl44PddAsPz1BgvNTdgfvgkFPouQeVXRuyuKsaMkZPyujn 4604s7fD7nyZ+9fMdisEtgoYb35cTYgvpEtwjaEKgwEcbUIkDK9R1DuS30cOEsAU pyIdPLrSYqAwIHYAGvHQKf/Cta1BBLqzWqlf59Ve4ppOCimsbPoBhTNmmYqpeBnm km1S0vIBj/tA88yO1GixyufxU7R6ernMxFIUyRUJJMTbzQc4rJz6kDuiTVMG5PAa Tacq4gcnqWmCgGaJCxOnHwBAnsBfk5A0W/go8Q+scqsdaV+6Iq6Q9iMWYLOtj1gW 6NE7eH7Y2SaIMIU21hVQCT9Shq1ruCpnhp3FSzVOOA/YMYLoIdjGW82AUZTDaThm JcFtfdnHB683Mfe5eKLZ/0yDU3fG+KrIkpw45NX0klHEGuK6XzIiMi67F8A/Ei5q XxFBMKmMSJhLlxLbcYFWj91seUEA+OUal8n1do4tJlxuNhKnipXV+cxB7SYh7SAg Cwmx/Jgo6pavZw5yKnchHyZBq+ci9h9EsOTZbuROZjJMAV/P5ETlVhyTwsYRkHDV Yu+kTnAToACP6w8QdG0yIzTs68itfjw8au8qOk7Ml3c8HdJYViTF7onKHvv7MhBF wdpW8WURC0ePShQJmVgT =DWzE -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm--