Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2466822pxb; Tue, 13 Apr 2021 02:35:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVoFLL0XX4aEhZriRKMap1r8bye3RRi+NK5Hi2mwUpy9ITWePPlYzEW12mvsg1uigKjPeD X-Received: by 2002:aa7:8486:0:b029:250:f6fc:ae93 with SMTP id u6-20020aa784860000b0290250f6fcae93mr1598698pfn.39.1618306554055; Tue, 13 Apr 2021 02:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618306554; cv=none; d=google.com; s=arc-20160816; b=mIimvYL9Zy3e+6APpdewU4jWtPFWoXSnucsQPV4II1FuzE21OzOFJ3M57p9MWPoA2Q PtGTFs6dAT9G2xIcMjfF+lNscDr8m0jaFupOcy6R7CLf5k0d65bvwCKr128wlj7jpWI2 1eZNATq8kFM6+gmxV6ktvIQ5eIra8gkIsD1BSx0l5GyL7zN5lF2n3smNAIJgX+ttRaKQ KQXVxucyrdjmh1fUbNxGGK/dKPluG8nh7zmpoa/MLhqjImCYG2hdGMHtkih1iffWh2T7 lRPv0tk80DTyqobI/kjPAPQxnoJUC1M5yNLuCuFaEa5AXzTArTCXJjtZ6G+M3kSqKr0y 91nQ== 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=3RpgkYwsEk24/oyS+RpxX+Eq0fId9ynv8/XeJ9Uev6Q=; b=Kwyq5MrygxIEtsFBzRoXR0bnSaN3lkMGSXbBkhON8bx1pUGf6e8R7bGTtkwjfdG9KY xQprGhxKiaI75m6mrv3EluzAmHEsuENy4peavqJ6kOk6hU5emrmXbBRVa0lu3VGVkVYM mrylaJNKEcNOqmOTmuvk0F1uDtblo9ArrefhfjxsMvCo/mRMeAc1BTJ3g5/seCm+XPh2 /9U2+Sy9G9fZWtNi9yubps16o/H6PZkEG4Q07IazOXcm8Ml432+8Ivs3awdI9YnHMtfA rlLvDCIzOK1P0WShkbEwmjKI8tXVb805oAm6IzWEU59hvpHnmp2Ps1aTzCoeAEWEvEHc Ax8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rbngbYah; 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 2si2453833pjr.77.2021.04.13.02.35.42; Tue, 13 Apr 2021 02:35:54 -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=rbngbYah; 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 S242697AbhDMIWt (ORCPT + 99 others); Tue, 13 Apr 2021 04:22:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:49898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhDMIWs (ORCPT ); Tue, 13 Apr 2021 04:22:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BCEBC613BF; Tue, 13 Apr 2021 08:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618302148; bh=FCK+SMdbdUGO5PuqGh46hY625MCpqFUerFbVNWNJmsU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rbngbYahMGe4TQffxAdJtnqoA+4uAXIIzQstIvnXyycZn6yoYgbMTptGxkY1QwoCN qaRj1wD0ufR2Z6BbaKA79azUIvCglPP1Q9d9Lkh7TDvzW9aq7byrS6HOAtEK604XId TxIecErW1PFjgVRTpT/6hn9OUwz9c6l3XRtTUWJXAwV80As1OviKsH0xrI7tBnuYVB 3TnSL2TNKhzj/rw0+Ms+XlqmAcJSrUvQxex+CUOvd0VjfuLCV7Q6r0gA40TTX8fqce PeJ50GXDTxHT4XTSgLiu9HSuHNFAX2bKVELWG8//h8siSyxG99z0Zic5Y9fDM0gcMp 59hXM3+4vWrCw== Received: by mail-wm1-f50.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso8280046wmi.0; Tue, 13 Apr 2021 01:22:28 -0700 (PDT) X-Gm-Message-State: AOAM53057+E4/qw2+OZHuSihv/EsqLpSyyis1TXcHr2o8IYmrOL9N63c cJ3IabUQ9Wfi1rsSvMHYNWKoszYksRxrhICo2BA= X-Received: by 2002:a7b:c14a:: with SMTP id z10mr2831003wmi.75.1618302147230; Tue, 13 Apr 2021 01:22:27 -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: Tue, 13 Apr 2021 10:22:11 +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 Tue, Apr 13, 2021 at 1:45 AM Andrew Jeffery wrote: > On Mon, 12 Apr 2021, at 18:18, Arnd Bergmann wrote: > > 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. > > Right. I guess the question is should we be splitting kernel subsystems > along host/bmc lines? Doesn't feel intuitive, it's all Linux, but maybe > we can consolidate in the future if it makes sense? We actually have a number of subsystems with somewhat overlapping functionality. I brought up serio, because it has an abstraction for multiple things that communicate over the keyboard controller and I thought the problem you were trying to solve was also related to the keyboard controller. It is also one of multiple abstractions that allow you to connect a device to a uart (along with serdev and tty_ldisc, probably at least one more that you can nest above or below these). Consolidating the kcs_bmc.c interface into something that already exists would obviously be best, but it's not clear which of these that should be, that depends on the fundamental properties of the hardware interface. > > 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. > > Well, sort of I guess. On Power systems we don't use the keyboard > controller for IPMI or keyboards, so we're just kinda exploiting the > hardware for our own purposes. Can you describe in an abstract form what the hardware interface can do here and what you want from it? I wonder if it could be part of a higher-level interface such as drivers/mailbox/ instead. Arnd