From 48c7907d928139debf4d73575f688e858ff24aca Mon Sep 17 00:00:00 2001 From: Muhammad Usama Anjum Date: Thu, 30 Jul 2026 12:12:52 +0100 Subject: [PATCH] misc: sgi-gru: inline the user CBR status update The process-context fault path always has a valid user CBR pointer. Inline the one-use status helper and remove its obsolete NULL check. No functional change. Signed-off-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20260730111316.3672672-4-usama.anjum@arm.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/sgi-gru/grufault.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index e43fdea01cb6..6b7e7dc37eac 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c @@ -111,21 +111,6 @@ static void gru_unlock_gts(struct gru_thread_state *gts) mmap_read_unlock(current->mm); } -/* - * Set a CB.istatus to active using a user virtual address. This must be done - * just prior to a TFH RESTART. The new cb.istatus is an in-cache status ONLY. - * If the line is evicted, the status may be lost. The in-cache update - * is necessary to prevent the user from seeing a stale cb.istatus that will - * change as soon as the TFH restart is complete. Races may cause an - * occasional failure to clear the cb.istatus, but that is ok. - */ -static void gru_cb_set_istatus_active(struct gru_instruction_bits *cbk) -{ - if (cbk) { - cbk->istatus = CBS_ACTIVE; - } -} - /* * Read & clear a TFM * @@ -354,7 +339,12 @@ static int gru_try_dropin(struct gru_state *gru, gru_flush_cache_cbe(cbe); } - gru_cb_set_istatus_active(cbk); + /* + * Set CB.istatus active in cache before restarting the TFH to avoid + * exposing stale pre-restart status. Cacheline eviction may lose the + * update, but an occasional stale status is harmless. + */ + cbk->istatus = CBS_ACTIVE; gts->ustats.tlbdropin++; tfh_write_restart(tfh, gpa, GAA_RAM, vaddr, asid, write, GRU_PAGESIZE(pageshift));