[PATCH v3 14/16] arm_mpam: add MPAM-Fb MSC firmware access support
Niyas Sait
niyas.sait at arm.com
Tue Jul 14 05:27:10 PDT 2026
On 10/07/2026 15:45, Andre Przywara wrote:
> +#define MPAM_VERSION_MSG_SIZE (PCC_TYPE3_MSG_PAYLOAD_OFS)
> +#define MPAM_READ_MSG_SIZE (PCC_TYPE3_MSG_PAYLOAD_OFS + 3 * sizeof(u32))
> +#define MPAM_WRITE_MSG_SIZE (PCC_TYPE3_MSG_PAYLOAD_OFS + 4 * sizeof(u32))
I think these lengths are wrong for ACPI extended PCC shared memory.
Length should be command + payload, and should not include the payload
offset within the PCC shared memory region.
I think this should be something like
#define MPAM_VERSION_MSG_SIZE sizeof(u32)
#define MPAM_READ_MSG_SIZE (sizeof(u32) + 3 * sizeof(u32))
#define MPAM_WRITE_MSG_SIZE (sizeof(u32) + 4 * sizeof(u32))
> +
> +static int mpam_fb_build_version_message(unsigned int token,
> + void __iomem *msg_buf)
> +{
> + struct acpi_pcct_ext_pcc_shared_memory *pcc_shmem = msg_buf;
> +
> + writel_relaxed(0, &pcc_shmem->flags);
Here the flags are always 0.
If the PCCT advertises interrupt based completion, I think we need to
set PCC_CMD_COMPLETION_NOTIFY here. Otherwise the platform can process
the request without generating an interrupt back to the AP, and the PCC
driver will time out waiting for completion.
> +
> +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);
MPAM-Fb token is a 10-bit field in the message header, so this needs to
be masked before using it. Otherwise once the token exceeds 1023, the
platform returns the wrapped 10-bit token but Linux compares it against
the original value and will probably time out.
May be something like:
unsigned int token = atomic_inc_return(&mpam_fb_token) &
FIELD_MAX(MPAM_MSC_TOKEN_MASK);
Thanks,
Niyas
More information about the linux-arm-kernel
mailing list