Re: [RFC PATCH v1 13/38] coco: host: arm64: Create a PDEV with rmm

Arto Merilainen
2025-07-31T11:47:53Z

On 28.7.2025 16.51, Aneesh Kumar K.V (Arm) wrote:

> +static int pci_res_to_pdev_addr(struct rmi_pdev_addr_range *pdev_addr,
> + unsigned int naddr, struct resource *res,
> + unsigned int nres)
> +{
> + int i, j;
> +
> + for (i = 0, j = 0; i < naddr && j < nres; j++) {
> + if (res[j].flags & IORESOURCE_MEM) {
> + pdev_addr[i].base = res[j].start;
> + pdev_addr[i].top = res[j].end;

I think there is an off-by-one bug in res[j].end. As per the RMM
specification the base address is inclusive and the top address is
exclusive. Both res[j].start and res[j].end are inclusive, and hence
res[j].end seems wrong.

> + /* use the rid and MMIO resources of the epdev */
> + params->rid_top = params->rid_base = rid;

Similar issue here. As per the specification the rid_base is inclusive
and the rid_top exclusive.

- R2