[{"id":1772709,"web_url":"http://patchwork.ozlabs.org/comment/1772709/","msgid":"<639a6e47-fc9e-c05c-8a92-c6198ec37212@nvidia.com>","list_archive_url":null,"date":"2017-09-21T11:19:10","subject":"Re: [PATCH 1/4] firmware: tegra: propagate error code to caller","submitter":{"id":66273,"url":"http://patchwork.ozlabs.org/api/people/66273/","name":"Jon Hunter","email":"jonathanh@nvidia.com"},"content":"On 07/09/17 10:31, Timo Alho wrote:\n> Response messages from Tegra BPMP firmware contain an error return\n> code as the first word of payload. The error code is used to indicate\n> incorrectly formatted request message or use of non-existing resource\n> (clk, reset, powergate) identifier. Current implementation of\n> tegra_bpmp_transfer() ignores this code and does not pass it to\n> caller. Fix this by adding an extra struct member to\n> tegra_bpmp_message and populate that with return code.\n> \n> Signed-off-by: Timo Alho <talho@nvidia.com>\n> ---\n>  drivers/firmware/tegra/bpmp.c | 22 ++++++++++++++++------\n>  include/soc/tegra/bpmp.h      |  1 +\n>  2 files changed, 17 insertions(+), 6 deletions(-)\n> \n> diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c\n> index 73ca55b..33683b5 100644\n> --- a/drivers/firmware/tegra/bpmp.c\n> +++ b/drivers/firmware/tegra/bpmp.c\n> @@ -194,16 +194,24 @@ static int tegra_bpmp_wait_master_free(struct tegra_bpmp_channel *channel)\n>  }\n>  \n>  static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,\n> -\t\t\t\t\t void *data, size_t size)\n> +\t\t\t\t\t void *data, size_t size, int *ret)\n>  {\n> +\tint err;\n> +\n>  \tif (data && size > 0)\n>  \t\tmemcpy(data, channel->ib->data, size);\n>  \n> -\treturn tegra_ivc_read_advance(channel->ivc);\n> +\terr = tegra_ivc_read_advance(channel->ivc);\n> +\tif (err < 0)\n> +\t\treturn err;\n> +\n> +\t*ret = channel->ib->code;\n> +\n> +\treturn 0;\n>  }\n>  \n>  static ssize_t tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,\n> -\t\t\t\t       void *data, size_t size)\n> +\t\t\t\t       void *data, size_t size, int *ret)\n>  {\n>  \tstruct tegra_bpmp *bpmp = channel->bpmp;\n>  \tunsigned long flags;\n> @@ -217,7 +225,7 @@ static ssize_t tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,\n>  \t}\n>  \n>  \tspin_lock_irqsave(&bpmp->lock, flags);\n> -\terr = __tegra_bpmp_channel_read(channel, data, size);\n> +\terr = __tegra_bpmp_channel_read(channel, data, size, ret);\n>  \tclear_bit(index, bpmp->threaded.allocated);\n>  \tspin_unlock_irqrestore(&bpmp->lock, flags);\n>  \n> @@ -337,7 +345,8 @@ int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,\n>  \tif (err < 0)\n>  \t\treturn err;\n>  \n> -\treturn __tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size);\n> +\treturn __tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size,\n> +\t\t\t\t\t &msg->rx.ret);\n>  }\n>  EXPORT_SYMBOL_GPL(tegra_bpmp_transfer_atomic);\n>  \n> @@ -371,7 +380,8 @@ int tegra_bpmp_transfer(struct tegra_bpmp *bpmp,\n>  \tif (err == 0)\n>  \t\treturn -ETIMEDOUT;\n>  \n> -\treturn tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size);\n> +\treturn tegra_bpmp_channel_read(channel, msg->rx.data, msg->rx.size,\n> +\t\t\t\t       &msg->rx.ret);\n>  }\n>  EXPORT_SYMBOL_GPL(tegra_bpmp_transfer);\n>  \n> diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h\n> index 9ba6522..57519f4 100644\n> --- a/include/soc/tegra/bpmp.h\n> +++ b/include/soc/tegra/bpmp.h\n> @@ -110,6 +110,7 @@ struct tegra_bpmp_message {\n>  \tstruct {\n>  \t\tvoid *data;\n>  \t\tsize_t size;\n> +\t\tint ret;\n>  \t} rx;\n>  };\n\nLooks good to me ...\n\nAcked-by: Jon Hunter <jonathanh@nvidia.com>\n\nCheers\nJon","headers":{"Return-Path":"<linux-tegra-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-tegra-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyZ0675Qzz9t3m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 21:20:06 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751652AbdIULUF (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 21 Sep 2017 07:20:05 -0400","from hqemgate15.nvidia.com ([216.228.121.64]:14720 \"EHLO\n\thqemgate15.nvidia.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751581AbdIULUF (ORCPT\n\t<rfc822;linux-tegra@vger.kernel.org>);\n\tThu, 21 Sep 2017 07:20:05 -0400","from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by\n\thqemgate15.nvidia.com\n\tid <B59c3a0460001>; Thu, 21 Sep 2017 04:19:34 -0700","from HQMAIL103.nvidia.com ([172.20.161.6])\n\tby hqpgpgate102.nvidia.com (PGP Universal service);\n\tThu, 21 Sep 2017 04:19:33 -0700","from UKMAIL101.nvidia.com (10.26.138.13) by HQMAIL103.nvidia.com\n\t(172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1293.2;\n\tThu, 21 Sep 2017 11:19:14 +0000","from [10.21.132.144] (10.21.132.144) by UKMAIL101.nvidia.com\n\t(10.26.138.13) with Microsoft SMTP Server (TLS) id 15.0.1293.2;\n\tThu, 21 Sep 2017 11:19:10 +0000"],"X-PGP-Universal":"processed;\n\tby hqpgpgate102.nvidia.com on Thu, 21 Sep 2017 04:19:33 -0700","Subject":"Re: [PATCH 1/4] firmware: tegra: propagate error code to caller","To":"Timo Alho <talho@nvidia.com>, <thierry.reding@gmail.com>","CC":"<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>","References":"<cover.1504776489.git.talho@nvidia.com>\n\t<c349d38a8cb1d00a4dc11d6aa286fb392017bc8c.1504776489.git.talho@nvidia.com>","From":"Jon Hunter <jonathanh@nvidia.com>","Message-ID":"<639a6e47-fc9e-c05c-8a92-c6198ec37212@nvidia.com>","Date":"Thu, 21 Sep 2017 12:19:10 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<c349d38a8cb1d00a4dc11d6aa286fb392017bc8c.1504776489.git.talho@nvidia.com>","X-Originating-IP":"[10.21.132.144]","X-ClientProxiedBy":"UKMAIL102.nvidia.com (10.26.138.15) To\n\tUKMAIL101.nvidia.com (10.26.138.13)","Content-Type":"text/plain; charset=\"utf-8\"","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Sender":"linux-tegra-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-tegra.vger.kernel.org>","X-Mailing-List":"linux-tegra@vger.kernel.org"}},{"id":1788227,"web_url":"http://patchwork.ozlabs.org/comment/1788227/","msgid":"<20171017104124.GD30589@ulmo>","list_archive_url":null,"date":"2017-10-17T10:41:24","subject":"Re: [PATCH 1/4] firmware: tegra: propagate error code to caller","submitter":{"id":26234,"url":"http://patchwork.ozlabs.org/api/people/26234/","name":"Thierry Reding","email":"thierry.reding@gmail.com"},"content":"On Thu, Sep 07, 2017 at 12:31:01PM +0300, Timo Alho wrote:\n> Response messages from Tegra BPMP firmware contain an error return\n> code as the first word of payload. The error code is used to indicate\n> incorrectly formatted request message or use of non-existing resource\n> (clk, reset, powergate) identifier. Current implementation of\n> tegra_bpmp_transfer() ignores this code and does not pass it to\n> caller. Fix this by adding an extra struct member to\n> tegra_bpmp_message and populate that with return code.\n> \n> Signed-off-by: Timo Alho <talho@nvidia.com>\n> ---\n>  drivers/firmware/tegra/bpmp.c | 22 ++++++++++++++++------\n>  include/soc/tegra/bpmp.h      |  1 +\n>  2 files changed, 17 insertions(+), 6 deletions(-)\n\nApplied, thanks.\n\nThierry","headers":{"Return-Path":"<linux-tegra-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-tegra-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"RWL9hPkc\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yGWvY56Vfz9s9Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 17 Oct 2017 21:41:29 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755677AbdJQKl2 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 17 Oct 2017 06:41:28 -0400","from mail-qt0-f194.google.com ([209.85.216.194]:51724 \"EHLO\n\tmail-qt0-f194.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753917AbdJQKl1 (ORCPT\n\t<rfc822;linux-tegra@vger.kernel.org>);\n\tTue, 17 Oct 2017 06:41:27 -0400","by mail-qt0-f194.google.com with SMTP id h4so2416879qtk.8;\n\tTue, 17 Oct 2017 03:41:27 -0700 (PDT)","from localhost\n\t(p200300E41BE4FD00CEAD5B94E1CFD280.dip0.t-ipconnect.de.\n\t[2003:e4:1be4:fd00:cead:5b94:e1cf:d280])\n\tby smtp.gmail.com with ESMTPSA id\n\tz187sm5728416qke.0.2017.10.17.03.41.25\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 17 Oct 2017 03:41:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to:user-agent;\n\tbh=6m7b4OrBTLPTLZ/VXSKc7Ze0ynFyzHsaZn2t205oezQ=;\n\tb=RWL9hPkccGoL8pMR4rA9DFfhLMpcHpJcldpXFpS8XPexL3PBq1bMuJUMns3ZFpjSwz\n\tUd3G9uK5VJty+rm2jZBFk8rnV+09AqdjeQLsA1MLjRDUonZSPBJMU4N7cRjRIlMfVnlh\n\tr8kxGLiW6WLGaiFoqOcgt3fOy7LTPFxD67sX05zkNyTSlWSKctSKGJR6+wuiTT9LgACD\n\tMd/BlRdDc1gg0ateTDOfAubQusWwjWhLnWSfbHQ6gdMUz7GwW2P6HCZbPGuyh+LIEIsU\n\ttNecj0mlV1wUgNfqUrZBEM19Hs0R40+62nk1IzLI4B4QGlhkW6vZ3vgq90IhVr5Xw1pe\n\t63rg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=6m7b4OrBTLPTLZ/VXSKc7Ze0ynFyzHsaZn2t205oezQ=;\n\tb=sPiLR+EaTCn1BRL2TiLU1UoI1tk+OW4qcePmNmrBZiI7JX+RLVv3kNjoichX17BRaA\n\t7jcyjqhc75XuxEuh5KzC0SWlVjInPa8Wxl9ppvzPgm6goBh5slTlksM6x6jiUnz092jk\n\t0JUi9H2TDNTxOONq3cgmVI8GOEDtl0H5sueJyDMtjO0T/gGmQzImBL49l5ZhJwBN0hNo\n\ty0Kit/ntHLDyf6PhmJ5JwZkgMRRhcp4Yr85ySttFlxR5fCGGDbO3UQ4fQ/gCW0s1M5Wn\n\tkp/zqVniojRakOsgui4gAFAd7VDzUErGfKFdGCeIUEXkLzoOrcSRj9SmrJeudNJ2chrz\n\tfsNw==","X-Gm-Message-State":"AMCzsaX9qFOTFWieFhvL8Sv4aXP7xY5KKNp2O+zKI+nfoapko8TveF73\n\tJ8VHJ5syLLz69uKhmDJYifQSWw==","X-Google-Smtp-Source":"ABhQp+RJ7oGYhsDY1AKbzOVJjfUmb3B8rEp5vpLvLGRkGLI1czr6sTdogcjhucgcbkyV++xts67s6w==","X-Received":"by 10.200.54.66 with SMTP id n2mr18722358qtb.325.1508236886867; \n\tTue, 17 Oct 2017 03:41:26 -0700 (PDT)","Date":"Tue, 17 Oct 2017 12:41:24 +0200","From":"Thierry Reding <thierry.reding@gmail.com>","To":"Timo Alho <talho@nvidia.com>","Cc":"linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org","Subject":"Re: [PATCH 1/4] firmware: tegra: propagate error code to caller","Message-ID":"<20171017104124.GD30589@ulmo>","References":"<cover.1504776489.git.talho@nvidia.com>\n\t<c349d38a8cb1d00a4dc11d6aa286fb392017bc8c.1504776489.git.talho@nvidia.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"0IvGJv3f9h+YhkrH\"","Content-Disposition":"inline","In-Reply-To":"<c349d38a8cb1d00a4dc11d6aa286fb392017bc8c.1504776489.git.talho@nvidia.com>","User-Agent":"Mutt/1.9.1 (2017-09-22)","Sender":"linux-tegra-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-tegra.vger.kernel.org>","X-Mailing-List":"linux-tegra@vger.kernel.org"}}]