Commit 922f440a authored by Quan Nguyen's avatar Quan Nguyen Committed by Wentao Guan
Browse files

ipmi: ssif_bmc: Fix new request loss when bmc ready for a response

stable inclusion
from stable-v6.6.76
commit 2851acb600d66ba3ebba209864367c8025a5326c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBW08Q

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2851acb600d66ba3ebba209864367c8025a5326c



--------------------------------

[ Upstream commit 83d8c79aa958e37724ed9c14dc7d0f66a48ad864 ]

Cosmo found that when there is a new request comes in while BMC is
ready for a response, the complete_response(), which is called to
complete the pending response, would accidentally clear out that new
request and force ssif_bmc to move back to abort state again.

This commit is to address that issue.

Fixes: dd2bc5cc ("ipmi: ssif_bmc: Add SSIF BMC driver")
Reported-by: default avatarCosmo Chou <chou.cosmo@gmail.com>
Closes: https://lore.kernel.org/lkml/20250101165431.2113407-1-chou.cosmo@gmail.com/


Signed-off-by: default avatarQuan Nguyen <quan@os.amperecomputing.com>
Message-ID: <20250107034734.1842247-1-quan@os.amperecomputing.com>
Signed-off-by: default avatarCorey Minyard <corey@minyard.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 2851acb600d66ba3ebba209864367c8025a5326c)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 9bc64d30
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -292,7 +292,6 @@ static void complete_response(struct ssif_bmc_ctx *ssif_bmc)
	ssif_bmc->nbytes_processed = 0;
	ssif_bmc->remain_len = 0;
	ssif_bmc->busy = false;
	memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer));
	wake_up_all(&ssif_bmc->wait_queue);
}

@@ -744,9 +743,11 @@ static void on_stop_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
			ssif_bmc->aborting = true;
		}
	} else if (ssif_bmc->state == SSIF_RES_SENDING) {
		if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF)
		if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF) {
			memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer));
			/* Invalidate response buffer to denote it is sent */
			complete_response(ssif_bmc);
		}
		ssif_bmc->state = SSIF_READY;
	}