[PATCH 10/33] arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate

Ben Horgan ben.horgan at arm.com
Wed Nov 12 07:37:51 PST 2025


Hi Shaopeng,

On 11/12/25 07:22, Shaopeng Tan (Fujitsu) wrote:
> Hello Ben,
> 
>> From: James Morse <james.morse at arm.com>
>>
>> Probing MPAM is convoluted. MSCs that are integrated with a CPU may only be
>> accessible from those CPUs, and they may not be online.
>> Touching the hardware early is pointless as MPAM can't be used until the
>> system-wide common values for num_partid and num_pmg have been
>> discovered.
>>
>> Start with driver probe/remove and mapping the MSC.
>>
>> CC: Carl Worth <carl at os.amperecomputing.com>
>> Tested-by: Fenghua Yu <fenghuay at nvidia.com>
>> Tested-by: Shaopeng Tan <tan.shaopeng at jp.fujitsu.com>
>> Tested-by: Peter Newman <peternewman at google.com>
>> Signed-off-by: James Morse <james.morse at arm.com>
>> Signed-off-by: Ben Horgan <ben.horgan at arm.com>
>> ---
[...]
>> +static struct mpam_msc *do_mpam_msc_drv_probe(struct platform_device
>> +*pdev) {
>> +	int err;
>> +	u32 tmp;
>> +	struct mpam_msc *msc;
>> +	struct resource *msc_res;
>> +	struct device *dev = &pdev->dev;
>> +
>> +	lockdep_assert_held(&mpam_list_lock);
>> +
>> +	msc = devm_kzalloc(&pdev->dev, sizeof(*msc), GFP_KERNEL);
>> +	if (!msc)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	err = devm_mutex_init(dev, &msc->probe_lock);
>> +	if (err)
>> +		return ERR_PTR(err);
>> +	err = devm_mutex_init(dev, &msc->part_sel_lock);
>> +	if (err)
>> +		return ERR_PTR(err);
>> +	msc->id = pdev->id;
>> +	msc->pdev = pdev;
>> +	INIT_LIST_HEAD_RCU(&msc->all_msc_list);
>> +	INIT_LIST_HEAD_RCU(&msc->ris);
>> +
>> +	err = update_msc_accessibility(msc);
>> +	if (err)
>> +		return ERR_PTR(err);
> 
> Since the return value of update_msc_accessibility(msc) is always 0,
> this check is unnecessary.

Yes, I've changed update_msc_accessibility() to return void.
> 
> Best regards,
> Shaopeng TAN
> 
Thanks,

Ben




More information about the linux-arm-kernel mailing list