Re: [RFC PATCH v1 34/38] coco: guest: arm64: Validate mmio range found in the interface report

Arto Merilainen
2025-07-31T11:39:20Z

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

> + for (int i = 0; i < interface_report->mmio_range_count; i++, mmio_range++) {
> +
> + /*FIXME!! units in 4K size*/
> + range_id = FIELD_GET(TSM_INTF_REPORT_MMIO_RANGE_ID, mmio_range->range_attributes);
> +
> + /* no secure interrupts */
> + if (msix_tbl_bar != -1 && range_id == msix_tbl_bar) {
> + pr_info("Skipping misx table\n");
> + continue;
> + }
> +
> + if (msix_pba_bar != -1 && range_id == msix_pba_bar) {
> + pr_info("Skipping misx pba\n");
> + continue;
> + }
> +

MSI-X and PBA can be placed to a BAR that has other registers as well.
While the PCIe specification recommends BAR-level isolation for MSI-X
structures, it is not mandated. It is enough to have sufficient
isolation within the BAR. Therefore, skipping the MSI-X and PBA BARs
altogether may leave registers unintentionally mapped via unprotected
IPA when they should have been mapped via protected IPA.

Instead of skipping the whole BAR, would it make sense to determine
where the MSI-X related regions reside, and skip validation only from
these regions?

- R2