mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
arm_mpam: propagate MSC access errors for __ris_msmon_read()
Allow the function for RIS accesses to return an error, and propagate read and write errors from the lower level up. This function is a bit special, since it can be called via an SMP helper, so the prototype must stay as void. So propagate any errors using the "err" field in the struct passed in as the sole argument to that function. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> Reviewed-by: Ben Horgan <ben.horgan@arm.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Tested-by: Gavin Shan <gshan@redhat.com> # on NVIDIA Grace Hopper [morse: Fixed merge conflicts in mpam_save_mbwu_state() and __ris_msmon_read()] Signed-off-by: James Morse <james.morse@arm.com>
This commit is contained in:
parent
e8166b1139
commit
d326995393
|
|
@ -1339,6 +1339,10 @@ static u64 mpam_msmon_overflow_val(enum mpam_device_features type,
|
|||
return overflow_val;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function might be called via smp_call_function_any(), so propagate
|
||||
* errors inside the arg struct.
|
||||
*/
|
||||
static void __ris_msmon_read_locked(struct mon_read *m)
|
||||
{
|
||||
u64 now;
|
||||
|
|
@ -1357,7 +1361,9 @@ static void __ris_msmon_read_locked(struct mon_read *m)
|
|||
|
||||
mon_sel = FIELD_PREP(MSMON_CFG_MON_SEL_MON_SEL, ctx->mon) |
|
||||
FIELD_PREP(MSMON_CFG_MON_SEL_RIS, ris->ris_idx);
|
||||
mpam_write_monsel_reg(msc, CFG_MON_SEL, mon_sel);
|
||||
m->err = mpam_write_monsel_reg(msc, CFG_MON_SEL, mon_sel);
|
||||
if (m->err)
|
||||
return;
|
||||
|
||||
switch (m->type) {
|
||||
case mpam_feat_msmon_mbwu_31counter:
|
||||
|
|
@ -1377,7 +1383,9 @@ static void __ris_msmon_read_locked(struct mon_read *m)
|
|||
* Read the existing configuration to avoid re-writing the same values.
|
||||
* This saves waiting for 'nrdy' on subsequent reads.
|
||||
*/
|
||||
read_msmon_ctl_flt_vals(m, &cur_ctl, &cur_flt);
|
||||
m->err = read_msmon_ctl_flt_vals(m, &cur_ctl, &cur_flt);
|
||||
if (m->err)
|
||||
return;
|
||||
|
||||
if (mpam_feat_msmon_mbwu_31counter == m->type)
|
||||
overflow = cur_ctl & MSMON_CFG_x_CTL_OFLOW_STATUS;
|
||||
|
|
@ -1391,18 +1399,24 @@ static void __ris_msmon_read_locked(struct mon_read *m)
|
|||
cur_ctl != (ctl_val | MSMON_CFG_x_CTL_EN);
|
||||
|
||||
if (config_mismatch || reset_on_next_read) {
|
||||
write_msmon_ctl_flt_vals(m, ctl_val, flt_val);
|
||||
m->err = write_msmon_ctl_flt_vals(m, ctl_val, flt_val);
|
||||
if (m->err)
|
||||
return;
|
||||
overflow = false;
|
||||
} else if (overflow) {
|
||||
mpam_write_monsel_reg(msc, CFG_MBWU_CTL,
|
||||
cur_ctl &
|
||||
~(MSMON_CFG_x_CTL_OFLOW_STATUS |
|
||||
MSMON_CFG_MBWU_CTL_OFLOW_STATUS_L));
|
||||
m->err = mpam_write_monsel_reg(msc, CFG_MBWU_CTL,
|
||||
cur_ctl &
|
||||
~(MSMON_CFG_x_CTL_OFLOW_STATUS |
|
||||
MSMON_CFG_MBWU_CTL_OFLOW_STATUS_L));
|
||||
if (m->err)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m->type) {
|
||||
case mpam_feat_msmon_csu:
|
||||
mpam_read_monsel_reg(msc, CSU, &now32);
|
||||
m->err = mpam_read_monsel_reg(msc, CSU, &now32);
|
||||
if (m->err)
|
||||
return;
|
||||
nrdy = now32 & MSMON___NRDY;
|
||||
now = FIELD_GET(MSMON___VALUE, now32);
|
||||
|
||||
|
|
@ -1424,7 +1438,9 @@ static void __ris_msmon_read_locked(struct mon_read *m)
|
|||
else
|
||||
now = FIELD_GET(MSMON___L_VALUE, now);
|
||||
} else {
|
||||
mpam_read_monsel_reg(msc, MBWU, &now32);
|
||||
m->err = mpam_read_monsel_reg(msc, MBWU, &now32);
|
||||
if (m->err)
|
||||
return;
|
||||
nrdy = now32 & MSMON___NRDY;
|
||||
now = FIELD_GET(MSMON___VALUE, now32);
|
||||
}
|
||||
|
|
@ -1831,6 +1847,9 @@ static int mpam_restore_mbwu_state(void *_ris)
|
|||
__ris_msmon_read_locked(&mbwu_arg);
|
||||
|
||||
mpam_mon_sel_unlock(msc);
|
||||
|
||||
if (mbwu_arg.err && mbwu_arg.err != -EBUSY)
|
||||
return mbwu_arg.err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user