From b3b55a6bd59edba86fd71de439b87092b8b853b9 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Mon, 6 Jul 2020 13:34:18 +0930 Subject: [PATCH] astlpc: Clear OBF during binding initialisation Whatever the buffer ownership state was previously, it is now irrelevant as we're initialising the binding. Ensure that we don't accidentally block initialisation due to the host failing to consume the previous KCS command (which implies OBF is set and therefore we would block on sending the dummy command). The relevant callsites for mctp_astlpc_kcs_set_status() were aleady setting KCS_STATUS_OBF in the status value passed to the function, therefore it's not necessary for the function to set it explicitly. Removing the explicit KCS_STATUS_OBF from mctp_astlpc_kcs_set_status() to make way for correct use in mctp_astlpc_init_bmc(). Signed-off-by: Andrew Jeffery Change-Id: I54266ee4459115e993af2ad6665252887c27ab3e --- astlpc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/astlpc.c b/astlpc.c index 103b48c7..87a4ccad 100644 --- a/astlpc.c +++ b/astlpc.c @@ -214,7 +214,6 @@ static int mctp_astlpc_kcs_set_status(struct mctp_binding_astlpc *astlpc, * interrupt is triggered, and can be ignored by the host. */ data = 0xff; - status |= KCS_STATUS_OBF; rc = mctp_astlpc_kcs_write(astlpc, MCTP_ASTLPC_KCS_REG_STATUS, status); if (rc) { @@ -414,8 +413,12 @@ static int mctp_astlpc_init_bmc(struct mctp_binding_astlpc *astlpc) mctp_astlpc_lpc_write(astlpc, &hdr, 0, sizeof(hdr)); - /* set status indicating that the BMC is now active */ - status = KCS_STATUS_BMC_READY | KCS_STATUS_OBF; + /* + * Set status indicating that the BMC is now active. Be explicit about + * clearing OBF; we're reinitialising the binding and so any previous + * buffer state is irrelevant. + */ + status = KCS_STATUS_BMC_READY & ~KCS_STATUS_OBF; return mctp_astlpc_kcs_set_status(astlpc, status); }