On Fri, 16 Oct 2026 18:10:42 +0800
Jinjie Ruan <[email protected]> wrote:

> From: Jinjie Ruan <[email protected]>
> 
> Add the DEN0065 MSC node builders for the MPAM table: the
> interrupt entry (flags 0 = wired, level per Table 5; GSIV 0 means
> not present) and the memory-controller and cache-controller node
> layouts (fixed 72-byte header plus one 24-byte resource node per
> RIS, MAX_NRDY_USEC 100) with the matching locators (proximity
> domain for memory, PPTT cache id for caches).
> 
> Static helpers; wired into the generated table by the next patch.

Is it worth having them separate?  I'd combine the two patches.
Not large enough to be worth keeping separate.


> 
> Signed-off-by: Jinjie Ruan <[email protected]>

Trivial stuff only.
Reviewed-by: Jonathan Cameron <[email protected]>

> ---
>  hw/arm/virt-acpi-build.c | 130 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 130 insertions(+)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index d368913..871ee45 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c

> +/*
> + * DEN0065 4.0: an MSC node is a 72-byte fixed header plus one 24-byte
> + * resource node per RIS.  MAX_NRDY_USEC 100 is the default ready-time.
> + */
> +#define MPAM_MSC_NODE_HDR_LEN   72
> +#define MPAM_MSC_RIS_ENTRY_LEN   24
> +#define MPAM_MSC_MAX_NRDY_USEC  100
Intents of numbers don't seem to be very consistent. 

> +
> +static void build_msc_memory_controller(GArray *table_data, int identifier,
> +                                        hwaddr base_addr, uint32_t mpam_id,
> +                                        int num_ris, uint64_t *nodes,
> +                                        uint32_t oflow_gsiv,
> +                                        uint32_t err_gsiv)
> +{
> +    int length = MPAM_MSC_NODE_HDR_LEN + MPAM_MSC_RIS_ENTRY_LEN * num_ris;
> +    int i;
> +
> +    build_append_int_noprefix(table_data, length, 2);
> +    /* Interface Type */
> +    build_append_int_noprefix(table_data, 0 /* MMIO */, 1);
> +    /* Reserved */
> +    build_append_int_noprefix(table_data, 0, 1);
> +    build_append_int_noprefix(table_data, identifier, 4);
> +    build_append_int_noprefix(table_data, base_addr, 8);
> +    build_append_int_noprefix(table_data, MPAM_SIZE, 4);
> +    /* Overflow interrupt */
> +    build_msc_interrupt(table_data, oflow_gsiv);
> +    /* Reserved */
> +    build_append_int_noprefix(table_data, 0, 4);
> +    /* Overflow Int Affinity */
> +    build_append_int_noprefix(table_data, 0, 4);
> +    /* Error interrupt */
> +    build_msc_interrupt(table_data, err_gsiv);
> +    /* More reserved */
> +    build_append_int_noprefix(table_data, 0, 4);
> +    /* Error Int Affinity */
> +    build_append_int_noprefix(table_data, 0, 4);

I guess if we want to try more fun corners of the mpam
spec at some point we'll want to enable controlling the
interrupt affinities. 



> +    /* MAX_NRDY_USEC */
> +    build_append_int_noprefix(table_data, MPAM_MSC_MAX_NRDY_USEC, 4);
> +    /* Linked Device - none for now */

Maybe document this is the _HID if there is a linked device
and zero otherwise.

> +    build_append_int_noprefix(table_data, 0, 8);
> +    /* _UID of linked device */
> +    build_append_int_noprefix(table_data, 0, 4);
> +    build_append_int_noprefix(table_data, num_ris, 4);
> +    /* Build a memory controller resource */
> +    for (i = 0; i < num_ris; i++) {

      for (int i = 0; ...

> +        build_append_int_noprefix(table_data, mpam_id, 4);
> +        build_append_int_noprefix(table_data, i, 1);
> +        /* Reserved1 */
> +        build_append_int_noprefix(table_data, 0, 2);
> +        /* Locator type - 1 = Memory */
> +        build_append_int_noprefix(table_data, 1, 1);
> +        /* Locator part 1 Node */
> +        build_append_int_noprefix(table_data, nodes[i], 8);
> +        /* Locator part 2 reserved */
> +        build_append_int_noprefix(table_data, 0, 4);
> +        /* Num functional dependencies */
> +        build_append_int_noprefix(table_data, 0, 4);
> +    }
> +}


Reply via email to