From: Brajesh Gupta <Brajesh.Gupta@imgtec.com>
To: "gye976@gmail.com" <gye976@gmail.com>
Cc: Luigi Santivetti <Luigi.Santivetti@imgtec.com>,
"imagination@lists.freedesktop.org"
<imagination@lists.freedesktop.org>,
"tzimmermann@suse.de" <tzimmermann@suse.de>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"airlied@gmail.com" <airlied@gmail.com>,
Alessio Belle <Alessio.Belle@imgtec.com>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
Alexandru Dadu <Alexandru.Dadu@imgtec.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] drm/imagination: Size page table preallocation by device address
Date: Mon, 5 Oct 2026 13:32:04 +0000 [thread overview]
Message-ID: <ea83a6faed24d574cee796deab9b9d1467bb4da6.camel@imgtec.com> (raw)
In-Reply-To: <CAKbEznvLy3dio5FigiVzcAggES0e1fjd_xFUzq_SZ4+zv0Rw5w@mail.gmail.com>
On Fri, 2026-10-02 at 10:08 +0900, Gyeyoung Baek wrote:
Hi Gyeyoung,
> Hi Brajesh,
>
> > > - const u32 l1_start_idx = pvr_page_table_l2_idx(start_addr);
> > > - const u32 l1_end_idx = pvr_page_table_l2_idx(start_addr + size);
> > > - const u32 l1_count = l1_end_idx - l1_start_idx + 1;
> > > - const u32 l0_start_idx = pvr_page_table_l1_idx(start_addr);
> > > - const u32 l0_end_idx = pvr_page_table_l1_idx(start_addr + size);
> > > - const u32 l0_count = l0_end_idx - l0_start_idx + 1;
> > > + const u64 last_addr = device_addr + size - 1;
> > > + const u64 l1_count =
> > > + (last_addr >> ROGUE_MMUCTRL_VADDR_PC_INDEX_SHIFT) -
> > > + (device_addr >> ROGUE_MMUCTRL_VADDR_PC_INDEX_SHIFT) + 1;
> > > + const u64 l0_count =
> > > + (last_addr >> ROGUE_MMUCTRL_VADDR_PD_INDEX_SHIFT) -
> > > + (device_addr >> ROGUE_MMUCTRL_VADDR_PD_INDEX_SHIFT) + 1;
> > Shouldn't we use 'device_addr + sgt_offset' instead of just 'device_addr' as
> > start address for l0/l1 count calculation? Only account for requested mapping
> > instead of whole memory.
> >
>
> This already counts only the requested mapping. `device_addr` is not
> the start of the BO but the GPU address where this mapping starts, and
> [device_addr, device_addr + size) is exactly the range pvr_mmu_map()
> fills.
>
> Adding sgt_offset does not narrow the range; it shifts it by
> sgt_offset, which is an offset into the BO, not a GPU address. This
> can leave too few preallocated tables, and VM_MAP then fails with
> -ENOMEM.
>
Make sense.
Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
Thanks,
Brajesh
next prev parent reply other threads:[~2026-10-05 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 13:39 [PATCH v2 0/2] drm/imagination: Fix pre-existing bugs flagged by Sashiko's review of a VM_BIND series Gyeyoung Baek
2026-10-01 13:39 ` [PATCH v2 1/2] drm/imagination: Fix reference and vm_bo handling in remap() Gyeyoung Baek
2026-10-01 13:39 ` [PATCH v2 2/2] drm/imagination: Size page table preallocation by device address Gyeyoung Baek
2026-10-01 14:31 ` Brajesh Gupta
2026-10-02 1:08 ` Gyeyoung Baek
2026-10-05 13:32 ` Brajesh Gupta [this message]
2026-10-05 15:14 ` Alessio Belle
2026-10-06 8:16 ` Gyeyoung Baek
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=ea83a6faed24d574cee796deab9b9d1467bb4da6.camel@imgtec.com \
--to=brajesh.gupta@imgtec.com \
--cc=Alessio.Belle@imgtec.com \
--cc=Alexandru.Dadu@imgtec.com \
--cc=Luigi.Santivetti@imgtec.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gye976@gmail.com \
--cc=imagination@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®