From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ED1CC432BE for ; Fri, 27 Aug 2021 04:39:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0ECAF60F58 for ; Fri, 27 Aug 2021 04:39:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0ECAF60F58 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeconstruct.com.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FWb2spp16G9s7PsMK2Ypl1tM2SnFdXUZlkbIebE9wkU=; b=4Wg8QMNpcsLAMb yBfelJGuPxhb/oAhtft47htfqI4/8hTr7vnaiG95fBPS01RMF175fkU7HJD0XsyZsqyFAqr+itMRg f78rNL6j2KoElQrB7gM6/B7nA4tos58PyQF59ke6LMFrtiZN9PJLFlBMxlrF5UwFyC7J9QKBeSajh rELrN15idmydEat1UmNadqZKYLQX25TcBvtUE5hGDajLisP+HMny2LcJzDzbl//YJMA/LfU/QHB5p BBS0DrGhKZDPON5p3CaDETdVGo4hrB3m1PmzYDRurUsnB0jlKHL+OmGzsXrIiyqEiEKCWKEG549/3 QEpku104vmRollltGQ2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJTbi-00BYu4-Dg; Fri, 27 Aug 2021 04:36:46 +0000 Received: from pi.codeconstruct.com.au ([203.29.241.158] helo=codeconstruct.com.au) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJTbe-00BYtX-Qi for linux-arm-kernel@lists.infradead.org; Fri, 27 Aug 2021 04:36:44 +0000 Received: from pecola.lan (unknown [159.196.93.152]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id F3B692012C; Fri, 27 Aug 2021 12:36:37 +0800 (AWST) Message-ID: <3f2feea6c2fb21c2fdcb419cdc7ceddf3ade06ee.camel@codeconstruct.com.au> Subject: Re: [PATCH v3 3/4] soc: aspeed: Add eSPI driver From: Jeremy Kerr To: ChiaWei Wang , "joel@jms.id.au" , "robh+dt@kernel.org" , "andrew@aj.id.au" , "linux-aspeed@lists.ozlabs.org" , "openbmc@lists.ozlabs.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Date: Fri, 27 Aug 2021 12:36:37 +0800 In-Reply-To: References: <20210826061623.6352-1-chiawei_wang@aspeedtech.com> <20210826061623.6352-4-chiawei_wang@aspeedtech.com> <7e7378c49ecfb21fef6a0640f92c1b3a7a5878d0.camel@codeconstruct.com.au> User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210826_213643_159271_8C6730DA X-CRM114-Status: GOOD ( 21.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Chiawei, > The eSPI slave device comprises four channels, where each of them has > individual functionality. Putting the four channels driver code into a > single file makes it hard to maintain and trace. Yep, understood. > We did consider to make them standard .c files. > But it requires to export channel functions into kernel space > although they are dedicated only to this eSPI driver. What do you mean by "export into kernel space" here? The function prototypes need to be available to your main (-ctrl.c) file, regardless of whether you're putting the entire functions in a header file, or just the prototype. There's doesn't need to be any difference in visibility outside of your own module if you were to do this the usual way. > As espi-ctrl needs to invoke corresponding channel functions when it > is interrupted by eSPI events. > > To avoid polluting kernel space, we decided to put driver code in > header files and make the channel functions 'static'. > > BTW, I once encountered .c file inclusion in other projects. Is it > proper for Linux driver development? It can be, just that in this case it's a bit unusual, and I can't see a good reason for doing so. This could just be a standard multiple-source-file module. > eSPI communication is based on the its cycle packet format. > We intended to let userspace decided how to interpret and compose > TX/RX packets including header, tag, length (encoded), and data. > IOCTL comes to our first mind as it also works in the 'packet' like > paradigm. But you're not always exposing a packet-like interface for this. For example, your virtual-wire interface just has a get/set interface for bits in a register (plus some PCH event handling, which may not be applicable to all platforms...). The other channels do look like more of a packet interface though, but in that case I'm not convinced that an ioctl interface is the best way to go for that. You're essentially sending a (length, pointer) pair over the ioctls there, which sounds more like a write() than an ioctl(). Regardless of the choice of interface though, this will definitely need some documentation or description of the API, and the ioc header to be somewhere useful for userspace to consume. With that documented, we'd have a better idea of how the new ABI is supposed to work. Cheers, Jeremy _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel