diff options
author | Andrew Donnellan <andrew.donnellan@au1.ibm.com> | 2018-09-14 13:46:22 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-09-17 21:39:01 -0500 |
commit | ecc4a562b5d17487899765609cb480629bacecde (patch) | |
tree | 579570648776048353c5f9705502ba331891a58f /hw/occ.c | |
parent | 8a2b6d51b77172d5ff81aa412ff7aa97f57d4f90 (diff) | |
download | blackbird-skiboot-ecc4a562b5d17487899765609cb480629bacecde.tar.gz blackbird-skiboot-ecc4a562b5d17487899765609cb480629bacecde.zip |
occ: Wait if OCC GPU presence status not immediately available
It takes a few seconds for the OCC to set everything up in order to read
GPU presence. At present, we try to kick off OCC initialisation as early as
possible to maximise the time it has to read GPU presence.
Unfortunately sometimes that's not enough, so add a loop in
occ_get_gpu_presence() so that on the first time we try to get GPU presence
we keep trying for up to 2 seconds. Experimentally this seems to be
adequate.
Fixes: 9b394a32c8ea ("occ: Add support for GPU presence detection")
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/occ.c')
-rw-r--r-- | hw/occ.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1238,14 +1238,24 @@ exit: bool occ_get_gpu_presence(struct proc_chip *chip, int gpu_num) { struct occ_dynamic_data *ddata; + static int max_retries = 20; + static bool found = false; assert(gpu_num <= 2); ddata = get_occ_dynamic_data(chip); + while (!found && max_retries) { + if (ddata->major_version == 0 && ddata->minor_version >= 1) { + found = true; + break; + } + time_wait_ms(100); + max_retries--; + ddata = get_occ_dynamic_data(chip); + } - if (ddata->major_version != 0 || ddata->minor_version < 1) { - prlog(PR_INFO, "OCC: OCC not reporting GPU slot presence, " - "assuming device is present\n"); + if (!found) { + prlog(PR_INFO, "OCC: No GPU slot presence, assuming GPU present\n"); return true; } |