[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc3807ea-25ba-4581-8b63-843bc3f015a4@arm.com>
Date: Tue, 30 Sep 2025 18:06:23 +0100
From: James Morse <james.morse@....com>
To: Ben Horgan <ben.horgan@....com>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-acpi@...r.kernel.org
Cc: D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
dfustini@...libre.com, amitsinght@...vell.com,
David Hildenbrand <david@...hat.com>, Dave Martin <dave.martin@....com>,
Koba Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
fenghuay@...dia.com, baisheng.gao@...soc.com,
Jonathan Cameron <jonathan.cameron@...wei.com>, Rob Herring
<robh@...nel.org>, Rohit Mathew <rohit.mathew@....com>,
Rafael Wysocki <rafael@...nel.org>, Len Brown <lenb@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>, Hanjun Guo
<guohanjun@...wei.com>, Sudeep Holla <sudeep.holla@....com>,
Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>
Subject: Re: [PATCH v2 15/29] arm_mpam: Reset MSC controls from cpu hp
callbacks
Hi Ben,
On 12/09/2025 12:25, Ben Horgan wrote:
> On 9/10/25 21:42, James Morse wrote:
>> When a CPU comes online, it may bring a newly accessible MSC with
>> it. Only the default partid has its value reset by hardware, and
>> even then the MSC might not have been reset since its config was
>> previously dirtyied. e.g. Kexec.
>>
>> Any in-use partid must have its configuration restored, or reset.
>> In-use partids may be held in caches and evicted later.
>>
>> MSC are also reset when CPUs are taken offline to cover cases where
>> firmware doesn't reset the MSC over reboot using UEFI, or kexec
>> where there is no firmware involvement.
>>
>> If the configuration for a RIS has not been touched since it was
>> brought online, it does not need resetting again.
>>
>> To reset, write the maximum values for all discovered controls.
>> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
>> index cd8e95fa5fd6..0353313cf284 100644
>> --- a/drivers/resctrl/mpam_devices.c
>> +++ b/drivers/resctrl/mpam_devices.c
>> @@ -777,8 +778,110 @@ static int mpam_msc_hw_probe(struct mpam_msc *msc)
>> +static void mpam_reset_ris_partid(struct mpam_msc_ris *ris, u16 partid)
>> +{
>> + struct mpam_msc *msc = ris->vmsc->msc;
>> + struct mpam_props *rprops = &ris->props;
>> +
>> + mpam_assert_srcu_read_lock_held();
>> +
>> + mutex_lock(&msc->part_sel_lock);
>> + __mpam_part_sel(ris->ris_idx, partid, msc);
>> +
>> + if (mpam_has_feature(mpam_feat_cpor_part, rprops))
>> + mpam_reset_msc_bitmap(msc, MPAMCFG_CPBM, rprops->cpbm_wd);
>> +
>> + if (mpam_has_feature(mpam_feat_mbw_part, rprops))
>> + mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
>> +
>> + if (mpam_has_feature(mpam_feat_mbw_min, rprops))
>> + mpam_write_partsel_reg(msc, MBW_MIN, 0);
>> +
>> + if (mpam_has_feature(mpam_feat_mbw_max, rprops))
>> + mpam_write_partsel_reg(msc, MBW_MAX, MPAMCFG_MBW_MAX_MAX);
>> +
>> + if (mpam_has_feature(mpam_feat_mbw_prop, rprops))
>> + mpam_write_partsel_reg(msc, MBW_PROP, 0);
> If mpam_feat_ccap_part is already in enum mpam_device_features then the
> reset would belong here but I expect it is better just to introduce
> mpam_feat_ccap_part later (patch 21). I also commented on this feature
> introduction split on patch 13.
Yup, this is some knock on cleanup from that change.
(I didn't understand what you meant the first time round!)
>> + mutex_unlock(&msc->part_sel_lock);
>> +}
>> +static void mpam_reset_msc(struct mpam_msc *msc, bool online)
>> +{
>> + struct mpam_msc_ris *ris;
>> +
>> + mpam_assert_srcu_read_lock_held();
> Unneeded? Checked in list_for_each_entry_srcu().> +
So it is! I'll rip those out. They were mostly for documentation anyway.
There will likely be a few others of these in the series...
>> + list_for_each_entry_srcu(ris, &msc->ris, msc_list, srcu_read_lock_held(&mpam_srcu)) {
>> + mpam_reset_ris(ris);
>> +
>> + /*
>> + * Set in_reset_state when coming online. The reset state
>> + * for non-zero partid may be lost while the CPUs are offline.
>> + */
>> + ris->in_reset_state = online;
>> + }
>> +}
>> +
Thanks,
James
Powered by blists - more mailing lists