Skip to content

Commit fdc29a1

Browse files
rohit-armctmarinas
authored andcommitted
arm_mpam: Probe for long/lwd mbwu counters
mpam v0.1 and versions above v1.0 support optional long counter for memory bandwidth monitoring. The MPAMF_MBWUMON_IDR register has fields indicating support for long counters. Probe these feature bits. The mpam_feat_msmon_mbwu feature is used to indicate that bandwidth monitors are supported, instead of muddling this with which size of bandwidth monitors, add an explicit 31 bit counter feature. Signed-off-by: Rohit Mathew <rohit.mathew@arm.com> [ morse: Added 31bit counter feature to simplify later logic ] Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Ben Horgan <ben.horgan@arm.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Tested-by: Fenghua Yu <fenghuay@nvidia.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Carl Worth <carl@os.amperecomputing.com> Tested-by: Gavin Shan <gshan@redhat.com> Tested-by: Zeng Heng <zengheng4@huawei.com> Tested-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent b353637 commit fdc29a1

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

drivers/resctrl/mpam_devices.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -783,25 +783,36 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris)
783783
dev_err_once(dev, "Counters are not usable because not-ready timeout was not provided by firmware.");
784784
}
785785
if (FIELD_GET(MPAMF_MSMON_IDR_MSMON_MBWU, msmon_features)) {
786-
bool hw_managed;
786+
bool has_long, hw_managed;
787787
u32 mbwumon_idr = mpam_read_partsel_reg(msc, MBWUMON_IDR);
788788

789789
props->num_mbwu_mon = FIELD_GET(MPAMF_MBWUMON_IDR_NUM_MON, mbwumon_idr);
790-
if (props->num_mbwu_mon)
790+
if (props->num_mbwu_mon) {
791791
mpam_set_feature(mpam_feat_msmon_mbwu, props);
792792

793-
if (FIELD_GET(MPAMF_MBWUMON_IDR_HAS_RWBW, mbwumon_idr))
794-
mpam_set_feature(mpam_feat_msmon_mbwu_rwbw, props);
793+
if (FIELD_GET(MPAMF_MBWUMON_IDR_HAS_RWBW, mbwumon_idr))
794+
mpam_set_feature(mpam_feat_msmon_mbwu_rwbw, props);
795795

796-
/* Is NRDY hardware managed? */
797-
hw_managed = mpam_ris_hw_probe_hw_nrdy(ris, MBWU);
798-
if (hw_managed)
799-
mpam_set_feature(mpam_feat_msmon_mbwu_hw_nrdy, props);
796+
has_long = FIELD_GET(MPAMF_MBWUMON_IDR_HAS_LONG, mbwumon_idr);
797+
if (has_long) {
798+
if (FIELD_GET(MPAMF_MBWUMON_IDR_LWD, mbwumon_idr))
799+
mpam_set_feature(mpam_feat_msmon_mbwu_63counter, props);
800+
else
801+
mpam_set_feature(mpam_feat_msmon_mbwu_44counter, props);
802+
} else {
803+
mpam_set_feature(mpam_feat_msmon_mbwu_31counter, props);
804+
}
800805

801-
/*
802-
* Don't warn about any missing firmware property for
803-
* MBWU NRDY - it doesn't make any sense!
804-
*/
806+
/* Is NRDY hardware managed? */
807+
hw_managed = mpam_ris_hw_probe_hw_nrdy(ris, MBWU);
808+
if (hw_managed)
809+
mpam_set_feature(mpam_feat_msmon_mbwu_hw_nrdy, props);
810+
811+
/*
812+
* Don't warn about any missing firmware property for
813+
* MBWU NRDY - it doesn't make any sense!
814+
*/
815+
}
805816
}
806817
}
807818

drivers/resctrl/mpam_internal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ enum mpam_device_features {
164164
mpam_feat_msmon_csu_xcl,
165165
mpam_feat_msmon_csu_hw_nrdy,
166166
mpam_feat_msmon_mbwu,
167+
mpam_feat_msmon_mbwu_31counter,
168+
mpam_feat_msmon_mbwu_44counter,
169+
mpam_feat_msmon_mbwu_63counter,
167170
mpam_feat_msmon_mbwu_capture,
168171
mpam_feat_msmon_mbwu_rwbw,
169172
mpam_feat_msmon_mbwu_hw_nrdy,

0 commit comments

Comments
 (0)