Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3611258pxv; Mon, 12 Jul 2021 22:57:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5zSfXcQTEoHbIa1yAk6s4qDOhHXUk3QGDj69bMRgbW/IJ+iNHDL6i317+B9W3yQ0N0w/p X-Received: by 2002:aa7:c6d4:: with SMTP id b20mr3313534eds.204.1626155876399; Mon, 12 Jul 2021 22:57:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626155876; cv=pass; d=google.com; s=arc-20160816; b=StXZErsuYN4kia6e8a9vCiJQC8MQUf0o7zg3VfdSlaU/gSNqJUoLVQepnX6o3g69O1 rvNKwmE/2IvKEdM5k2QQK6Q+3sLqbQsW1Tb6BFYJGao2GKpGYcURM12LVSO6HoURO1UX 1YMA4nSUK4xEqGU+WtdALWgFGUl1gfzYfovB4Y418k9h03W6GmLCpCCu9p3wQTiLsTBZ MvX2V4vGQDnWkASHWIRRxQFfhxInlE4gyncn5ucN+qZXWmylx3fZn94KD1GnGOTnzatw EvHoW5uYj5LMk1GxW1k2vWSOzzMxIW0oBWgHvsZIGx5p0M4vsuOBPTuRtdv/eks6KL74 Oxig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=IErloZA/PsJ8Yf4Nai0BwectqjObW7+Y46dkM61/fuY=; b=dmk15+Uyf8Bx+tabAp4eYu8yjBgd1z015OTw4xKg4VspVjoLoP3yCQ9ATbc022q0b3 e7cX9xxwmHv5BlJWdr+X8pOMbOABCr8YTWiewBWozjp75P4t+QRt/wkkRwQXroKZ3TFe di39GvYkJoo1z1rMfvzCCa/GwDiuPqKCy7t1m9HllQ1hVUyBfDcago4FLMQS7hrGMFrG RXFs2q6gBmxkgAD3rCHbwnrGZv4Tx8gNi/arEvZRp1+yLWtJphyKT2wN4j6Mxw4gmtfj bRQXXbA5n+5duZmaHJ1mZipMJ0e/AcspS2HcpUyiWXy2ZoWoJ2R1e7mkBiDf0fFfidoW Ju4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=N2oqlQUm; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si19716699ejd.87.2021.07.12.22.57.33; Mon, 12 Jul 2021 22:57:56 -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=@os.amperecomputing.com header.s=selector2 header.b=N2oqlQUm; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233527AbhGMF5g (ORCPT + 99 others); Tue, 13 Jul 2021 01:57:36 -0400 Received: from mail-dm6nam10on2118.outbound.protection.outlook.com ([40.107.93.118]:60449 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231971AbhGMF5g (ORCPT ); Tue, 13 Jul 2021 01:57:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=noXVBGl5tkZMgc7Xd5HWOGdxiUwHO8A2ITDaj2jHOGXggbjzhyiChyrp0fz4haAhGrsb4+Mw2lxcRaPYQomancXjMIjZ5FZjHbumOCcjVp5BpVJhncso9nOX20q04lKai0YVa3YqSAN/GV0rCh0YD4M8WC64OauXgGYOpRtdhxEOVJLetq/t1MATUpj6gAaJw/O+C3XfCbZGGiLXJkPVMsZ91cvr42/AWjiIxymVxY8tJB+VRIdthNYA84xzADW4qXrWcpn6ClWEVU022Rg2f2jY3WFQwgmUiqWi5U0QZeCOr7yXIXjQCNYH6Qg4MN73AnlHZxuDxv60ccvSww5FtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IErloZA/PsJ8Yf4Nai0BwectqjObW7+Y46dkM61/fuY=; b=OjNEeA/GzJTKCQKOaO+bFHLL6pTL3YKr+lp5OmGGW16xtTwUDWz9bxvYTDXVoIPvBldemhQmM1En1+ejvLemQ9b382rmlOSk0G33rBlflpbJzU+PjtdX6oDbKr+47gWJq8vjcUtGPRfZbnqjVVA58vbvoQ08S3xi4W0JC39LAYDH4afA2upxTiQ/PCPmHDzNd+6NtT2YmXki81PxO948mtbFYBDdY5epLanGEDXCccbm4d1mfIiVcN+aK3fJM3hZHZ3ddrhra4zxMkDXI1dkD4d3ArI9J2nByhsZfX0w0gAWdyHdU9vvvEDg00dc91voX3p8IKEJlTqDKaT8XzbK5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IErloZA/PsJ8Yf4Nai0BwectqjObW7+Y46dkM61/fuY=; b=N2oqlQUmHwnoQ87EXfcgGnXKwgJvcW45mRpnt4WEQFN4QegAWxL9OpsrSX59Yl7SyBCzliXW6kEBnsS+jD1Q4055wIkfsh4wcy6Xjnbd6bBnsBybO1YgbrceplouS2tjGcOR0uHIRHDZNVNv9Dinav/Qh9kCDEwVYXvU04m9oog= Authentication-Results: acm.org; dkim=none (message not signed) header.d=none;acm.org; dmarc=none action=none header.from=os.amperecomputing.com; Received: from MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) by CO1PR01MB6535.prod.exchangelabs.com (2603:10b6:303:d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19; Tue, 13 Jul 2021 05:54:43 +0000 Received: from MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e]) by MW2PR0102MB3482.prod.exchangelabs.com ([fe80::452a:24fb:12cb:9d7e%5]) with mapi id 15.20.4308.027; Tue, 13 Jul 2021 05:54:43 +0000 From: Quan Nguyen To: Corey Minyard , Rob Herring , Joel Stanley , Andrew Jeffery , Brendan Higgins , Benjamin Herrenschmidt , Wolfram Sang , openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Open Source Submission , Phong Vo , "Thang Q . Nguyen" Subject: [PATCH v4 0/3] Add SSIF BMC driver Date: Tue, 13 Jul 2021 12:54:22 +0700 Message-Id: <20210713055425.30636-1-quan@os.amperecomputing.com> X-Mailer: git-send-email 2.28.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: HKAPR03CA0027.apcprd03.prod.outlook.com (2603:1096:203:c9::14) To MW2PR0102MB3482.prod.exchangelabs.com (2603:10b6:302:c::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from hcm-sw-17.amperecomputing.com (118.69.219.201) by HKAPR03CA0027.apcprd03.prod.outlook.com (2603:1096:203:c9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Tue, 13 Jul 2021 05:54:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f69ebcc1-5f8e-48b2-76f6-08d945c2b60d X-MS-TrafficTypeDiagnostic: CO1PR01MB6535: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kfOwJCLShIMgA1gVQVpJBjNCnomamnPd2RllmPsD42ryF15BAhbBCz0yPkd/880B1GkTv8Y0MAvOsZIz58Mnvj8vr2d77Ty8xa6+TsS0Y7AmT6GXCOp1k635GGJ03qGU8m9ojau9oUI4YsEUN7Z30LrUtxQgAHhkELVeYKYwVDmzYQJhnAmO3lCUgtQDV7Q9cvYacnpO90mvoYQE/9fbFPTHd74DFS5p1RKlXLDsEUYFcYIG8OKYxslIjgTiQmzC1mPTMmtA2bRTBrenADtBvEffvqMVW0oc2Y4+BkxX+I3IRdZb/sSPlydn6aszUapmxI9fLl7YPrH7OQ8kCARbE+dpu/phcLFCnh4PeeYNqOAKb8l0rnvZL93jXnxzVB3DNoxJMmqINqSlwV7+9x/rC6ogQCQB9Z2cpMtLeIG2xLB6GjEjtwW7QEBBxcGu/+kQxQJOARh9R7NmMJifcF4PBidq656x2X4ZwnnldSwsiDzhWVvJ7Gfbk0xgLJ2T7LYrb9ttxQb5AqybDD+XNR3sZ5ZDJKsRr8rA2W2n9ih1FIb1MS/9tF1dUtLxA76rz0LtlSHZ3MCQZ/7nBbOSgrh97AG1qOxvmzC5sc/a4bnfe+wa5jGm38aO1ilf0rW3MaJ4jc8tvhe0caDVRWZIbF2KzaqWiqaqRLk93l+2tlm9jobrA83JQtIlz5Lk8KXf21Nkc/6+L29GcmRxn+mtVs2F4pJ4caSj1Hy+8XPCwuS10AM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW2PR0102MB3482.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(136003)(366004)(396003)(39850400004)(346002)(956004)(8676002)(54906003)(86362001)(5660300002)(2616005)(2906002)(1076003)(7416002)(52116002)(66946007)(107886003)(478600001)(66556008)(6666004)(66476007)(6506007)(921005)(110136005)(26005)(186003)(38100700002)(316002)(4326008)(38350700002)(83380400001)(6512007)(8936002)(6486002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?/Wz7Yj6u3CH6zOWilbPfskaAzauLpfwC0eqtWm+9U67FIZqnV9/N5IFQdXVM?= =?us-ascii?Q?NIeBsX2j7oInUw6ORsKq85/6/DyBx8z5JfYvrFiPg+Cqyhzqgmj2q2u1M6R4?= =?us-ascii?Q?jdRZgM1fzfHL6uevIMCIvarTUh4JJ5YRSCFL7e3b7EjmfQs6mAVtRtTjWoy0?= =?us-ascii?Q?oRgfNryono61LmurVcH5SsOm0fdo8B1okc5jrEyEz0VMA1D1GBeB0In8AXr4?= =?us-ascii?Q?6XLNlvqhhgsEXvDeEAy16PPQde6ewTGPtsPOCCWUkNXsTp9CoEAFpVLgnaOp?= =?us-ascii?Q?dh9WOCFYGWa8P9/GWqDyr5vjp2Q7ng5+RgnzINgzQszK4KaXy0q5yL5rb2bY?= =?us-ascii?Q?/FowfW6r5mvUtWvUFjzt4NJJW7LZjdzCNxr4+EVUpEDPBtzvcVFZC/16UqJD?= =?us-ascii?Q?5Cc+CuoEOcGY7lYdv7gnKxWlsUvEfgjmCfd/LCAeyO8p0WrU1UZ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-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f69ebcc1-5f8e-48b2-76f6-08d945c2b60d X-MS-Exchange-CrossTenant-AuthSource: MW2PR0102MB3482.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2021 05:54:43.4161 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Lj7N2U8YxlOa68+EstTyyYAa2Jt44wyUpSc0u080y7tISvV922YtqfnsXlQdUFk4EfNdpO/qU7/05kF5QYvgpr30/PYV+Md6hmLoc9/HHks= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6535 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series add support the SSIF BMC driver which is to perform in-band IPMI communication with their host in management (BMC) side. SSIF BMC driver in this series is tested with Aspeed AST2500. v4: + Fix recursive spinlock [Graeme] + Send response with Completion code 0xFF when aborting [Quan] + Fix warning with dt_binding_check [Rob] + Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan] + Added bounding check on SMBus writes and the whole request [Dan] + Moved buffer to end of struct ssif_bmc_ctx to avoid context corruption if somehow buffer is written past the end [Dan] + Return -EINVAL if userspace buffer too small, dont silence truncate [Corey, Joel] + Not necessary to check NONBLOCK in lock [Corey] + Enforce one user at a time [Joel] + Reject write with invalid response length from userspace [Corey] + Add state machines for better ssif bmc state handling [Quan] + Drop ssif_bmc_aspeed.c and make ssif_bmc.c is generic SSIF BMC driver [Quan] + Change compatible string "aspeed,ast2500-ssif-bmc" to "ampere,ssif-bmc" [Quan] + Toggle Slave enable in i2c-aspeed to turn on/off slave mode [Ryan] + Added slave_enable() to struct i2c_algorithm to control slave mode and to address the recursive spinlock [Graeme, Ryan] + Abort current request with invalid SMBus write or invalid command [Quan] + Abort all request if there is pending response [Quan] + Changed validate_pec() to validate_request() [Quan] + Add unsupported_smbus_cmd() to handle unknown SMBus command [Quan] + Print internal state string for ease investigating issue [Quan] + Move to READY state on SLAVE_STOP event [Quan] + Change initilize_transfer() to process_smbus_cmd() [Quan] + Introduce functions for each slave event [Quan] v3: + Switched binding doc to use DT schema format [Rob] + Splited into generic ssif_bmc and aspeed-specific [Corey, Joel] + Removed redundant license info [Joel] + Switched to use traditional if-else [Joel] + Removed unused ssif_bmc_ioctl() [Joel] + Made handle_request()/complete_response() to return void [Joel] + Refactored send_ssif_bmc_response()/receive_ssif_bmc_request() [Corey] + Remove mutex [Corey] + Use spin_lock/unlock_irqsave/restore in callback [Corey] + Removed the unnecessary memset [Corey] + Switch to use dev_err() [Corey] + Combine mask/unmask two interrupts together [Corey] + Fixed unhandled Tx done with NAK [Quan] + Late ack'ed Tx done w/wo Ack irq [Quan] + Use aspeed-specific exported aspeed_set_slave_busy() when slave busy to fix the deadlock [Graeme, Philipp, Quan] + Clean buffer for last multipart read [Quan] + Handle unknown incoming command [Quan] v2: + Fixed compiling error with COMPILE_TEST for arc Quan Nguyen (3): ipmi: ssif_bmc: Add SSIF BMC driver bindings: ipmi: Add binding for SSIF BMC driver i2c: aspeed: Add slave_enable() to toggle slave mode .../devicetree/bindings/ipmi/ssif-bmc.yaml | 38 + drivers/char/ipmi/Kconfig | 11 + drivers/char/ipmi/Makefile | 1 + drivers/char/ipmi/ssif_bmc.c | 781 ++++++++++++++++++ drivers/char/ipmi/ssif_bmc.h | 106 +++ drivers/i2c/busses/i2c-aspeed.c | 20 + include/linux/i2c.h | 2 + 7 files changed, 959 insertions(+) create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml create mode 100644 drivers/char/ipmi/ssif_bmc.c create mode 100644 drivers/char/ipmi/ssif_bmc.h -- 2.28.0