From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6758A45A28B for ; Thu, 30 Jul 2026 19:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785438324; cv=none; b=GX7Sefkx8gpGYmlnq+w5JtEp2CbscoBnSaSW1pGw5s36MG3NP2+TF5v78zhzJzhOdO3YF58EjLlWs1vzJUqBMPTNbwymG64uCudIJ7GX0SzJ420nXqZuowhIMqcARQ8d7ath7RZaAlNCHasAzcCBDgeogPm32Kp76o/oul5SNZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785438324; c=relaxed/simple; bh=GmvbZIw9FVSnGdEtAIA/a6EBcDxWnIXefHSmgFiJBcc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iU2s2xquSDO+nJeVrbp1KEV2vjJaDvGaygjHgcEJkFY49SS3MkOM+AfdC32VFwLSB/ilRBbRlNb9OPM3U7yDZKwyE6tZPVMBqP944nQtEtF8Sm/S+MRi6OJBh7ImVFWMdAu5rpjdjKIBPJ1/nS8fdGd+z/z8SgrMFwGL7XgTbU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=QpUixNTy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=egoJCji+; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="QpUixNTy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="egoJCji+" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66UIRMoB1828368 for ; Thu, 30 Jul 2026 19:05:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GqFouO/Y0c5A8aRED0hGU8nzTxnUOhLbljZSc3SPdr8=; b=QpUixNTyrWH4KVoV tVDCeqi0jYtHrpR/Z5/f0oC18+A+6h/iU14wotg513bT/EzpJ0HPkhpBVtA04Zw0 r1g77haoJwdtQt+QGcQbaXdtynhR+TJoxHr5MZDIRlbDNy3lHKjtI1W3ZFfCx77O xcDxK220a1yqlEffKUy6vq5fJdQxRDLW2T/0FO98YBBVFZ79Yb+p0Y/GrXooFF1I hEriF+By07dbkwiisoCL89jA6GvJi9i0ubDZeQkK9hpyjrAQXKs3x+yrM/nZHNlx maGZxd5DUdJw++//nv8+h6Rw1sRCgitbC4Trot+SHsgBqg/HrVfebvD+k7um8Qmu EyQ+DA== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4frbwh0625-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 19:05:22 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cab048cdb3eso159457a12.0 for ; Thu, 30 Jul 2026 12:05:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785438322; x=1786043122; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=GqFouO/Y0c5A8aRED0hGU8nzTxnUOhLbljZSc3SPdr8=; b=egoJCji+cg4axnrQaqYUbMuKRwHGZcyhmPCl78L8JzpNlys4Ta5JGTJQ75ozeDmo3c KCftqvNTAolrCzBTk212F92xboV31ueT1y+yrr8E+dgk9q3DyJDd4Z+4ovBl/xqt/NLv Ug/UeW/GjPuvdnC8Ts1dLJLk4xWvpEhPjOyBJgzRvzapcRvhPQ0xjqL32MJI61GPE9Gg NKiQssexAt4AW01l+plgDo8gBuKjVm4e2dLmkrqeYR4OLzpGUtyPsqsnd3/GH7hgLL4v wS4TVpFJHdKJse4M4uUhp9x6UrGfvyzJetI0iFQzStuipaodWN24ym3Sv4c0ENxoq937 80Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785438322; x=1786043122; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=GqFouO/Y0c5A8aRED0hGU8nzTxnUOhLbljZSc3SPdr8=; b=KfWzHc5TdpdVVYTpxKgxV24WVB1XUXyXS75wa2gIlfWnVltz39uE8ZxVwXpN7goDzr xH6hJuooQ8KvPsvu53VhYFo45QDfEi4SqGTuBkeJJp4tc0vzSCjvQCTW6FyJlFn9B2Tz fyN7FHw8QKHfs4mFFBivYmV91UGtKHpj3QaBJ1YAo2ckWeNVmK0oEo80Ky7kFh3UgUaD z+y0fjA1MX+GNGOBeqecIgiejVkcvJ2voCpZQzqk++U8iCAiuuyW0ViuhRQDauSGbZ1s jSthjwrBHya8dBNaxOsJo/oJGbS8b0fzLhbbiuSQjlPMimSHB/09LfZ9G19IHO0W+ip/ r1sg== X-Forwarded-Encrypted: i=1; AHgh+RoIu69rk3qIhhnsDc0HpGheCAKabsWTqNsDX9xraxPzMp0IZ2wE29dbETHqlEjQoBtQPBvi8T+WQ+P5Aeo=@vger.kernel.org X-Gm-Message-State: AOJu0YyZG9aDH8ANLUt4VnrkSLhHWUtVlbEoARyB9v+FDyPBcJbqM6si zZlibYV8JgHebvBVA7bYjyRBBEGKy1W0VSqFE55NUNkzRz+fE4oQ+UIMG4jUODyZCkazLCbwsby 0V6Q+YRLKnT5+2tBeF6zCbbTU8oTd8kxEwzhyjNxcGO09G8E4EOOeKJZYlULIOEc81kE= X-Gm-Gg: AR+sD11IhfJlUdNA+m0KSMaBSZsVlIjHUaRHMDUPupt1cbI6fKWm/+heCa0XUlKfjZC RKwowCYDNGAaKStr+QAFTJdm7d8FEF0h7VJo9Ne6FIuOkmcqA80wLblOtPCZc6Gw0SPAK+CLo+0 dV6FrbFX5LEHIy5fm9rUQ6VYA8aE6/7LoRgGSmW6QipQ3ybslXY9DTJDO3OUqNQVTMXWOjH89OE XlwIBP8xhd4mK5D2eO/0iLJzvgTDNyeOFeC+16iKG8bmJjX9QKHMfFmjVlzCF//z84noCbhqfnu LJ/CP9gB9SCToOhSz3Kn2iXdZOkSr0wdPXlHBu76w1Qe8qzu7bXbVkwISrQJGbts6fOW11vh0aA qGp+foa3jOCaiUlDo3vO6h4O1hw== X-Received: by 2002:a05:6a21:692:b0:3a0:bc61:62e6 with SMTP id adf61e73a8af0-3c90d3da39fmr1381077637.8.1785438321818; Thu, 30 Jul 2026 12:05:21 -0700 (PDT) X-Received: by 2002:a05:6a21:692:b0:3a0:bc61:62e6 with SMTP id adf61e73a8af0-3c90d3da39fmr1381039637.8.1785438321357; Thu, 30 Jul 2026 12:05:21 -0700 (PDT) Received: from localhost ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504b15f77sm25603658eec.4.2026.07.30.12.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 12:05:20 -0700 (PDT) Date: Thu, 30 Jul 2026 12:05:16 -0700 From: Jonathan Cameron To: Andre Przywara Cc: Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , James Morse , Ben Horgan , Reinette Chatre , Fenghua Yu , Jonathan Cameron , Srivathsa L Rao , Ganapatrao Kulkarni , Trilok Soni , Srinivas Ramana , Niyas Sait , Lee Trager , Ritwick Sharma , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 08/10] arm_mpam: add MPAM-Fb MSC firmware access support Message-ID: <20260730120516.000059aa@oss.qualcomm.com> In-Reply-To: <20260730152539.2712312-9-andre.przywara@arm.com> References: <20260730152539.2712312-1-andre.przywara@arm.com> <20260730152539.2712312-9-andre.przywara@arm.com> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDE0MCBTYWx0ZWRfX3lFKBmhOcyqu cJhsjn4YAypt5GWCStPZFieCQhO/DRg+9NHbmyfi5yke3QD0YrbRjPfdYMd+q1rxgHIcJF5+QMI ys2xhfM882AOUTXtZ5Y3h9q6SFPv7NE= X-Authority-Analysis: v=2.4 cv=A5xc+aWG c=1 sm=1 tr=0 ts=6a6ba072 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=7CQSdrXTAAAA:8 a=EUspDBNiAAAA:8 a=irsnRLeOcCLjm4-ghIcA:9 a=CjuIK1q_8ugA:10 a=x9snwWr2DeNwDh03kgHS:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDE0MCBTYWx0ZWRfX9tAScP3zJQKD IvfAKP6shB4iowxTJ/1LdE0G8U8RF738sETUchnqfLLpF6XRPvEGCxFwO0imhDunZatZ4yFjc6q jfDdK/602kAAc4T2BQO67fcDGS4tiIb5V0ThzuR8xgh1cZvAej+EhITPfxy/Mzrq/cQmjRA6EwI 8nl0T0Z7YC+WRWJXnQgxSfJbkNyW+64LOaGpIyqpjdz0tskf3UH/fOBKzBPaNT5LQauYwRf0AwU 5a98uChYp2OWM4gmvJHWk37oQODPJ2PsOnHi7XlcXiehsK7S5D3OfV9dtCh92em7DjYiIlRc2Xw IBij1hR3n5FAFQjWVLPnzCqL4kDm29CmmUhNamDxna9o30PVCoWdE65Imc+OqQzgokqV1wmsN7I Gb9N8yaKg+kngNyGNbIWS7pMj0j6yaDfy7gWimb5OBKrPvGDGGN8+iAudYzZln/NUHscftdeY2n rAA3WHtspemQCIMMZCQ== X-Proofpoint-ORIG-GUID: hsX-l8arTuSTpROBvGVcjvWwwe2VxA1x X-Proofpoint-GUID: hsX-l8arTuSTpROBvGVcjvWwwe2VxA1x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-30_05,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 suspectscore=0 priorityscore=1501 impostorscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300140 On Thu, 30 Jul 2026 17:25:37 +0200 Andre Przywara wrote: > The Arm MPAM Firmware-backed (Fb) Profile document[1] describes an > alternative way of accessing the "Memory System Components" (MSC) in an > MPAM enabled system. > > Normally the MSCs are MMIO mapped, but in some implementations this > might not be possible (MSC located outside of the local socket, MSC > mapped secure-only) or desirable (direct MMIO access too slow or needs > to be mediated through a control processor). MPAM-fb standardises a > protocol to abstract MSC accesses, building on the SCMI protocol. > > Add functions that do an MSC read or write access by redirecting the > request through a firmware interface. For now this done via an ACPI > PCC shared memory and mailbox combination. > > Since the protocol used is only a small subset of the full SCMI spec, > and the SCMI protocol has no full ACPI support anyway, open-code the > (simple) SCMI message generation, for just the fields we need. > > [1] https://developer.arm.com/documentation/den0144/latest > > Signed-off-by: Andre Przywara On trivial style consistency comment. Otherwise looks fine to me. Reviewed-by: Jonathan Cameron > diff --git a/drivers/resctrl/mpam_fb.c b/drivers/resctrl/mpam_fb.c > new file mode 100644 > index 000000000000..e2ce28a602aa > --- /dev/null > +++ b/drivers/resctrl/mpam_fb.c ... > +static int mpam_fb_send_request(struct mpam_pcc_chan *pcc_chan, u32 msc_id, > + u16 reg, u32 *result, int mpam_fb_command) > +{ > + unsigned int token = atomic_inc_return(&mpam_fb_token); > + struct acpi_pcct_ext_pcc_shared_memory __iomem *pcc_shmem; > + struct pcc_mbox_chan *chan; > + void __iomem *payload_ofs; > + int mpam_fb_err = 0; > + u32 status; > + int ret; > + > + if (!pcc_chan) > + return -ENODEV; > + > + chan = pcc_chan->pcc_chan; > + > + /* prune token to fit into the 10 bits inside the command register */ > + token = FIELD_GET(MPAM_MSC_TOKEN_MASK, > + FIELD_PREP(MPAM_MSC_TOKEN_MASK, token)); > + > + mutex_lock(&pcc_chan->pcc_chan_lock); > + > + switch (mpam_fb_command) { > + case MPAM_MSC_WRITE_CMD: > + mpam_fb_build_write_message(msc_id, reg, *result, > + token, chan->shmem); > + break; > + case MPAM_MSC_READ_CMD: > + mpam_fb_build_read_message(msc_id, reg, token, chan->shmem); > + break; > + case MPAM_PROTOCOL_VERSION_CMD: > + mpam_fb_build_version_message(token, chan->shmem); > + break; > + default: > + dev_err(pcc_chan->pcc_cl.dev, "unsupported MPAM-Fb command %d\n", > + mpam_fb_command); > + ret = -EINVAL; > + goto out_err; > + } > + > + ret = mbox_send_message(chan->mchan, NULL); > + if (ret < 0) > + goto out_err; > + > + pcc_shmem = chan->shmem; > + payload_ofs = chan->shmem + sizeof(*pcc_shmem); > + status = readl(&pcc_shmem->command); > + if (FIELD_GET(MPAM_MSC_TOKEN_MASK, status) != token) { > + ret = -ETIMEDOUT; > + Slightly odd style. I'd drop blank lines in places like this. They aren't consistent as things stand. > + goto out_err; > + } > + > + mpam_fb_err = readl(payload_ofs + 0x0); > + if (mpam_fb_err < 0) { > + ret = mpam_fb_translate_error_code(mpam_fb_err); > + > + goto out_err; > + } > + > + if (mpam_fb_command != MPAM_MSC_WRITE_CMD) > + *result = readl(payload_ofs + 0x4); > + > + mutex_unlock(&pcc_chan->pcc_chan_lock); > + > + return 0; > + > +out_err: > + mutex_unlock(&pcc_chan->pcc_chan_lock); > + > + mpam_fb_disable_mpam(ret, mpam_fb_err); > + > + return ret; > +}