[PATCH 3/5] drm/panfrost: Add a no execute flag for BO allocations

Robin Murphy robin.murphy at arm.com
Mon Jul 22 13:25:28 UTC 2019


On 22/07/2019 13:19, Steven Price wrote:
[...]
> Indeed, that case was just occurring to me too! How about:
> 
> 	u64 next_seg = ALIGN(*start, PFN_4G);
> 
> 	if (next_seg - *start <= PFN_16M)
> 		*start = next_seg + 1;
> 
> 	*end = min(*end, ALIGN(*start, PFN_4G) - 1);
> 
> So always allocate at the beginning, but skip past the next 4GB boundary
> if there's less than 16MB left (or equal to avoid the 4GB boundary).

Ah, there it is! I think it generalises even further by just changing 
the condition to "if (next_seg - *start < *end - next_seg)", although 
we'd need to ensure a signed comparison to cover the case where start 
and end are already in the same segment.

Robin.


More information about the dri-devel mailing list