From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F166CC5516E for ; Thu, 30 Jul 2026 19:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GqFouO/Y0c5A8aRED0hGU8nzTxnUOhLbljZSc3SPdr8=; b=sy26cP7PCG3u/YqUXNURFRedpP 26ETRDiIiucEMVM6ebnVooOgybal75PbDZiEkp7qR/XJt2ERc5xwiF6jK1RHFPu6Z7zD0pmV0+lVf 6grvJOhMhp/IV2xz9XOe0HvhgkRF+UFrmLIHPVno94GdIuJlpvyTdtCIb1HUzJyyhPA6IPtRKN4lr F1Fu/PG3+nZVYCHb7I27BCZG/j3TQ3iKIJhgfMACqQ06EWXkLv10VLgHuXlSSY/UhJ8jSoIi4SOiU n66ICzSDssrbJ5CRn9WOmI6GW4Sp/DPnaQ8aPwG7vw243gXTKYDRMuRxRVHxjG+mp0Nn0C+zwNTMX VTX56QnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wpW4N-0000000BCZm-1wud; Thu, 30 Jul 2026 19:05:27 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wpW4K-0000000BCZA-0RO8 for linux-arm-kernel@lists.infradead.org; Thu, 30 Jul 2026 19:05:25 +0000 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66UGWfnA1377596 for ; Thu, 30 Jul 2026 19:05:23 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-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fr8jmscmq-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-f200.google.com with SMTP id 41be03b00d2f7-cb733fc5024so170253a12.2 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=lists.infradead.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=bYCFTIb+A1PebGz0ahlc7XLMVrEQIjPdZGMA7ajtsGf7gsdV3vb8SpS5/csZJ+wTBQ Rqx/1M1s7ulL7LwBNv/C/ksqZOXBElOcVhQSzikkdoodRucHoRbcbznRD+xpnx3CzGjv 15YcLquMqdMurrHQSjiV4B5VFRNS490x6Tcm4cWZ+VJPpHsEbzo9huGk8HdE0ZdHEgpd oayOgrWtlmZcVlmSZqSylx3530JGc5klKv0HMTlUfavGCZNWAYlWKn7iSPzIFS2HeSCz lXk+AvfwyGX3Urik8M7W2Q4iPiVlNwo0MNjEa7xWzAXmQ49NrInZK4M7Oy1Bbaz22rBQ fbyw== 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=ToPxqRvvbdlLf3l4kM33vry+JTRVHSETtmp732f+Zc1Uq1YwU0zlaAIZQrDljks0li OhjrfIDF2CQjA5WoVdP5mwqPHTmPZ8lq6lyRY4yxg+74F+VsjoE1TIZEfhIOYNMP3cdS T84bYgshf6Rhd606Qj7Nyh/NWHxaNrzxV/3kus6IUjzzSjBRMD3T6KCZ8X7Z7a5hTMOE Z8uzgf6ymLmOAeSLS7N4m8/t6AaHrsGDjNZXg+GDGnOh6ORaunx13rsZ1OsCjJUjx17Q Pdvm0/ItRT8gpA+mrGG3JB0zx94K77Vje9RBka/oTEwc7o/InJl9/RLWPPs+o+MgNjh7 foWQ== X-Forwarded-Encrypted: i=1; AHgh+Roy3zArh9UMx+4p2zJVyMnXSu5n1PQ8d3Fxq3Z2eqnkpHEhUbib45nL+QZ6YgKvY1T74A/g8assWwHdB3J0Q/Mp@lists.infradead.org X-Gm-Message-State: AOJu0YyHvXXKxz3YSLIHuXo2cDzvrG1chTQun3MCdeBhJ9jG1DjcZ86D V1FsjZOX7/Y/icEnXpa5d1b1BpqxJhzbZFbRjbFACNTTRZrUO0mjmjX6WlZ+dCUs5Nsnc6r8ArS i2DJMGg2DZP3CRBNLtX3A2jnXnCJTkqxZqMjVVjZYOriMkHnoE/+UL7GUIlJByFyR2eDo+EjmsL Bluw== X-Gm-Gg: AR+sD11cChpzEgitmYunUUYo9KGcgyTFzBWbrIDdhET9UETLRxuQqIhVE+/forH+aUI fpN737NfV7DmqIVDGlnY0Niu08+15fP7HAgmCYrqAiUlJatCeHZyImqvMbIJOX8TEaZ0XSvaAx9 dfKLl+UUSRDoHFqgOjiSTyauieEaIQg9e8urLc9MsFqU0Ie8V9B+idtoJxQXTvzv6gNQ3gkGgRK Ualq8G5NaJJGgTf4yyCGGCOIKgQ9b65WeyiYUu4jW5MMmfUVspIo1qSLGcEGDLKHTZSFPsbH5vm 7wgN213d94HHcc+I34ZBU+ts+BQPOAZMMUI4WNr62oZioK3JsqrOeS4bq4nQK+LJ8a0uP1oo9DQ SSAyY0I86zdLBMYatps+N1s/J8A== X-Received: by 2002:a05:6a21:692:b0:3a0:bc61:62e6 with SMTP id adf61e73a8af0-3c90d3da39fmr1381071637.8.1785438321816; 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) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=V4tNF+ni c=1 sm=1 tr=0 ts=6a6ba072 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=7CQSdrXTAAAA:8 a=EUspDBNiAAAA:8 a=irsnRLeOcCLjm4-ghIcA:9 a=CjuIK1q_8ugA:10 a=3WC7DwWrALyhR5TkjVHa:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-GUID: glkKmjflPGqFVA4j3xrrvIJg5045GVNu X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDE0MCBTYWx0ZWRfX4HxWI96WhFhz 2wPIfpeOQ72UWdkm9yoWH39/dhB5xp+lq+xhxkB4IDANilr3OjFljCbJeSXNDOWE5PX/Lxy/HRw C+/lhYTEUbrRY/cpjGlBGh9bUfnppPAHJXua2/EQyRtS5B4kIuQdP8ruNDawCMKaCuYc0mJ4Fjf lEvaSozi2qCTzWZKAVcRuU5Untf3ygJCIlKY6rnMdKraAljzaKApYUzAawMccaWfK+831M975gQ iMIWSonPOs+Bq7CoSSinGPKKJ06pMN9sFf5EiDD4WbsW2oALZyHLwVbLWElkLmHEE+P3qLImZ9X 4PDMWKyLrf3IRUQ0+E3s6kso0SNctdZ2uLkSKy6pG/icyPXDWlX4pCPhARTko51KfV4UTRlI91j oSiGW+wEn2PKHcWASBzrw6X5j1Z9SBEcnpFGp0SRLjumAq8qlzdN4S0MhkiH6lzfY9ZRtJANPBh Mw/isFhXhQhDvmoP5uw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDE0MCBTYWx0ZWRfX/4ZUan2K3U5H BgZEDC17qvOgxe4ts+nMqIhu1FTsib6krHbFpj7isjC2xICERGfsOqANyQZrFHj4p9uFaKmIxFs fQeimv4bWmHGlwX44+0Ximw8xxmt+PA= X-Proofpoint-ORIG-GUID: glkKmjflPGqFVA4j3xrrvIJg5045GVNu 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 clxscore=1015 bulkscore=0 impostorscore=0 suspectscore=0 phishscore=0 adultscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300140 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260730_120524_271041_1322C8E4 X-CRM114-Status: GOOD ( 29.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; > +}