From: Nathan Lynch <nath...@linux.ibm.com>

Use rtas_ibm_activate_firmware_lock to prevent interleaving call
sequences of the ibm,activate-firmware RTAS function, which typically
requires multiple calls to complete the update. While the spec does
not specifically prohibit interleaved sequences, there's almost
certainly no advantage to allowing them.

Reviewed-by: Aneesh Kumar K.V (IBM) <aneesh.ku...@kernel.org>
Signed-off-by: Nathan Lynch <nath...@linux.ibm.com>
---
 arch/powerpc/kernel/rtas.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 4d28983e8b1d..72f6b5a402dd 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1734,10 +1734,14 @@ void rtas_activate_firmware(void)
                return;
        }
 
+       mutex_lock(&rtas_ibm_activate_firmware_lock);
+
        do {
                fwrc = rtas_call(token, 0, 1, NULL);
        } while (rtas_busy_delay(fwrc));
 
+       mutex_unlock(&rtas_ibm_activate_firmware_lock);
+
        if (fwrc)
                pr_err("ibm,activate-firmware failed (%i)\n", fwrc);
 }

-- 
2.41.0

Reply via email to