From nobody Tue Nov 26 03:45:12 2024 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 6F73785C5E; Tue, 22 Oct 2024 01:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729560205; cv=none; b=gohiIuNjk3VQqUdZaYbVOVhCU3rlPzRvCBgvJcvOWW2D4y6WCBPKtaZKdrs+5GbXSKtsjPyrNSBfTk5CjhGh2Z5xj1RWkHNSG4nY6kgPmVVMGL2UQRqsvsvZzpLJgs30Ud+LPyvC8lRi83bPhAyNQaj1vVegkftyD5EPa3hf3C4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729560205; c=relaxed/simple; bh=nn2Rxbzki8aH4042gmU46/WUTDCnn3JnpSpUDXByOCQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HNWQR4hVbNPhX5Zohj8ZCTlIIXA2Mhi9D/6q+clQz23plDPlU6k2AMmlh2zXd5wf8MEgtBWY7vdqGuIe71xIf2CuFCm7FT0kzUNjXeh24SYHspDRDSFoIZOrWKHTUdklnzirNe/lDLny7+zkydNe3uNmlURA39NXwmZ3fRET+js= 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=U2WuTW48; arc=none smtp.client-ip=209.85.216.50 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="U2WuTW48" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2e18293a5efso3348901a91.3; Mon, 21 Oct 2024 18:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729560204; x=1730165004; 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=VxtXGGp+IPO+JLVgjZAJAUQ+Dzcq0V5RhM6NRuq/n0k=; b=U2WuTW48vPEafYREG4ORlw9Ar+iPgjTK0H8vGYmL9gAgPjXoy1ijuKOaVoru2q8CM7 MpS/ngaJKI8Zh3CHgzx4WnliS/AaRJ2Bd70E4ziLHpqeWtNKsv6RCDIjIe1Pg0je22wi Arz9vCM6yeXOpSZP/KRHXiASVEGn/SwKipHNoAmpy4DyC8j2ZHKIOYqkb/ecCKw469B8 dCLEE6xqx3juFCXPvkoOlmvEO4iFEHlqxcl1UT+a91j5mAfAuoBAFWT5wyusvFsY67mu BaFtL+mnlgUBCtB6KLz/3rbtyumS2rwhPTzJZBC7QT4UvPVRGB2VI+8uPJBziVXQgstZ cumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729560204; x=1730165004; 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=VxtXGGp+IPO+JLVgjZAJAUQ+Dzcq0V5RhM6NRuq/n0k=; b=vM+tGGfYokAuGUHrRvj7QRsts/g6DvtdJo9edBGizao5flFOzU3XULdEXtyIRjY+L7 EbunUpN9lSht18RRE9zlvLPEh8psCbCxB6kZaVohI9+TEwetcXrejNORZsUmZEgXrCdU Zs21cNcMAxu0AXQtk/go/iOUlRBH31nk8XTM5ySw1gGUq0gB9ReLxEjJq8b59O/JbSDt tWIQTzW/c1D606C/vZUvEe8+v8vGGhk4aQGUMwK8QDRRTi95k/gsfr9cY0bs9j2fVbf8 YwrEoUKTKdVEdxq/SWpgYvnKtMtNsMMJZXGJyH8llBpHnuqjKXKPH+tMHaKgcIjjUkgb PDlg== X-Forwarded-Encrypted: i=1; AJvYcCUp/TxzbbuAlrq+5MS/SLfJjHQJhcLkZVG+U2XEVxNHNoD6hPi+UWO/yO051Wf31rvXu0SpuKgeTkWtiUT4@vger.kernel.org, AJvYcCWe0J7qmgI7vZhZsO3DJfmjOWKqFU1+GzaAawhS5fRf73mWYfAqnlDeC/bVp3WH5KKTkSOG8fhVeYy7@vger.kernel.org X-Gm-Message-State: AOJu0YxSVVPpeEH6uHo+DqPRHeyDc0jqmo23zQlayUFOf7QR+rlp9uFy pSS2JkVJiYGhJjbIXIObr0TWz0c+v548A9hQNvt7orrpxY6DL/2EWHqjUw== X-Google-Smtp-Source: AGHT+IGEcA425R+zt7O3mhkGya1ytfmxp/EH1+frDZZC/31L7dOO7/HqcpoC1ICNuNvhynWfycL5WQ== X-Received: by 2002:a17:90a:d90c:b0:2e5:5ab5:ba52 with SMTP id 98e67ed59e1d1-2e56165ea76mr16533853a91.20.1729560203752; Mon, 21 Oct 2024 18:23:23 -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-2e5ad365d14sm4718919a91.13.2024.10.21.18.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 18:23:23 -0700 (PDT) From: Potin Lai Date: Tue, 22 Oct 2024 09:20:46 +0800 Subject: [PATCH v2 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: <20241022-ssif-alert-gpios-v2-1-c7dd6dd17a7e@gmail.com> References: <20241022-ssif-alert-gpios-v2-0-c7dd6dd17a7e@gmail.com> In-Reply-To: <20241022-ssif-alert-gpios-v2-0-c7dd6dd17a7e@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=1729560198; l=1245; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=nn2Rxbzki8aH4042gmU46/WUTDCnn3JnpSpUDXByOCQ=; b=HwcYWWEZRDQhw8ANje8Mjiy2UnduAhS0y+SPltj9xaSY/Bfrd4THWJtvnIZNOU9IFMTUcMHVn 3w2/K7UFoQaD+KjlbUYoHCi4s159GrnsOPBBSoDM6ISpSc6LhdzE/PZ 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 Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml b/Documen= tation/devicetree/bindings/ipmi/ssif-bmc.yaml index 02b662d780bb..7142151a3787 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 @@ -27,6 +33,7 @@ additionalProperties: false =20 examples: - | + #include i2c { #address-cells =3D <1>; #size-cells =3D <0>; @@ -34,5 +41,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 03:45:12 2024 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 671F485C5E; Tue, 22 Oct 2024 01:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729560211; cv=none; b=tldunRGOv04rhLbeg6phTOz+OVJH+uNcBjNzp0aqhBcplE+4LL2AKQc+O9BQsODyqm0Ar/2+T5NwI86uMDKzI4l9oWAcHa+dCuESSR23fBKbJoWHdVbJqGZDAXR/r0xERF1YdAS/TH2svVzHJy93j5ZLsd2ejP7n5i18ymFNZSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729560211; c=relaxed/simple; bh=MIGPOdo21PTWbv6zESRF7XdStcwjMCU1AGOn2z3JMpM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r1PdolKxteYa5FNimSIz/vNLcfaqOP8njSg/+irPPkG0Jh6HKRnDA6SAeepzWtz4h+l31i+UqnKo+bF6jF2W85qXmk53SFg8O2byozwS3GfLMJQojZJSJBjIFX3DGMIUQnUmjdE17W4Ln/e5/Iu2jvInxxK+C7gaUYmV3akK1os= 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=c3N0BImI; arc=none smtp.client-ip=209.85.216.42 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="c3N0BImI" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2e2dcf4b153so3709752a91.1; Mon, 21 Oct 2024 18:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729560210; x=1730165010; 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=c3N0BImIvY5cduUTvGafDkpAAOEwHY+JnLF3cn+rzCewOqnUDpAvUu/koxgLaN/N5Q HnZuLT5srW8CrhcOUcjrdw3464LBmipm8Wa+YudvFwyfbtzVVPqtCLQXfvSTuZ1GLXqm 4EPWNo5aQYUfxaYdmgMkEOVRBy9WVjWCMifaW6SNrYXJ+LapbPSXDP4iLKmtyZqA851v SLASUkbhoimnw8YCxbJOE0Uc3aJMRUqJgo2z9clppBhpKr8ahQqx1hh4ENFoADfPl+Dv fDMOY69cIeCpB0k7evLnyNrxD7XxlgsTOXRGy7dByiXQ3vANVeJ9QrsyOGrgqfoBiybz XKEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729560210; x=1730165010; 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=OKI930XPd1dixvTGa98LFN6O+GUyh/aA/CR4KB5dvfnJbhIk3b6JFSJY20hoMqtDo2 IaXudvjCqk9jITvXNAcqs+gEvUqU7NNBMg4MfySEhl8QgUbaldNfmWK/udMLsbXm5Ee/ sXtkLa2vqJlvX6IUlglTN0E3rgp0syYEVvDogPklXDtVo60ela+KJ/k2i2JoftZS60Nu qLFpaXIwREdgSNh8SQe7tTGafttJpygD6Q8Ji5U7QqKl4UCg+wbjD8ALW6HfBEoPaX6Z lMD+5HD4UpqLi4oE8DTwK3gjBeGXGyeFIExyLykxqs7OPWHABnYo0FB7bIebWFceszdg kzgw== X-Forwarded-Encrypted: i=1; AJvYcCWoSv2sdmt1SD9ydDVEF3kUbjKw2+++Xmbk1+a3TLYnkTPHJDW9Jyc8jvNXVfnyQ2wi6rGaxxZxoilZ@vger.kernel.org, AJvYcCXZ0i0QsuCuQimMWb9Q6mMPfU6NCUihCO4ofSUWICB0SckMFgTrRdE6spLeZfazHHONHjptMohw5YHL52T+@vger.kernel.org X-Gm-Message-State: AOJu0YwJwzyAO1Rsm8O2y3ymkBNd95ESvGUaZIQRyrg7HYnQe6c0yDeN EvODfk5pUZpaa6aeMsN1ZNIj+WYRRxWmLBzH/vUY/dKZtwIZCf0V X-Google-Smtp-Source: AGHT+IFDF8vNafHQIu1BhZKfSynLDr8X+Y76zj3pF0K4HDOWPyQhGrBM3vZ3HSYkUohWmDmh0iN3ug== X-Received: by 2002:a17:90a:fd10:b0:2e2:8c75:b45 with SMTP id 98e67ed59e1d1-2e5da580a85mr2166127a91.11.1729560206396; Mon, 21 Oct 2024 18:23:26 -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-2e5ad365d14sm4718919a91.13.2024.10.21.18.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 18:23:26 -0700 (PDT) From: Potin Lai Date: Tue, 22 Oct 2024 09:20:47 +0800 Subject: [PATCH v2 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: <20241022-ssif-alert-gpios-v2-2-c7dd6dd17a7e@gmail.com> References: <20241022-ssif-alert-gpios-v2-0-c7dd6dd17a7e@gmail.com> In-Reply-To: <20241022-ssif-alert-gpios-v2-0-c7dd6dd17a7e@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=1729560198; l=2721; i=potin.lai.pt@gmail.com; s=20240724; h=from:subject:message-id; bh=PUD6kC7ss3fWPkXsFlsDDO/XmHqy3YarK27U7zFcq0Q=; b=MyfetClwEMMrsdJaxnzazo2rPnNjJCZ9K1ekxRTXpo/c8c/YsSJqGaU10vFCc71b8hk75UtUe 2GRhg/5TkDrCWG8W1UO6rPs30IqeFSulmQw9mAGIAVkp3ZJVH0iVizv 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 Reviewed-by: Quan Nguyen --- 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