Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1602896pxb; Mon, 12 Apr 2021 02:02:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD089f37f69TNlmHBfb4ITnhay5BGzIx8SqMO1QQHXgyOSRQ9/qB7CwtW9JNht9aArPm1j X-Received: by 2002:a17:907:760a:: with SMTP id jx10mr15587693ejc.126.1618218164167; Mon, 12 Apr 2021 02:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618218164; cv=none; d=google.com; s=arc-20160816; b=CKeVPZ3BK955qLc/Lshb5lbHqa4IB/13Jcd+JtbYQqTZPCQ+rD1KLZuCGHra91iZla MJhqRjMeqfmYPWe0c7B49qbtxAgre/G+Edyz6Uxco30OVrPRuvOjXq2ywFTC7Qs19bOC 9vUaGSE3Vt3/WtGVZytIv4saBJ/tqsUK9gaPuLZJpXapiLs05kLL9Pw2MJoFU2jL+Mot 5rEjxrVASqZJNKEGv0x99ecIUvGF6HlPWi+e3ZIDzCFBHLQQWYzmFJx3IJyoRJQHFJ+F Y8bMdaVLe72MCFnGrAMFx9CPUqfrKE4RB/8Ti7D5UTJjIX2duav9QF+VxxmCH/RXItsl 4LRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W8irrMWImW++p/7zMcn/az8UJbyx/calbnKIc/iZqJI=; b=ZClI6QIFgE6QIomX7kJpL9kfvOXDmE+lbQXf9rVOIyHqXMj9nCZ96e/2zsY7OdDPDi rYe9SrgE4ggFtwuhXs833y47dNMThXGQ3rwJLR450+Gf1CLzE1vt+Hc+Tz56GbmhR3kt UKYL0cAYT6KUvDEfXHI9/Ev5XZ7gN0jRqL/bg3j8W3C68jEkMlwUqzup1CxyLYr32fqB fvxkbQeXUa9zwpQH3w9OB/wYaaQJbKuzGj2tkt66ZRieaAHtjTFpxJGBJc5G3EsePZ6W Kr2RHbbyF77govlc1dBIea/RBPuqPHWzfYzuGrdtt7tlddYx1Qky2TU3IwSY4PrQ9v3s q5/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uey+W82d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si7594834ejx.751.2021.04.12.02.02.21; Mon, 12 Apr 2021 02:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uey+W82d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239378AbhDLJAB (ORCPT + 99 others); Mon, 12 Apr 2021 05:00:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:36784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238328AbhDLItb (ORCPT ); Mon, 12 Apr 2021 04:49:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D155F61379; Mon, 12 Apr 2021 08:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618217313; bh=eLznHwvEfmec088sW414tCcwJZyAy1dqSqy3r+pI7zc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uey+W82dISxV0CSUCEiP+7gx9QuEZBJfcRoFlSMpkmrDlRAJJ0xVAOCsY94BkROLO zR/I466PgDid3faek70DuVNVg7noHojv66W6cwsIyY2yvu9Lt2qRuc9nGzCIxgZBXn b+pFwRet18DXS13aa8a0O4MFYM9FTwIPGTmzP+TKLFSBeZqwLd+xPrXiLpfNkZam// nTLqalOsrHTkSgYJ0euxXxHf96MAHZTKfV0Uyr+Q3gmjq/OvXQUq6zhW/U9m2u5Nji FvCPzYE1fW7fbdBhJcyx8lAQrFqUby6/4TW+Qu7SCI6vP9Tw1jB9lcRoTkvaxiDZxi iOtWMOODr0mgA== Received: by mail-wr1-f48.google.com with SMTP id a6so12023710wrw.8; Mon, 12 Apr 2021 01:48:32 -0700 (PDT) X-Gm-Message-State: AOAM532eWGV1hrPeuH8JRUJZ3NwfO5LXvWL3KOuKwK1eC7rK6S6szAGj ExltV7g47vRwzoDHS11IYRaUMbgTSbFR/zbyazI= X-Received: by 2002:adf:c70b:: with SMTP id k11mr30918454wrg.165.1618217311367; Mon, 12 Apr 2021 01:48:31 -0700 (PDT) MIME-Version: 1.0 References: <20210319062752.145730-1-andrew@aj.id.au> <20210319062752.145730-16-andrew@aj.id.au> In-Reply-To: From: Arnd Bergmann Date: Mon, 12 Apr 2021 10:48:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 16/21] ipmi: kcs_bmc: Add a "raw" character device interface To: Andrew Jeffery Cc: Dmitry Torokhov , openipmi-developer@lists.sourceforge.net, OpenBMC Maillist , Corey Minyard , Joel Stanley , Ryan Chen , DTML , Tomer Maimon , linux-aspeed , "open list:GPIO SUBSYSTEM" , Avi Fishman , Patrick Venture , Linus Walleij , Linux Kernel Mailing List , Tali Perry , Rob Herring , Lee Jones , "Chia-Wei, Wang" , Linux ARM , Benjamin Fair Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 3:33 AM Andrew Jeffery wrote: > On Fri, 9 Apr 2021, at 17:25, Arnd Bergmann wrote: > > On Fri, Mar 19, 2021 at 7:31 AM Andrew Jeffery wrote: > > > > > > The existing IPMI chardev encodes IPMI behaviours as the name suggests. > > > However, KCS devices are useful beyond IPMI (or keyboards), as they > > > provide a means to generate IRQs and exchange arbitrary data between a > > > BMC and its host system. > > > > I only noticed the series after Joel asked about the DT changes on the arm > > side. One question though: > > > > How does this related to the drivers/input/serio/ framework that also talks > > to the keyboard controller for things that are not keyboards? > > I've taken a brief look and I feel they're somewhat closely related. > > It's plausible that we could wrangle the code so the Aspeed and Nuvoton > KCS drivers move under drivers/input/serio. If you squint, the i8042 > serio device driver has similarities with what the Aspeed and Nuvoton > device drivers are providing to the KCS IPMI stack. After looking some more into it, I finally understood that the two are rather complementary. While the drivers/char/ipmi/kcs_bmc.c is the other (bmc) end of drivers/char/ipmi/ipmi_kcs_sm.c, it seems that the proposed kcs_bmc_cdev_raw.c interface would be what corresponds to the other side of drivers/input/serio/i8042.c+userio.c. Then again, these are also on separate ports (0x60 for the keyboard controller, 0xca2 for the BMC KCS), so they would never actually talk to one another. > Both the KCS IPMI and raw chardev I've implemented in this patch need > both read and write access to the status register (STR). serio could > potentially expose its value through serio_interrupt() using the > SERIO_OOB_DATA flag, but I haven't put any thought into it beyond this > sentence. We'd need some extra support for writing STR via the serio > API. I'm not sure that fits into the abstraction (unless we make > serio_write() take a flags argument?). > > In that vein, the serio_raw interface is close to the functionality > that the raw chardev provides in this patch, though again serio_raw > lacks userspace access to STR. Flags are ignored in the ->interrupt() > callback so all values received via ->interrupt() are exposed as data. > The result is there's no way to take care of SERIO_OOB_DATA in the > read() path. Given that, I think we'd have to expose an ioctl() to > access the STR value after taking care of SERIO_OOB_DATA in > ->interrupt(). > > I'm not sure where that lands us. Based on what I looked up, I think you can just forget about my original question. We have two separate interfaces that use an Intel 8042-style protocol, but they don't really interact. Arnd