Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp524060rdb; Tue, 5 Dec 2023 11:45:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVwFfJ/9wW4MWt5Y3cZzhy6v3qHbHDY9sA52ZY+lp3J6/ac2N17ZpQQAeIw7enyJY2c93+ X-Received: by 2002:a05:6a20:7d86:b0:18f:1a27:11dd with SMTP id v6-20020a056a207d8600b0018f1a2711ddmr4277304pzj.92.1701805531064; Tue, 05 Dec 2023 11:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701805531; cv=none; d=google.com; s=arc-20160816; b=aF0l5a+pvuaaNf5FWcXtOM3bh0almqtzy0nHPWHv4auILW6PuxsenjdO5aTV3wN+WL WcPrljTjThtq/1kRxKWk7kqz2hy94wUROixZngtZOdTyBZ7LKhJgDdxnx7v++z4LgyNU wcfDSoi/wTetUoefxriMQica5RiWWEWya/+CXx75Zu3Wvm202nT/AEljOuET2Gv9caOO TJg4jscRKvfluaBAfkzAChEUncxdhH55aJT7sbHCls0XIRvtvgPSh6O4+EY8+GF3YtKY +9o9y3gUxwHNJPFxqMkmoVtO3qHM6+asXkBYyWsqAPMh5UqqNFCN7Gse+QknLGnsJxvZ 2IOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YwsKIKQrLaNOsOjZ7im0s5OrH8RyzcnSRvi0a6r+rUs=; fh=F6vrVq0gA9HfYgZYmVgqLgKaOiLBASMopFfTB7i9Kts=; b=TGtmzzPc8t8kgI/dRbDbv53EqRJQfFon8MVJwdp/CSh1GGMXVaejrGurbLL9jmeEqk guRuaVpGTS8zmwGYGsvwLXJ4YieBgPPQh7CVLZXR9xqxiTB5bm5QzkT2IVIdDtaH7moz ETBwmjOLm69yCvOD1k9XPZVWN50SXi/CkeTgEuUhc+ColwFxMSCc2j6IhrztJDIgfgim Qrs3YMsXSnG25iH4lVI+7x6BIzu4oOWFJuLKvC2OWDU8KHyg28ZHB6nV+9Hsxs563XMc OBuuVGlRqvvfwkWghFO2Rt1TjDoN2L9HTT/bPvVSZgtaLQkBPZhhBzhuj06EkfDDSRHL JQyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CCozMJ3Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e2-20020a656882000000b005c66d702780si5282843pgt.69.2023.12.05.11.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 11:45:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CCozMJ3Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 6FA7181E1421; Tue, 5 Dec 2023 11:45:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbjLETpM (ORCPT + 99 others); Tue, 5 Dec 2023 14:45:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjLETpL (ORCPT ); Tue, 5 Dec 2023 14:45:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 954CC183 for ; Tue, 5 Dec 2023 11:45:17 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 037F4C433C7; Tue, 5 Dec 2023 19:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1701805516; bh=2Pc1SUSOg33xNmlAlMr3NhuJ02ZZaNiPd6NG+yOqZnQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CCozMJ3YI18rqWdF4BLcgJdxVToMXDJ4sQXO6U1BhJFjEbZ0kEbZM9DE03aOZ2wG4 n+hCxNdziZm3MaVfCZkYMuGr/VXGPXPvYEWZVza+VEfjcNJ9pc4vin+S/bpcdpEFiq hwiz/PCNf2gY9SHIHtoBxjkIiytMrL8QEga3zx30= Date: Wed, 6 Dec 2023 04:45:14 +0900 From: Greg KH To: Ayush Singh Cc: Johan Hovold , greybus-dev@lists.linaro.org, elder@kernel.org, linux-kernel@vger.kernel.org, jkridner@beagleboard.org, kernel test robot Subject: Re: [PATCH V3] greybus: gb-beagleplay: Ensure le for values in transport Message-ID: <2023120616-rely-naturist-01db@gregkh> References: <20231204131008.384583-1-ayushdevel1325@gmail.com> <7ead544b-9234-483f-aacb-55ed05b01fa3@gmail.com> <2023120515-mongrel-undertook-6e5a@gregkh> <4cafbb5a-8ecd-407e-81a0-76d6505d013b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4cafbb5a-8ecd-407e-81a0-76d6505d013b@gmail.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 11:45:28 -0800 (PST) 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 > > > > > Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/ > > > > > Signed-off-by: Ayush Singh > > > > > --- > > > > > 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