From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 815A9175A99 for ; Tue, 4 Aug 2026 03:29:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785814161; cv=none; b=bpa+e+fpMKV+EwG/wGQGhjqEa0QmX6Z6ycrZPNpzqGQJNUOzrfPwAQlCaGmbfelDJPtkC6th8Tr1f+bts2Eyc0SZYVNR7gbNoU0h3lPf/m+ZVRsFOIvyqzQcaS/+DmZ+d9IXMLotPZpoAtg56r5HjF5MqVmfqU+nUCvmZyee/O8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785814161; c=relaxed/simple; bh=WmthJ5kcasnEkzaisn9P/6G/RU2Oxhz3DnvME3jrqeg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f/uISn7hwnClhmmIEuc7n8jEHCBa6Z+XJTHEhDKwrzvaBcCujtS46zDj5xlX9AqVkdbifVei6mxFm61H4N7FC6YnGCT+/WUfpb4Qt/kK5tHxiZP5AWGaNKdX2QnIqYR6hFqzKEoSEL8D1+VmRUwKSBPVoIGChRZH75joTdniyeQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Epn5pP1u; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=TNMpdf8d; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Epn5pP1u"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="TNMpdf8d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785814158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=73+Vcs8356c8UcX6JzaxNcxmLM11GF7IimgXsgpettQ=; b=Epn5pP1uyec3eevHSuUrGxyNwAHsOIkalfbawJ8avoXm9Y06rrkGNgIjnDA/+VGHOnSpYj FReSE1DaJR8QQuQuYBpgI34pYySJnBd8wtXgeLfIB6Fxgk2S5VWHFaGXrVbIOHXTNAavaD RLeEY11ZHi0dSjFVG6nYy+6aFy41DdM= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-Z9yIyqLKORebfMLsbsoaRg-1; Mon, 03 Aug 2026 23:29:17 -0400 X-MC-Unique: Z9yIyqLKORebfMLsbsoaRg-1 X-Mimecast-MFC-AGG-ID: Z9yIyqLKORebfMLsbsoaRg_1785814156 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-381250979d5so4013524a91.0 for ; Mon, 03 Aug 2026 20:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1785814156; x=1786418956; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=73+Vcs8356c8UcX6JzaxNcxmLM11GF7IimgXsgpettQ=; b=TNMpdf8dALCGAtr688ZvaRzMIqsGhEcPicweJvLZb2QLP9QfIjcYSZPvVpcu6ndqpU n6bRUzj2zr223/f02wCJdbNanb8Ng1pv/MbUqKKjL2XLnYpPuNtsE5CMQ1pvnlFfz1aY oiFE1rbdePvOmpGtdwxaabx7TuBv7oK9q4Tzu88QRhNfQIkObGohY+w0eygWOEVnfGFh LrZro0kPOjCk6MoOC030iBjGFI+Y3WKMxpikKs5BSRezcXV7WvuA59yVyqGWNsLMdm8O Q9LBnUHM3Ni9hl1AuiFkFyIPbjMFHTF2QTr85kPb2MlDRpwbZrJ+Y0byDYs3rnhphGH+ cfAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785814156; x=1786418956; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=73+Vcs8356c8UcX6JzaxNcxmLM11GF7IimgXsgpettQ=; b=l8ibwpp9o6Mdec8U1VI6KnFoCLAFyZqPn8LaQChM35MBjqcbsuZZCqHtJcILtOXQFG aHu+ltKFuUytoYjp1ns3O1gQ/imKJZy33UWCbY5fvVcASvt5HEyPN13fUtlCIxRMps0h kYh8aonXXYvBEB8JJ99HGyo0Q/K3eq4EQBhvQbaBh3MsqcnP6UK3P5uU0IYa1lSh8R9T 8uPin+hkewq/MFhH/d5Uxa12sWYSqaqtwaeGhSL4WTxXdz/g1Rk7O7v8vfHBDApPSAT0 rY+9/oeFd5gr/aitPuVkftKMgEWYCt2qbmcGSP2xP1bU4OwSiB+KnmdNRK89pyg1knGb f/eA== X-Forwarded-Encrypted: i=1; AHgh+RpzStI7auzt/gjntL6BK/8zonf7e8H2mWR5iExtcqocPhXiCHybM/+8QFh748mXKKLglBJkRef8tb+VgOY=@vger.kernel.org X-Gm-Message-State: AOJu0YzpZmKt1jHauFoZGetQl9cRJQaaGvK3L8xYRpx0e8/f0O/+WXuN ySTTaopXOpburdfouozMeacxQJrcEDSP0y24f0OVW4Xx+xHsRCMZG49s2aefzZ5BXI+I6nniByx qLzOKC/SWzW0Il6qFbgqTXP2eDYK4Qzb/g1fveAbQ8xsZXcUFSgBrgRxkrgauRBkIZw== X-Gm-Gg: AR+sD12gVM8Zenl0y6KeSabZr8XkwRcohoQYHBxrRdgNnJ58iZcqc58aog1O4o9lpsq BmawH8MswM54CcRXmokbV9y6l394JpiDsL4vtUOaqF9hcKSEcakfwgh0VWk/fKAGMscpSDeGazp DmZUjMzvhkhIkOyvPtSsYq8sqOm26FHCYAUTxe4kOl01j+rM8eNrCAiHdcOvHCRIILQUQLeHuWv iygcHc4v304ipOxAmIjsJE/XQAa7JTzaP5YfAyUoacUyty3y9Xr4wxPgA+eDzjl4kgAbtSE4MiM JHnaxWRroxvPB9co+zUHj0Y4PzHaGdO0rVvNxvNC6FzIkpbw/MJHUEInxmJov+ZNmU+3kSk3JKw G4KpTk7Vgb6XtLQuQrMKkbbKwmoLhCxkPvWy/O+CrMEQ= X-Received: by 2002:a17:90b:1b01:b0:387:e0db:bc2c with SMTP id 98e67ed59e1d1-38fbc548a91mr11429655a91.34.1785814155909; Mon, 03 Aug 2026 20:29:15 -0700 (PDT) X-Received: by 2002:a17:90b:1b01:b0:387:e0db:bc2c with SMTP id 98e67ed59e1d1-38fbc548a91mr11429629a91.34.1785814155373; Mon, 03 Aug 2026 20:29:15 -0700 (PDT) Received: from [192.168.68.51] (n175-34-8-244.mrk21.qld.optusnet.com.au. [175.34.8.244]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3153e04491dsm57772486eec.16.2026.08.03.20.29.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Aug 2026 20:29:14 -0700 (PDT) Message-ID: <6f8bc358-91a0-4c44-9110-c071e10df385@redhat.com> Date: Tue, 4 Aug 2026 13:29:04 +1000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 00/11] arm_mpam: Add MPAM-Fb firmware support To: Andre Przywara , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Len Brown , James Morse , Ben Horgan , Reinette Chatre , Fenghua Yu Cc: 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 References: <20260731170324.2927758-1-andre.przywara@arm.com> Content-Language: en-US From: Gavin Shan In-Reply-To: <20260731170324.2927758-1-andre.przywara@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/1/26 3:03 AM, Andre Przywara wrote: > v7 is another quick respin of the MPAM-Fb code, for firmware based MSC > accesses. This propagates MSC access errors in a function where it was > missing before, covering more functions that pass their return value > to userspace (new patch 07/11). Also some bug fixes, formatting > adjustments and adding the accumulated tags - many thanks to the > reviewers. Find the changelog below. Based on v7.2-rc1. > > ======================= > The Arm MPAM specification defines Memory System Components (MSCs), > which are devices that are programmed through an MMIO register frame. In > some occasions this turned out to be too limiting: the MSC might be > located behind a separate bus system (for instance inside an on-board > controller), it might be mapped secure-only, or in a different processor > socket without direct MMIO mapping. Also the MMIO access might be too slow > or it would need to be filtered or otherwise access controlled. Finally > there might be bugs in the MSC integration, which require a mediating > firmware to be accessible. > > To accommodate all those different use cases, the MPAM-Fb specification > [1] describes an alternative way to access MSCs. Accesses to an MSC > would be wrapped in a message and communicated to the system using a > shared-memory/mailbox system mostly mimicking the Arm SCMI spec. > For ACPI systems, this would be abstracted through an ACPI PCC channel, > which provides the shared-memory region and the mailbox trigger. We can > lean on existing ACPI parsing code to register with these two > subsystems, but cannot rely on the existing SCMI code in the kernel. > This means we somewhat need to open code a very simplified SCMI handler, > which just provides enough functionality for the very basic subset of > SCMI that the MPAM-Fb spec requires. > > The first seven patches rework all MSC access wrappers to propagate error > information. Pure MMIO based MSC accesses would never fail, but the > MPAM-Fb access can go wrong in multiple ways. The patches have been split > up purely for reviewing reasons, if the number is a problem, we could as > well squash them. Please note that until the very last patch of this series > any MSC accesses would always only return 0, it's only the final enablement > of MPAM-Fb that could possibly introduce errors. Hence all former patches > can add error handling gradually, those code paths wouldn't be triggered > before patch 11/11. > Patch 8/11 solves a nasty problem: At the moment we protect stateful MSC > register accesses (mon_sel) through a spinlock. Unfortunately the mailbox > subsystem and the slow nature of the communication through this channel > forbid MPAM-Fb access in atomic context. So this patch keeps using a > spinlock for MMIO based accesses, but reverts to a mutex otherwise. > We just deny taking the lock for MPAM-Fb in atomic context, ideally we > wouldn't need that (no need to IPI another core when the MSC access does > not need to be local to one particular core), or we simply deny that part > of the functionality (access through perf). > Patch 9/11 adds the code to redirect MSC accesses through the > PCC shmem/mailbox system. > Patch 10/11 reworks the error interrupt handler to use a threaded IRQ for > MPAM-Fb, to be able to do MPAM-Fb MSC accesses inside (which might sleep). > The final patch 11/11 then adds the code to detect and store the PCC > channel information from the ACPI tables, and eventually enables > MPAM-Fb accesses. > > This would enable systems where some MSCs are not accessible via MMIO to > use those components anyway. > > Please have a look and test! > > Cheers, > Andre > > [1] https://developer.arm.com/documentation/den0144/latest > > Changes in v7: > - add tags > - add new patch to propagate errors in mpam_reprogram_ris_partid() > - prevent loop when mpam_diable() tries MSC accesses again > - register MMIO error IRQ handler without IRQF_ONESHOT > - re-use existing "err" variable instead of declaring "ret" > - initialise mon_sel_lock later, to wait for interface decision > - convert timeout units for nominal latency, between us and ms > [...] > > Andre Przywara (11): > arm_mpam: let low level MSC accessors return an error > arm_mpam: propagate MSC access errors for hw_probe functions > arm_mpam: propagate MSC access errors for MBWU counters > arm_mpam: propagate MSC access errors for msmon helpers > arm_mpam: propagate MSC access errors for __ris_msmon_read() > arm_mpam: propagate MSC access errors for state saving function > arm_mpam: propagate MSC access errors for mpam_reprogram_ris_partid() > arm_mpam: prepare mon_sel locking for MPAM-Fb > arm_mpam: add MPAM-Fb MSC firmware access support > arm_mpam: change MPAM-Fb error IRQ to use a threaded IRQ handler > arm_mpam: detect and enable MPAM-Fb PCC support > > drivers/resctrl/Makefile | 2 +- > drivers/resctrl/mpam_devices.c | 820 +++++++++++++++++++++++--------- > drivers/resctrl/mpam_fb.c | 250 ++++++++++ > drivers/resctrl/mpam_internal.h | 62 ++- > include/linux/arm_mpam.h | 2 +- > 5 files changed, 915 insertions(+), 221 deletions(-) > create mode 100644 drivers/resctrl/mpam_fb.c > With this series (manually) applied to v7.2.rc6, the tests for the existing functions like kunit-tests, L3 cache partitioning, MBW (soft) limiting, llc_occupancy monitor look fine on NVidia's grace-hopper machine. Tested-by: Gavin Shan Thanks, Gavin