powerpc/pseries/setup: 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_cmo_feature_init() ignores this, making it possible to fail to
detect cooperative memory overcommit capabilities during boot.

Move the RTAS call into a conventional rtas_busy_delay()-based
loop, dropping unnecessary clearing of rtas_data_buf.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230125-b4-powerpc-rtas-queue-v3-5-26929c8cce78@linux.ibm.com
This commit is contained in:
Nathan Lynch 2023-02-10 12:41:53 -06:00 committed by Michael Ellerman
parent 5d08633e5f
commit b7d5333c48
1 changed files with 12 additions and 8 deletions

View File

@ -941,21 +941,25 @@ void pSeries_coalesce_init(void)
*/ */
static void __init pSeries_cmo_feature_init(void) static void __init pSeries_cmo_feature_init(void)
{ {
const s32 token = rtas_token("ibm,get-system-parameter");
char *ptr, *key, *value, *end; char *ptr, *key, *value, *end;
int call_status; int call_status;
int page_order = IOMMU_PAGE_SHIFT_4K; int page_order = IOMMU_PAGE_SHIFT_4K;
pr_debug(" -> fw_cmo_feature_init()\n"); pr_debug(" -> fw_cmo_feature_init()\n");
spin_lock(&rtas_data_buf_lock);
memset(rtas_data_buf, 0, RTAS_DATA_BUF_SIZE); do {
call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1, spin_lock(&rtas_data_buf_lock);
NULL, call_status = rtas_call(token, 3, 1, NULL,
CMO_CHARACTERISTICS_TOKEN, CMO_CHARACTERISTICS_TOKEN,
__pa(rtas_data_buf), __pa(rtas_data_buf),
RTAS_DATA_BUF_SIZE); RTAS_DATA_BUF_SIZE);
if (call_status == 0)
break;
spin_unlock(&rtas_data_buf_lock);
} while (rtas_busy_delay(call_status));
if (call_status != 0) { if (call_status != 0) {
spin_unlock(&rtas_data_buf_lock);
pr_debug("CMO not available\n"); pr_debug("CMO not available\n");
pr_debug(" <- fw_cmo_feature_init()\n"); pr_debug(" <- fw_cmo_feature_init()\n");
return; return;