Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1153365pxf; Thu, 18 Mar 2021 23:29:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6OoXGOEQKNeD7784w5jbggTDFU5V2ogdBDiYx0rjivGHKQebad5pJpzE16A+tPEcJ1Y6R X-Received: by 2002:a17:906:5450:: with SMTP id d16mr2606227ejp.274.1616135397361; Thu, 18 Mar 2021 23:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616135397; cv=none; d=google.com; s=arc-20160816; b=RTwj8yFmFfwzaev0HFHJnqfS9MAy1lzpQVENjcqm0IryfSZ1Oo6efc8Tc2jDXeq95H /SpU5EZdfUrpoUS4q0NfXGjjgijIuphG3SRs8kpLXp95lZSpEDHkuCJQgO2dcMnO8f9s g1HqP7xLRHE+ka2hJqunLx9J6ZZXSymwS2Sw+DCh1YJsnjtPGg5LGq2TovCk8Au1Usr6 x5kcPLTadGV7kbVNGByvWo3Az/+fNSA8Vh4m5w3NwIWaQhC9lEfgy4A0BGs/bZtSVV5d /z3VZhHUmAZEHhfQtPhHf1ah8FT86QvxR5PLDUsVLr2LcY1A4Nlh3T8Z9Vc6jotaeA4G KswQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=DQ0e988igZ7sIe0ymg68c1lDjuQ6xtIxXzAGPLSh1nI=; b=KUtlhrBKixoxLcDEM3CRRnbzgV3DUS3kqy5Q/qTlAMfIF8Q+VSkijK0q0rwjx0RIII h1M5lEb6J1o1bVZJj23pBkYLMtiMM+UoLSMBPFua8LupDtoaHB3n6HXN2mhtApI8b+ii PKmqthSYkt1OmZT+Y9ieV/c3PJBPVgdcRmB3iDDHtSqM9ukUkRh7xThd21gQZwH3E0Ex F3eoTir3UjypVrTa7YwfIVLQm/ajQputO8oDtIuXZSGac/j8N8iqIcd/Se01COAnpwE7 qDKtH2CxDC8lEMWdChdnN4hbGp6SSbct+Un4TKY26MgI26qTz8qxnawkcV2H8PXRTIWs 52nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b="iUz/zNDt"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=p9WxThGy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si3221688edu.375.2021.03.18.23.29.35; Thu, 18 Mar 2021 23:29:57 -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=@aj.id.au header.s=fm2 header.b="iUz/zNDt"; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=p9WxThGy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234001AbhCSGVI (ORCPT + 99 others); Fri, 19 Mar 2021 02:21:08 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:56531 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232992AbhCSGUj (ORCPT ); Fri, 19 Mar 2021 02:20:39 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 9C2E3580A7A; Fri, 19 Mar 2021 02:20:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 19 Mar 2021 02:20:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm2; bh=DQ0e988igZ7sIe0ymg68c1lDju Q6xtIxXzAGPLSh1nI=; b=iUz/zNDta8Y4JVXEyCbmxRcBFb5BonujfrZcF74o1l Lq9sUqDmc7QhyS25xjwdSc17BL7nsG8FJ4BqoJw+cVF9k/Bs6A4Y2pSY+mpRdzd8 uDzMOQCJgIixT0HWC947AfbzNVGU9TXK1fJoIHykU9K/neeKvT2/V55RjotrPW3f 0bdAYas6+ipiflJbLSUZmDhU3tm4wBe22TJKRzLjUIfgoEqNIX6SMmA+bw6KHLWQ ViwTslmqAoZFFa54qdeXE6XEVlD6bGKBhFv2lAr8lGBUkUU09vn0CQ8xApEzHE8K xImiHcEUDKCI5mJDACqyPD5b7ZnF5SV9V8CCgXxdloww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=DQ0e988igZ7sIe0ym g68c1lDjuQ6xtIxXzAGPLSh1nI=; b=p9WxThGyse3NLP1n85Tefdn9wRP9DroOd Wt4kI5kWTS9qWGNJ6qXYJiCqAu1jViYKt6ai6060xTok9QaR6A2uG41/j3n6XWei KwmirTXI9Fs8k2iLrMqeORuUb/qm9poyfrkF2CJgatKUpHa2lVCaguTZCQQnaB5J dlg+6OAztW+KgVz0QhCOjn7XkihFW7ZTO38WqYp80YrpKWcyWbyinNAMZ6zcY27y GjqYzHpI7jZ9UYJx1sdBtBpfnXt9NMjm26cJWiT3CwhOALYTwSd70Ai3L8tyrIfg XLDPhVc00BNGyJsWvdwZf84J43/u+LFALGXA/tJ4HUXpHq1Vl4zkg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudefjedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomheptehnughrvgifucflvghffhgvrhihuceorghnughrvgifsegrjhdr ihgurdgruheqnecuggftrfgrthhtvghrnhepieelfedtfeetveffgeetteetveeitefhke etvdefteevledvheekveeihfekffefnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdp ihhnthgvlhdrtghomhdpghhithhhuhgsrdgtohhmpdgumhhtfhdrohhrghenucfkphepud dukedrvddutddrudekuddrheehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: from localhost.localdomain (ppp118-210-181-55.adl-adc-lon-bras34.tpg.internode.on.net [118.210.181.55]) by mail.messagingengine.com (Postfix) with ESMTPA id 3FD8C1080057; Fri, 19 Mar 2021 02:20:31 -0400 (EDT) From: Andrew Jeffery To: openipmi-developer@lists.sourceforge.net, openbmc@lists.ozlabs.org, minyard@acm.org Cc: joel@jms.id.au, ryan_chen@aspeedtech.com, devicetree@vger.kernel.org, tmaimon77@gmail.com, linux-aspeed@lists.ozlabs.org, linux-gpio@vger.kernel.org, avifishman70@gmail.com, venture@google.com, linus.walleij@linaro.org, linux-kernel@vger.kernel.org, tali.perry1@gmail.com, robh+dt@kernel.org, lee.jones@linaro.org, chiawei_wang@aspeedtech.com, linux-arm-kernel@lists.infradead.org, benjaminfair@google.com Subject: [PATCH v2 00/21] ipmi: Allow raw access to KCS devices Date: Fri, 19 Mar 2021 16:49:30 +1030 Message-Id: <20210319061952.145040-1-andrew@aj.id.au> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This series is a bit of a mix of things, but its primary purpose is to expose BMC KCS IPMI devices to userspace in a way that enables userspace to talk to host firmware using protocols that are not IPMI. v1 can be found here: https://lore.kernel.org/openbmc/20210219142523.3464540-1-andrew@aj.id.au/ Changes in v2 include: * A rebase onto v5.12-rc2 * Incorporation of off-list feedback on SerIRQ configuration from Chiawei * Further validation on hardware for ASPEED KCS devices 2, 3 and 4 * Lifting the existing single-open constraint of the IPMI chardev * Fixes addressing Rob's feedback on the conversion of the ASPEED KCS binding to dt-schema * Fixes addressing Rob's feedback on the new aspeed,lpc-interrupts property definition for the ASPEED KCS binding A new chardev device is added whose implementation exposes the Input Data Register (IDR), Output Data Register (ODR) and Status Register (STR) via read() and write(), and implements poll() for event monitoring. The existing /dev/ipmi-kcs* chardev interface exposes the KCS devices in a way which encoded the IPMI protocol in its behaviour. However, as LPC[0] KCS devices give us bi-directional interrupts between the host and a BMC with both a data and status byte, they are useful for purposes beyond IPMI. As a concrete example, libmctp[1] implements a vendor-defined MCTP[2] binding using a combination of LPC Firmware cycles for bulk data transfer and a KCS device via LPC IO cycles for out-of-band protocol control messages[3]. This gives a throughput improvement over the standard KCS binding[4] while continuing to exploit the ease of setup of the LPC bus for early boot firmware on the host processor. The series takes a bit of a winding path to achieve its aim: 1. It begins with patches 1-5 put together by Chia-Wei, which I've rebased on v5.12-rc2. These fix the ASPEED LPC bindings and other non-KCS LPC-related ASPEED device drivers in a way that enables the SerIRQ patches at the end of the series. With Joel's review I'm hoping these 5 can go through the aspeed tree, and that the rest can go through the IPMI tree. 2. Next, patches 6-13 fairly heavily refactor the KCS support in the IPMI part of the tree, re-architecting things such that it's possible to support multiple chardev implementations sitting on top of the ASPEED and Nuvoton device drivers. However, the KCS code didn't really have great separation of concerns as it stood, so even if we disregard the multiple-chardev support I think the cleanups are worthwhile. 3. Patch 14 adds some interrupt management capabilities to the KCS device drivers in preparation for patch 16, which introduces the new "raw" KCS device interface. I'm not stoked about the device name/path, so if people are looking to bikeshed something then feel free to lay into that. 4. The remaining patches switch the ASPEED KCS devicetree binding to dt-schema, add a new interrupt property to describe the SerIRQ behaviour of the device and finally clean up Serial IRQ support in the ASPEED KCS driver. Rob: The dt-binding patches still come before the relevant driver changes, I tried to keep the two close together in the series, hence the bindings changes not being patches 1 and 2. I've exercised the series under qemu with the rainier-bmc machine plus additional patches for KCS support[5]. I've also substituted this series in place of a hacky out-of-tree driver that we've been using for the libmctp stack and successfully booted the host processor under our internal full-platform simulation tools for a Rainier system. Note that this work touches the Nuvoton driver as well as ASPEED's, but I don't have the capability to test those changes or the IPMI chardev path. Tested-by tags would be much appreciated if you can exercise one or both. Please review! Andrew [0] https://www.intel.com/content/dam/www/program/design/us/en/documents/low-pin-count-interface-specification.pdf [1] https://github.com/openbmc/libmctp/ [2] https://www.dmtf.org/sites/default/files/standards/documents/DSP0236_1.3.1.pdf [3] https://github.com/openbmc/libmctp/blob/master/docs/bindings/vendor-astlpc.md [4] https://www.dmtf.org/sites/default/files/standards/documents/DSP0254_1.0.0.pdf [5] https://lore.kernel.org/qemu-devel/20210309131641.2709380-1-clg@kaod.org/ Andrew Jeffery (16): ipmi: kcs_bmc_aspeed: Use of match data to extract KCS properties ipmi: kcs_bmc: Make status update atomic ipmi: kcs_bmc: Rename {read,write}_{status,data}() functions ipmi: kcs_bmc: Split out kcs_bmc_cdev_ipmi ipmi: kcs_bmc: Turn the driver data-structures inside-out ipmi: kcs_bmc: Split headers into device and client ipmi: kcs_bmc: Strip private client data from struct kcs_bmc ipmi: kcs_bmc: Decouple the IPMI chardev from the core ipmi: kcs_bmc: Allow clients to control KCS IRQ state ipmi: kcs_bmc: Don't enforce single-open policy in the kernel ipmi: kcs_bmc: Add a "raw" character device interface dt-bindings: ipmi: Convert ASPEED KCS binding to schema dt-bindings: ipmi: Add optional SerIRQ property to ASPEED KCS devices ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration ipmi: kcs_bmc_aspeed: Fix IBFIE typo from datasheet ipmi: kcs_bmc_aspeed: Optionally apply status address Chia-Wei, Wang (5): dt-bindings: aspeed-lpc: Remove LPC partitioning ARM: dts: Remove LPC BMC and Host partitions ipmi: kcs: aspeed: Adapt to new LPC DTS layout pinctrl: aspeed-g5: Adapt to new LPC device tree layout soc: aspeed: Adapt to new LPC device tree layout Documentation/ABI/testing/dev-raw-kcs | 25 + .../bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml | 106 +++ .../bindings/ipmi/aspeed-kcs-bmc.txt | 33 - .../devicetree/bindings/mfd/aspeed-lpc.txt | 100 +-- arch/arm/boot/dts/aspeed-g4.dtsi | 70 +- arch/arm/boot/dts/aspeed-g5.dtsi | 121 ++-- arch/arm/boot/dts/aspeed-g6.dtsi | 123 ++-- drivers/char/ipmi/Kconfig | 30 + drivers/char/ipmi/Makefile | 2 + drivers/char/ipmi/kcs_bmc.c | 534 ++++---------- drivers/char/ipmi/kcs_bmc.h | 94 +-- drivers/char/ipmi/kcs_bmc_aspeed.c | 663 +++++++++++++----- drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 570 +++++++++++++++ drivers/char/ipmi/kcs_bmc_cdev_raw.c | 443 ++++++++++++ drivers/char/ipmi/kcs_bmc_client.h | 47 ++ drivers/char/ipmi/kcs_bmc_device.h | 20 + drivers/char/ipmi/kcs_bmc_npcm7xx.c | 97 ++- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 17 +- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 20 +- drivers/soc/aspeed/aspeed-lpc-snoop.c | 23 +- 20 files changed, 2132 insertions(+), 1006 deletions(-) create mode 100644 Documentation/ABI/testing/dev-raw-kcs create mode 100644 Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml delete mode 100644 Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt create mode 100644 drivers/char/ipmi/kcs_bmc_cdev_ipmi.c create mode 100644 drivers/char/ipmi/kcs_bmc_cdev_raw.c create mode 100644 drivers/char/ipmi/kcs_bmc_client.h create mode 100644 drivers/char/ipmi/kcs_bmc_device.h -- 2.27.0