Re: [PATCH v9 10/12] arm_mpam: add MPAM-Fb MSC firmware access support

Andre Przywara <[email protected]>
Newsgroups org.kernel.vger.linux-acpi,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Lee,

On 9/1/26 00:19, Lee Trager wrote:
> On 8/7/26 3:54 AM, Andre Przywara wrote:
> 
>> +
>> +static int mpam_fb_send_request(struct mpam_msc *msc, 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 mpam_pcc_chan *pcc_chan;
>> +    struct pcc_mbox_chan *chan;
>> +    void __iomem *payload_ofs;
>> +    int mpam_fb_err = 0;
>> +    u32 status;
>> +    int ret;
>> +
>> +    pcc_chan = msc->pcc_chan;
>> +    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_PROTOCOL_VERSION_CMD:
>> +        mpam_fb_build_version_message(token, chan->shmem);
>> +        break;
>> +    case MPAM_MSC_READ_CMD:
>> +        mpam_fb_build_read_message(msc_id, reg, token, chan->shmem);
>> +        break;
>> +    case MPAM_MSC_WRITE_CMD:
>> +        mpam_fb_build_write_message(msc_id, reg, *result,
>> +                        token, chan->shmem);
>> +        break;
>> +    default:
>> +        dev_err(&msc->pdev->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;
>> +
> While testing this series when building arm64 allnoconfig with 
> CONFIG_ARM4_MPAM=y I got a link failure:
> 
> drivers/resctrl/mpam_fb.o: undefined reference to `mbox_send_message`

Ah, thanks, that's a good find.

> Since the ACPI MPAM-Fb transport also reqiures PCC, wold it make sense 
> for ARM64_MPAM_DRIVER to select both dependencies?
> 
>      select MAILBOX
>      select PCC if ACPI

Yes, that looks like a pragmatic solution. Not sure if the MAILBOX 
should be selected so easily, as the other selects for that symbol seem 
to be more precise and constrained, and technically the mailbox is not 
required by the core functionality of MPAM. But I leave that to the 
maintainers to decide.

Cheers,
Andre
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.