From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 904AB10ECE7 for ; Wed, 25 May 2022 06:42:13 +0000 (UTC) Date: Tue, 24 May 2022 23:41:48 -0700 Message-ID: <87r14it8pf.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Zbigniew =?ISO-8859-2?Q?Kempczy=F1ski?= In-Reply-To: <20220524111836.152123-1-zbigniew.kempczynski@intel.com> References: <20220524111836.152123-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable Subject: Re: [igt-dev] [PATCH i-g-t] lib/intel_batchbuffer: Use detected start offset in intel-bb instead 0x0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Tue, 24 May 2022 04:18:36 -0700, Zbigniew Kempczy=F1ski wrote: > > On some platforms (like on ATS) 0x0 may not be available so allocator > should be instantiated with safe start offset to avoid getting -ENOSPC. > Change require also relaxation of automatic range selection in the > allocator. The patch LGTM: Reviewed-by: Ashutosh Dixit Do other callers of intel_allocator_open_full() also need to be modified to provide a safe start offset? > > Signed-off-by: Zbigniew Kempczy=F1ski > Cc: Ashutosh Dixit > Cc: Dominik Grzegorzek > --- > lib/intel_allocator.c | 2 +- > lib/intel_batchbuffer.c | 3 +++ > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lib/intel_allocator.c b/lib/intel_allocator.c > index 340b888286..7882e484b5 100644 > --- a/lib/intel_allocator.c > +++ b/lib/intel_allocator.c > @@ -909,7 +909,7 @@ static uint64_t __intel_allocator_open_full(int fd, u= int32_t ctx, > struct alloc_resp resp; > uint64_t gtt_size; > > - if (!start && !end) { > + if (!end) { > igt_assert_f(can_report_gtt_size(fd), "Invalid fd\n"); > gtt_size =3D gem_aperture_size(fd); > if (!gem_uses_full_ppgtt(fd)) > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c > index 8680c9ba93..555618e463 100644 > --- a/lib/intel_batchbuffer.c > +++ b/lib/intel_batchbuffer.c > @@ -1359,6 +1359,9 @@ __intel_bb_create(int i915, uint32_t ctx, uint32_t = size, bool do_relocs, > if (!ibb->uses_full_ppgtt) > do_relocs =3D true; > > + /* Use safe start offset instead assuming 0x0 is safe */ > + start =3D max_t(uint64_t, start, gem_detect_safe_start_offset(i915)); > + > /* if relocs are set we won't use an allocator */ > if (do_relocs) > allocator_type =3D INTEL_ALLOCATOR_NONE; > -- > 2.32.0 >