Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arm_mpam: Reset when feature configuration bit unset

To indicate that the configuration, of the controls used by resctrl, in a
RIS need resetting to driver defaults the reset flags in mpam_config are
set. However, these flags are only ever set temporarily at RIS scope in
mpam_reset_ris() and hence mpam_cpu_online() will never reset these
controls to default. As the hardware reset is unknown this leads to unknown
configuration when the control values haven't been configured away from the
defaults.

Use the policy that an unset feature configuration bit means reset. In this
way the mpam_config in the component can encode that it should be in reset
state and mpam_reprogram_msc() will reset controls as needed.

Fixes: 09b89d2a72f3 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: James Morse <james.morse@arm.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
[ morse: Removed unused reset flags from config structure ]
Signed-off-by: James Morse <james.morse@arm.com>

authored by

Ben Horgan and committed by
James Morse
a1cb6577 f91e9133

+12 -32
+12 -28
drivers/resctrl/mpam_devices.c
··· 1364 1364 __mpam_intpart_sel(ris->ris_idx, partid, msc); 1365 1365 } 1366 1366 1367 - if (mpam_has_feature(mpam_feat_cpor_part, rprops) && 1368 - mpam_has_feature(mpam_feat_cpor_part, cfg)) { 1369 - if (cfg->reset_cpbm) 1370 - mpam_reset_msc_bitmap(msc, MPAMCFG_CPBM, rprops->cpbm_wd); 1371 - else 1367 + if (mpam_has_feature(mpam_feat_cpor_part, rprops)) { 1368 + if (mpam_has_feature(mpam_feat_cpor_part, cfg)) 1372 1369 mpam_write_partsel_reg(msc, CPBM, cfg->cpbm); 1370 + else 1371 + mpam_reset_msc_bitmap(msc, MPAMCFG_CPBM, rprops->cpbm_wd); 1373 1372 } 1374 1373 1375 - if (mpam_has_feature(mpam_feat_mbw_part, rprops) && 1376 - mpam_has_feature(mpam_feat_mbw_part, cfg)) { 1377 - if (cfg->reset_mbw_pbm) 1374 + if (mpam_has_feature(mpam_feat_mbw_part, rprops)) { 1375 + if (mpam_has_feature(mpam_feat_mbw_part, cfg)) 1378 1376 mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits); 1379 1377 else 1380 1378 mpam_write_partsel_reg(msc, MBW_PBM, cfg->mbw_pbm); ··· 1382 1384 mpam_has_feature(mpam_feat_mbw_min, cfg)) 1383 1385 mpam_write_partsel_reg(msc, MBW_MIN, 0); 1384 1386 1385 - if (mpam_has_feature(mpam_feat_mbw_max, rprops) && 1386 - mpam_has_feature(mpam_feat_mbw_max, cfg)) { 1387 - if (cfg->reset_mbw_max) 1388 - mpam_write_partsel_reg(msc, MBW_MAX, MPAMCFG_MBW_MAX_MAX); 1389 - else 1387 + if (mpam_has_feature(mpam_feat_mbw_max, rprops)) { 1388 + if (mpam_has_feature(mpam_feat_mbw_max, cfg)) 1390 1389 mpam_write_partsel_reg(msc, MBW_MAX, cfg->mbw_max); 1390 + else 1391 + mpam_write_partsel_reg(msc, MBW_MAX, MPAMCFG_MBW_MAX_MAX); 1391 1392 } 1392 1393 1393 - if (mpam_has_feature(mpam_feat_mbw_prop, rprops) && 1394 - mpam_has_feature(mpam_feat_mbw_prop, cfg)) 1394 + if (mpam_has_feature(mpam_feat_mbw_prop, rprops)) 1395 1395 mpam_write_partsel_reg(msc, MBW_PROP, 0); 1396 1396 1397 1397 if (mpam_has_feature(mpam_feat_cmax_cmax, rprops)) ··· 1487 1491 return 0; 1488 1492 } 1489 1493 1490 - static void mpam_init_reset_cfg(struct mpam_config *reset_cfg) 1491 - { 1492 - *reset_cfg = (struct mpam_config) { 1493 - .reset_cpbm = true, 1494 - .reset_mbw_pbm = true, 1495 - .reset_mbw_max = true, 1496 - }; 1497 - bitmap_fill(reset_cfg->features, MPAM_FEATURE_LAST); 1498 - } 1499 - 1500 1494 /* 1501 1495 * Called via smp_call_on_cpu() to prevent migration, while still being 1502 1496 * pre-emptible. Caller must hold mpam_srcu. ··· 1494 1508 static int mpam_reset_ris(void *arg) 1495 1509 { 1496 1510 u16 partid, partid_max; 1497 - struct mpam_config reset_cfg; 1511 + struct mpam_config reset_cfg = {}; 1498 1512 struct mpam_msc_ris *ris = arg; 1499 1513 1500 1514 if (ris->in_reset_state) 1501 1515 return 0; 1502 - 1503 - mpam_init_reset_cfg(&reset_cfg); 1504 1516 1505 1517 spin_lock(&partid_max_lock); 1506 1518 partid_max = mpam_partid_max;
-4
drivers/resctrl/mpam_internal.h
··· 266 266 u32 mbw_pbm; 267 267 u16 mbw_max; 268 268 269 - bool reset_cpbm; 270 - bool reset_mbw_pbm; 271 - bool reset_mbw_max; 272 - 273 269 struct mpam_garbage garbage; 274 270 }; 275 271