Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BA5FC433F5 for ; Fri, 29 Oct 2021 18:09:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 626FD60F92 for ; Fri, 29 Oct 2021 18:09:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 626FD60F92 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D963F6E105; Fri, 29 Oct 2021 18:09:44 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id B6A676E105 for ; Fri, 29 Oct 2021 18:09:43 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10152"; a="228177482" X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="228177482" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2021 11:09:29 -0700 X-IronPort-AV: E=Sophos;i="5.87,193,1631602800"; d="scan'208";a="499007032" Received: from ideak-desk.fi.intel.com ([10.237.68.141]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2021 11:09:28 -0700 Date: Fri, 29 Oct 2021 21:09:24 +0300 From: Imre Deak To: Matthew Auld Cc: Intel Graphics Development Message-ID: <20211029180924.GA3313089@ideak-desk.fi.intel.com> References: <20211026225105.2783797-1-imre.deak@intel.com> <20211026225105.2783797-4-imre.deak@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Intel-gfx] [PATCH 3/7] drm/i915/fb: Factor out functions to remap contiguous FB obj pages X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Oct 29, 2021 at 05:26:05PM +0100, Matthew Auld wrote: > On Tue, 26 Oct 2021 at 23:51, Imre Deak wrote: > > > > Factor out functions needed to map contiguous FB obj pages to a GTT/DPT > > VMA view in the next patch. > > > > No functional changes. > > > > Signed-off-by: Imre Deak > > --- > > drivers/gpu/drm/i915/gt/intel_ggtt.c | 110 +++++++++++++++------------ > > 1 file changed, 60 insertions(+), 50 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c > > index 57c97554393b9..a30366d4965b6 100644 > > --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c > > +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c > > @@ -1387,6 +1387,25 @@ intel_rotate_pages(struct intel_rotation_info *rot_info, > > return ERR_PTR(ret); > > } > > > > +static struct scatterlist * > > +add_padding_pages(unsigned int count, > > + struct sg_table *st, struct scatterlist *sg) > > +{ > > + st->nents++; > > + > > + /* > > + * The DE ignores the PTEs for the padding tiles, the sg entry > > + * here is just a convenience to indicate how many padding PTEs > > + * to insert at this spot. > > + */ > > + sg_set_page(sg, NULL, count * 4096, 0); > > s/4096/I915_GTT_PAGE_SIZE ? Yes, will change this. > > + sg_dma_address(sg) = 0; > > I guess maybe a little bit scary, since that might be a valid address. Was pondering what to use here, but this looked the simple and fast way. Using the scratch page (for all padding PTEs this sg covers) would require special-casing this sg entry that the insert_entries hook could see and repeat the same address for each PTE instead of the usual increment-by-page-size for each sg iteration step. Or we could add here 'count' number of sg entries each pointing to the scratch page, but that's not the most compact. Another concern was the prefetching done by VTd, which may require a valid PTE. But these PTEs go to DPT (vs. GGTT) and at least there the HW is not using the padding PTEs for anything. (Bspec 53393): "The padded entries do not need to be valid." > Using the vma->vm scratch might be annoying though, since it could be > a different type than the object, plus this is only the GGTT. > > Looks fine I think, > Reviewed-by: Matthew Auld Thanks.