Hi Oleksandr,

On 21/04/17 19:44, Oleksandr Tyshchenko wrote:
On Fri, Apr 21, 2017 at 7:27 PM, Julien Grall <[email protected]> wrote:
On 21/04/17 15:18, Oleksandr Tyshchenko wrote:

On Wed, Apr 19, 2017 at 8:46 PM, Julien Grall <[email protected]>
wrote:

Aha. Seems, I understand what you meant. I already have a check in IPMMU driver:

/*
* both the virtual address and the physical one, as well as
* the size of the mapping, must be aligned (at least) to the
* size of the smallest page supported by the hardware
*/
if (!IS_ALIGNED(iova | paddr | size, min_pagesz)) {
printk("unaligned: iova 0x%lx pa 0x%"PRIx64" size 0x%zx min_pagesz 0x%x\n",
      iova, paddr, size, min_pagesz);
return -EINVAL;
}

where min_pagesz - is a minimum page size supported by hardware.
Hope, that this check can catch such case.

I think will cover what I meant. Although, can't we do this check when the IOMMU is initialized at boot time rather than for every mapping?

For instance you know that if the mimimum page granularity supported by the IOMMU is bigger than PAGE_SIZE, than you will likely get into trouble later on.

So rather than randomly crashing at runtime, you can disable the IOMMU/panic at boot time.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reply via email to