From nobody Tue Nov 26 09:43:35 2024 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1A94188A0C; Sat, 19 Oct 2024 15:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729352452; cv=none; b=B7xDKMfL+iZKYL25pMJmm639JvkTW/dleYhGdp4JEMp/h2Sh6W52Rs1W+5hXJfPDYGKZ8yktxWwa5od1MZqvKJGz/0fWJmLB+GRoPNWlSxna28jaKP5+rIPPd6aFcH4BHKJYdgcfZP6mVEGO49cOyILybkFuKNMGomM6SsBCo18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729352452; c=relaxed/simple; bh=Ox+0thN9kPglPoXsy/wkj2zaKeHrfkwDa5J9akhvaKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jWM219yx7x+DA7w08ltK6yK0JCdmDXy7msSifBKl9oZp4G+nNddbQGOq4l05cWSv3TE7spkEK86/1cP7MVLwBnrGNJIVt+hvJhmuoaet7NBW0Y0JnssCpMZ8dNSHIl3u+RXoaQW5+Wcpdg9kuXPDVsF684/mR93cdgYbMkCP42g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PU5JBzWi; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PU5JBzWi" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7e6ed072cdaso2204755a12.0; Sat, 19 Oct 2024 08:40:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729352450; x=1729957250; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UeYHqkho8rJuBl15lMa0XKA7XOcPhhBBEGYMU/dbg7E=; b=PU5JBzWixWGuUjamaK8NkgWky0Ut4gCoKJVEAmw8QzWu9FiAq9j9GyPmdMnC99e70j ipjo4lG4Ur8HYH8NikSsTcvxrvUEtwxKbohdW1NdRxPvrj/2liCNxn7G1gM+mzZGT0O/ HOhXBJY+CWsfr6iQ4T1fHvHLEHls2doo2+q4ovFZsPEFXfrbcNWYWAirjCBwdsE4odVF BmYFgJOsrS1FroYezEGKI8JCVnKC3VAxneNSI4cojJGoqmFFzQXSXfycTd8bEMTbScfW se3eHSgIjwKtEP9DcT30GWHiWnwKZa9kT/AUNjy7+M+0eAY4WuquaS3N9Z4/nbNghrkS XIeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729352450; x=1729957250; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UeYHqkho8rJuBl15lMa0XKA7XOcPhhBBEGYMU/dbg7E=; b=O5mGgYkmzI4sYZE1f02ZnN0q7uRHgJbk5EDGWrXgYVDXgF9Rmixp+BKdPBmlKXZubw +adxIPtcvqKq0d6L3VQs3f+d8lMJ3n9i8dWsaqRmvVvO1NHp5RMXfkwxdH9KpCka0B4l Mh8SFXETXEQb0ojF8TMxlifOjkYmVePzpp3LleWTe6yUMoCNCMR9uQYHZWWzMmmE0/UO Lto+rl3ItPnKR2bIEpVYrOC8s0zJn1owQK8oYDDFZ9I4pepQi2/9ZuJyKG+UgfDf8L+5 v0vm5TMksWQcaeuNao0bK/6wxFH4BxP4Q92RM+WG7ONK5qCX4pBo105wrR25z9ZNFoFf TaHw== X-Forwarded-Encrypted: i=1; AJvYcCUmAPmZNBvqN/5xrzu6oHYdjurqIN9QuVr6jxpEspSEBr33aa5ySMgWldL+tnZ70r3i+jhOWXQlUPq5@vger.kernel.org, AJvYcCXsbYCZloCHmhpKvPAPUFxoYIqFzoaQXqJTz+WM07z04qhwRaoduMzbib0k4C04BAeAv3eevr9AJC9PQXoD@vger.kernel.org X-Gm-Message-State: AOJu0Yx9pB8cQn+WWOXtAbTZpCNWb2nrnZxW/B6Iu4w0xpsXDM8epL2z WCrpIU/yohfY/IyYIsVzSNachWExvP3BaA10pIqR0lXRhzEZdAlK X-Google-Smtp-Source: AGHT+IEBLE0HR+usOqrbO9kqmBEVegE9Oqw6rqhuhItCAFZ0cYTpP7kQzhXZDecSoyRM44YX4GcfwQ== X-Received: by 2002:a17:90a:e387:b0:2d8:8430:8a91 with SMTP id 98e67ed59e1d1-2e5616e69b8mr7743161a91.10.1729352450192; Sat, 19 Oct 2024 08:40:50 -0700 (PDT) Received: from localhost.localdomain (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e55d7ade96sm2781319a91.1.2024.10.19.08.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2024 08:40:49 -0700 (PDT) From: Potin Lai Date: Sat, 19 Oct 2024 23:38:04 +0800 Subject: [PATCH 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241019-ssif-alert-gpios-v1-1-483eee5f99d3@gmail.com> References: <20241019-ssif-alert-gpios-v1-0-483eee5f99d3@gmail.com> In-Reply-To: <20241019-ssif-alert-gpios-v1-0-483eee5f99d3@gmail.com> To: Corey Minyard , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Quan Nguyen , Patrick Williams Cc: openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmo Chou , Potin Lai , Potin Lai X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729352444; l=1060; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=Ox+0thN9kPglPoXsy/wkj2zaKeHrfkwDa5J9akhvaKY=; b=kU+lBaa0FelMbNLd7IpLSp/VudEMLnENj7/AG7MzIPWjAjUQkoJVymsT1QBJNjDLKBNS7gGr8 XCd5d0jNuUdCJnpvMurroC2pUdsBhIo9Ant4UVslZY+G4M8d/USd/H0 X-Developer-Key: i=potin.lai.pt@gmail.com; a=ed25519; pk=6Z4H4V4fJwLteH/WzIXSsx6TkuY5FOcBBP+4OflJ5gM= Introduce the `alert-gpios` property to define an alert pin, enabling the BMC to notify the host when a response is available. Signed-off-by: Potin Lai --- Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml b/Documen= tation/devicetree/bindings/ipmi/ssif-bmc.yaml index 02b662d780bb..104283fa851a 100644 --- a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml +++ b/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml @@ -19,6 +19,12 @@ properties: reg: maxItems: 1 =20 + alert-gpios: + description: + GPIO pin designated for SSIF alert, used by the BMC to notify the + host when a response is available. + maxItems: 1 + required: - compatible - reg @@ -34,5 +40,6 @@ examples: ssif-bmc@10 { compatible =3D "ssif-bmc"; reg =3D <0x10>; + alert-gpios =3D <&gpio 0 GPIO_ACTIVE_LOW>; }; }; --=20 2.31.1 From nobody Tue Nov 26 09:43:35 2024 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D7E718C34B; Sat, 19 Oct 2024 15:40:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729352455; cv=none; b=EGDRGihasEq03VtzlXcL3FnFwzhuCdCJsi/ElGoLJ9a4yCxZ1P//zJO7YggYj09RSV5JtTYPyAFWclvkVfCR+QY0xDmwO4pE4V5KfpDG7twx0+pX0O4gzco5bhDrAEt29DQ9DbFFNBEDXravMhEpDhi8zD5BNsZ/Uoo3CzCtH5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729352455; c=relaxed/simple; bh=MIGPOdo21PTWbv6zESRF7XdStcwjMCU1AGOn2z3JMpM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uZiz+FWQEjF2XnOd3BSI78CLoTHDBXXNBVYZ3tVp6H2zxEjc4w5uM3oLMkpRrPzdJS2s5rhnRtXVhYjyE2f1QyZSMzfGSjcANp6T/t8EJoCvPcHPVZo12/Rkq2o9xBahy7m5Q2TpoilBDYdltPdGqTSBWwEvTTUzfssVG+WQ1j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S12B1X13; arc=none smtp.client-ip=209.85.215.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S12B1X13" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7d4f85766f0so2359500a12.2; Sat, 19 Oct 2024 08:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729352453; x=1729957253; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0kpvlTNyCm02akaAvuo0njQRu2uaU/VS1NFzMgstuUA=; b=S12B1X13nQD3WMrnvywJe5LY3RTEU9FVRVubnZITqGRbEvIxU21+6ulU/ajRoeGE7P PFvGRCFqHC7OfysFRqRRsyWQWYmhA6x7hGCL4of1+bDbFVYVMOShIiw4iv5GJhsk2tRy U4uqGgkgIzePkxlc8m9843lWP72BU9ozWuEPU8DO+9zdgnbdyeBNkg9e4PxmAjM7Jk5O atXDMOCO29e3qcyC3j4ghuukwavMSC3R1kqNkeS52M0jT9KfctZy83ONryEBZyt7WetI xrAJ7ekCf3b3jbVXHcPLAASLejWqjv2zdd7EwFbNGbxgiQaoSi0WEsp78QgAx2fJxztK Mwxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729352453; x=1729957253; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0kpvlTNyCm02akaAvuo0njQRu2uaU/VS1NFzMgstuUA=; b=iS2Bo1iouBeWl/nYP6M2cOcjt4kBEB6+Rxi7I5FkcTrKU8g+u95NWm3U58UVSLDEyM GCKxpQb5ors5c72ELhRo5PAUrUIXxcfkHr7/N4xr3Ty67xcT+qsfPOTye6e1cgoL+CaR 8dixwemYNaahWRpr8KskP9gR2T5bqOq3F6lUVQF7Y9GUGvKwXU29R7cp2EpswaF3DhDU yBd+jcb6AVyAXHGG1QUZvHmv4oEMx8Dy/rZ8IDxfSie+3QM2B8dFE/I9eZhkyxE+9zza f5x/FJuk7+RBnhw2ajIe+K/MDujgzSWaC+FreuJ1eFJIDTWyIb7QhCCo6XiXvCoa83u6 cG2g== X-Forwarded-Encrypted: i=1; AJvYcCUPTzG1tBlww/7t/ZBwUNZYv7Q8sG2vCOBNS6XKWLa/gjrGBa/YeM4ltX/jhV7iaomXfdkY1TdIHPrHOSQI@vger.kernel.org, AJvYcCW3kbX/oENvnXN18G9Q3ER11PAG8d1ffqUYk3Ae5WQ0HqVyQs723luGxjtl2OeX0RUuiCPjknyKjmu9@vger.kernel.org X-Gm-Message-State: AOJu0YyGKA05MvSNuceARLWgr0AS1A0sTZq2UDcIU0lmpVuTBHf/7HMy ujGzS/US7ituvMDwIkSQqGlk9SoZ9fIwnYlFRUiKm8l3WZn3PbuH X-Google-Smtp-Source: AGHT+IFdLrj9ecgap3E+CV4uniSSefMCOxPr2gq2twi75rct7WYFoHMPbtABci+Q0/SowtSf0WvsXw== X-Received: by 2002:a17:90b:1d85:b0:2e2:c6c2:b3d5 with SMTP id 98e67ed59e1d1-2e56171dbe2mr7135012a91.9.1729352452752; Sat, 19 Oct 2024 08:40:52 -0700 (PDT) Received: from localhost.localdomain (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e55d7ade96sm2781319a91.1.2024.10.19.08.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2024 08:40:52 -0700 (PDT) From: Potin Lai Date: Sat, 19 Oct 2024 23:38:05 +0800 Subject: [PATCH 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241019-ssif-alert-gpios-v1-2-483eee5f99d3@gmail.com> References: <20241019-ssif-alert-gpios-v1-0-483eee5f99d3@gmail.com> In-Reply-To: <20241019-ssif-alert-gpios-v1-0-483eee5f99d3@gmail.com> To: Corey Minyard , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Quan Nguyen , Patrick Williams Cc: openipmi-developer@lists.sourceforge.net, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmo Chou , Potin Lai , Potin Lai , Cosmo Chou X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729352444; l=2721; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=PUD6kC7ss3fWPkXsFlsDDO/XmHqy3YarK27U7zFcq0Q=; b=2u8vlc9BMIFn8F0V/Ypep6jH2SfZWpPZ7MTD1f9cjupP6HhxPFbYLnyKovj3E7PIGZKWC41Wp r1I0R1vIRB3D9QI0RQG+wvSp/E5VPhf7lQO7/Fc185L35HpT3J0+n8l X-Developer-Key: i=potin.lai.pt@gmail.com; a=ed25519; pk=6Z4H4V4fJwLteH/WzIXSsx6TkuY5FOcBBP+4OflJ5gM= From: Cosmo Chou Implement GPIO-based alert mechanism in the SSIF BMC driver to notify the host when a response is ready. This improves host-BMC communication efficiency by providing immediate notification, potentially reducing host polling overhead. Signed-off-by: Cosmo Chou --- drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c index a14fafc583d4..73be166b0042 100644 --- a/drivers/char/ipmi/ssif_bmc.c +++ b/drivers/char/ipmi/ssif_bmc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include =20 #define DEVICE_NAME "ipmi-ssif-host" @@ -102,6 +103,7 @@ struct ssif_bmc_ctx { struct ssif_part_buffer part_buf; struct ipmi_ssif_msg response; struct ipmi_ssif_msg request; + struct gpio_desc *alert; }; =20 static inline struct ssif_bmc_ctx *to_ssif_bmc(struct file *file) @@ -222,6 +224,9 @@ static ssize_t ssif_bmc_write(struct file *file, const = char __user *buf, size_t =20 /* Clean old request buffer */ memset(&ssif_bmc->request, 0, sizeof(struct ipmi_ssif_msg)); + + if (!IS_ERR(ssif_bmc->alert)) + gpiod_set_value(ssif_bmc->alert, 1); exit: spin_unlock_irqrestore(&ssif_bmc->lock, flags); =20 @@ -584,6 +589,9 @@ static void process_smbus_cmd(struct ssif_bmc_ctx *ssif= _bmc, u8 *val) memset(&ssif_bmc->part_buf.payload[0], 0, MAX_PAYLOAD_PER_TRANSACTION); =20 if (*val =3D=3D SSIF_IPMI_SINGLEPART_WRITE || *val =3D=3D SSIF_IPMI_MULTI= PART_WRITE_START) { + if (!IS_ERR(ssif_bmc->alert)) + gpiod_set_value(ssif_bmc->alert, 0); + /* * The response maybe not come in-time, causing host SSIF driver * to timeout and resend a new request. In such case check for @@ -640,6 +648,8 @@ static void on_read_requested_event(struct ssif_bmc_ctx= *ssif_bmc, u8 *val) calculate_response_part_pec(&ssif_bmc->part_buf); ssif_bmc->part_buf.index =3D 0; *val =3D ssif_bmc->part_buf.length; + if (!IS_ERR(ssif_bmc->alert)) + gpiod_set_value(ssif_bmc->alert, 0); } =20 static void on_read_processed_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) @@ -808,6 +818,11 @@ static int ssif_bmc_probe(struct i2c_client *client) if (!ssif_bmc) return -ENOMEM; =20 + /* Request GPIO for alerting the host that response is ready */ + ssif_bmc->alert =3D devm_gpiod_get(&client->dev, "alert", GPIOD_ASIS); + if (!IS_ERR(ssif_bmc->alert)) + gpiod_direction_output(ssif_bmc->alert, 0); + spin_lock_init(&ssif_bmc->lock); =20 init_waitqueue_head(&ssif_bmc->wait_queue); --=20 2.31.1