All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Rosenzweig <alyssa@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	dri-devel@lists.freedesktop.org, Rob Herring <robh@kernel.org>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] drm/panfrost: Handle non-aligned lock addresses
Date: Wed, 25 Aug 2021 10:07:21 -0400	[thread overview]
Message-ID: <YSZOgzaYN2Vub4w+@maud> (raw)
In-Reply-To: <6fe675c4-d22b-22da-ba3c-f6d33419b9ed@arm.com>

> > In practice, the current callers pass PAGE_SIZE aligned inputs, avoiding
> > the bug. Therefore this doesn't need to be backported. Still, that's a
> > happy accident and not a precondition of lock_region, so we let's do the
> > right thing to future proof.
> 
> Actually it's worse than that due to the hardware behaviour, the spec
> states (for LOCKADDR_BASE):
> 
> > Only the upper bits of the address are used. The address is aligned to a
> > multiple of the region size, so a variable number of low-order bits are
> > ignored, depending on the selected region size. It is recommended that software
> > ensures that these low bits in the address are cleared, to avoid confusion.
> 
> It appears that indeed this has caused confusion ;)
> 
> So for a simple request like locking from 0xCAFE0000 - 0xCB010000 (size
> = 0x30000) the region width gets rounded up (to 0x40000) which causes
> the start address to be effectively rounded down (by the hardware) to
> 0xCAFC0000 and we fail to lock 0xCB000000-0xCB010000.
> 
> Interestingly (unless my reading of this is wrong) that means to lock
> 0xFFFF0000-0x100010000 (i.e. crossing the 4GB boundary) requires locking
> *at least* 0x00000000-0x200000000 (i.e. locking the first 8GB).
> 
> This appears to be broken in kbase (which actually does zero out the low
> bits of the address) - I've raised a bug internally so hopefully someone
> will tell me if I've read the spec completely wrong here.

Horrifying, and not what I wanted to read my last day before 2 weeks of
leave. Let's drop this patch, hopefully by the time I'm back, your
friends in GPU can confirm that's a spec bug and not an actual
hardware/driver one...

Can you apply the other 3 patches in the mean time? Thanks :-)

  reply	other threads:[~2021-08-25 14:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 17:30 [PATCH v2 0/4] drm/panfrost: Bug fixes for lock_region Alyssa Rosenzweig
2021-08-24 17:30 ` [PATCH v2 1/4] drm/panfrost: Simplify lock_region calculation Alyssa Rosenzweig
2021-08-25  9:03   ` Steven Price
2021-08-25  9:03     ` Steven Price
2021-08-24 17:30 ` [PATCH v2 2/4] drm/panfrost: Use u64 for size in lock_region Alyssa Rosenzweig
2021-08-24 17:30 ` [PATCH v2 3/4] drm/panfrost: Clamp lock region to Bifrost minimum Alyssa Rosenzweig
2021-08-24 17:30 ` [PATCH v2 4/4] drm/panfrost: Handle non-aligned lock addresses Alyssa Rosenzweig
2021-08-25  9:04   ` Steven Price
2021-08-25  9:04     ` Steven Price
2021-08-25 14:07     ` Alyssa Rosenzweig [this message]
2021-08-25 14:34       ` Steven Price
2021-08-25 15:05         ` Alyssa Rosenzweig
2021-08-24 22:37 ` [PATCH v2 0/4] drm/panfrost: Bug fixes for lock_region Rob Herring
2021-08-24 22:37   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YSZOgzaYN2Vub4w+@maud \
    --to=alyssa@collabora.com \
    --cc=airlied@linux.ie \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.