Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3234565ybl; Sun, 26 Jan 2020 23:23:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxr5bbzY461k17SxejRBCHIOftZ08AZ2wfVfMBhieon8kl5ePiGPhFblLVh16GvylL/NKyn X-Received: by 2002:a05:6808:249:: with SMTP id m9mr5321605oie.5.1580109814989; Sun, 26 Jan 2020 23:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580109814; cv=none; d=google.com; s=arc-20160816; b=O9fVRQGrBfmSMHXfdX/SBrYsgqV9oSY9cHwpr/EmZ+PScIPtlKGxqGySIEM518HxPr Ej1CtapQ0vEhVxWngZ7LyJEBJBzJoQkAb1eMr+7gLDuj+WLHd8GMciawF6RXjF+2iX3F 0xdVqAr9hQfuxqWg+cN0j/uTenSPwPNfXFDq3Z1tcD/IUSjjQx73GxrPjcA83XO4KNZv h/Wg2P+ce4846RNwUFhjM3Y7j8YB5mhhDGoIyAydH47SGj9p+0iEhtZj1/9WFR2B+y2F H1FwZ9G3mksy7o9fl7hg77yNbWUB2/wHW4+CD2uuFZbrPlhRMA4e3ZKlwEYzfNRa1VMz 7QNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=HD7embOKTGy2LLNGpLKXcU93uxMMr7pmRlfkYXVY66E=; b=qvQRrsKqSwUmzwUSa16me4zyW/TsT/+BVGyeo0NsgbH2cvYdsd67t3gRyPj3BQsxmF n5d8tbKBRaWHFfk8Jdq1NMKOvNbHLkwvLChKDToGAafusjvAlG/9ul1O/JrfO25+DBDR FYIICGB3TV9w2cSdHu/PFPCHXXcXTipFTDonyNcJqWh5jiHllFs8No/XykXfUPVSaOqS Hejqdf0fFee5FuMxYfBfq8dEp8ITAHXDJEMIFPeBMmyvbVRQy2edHFopl0SD66bcyDRC IjdfV5vgArvKCsFR2sXpBXNwJj3/q+euF/nF0ggDtAdGNjJMzyLrC54orMCi4CgvB24Y qNZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xydVaDx8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si3345484oie.74.2020.01.26.23.23.23; Sun, 26 Jan 2020 23:23:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xydVaDx8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725975AbgA0HVb (ORCPT + 99 others); Mon, 27 Jan 2020 02:21:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:33544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725765AbgA0HVa (ORCPT ); Mon, 27 Jan 2020 02:21:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 96DDD20702; Mon, 27 Jan 2020 07:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580109690; bh=zyx7MlovBaHqREoEGe7StehB9D36LjrQuxtgzD7rRPQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xydVaDx8hefBeGTESOELkVmsgxqE3J6pdwmidoET0PXJShUFdUdhUXy4hnNC0Bxqm Fhu1FGEZN3GRB2RgPR+i/5jgWtkoYefIMC12NXonw+2dxmKbx2FIXT2c7L4MwERvKf vg3FF4WUxF1angQsK56VwR8a94/crfRbynhPvLnY= Date: Mon, 27 Jan 2020 08:21:27 +0100 From: Greg KH To: Manivannan Sadhasivam Cc: Jeffrey Hugo , arnd@arndb.de, smohanad@codeaurora.org, kvalo@codeaurora.org, bjorn.andersson@linaro.org, hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/16] bus: mhi: core: Add support for ringing channel/event ring doorbells Message-ID: <20200127072127.GA281402@kroah.com> References: <20200123111836.7414-1-manivannan.sadhasivam@linaro.org> <20200123111836.7414-6-manivannan.sadhasivam@linaro.org> <20200125134631.GA3518689@kroah.com> <20200127071052.GB4768@mani> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127071052.GB4768@mani> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 27, 2020 at 12:40:52PM +0530, Manivannan Sadhasivam wrote: > On Sat, Jan 25, 2020 at 02:46:31PM +0100, Greg KH wrote: > > On Fri, Jan 24, 2020 at 03:51:12PM -0700, Jeffrey Hugo wrote: > > > > +struct mhi_event_ctxt { > > > > + u32 reserved : 8; > > > > + u32 intmodc : 8; > > > > + u32 intmodt : 16; > > > > + u32 ertype; > > > > + u32 msivec; > > > > + > > > > + u64 rbase __packed __aligned(4); > > > > + u64 rlen __packed __aligned(4); > > > > + u64 rp __packed __aligned(4); > > > > + u64 wp __packed __aligned(4); > > > > +}; > > > > > > This is the struct that is shared with the device, correct? Surely it needs > > > to be packed then? Seems like you'd expect some padding between msivec and > > > rbase on a 64-bit system otherwise, which is probably not intended. > > > > > > Also I strongly dislike bitfields in structures which are shared with > > > another system since the C specification doesn't define how they are > > > implemented, therefore you can run into issues where different compilers > > > decide to implement the actual backing memory differently. I know its less > > > convinent, but I would prefer the use of bitmasks for these fields. > > > > You have to use bitmasks in order for all endian cpus to work properly > > here, so that needs to be fixed. > > > > Okay. > > > Oh, and if these values are in hardware, then the correct types also > > need to be used (i.e. __u32 and __u64). > > > > I thought the __* prefix types are only for sharing with userspace... > Could you please clarify why it is needed here? It crosses the kernel boundry, so it needs to use those types. This is not a new requirement, has been there for decades. greg k-h