From: Greg KH <gregkh@linuxfoundation.org>
To: Ayush Singh <ayushdevel1325@gmail.com>
Cc: Johan Hovold <johan@kernel.org>,
greybus-dev@lists.linaro.org, elder@kernel.org,
linux-kernel@vger.kernel.org, jkridner@beagleboard.org,
kernel test robot <yujie.liu@intel.com>
Subject: Re: [PATCH V3] greybus: gb-beagleplay: Ensure le for values in transport
Date: Wed, 6 Dec 2023 04:45:14 +0900 [thread overview]
Message-ID: <2023120616-rely-naturist-01db@gregkh> (raw)
In-Reply-To: <4cafbb5a-8ecd-407e-81a0-76d6505d013b@gmail.com>
On Tue, Dec 05, 2023 at 05:15:33PM +0530, Ayush Singh wrote:
>
> On 12/5/23 05:44, Greg KH wrote:
> > On Mon, Dec 04, 2023 at 09:58:55PM +0530, Ayush Singh wrote:
> > > On 12/4/23 19:42, Johan Hovold wrote:
> > > > On Mon, Dec 04, 2023 at 06:40:06PM +0530, Ayush Singh wrote:
> > > > > Ensure that the following values are little-endian:
> > > > > - header->pad (which is used for cport_id)
> > > > > - header->size
> > > > >
> > > > > Fixes: ec558bbfea67 ("greybus: Add BeaglePlay Linux Driver")
> > > > > Reported-by: kernel test robot <yujie.liu@intel.com>
> > > > > Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/
> > > > > Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
> > > > > ---
> > > > > V3:
> > > > > - Fix endiness while sending.
> > > > > V2: https://lists.linaro.org/archives/list/greybus-dev@lists.linaro.org/thread/L53UN5ROSG4M6OE7CU5Y3L5F44T6ZPCC/
> > > > > - Ensure endianess for header->pad
> > > > > V1: https://lists.linaro.org/archives/list/greybus-dev@lists.linaro.org/message/K7UJ6PEAWBLNDMHLT2IO6OP5LQISHRUO/
> > > > >
> > > > > drivers/greybus/gb-beagleplay.c | 9 +++++----
> > > > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c
> > > > > index 43318c1993ba..8b21c3e1e612 100644
> > > > > --- a/drivers/greybus/gb-beagleplay.c
> > > > > +++ b/drivers/greybus/gb-beagleplay.c
> > > > > @@ -93,9 +93,9 @@ static void hdlc_rx_greybus_frame(struct gb_beagleplay *bg, u8 *buf, u16 len)
> > > > > memcpy(&cport_id, hdr->pad, sizeof(cport_id));
> > > > > dev_dbg(&bg->sd->dev, "Greybus Operation %u type %X cport %u status %u received",
> > > > > - hdr->operation_id, hdr->type, cport_id, hdr->result);
> > > > > + hdr->operation_id, hdr->type, le16_to_cpu(cport_id), hdr->result);
> > > > > - greybus_data_rcvd(bg->gb_hd, cport_id, buf, len);
> > > > > + greybus_data_rcvd(bg->gb_hd, le16_to_cpu(cport_id), buf, len);
> > > > This looks broken; a quick against mainline (and linux-next) check shows
> > > > cport_id to be u16.
> > > >
> > > > I think you want get_unaligned_le16() or something instead of that
> > > > memcpy() above.
> > > Thanks, will do.
> > > > But that just begs the question: why has this driver repurposed the pad
> > > > bytes like this? The header still says that these shall be set to zero.
> > > So, the reason is multiplexing. The original gbridge setup used to do this,
> > > so I followed it when I moved gbridge to the coprocessor (during GSoC).
> > >
> > > Using the padding for storing cport information allows not having to wrap
> > > the message in some other format at the two transport layers (UART and TCP
> > > sockets) beagle connect is using.This also seems better than trying to do
> > > something bespoke, especially since the padding bytes are not being used for
> > > anything else.
> > >
> > > The initial spec was for project Ara (modular smartphone), so the current
> > > use for IoT is significantly different from the initial goals of the
> > > protocol. Maybe a future version of the spec can be more focused on IoT, but
> > > that will probably only happen once it has proven somewhat useful in this
> > > space.
> > Please don't violate the spec today this way, I missed that previously,
> > that's not ok. We can change the spec for new things if you need it,
> > but to not follow it, and still say it is "greybus" isn't going to work
> > and will cause problems in the long-run.
> >
> > Should I just disable the driver for now until this is fixed up?
> >
> > thanks,
> >
> > greg k-h
>
> Well, I will look into some ways to pass along the cport information (maybe
> using a wrapper over greybus message) for now. However, I would prefer
> having some bytes in greybus messages reserved for passing around this
> information in a transport agnostic way.
I'm confused, what exactly is needed here to be sent that isn't in the
existing message definition.
And as to your original statement, the protocol definition was not
designed for any specific use case that would make IoT "special" here
that I can see. It was designed to provide a discoverable way to
describe and control hardware on an unknown transport layer for devices
that are not discoverable by definition (serial, i2c, etc.)
The fact that we implemented this on both USB and unipro successfully
provided that the transport layer for the data should be working and
agnositic.
thanks,
greg k-h
next prev parent reply other threads:[~2023-12-05 19:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 13:10 [PATCH V3] greybus: gb-beagleplay: Ensure le for values in transport Ayush Singh
2023-12-04 14:12 ` Johan Hovold
2023-12-04 16:28 ` Ayush Singh
2023-12-05 0:14 ` Greg KH
2023-12-05 11:45 ` Ayush Singh
2023-12-05 19:45 ` Greg KH [this message]
2023-12-05 20:32 ` Ayush Singh
2023-12-06 14:52 ` Alex Elder
2023-12-06 15:43 ` Ayush Singh
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=2023120616-rely-naturist-01db@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ayushdevel1325@gmail.com \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=jkridner@beagleboard.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yujie.liu@intel.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