mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Shawn N <shawnn@chromium.org>
Cc: Jon Hunter <jonathanh@nvidia.com>,
	Olof Johansson <olof@lixom.net>,
	Benson Leung <bleung@chromium.org>,
	Lee Jones <lee.jones@linaro.org>,
	linux-kernel@vger.kernel.org,
	Doug Anderson <dianders@chromium.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Gwendal Grignou <gwendal@chromium.org>,
	Enric Balletbo <enric.balletbo@collabora.co.uk>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v3] platform/chrome: Use proper protocol transfer function
Date: Tue, 19 Sep 2017 23:13:18 -0700	[thread overview]
Message-ID: <20170920061317.GB13616@google.com> (raw)
In-Reply-To: <CALaWCOPzT-BWu-YcMY+xEAWGRmvvVEoA64ceEK3zG3K-wajskQ@mail.gmail.com>

Hi,

On Tue, Sep 19, 2017 at 11:05:38PM -0700, Shawn N wrote:
> This is failing because our EC_CMD_GET_PROTOCOL_INFO host command is
> getting messed up, or the reply buffer is getting corrupted somehow.
> 
>                ec_dev->proto_version =
>                         min(EC_HOST_REQUEST_VERSION,
>                                         fls(proto_info->protocol_versions) - 1);
> 
> If proto_info->protocol_versions == 0 then ec_dev->proto_version will
> be assigned 0xffff. The logic here seems strange to me, if the EC is

Whoops...

> successfully replying to our v3 command then obviously it supports v3
> (maybe it will be useful someday if EC_HOST_REQUEST_VERSION is rev'd).
> Anyway, we need to figure out what is happening with our
> EC_HOST_REQUEST_VERSION host command.
> 
> On Tue, Sep 19, 2017 at 10:14 AM, Brian Norris <briannorris@chromium.org> wrote:
> > Hi Jon,
> >
> > On Tue, Sep 19, 2017 at 05:39:56PM +0100, Jon Hunter wrote:
> >> On 19/09/17 15:09, Shawn N wrote:
...
> > Furthermore, the only assignments to this 'proto_version' field look
> > like they're only writing one of 0, 2, 3, or
> >
> >    min(EC_HOST_REQUEST_VERSION, fls(proto_info->protocol_versions) - 1)
> >
> > . I don't see where 0xffff comes from.

...I'm an idiot. While the rvalue (the expression above) is an int (e.g,
-1), it's getting cast into a uint16_t (ec_dev->proto_version). So
that's where the 0xffff can come from.

Sorry if I misled you Shawn :(

Brian

  reply	other threads:[~2017-09-20  6:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 20:50 Brian Norris
2017-09-11 19:48 ` Benson Leung
2017-09-19 13:44 ` Jon Hunter
2017-09-19 14:09   ` Shawn N
2017-09-19 16:39     ` Jon Hunter
2017-09-19 17:03       ` Shawn N
2017-09-19 17:14       ` Brian Norris
2017-09-20  6:05         ` Shawn N
2017-09-20  6:13           ` Brian Norris [this message]
2017-09-20 20:22             ` Shawn N
2017-09-25 23:15               ` Shawn N
2017-09-26 15:40                 ` Jon Hunter
2017-11-14 15:56                   ` Jon Hunter
2017-11-14 15:59                     ` Shawn N
2017-10-10 13:35                 ` Jon Hunter
2017-10-10 15:33                   ` Shawn N
2017-10-10 16:52                     ` Doug Anderson
2017-11-07 11:28                       ` Jon Hunter
2017-11-07 17:22                         ` Doug Anderson
2017-11-08 10:20                           ` Jon Hunter
2017-11-08 16:45                             ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170920061317.GB13616@google.com \
    --to=briannorris@chromium.org \
    --cc=bleung@chromium.org \
    --cc=computersforpeace@gmail.com \
    --cc=dianders@chromium.org \
    --cc=enric.balletbo@collabora.co.uk \
    --cc=gwendal@chromium.org \
    --cc=jonathanh@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=shawnn@chromium.org \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome