Commit daa8ab59 authored by Nathan Lynch's avatar Nathan Lynch Committed by Michael Ellerman

powerpc/pseries/lpar: add missing RTAS retry status handling

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

pseries_lpar_read_hblkrm_characteristics() ignores this, making it
possible to incorrectly detect TLB block invalidation characteristics
at boot.

Move the RTAS call into a coventional rtas_busy_delay()-based loop.
Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
Fixes: 1211ee61 ("powerpc/pseries: Read TLB Block Invalidate Characteristics")
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-3-26929c8cce78@linux.ibm.com
parent cc4b26ea
...@@ -1481,22 +1481,22 @@ static inline void __init check_lp_set_hblkrm(unsigned int lp, ...@@ -1481,22 +1481,22 @@ static inline void __init check_lp_set_hblkrm(unsigned int lp,
void __init pseries_lpar_read_hblkrm_characteristics(void) void __init pseries_lpar_read_hblkrm_characteristics(void)
{ {
const s32 token = rtas_token("ibm,get-system-parameter");
unsigned char local_buffer[SPLPAR_TLB_BIC_MAXLENGTH]; unsigned char local_buffer[SPLPAR_TLB_BIC_MAXLENGTH];
int call_status, len, idx, bpsize; int call_status, len, idx, bpsize;
if (!firmware_has_feature(FW_FEATURE_BLOCK_REMOVE)) if (!firmware_has_feature(FW_FEATURE_BLOCK_REMOVE))
return; return;
spin_lock(&rtas_data_buf_lock); do {
memset(rtas_data_buf, 0, RTAS_DATA_BUF_SIZE); spin_lock(&rtas_data_buf_lock);
call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, memset(rtas_data_buf, 0, RTAS_DATA_BUF_SIZE);
NULL, call_status = rtas_call(token, 3, 1, NULL, SPLPAR_TLB_BIC_TOKEN,
SPLPAR_TLB_BIC_TOKEN, __pa(rtas_data_buf), RTAS_DATA_BUF_SIZE);
__pa(rtas_data_buf), memcpy(local_buffer, rtas_data_buf, SPLPAR_TLB_BIC_MAXLENGTH);
RTAS_DATA_BUF_SIZE); local_buffer[SPLPAR_TLB_BIC_MAXLENGTH - 1] = '\0';
memcpy(local_buffer, rtas_data_buf, SPLPAR_TLB_BIC_MAXLENGTH); spin_unlock(&rtas_data_buf_lock);
local_buffer[SPLPAR_TLB_BIC_MAXLENGTH - 1] = '\0'; } while (rtas_busy_delay(call_status));
spin_unlock(&rtas_data_buf_lock);
if (call_status != 0) { if (call_status != 0) {
pr_warn("%s %s Error calling get-system-parameter (0x%x)\n", pr_warn("%s %s Error calling get-system-parameter (0x%x)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment