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: 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>

authored by

Rohit Mathew and committed by
Catalin Marinas
fdc29a14 b3536379

+26 -12
+23 -12
drivers/resctrl/mpam_devices.c
··· 783 783 dev_err_once(dev, "Counters are not usable because not-ready timeout was not provided by firmware."); 784 784 } 785 785 if (FIELD_GET(MPAMF_MSMON_IDR_MSMON_MBWU, msmon_features)) { 786 - bool hw_managed; 786 + bool has_long, hw_managed; 787 787 u32 mbwumon_idr = mpam_read_partsel_reg(msc, MBWUMON_IDR); 788 788 789 789 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) { 791 791 mpam_set_feature(mpam_feat_msmon_mbwu, props); 792 792 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); 795 795 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 + } 800 805 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 + } 805 816 } 806 817 } 807 818
+3
drivers/resctrl/mpam_internal.h
··· 164 164 mpam_feat_msmon_csu_xcl, 165 165 mpam_feat_msmon_csu_hw_nrdy, 166 166 mpam_feat_msmon_mbwu, 167 + mpam_feat_msmon_mbwu_31counter, 168 + mpam_feat_msmon_mbwu_44counter, 169 + mpam_feat_msmon_mbwu_63counter, 167 170 mpam_feat_msmon_mbwu_capture, 168 171 mpam_feat_msmon_mbwu_rwbw, 169 172 mpam_feat_msmon_mbwu_hw_nrdy,