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

The ibm,get-system-parameter RTAS function may return -2 or 990x,
which indicate that the caller should try again.

lparcfg's parse_system_parameter_string() ignores this, making it
possible to intermittently report incorrect SPLPAR characteristics.

Move the RTAS call into a coventional rtas_busy_delay()-based loop.

Signed-off-by: Nathan Lynch <nath...@linux.ibm.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 arch/powerpc/platforms/pseries/lparcfg.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/lparcfg.c 
b/arch/powerpc/platforms/pseries/lparcfg.c
index 63fd925ccbb8..cd33d5800763 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -408,6 +408,7 @@ static void read_lpar_name(struct seq_file *m)
  */
 static void parse_system_parameter_string(struct seq_file *m)
 {
+       const s32 token = rtas_token("ibm,get-system-parameter");
        int call_status;
 
        unsigned char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
@@ -417,16 +418,15 @@ static void parse_system_parameter_string(struct seq_file 
*m)
                return;
        }
 
-       spin_lock(&rtas_data_buf_lock);
-       memset(rtas_data_buf, 0, SPLPAR_MAXLENGTH);
-       call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
-                               NULL,
-                               SPLPAR_CHARACTERISTICS_TOKEN,
-                               __pa(rtas_data_buf),
-                               RTAS_DATA_BUF_SIZE);
-       memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH);
-       local_buffer[SPLPAR_MAXLENGTH - 1] = '\0';
-       spin_unlock(&rtas_data_buf_lock);
+       do {
+               spin_lock(&rtas_data_buf_lock);
+               memset(rtas_data_buf, 0, SPLPAR_MAXLENGTH);
+               call_status = rtas_call(token, 3, 1, NULL, 
SPLPAR_CHARACTERISTICS_TOKEN,
+                                       __pa(rtas_data_buf), 
RTAS_DATA_BUF_SIZE);
+               memcpy(local_buffer, rtas_data_buf, SPLPAR_MAXLENGTH);
+               local_buffer[SPLPAR_MAXLENGTH - 1] = '\0';
+               spin_unlock(&rtas_data_buf_lock);
+       } while (rtas_busy_delay(call_status));
 
        if (call_status != 0) {
                printk(KERN_INFO

-- 
2.39.1

Reply via email to