[PATCH 3/5] drm/panfrost: Add a no execute flag for BO allocations
Rob Herring
robh at kernel.org
Mon Jul 22 16:18:17 UTC 2019
On Mon, Jul 22, 2019 at 7:25 AM Robin Murphy <robin.murphy at arm.com> wrote:
>
> 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;
This could make start > end...
It also doesn't handle not starting on a 4G boundary (or was that
condition check supposed to be included still).
> >
> > *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.
IMO, relying on signed comparsion doesn't really improve the readability...
Rob
More information about the dri-devel
mailing list