Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5534915pxb; Wed, 26 Jan 2022 14:23:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO+AXepYINMTnTa1bf7rkeeeGwoRk/gPNNge18T8xh7RxIINmcYO4q6mKopr0GOw/X5q66 X-Received: by 2002:a17:906:1291:: with SMTP id k17mr620908ejb.451.1643235802158; Wed, 26 Jan 2022 14:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643235802; cv=none; d=google.com; s=arc-20160816; b=YurrGEqzvo8+BjoP/ifkRWBMfDAHEE5CioXfl9lAkG5ZHxQYwStM0cuigDemcFvlRT SwTYpNeFT2g7qJpuQKSe/+YiGHNmRy2+Q+o6ngUX+v7fVe69mnBBgYUJqAsf/oamCLEs VXDF4RGK3LqLeCo0HlCELld3KNSH5sOxU9qSzTPOHUoODsQZ46iw1h8M4D6zaxva1sXr tp7i6tBoIu6jnTghHYKzRwHC+d00/KT1OE+INjWYyP30AVaDnbLnenUt/pZXMdftK7N5 5uBFiTLHhW18r7ROX0v87ZRui0p1PMKtgWFVWc7zODK04sTCMi0JADEaaCV7hMFKkxio 2DdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=KigWLtlgxBZCNn/XDeQ26fG8yTHaXTTWLgGnor4S8Zw=; b=rWRzed0F0g2M64awNGnLZu1WJHtFrEP8X5OzrPzQxF1DgRDajzDK1/u074Pv/5UNYm Rli5q7pp48HTSdeDo8OcIwZjZf8hGZbS1dN6uzEJ6SSL3bgpCgUWWKsUmohlQq9+ACWS UyxwA7U/qpKgKRmZnkiJwlxkfjNG3KUCRvsIbsgIFjC8uE86dEVYZwtJn70KZiEmCbio BNtRiG0PVtt/0J1Z6jXGKT0/gmzwyeIoJDdSIIuIod/Nn23/d3RpElKw8G7yDjA/pDEY jsnF+gpQD3TnOnqp7u/432ApXJC01NvclKGUczNEC/1WwleKCr3vy/ijK+1e2hgMKPCT 8JlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Obr630Mx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si313036edj.235.2022.01.26.14.22.57; Wed, 26 Jan 2022 14:23:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Obr630Mx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242495AbiAZRWA (ORCPT + 99 others); Wed, 26 Jan 2022 12:22:00 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:41852 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231168AbiAZRVy (ORCPT ); Wed, 26 Jan 2022 12:21:54 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 73D001F44B34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643217713; bh=a2EttWk/EvkJEucz64EmoVP3sbrDjOfns3KUuviWjqI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Obr630MxwR+xpy71rvzSSru0IhT0L1X7Iom/BKuDfl3xPpvFzRwIBKdhnLf1iyNCh rJ+AAP36C61mR3MJnzRPkbW+4X3Npnau6Wwd6juH42uUBddMIZFXVEfvr/q+hRSv8t z94rXeh78bR+Bh+ftU/ZAOw19rtvZQpIi7ucwGBO/6JYHsBQ+keOtD6TM1P9enGVec Qe2EWANtBdxH2CpjAGVKQR+H1veHXhJl2XxgiQcJtYMo9dPHNkgBrdjANaXDOGFccL gQKt++7cO1vU7KzmcWKIeDb2ljkLzQVbDASOThjPbtzXiYTXrIuY2ep9OEavTkDTCc EscTw9O3y2Ieg== Message-ID: Date: Wed, 26 Jan 2022 17:21:51 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [Intel-gfx] [PATCH v5 2/5] drm/i915: enforce min GTT alignment for discrete cards Content-Language: en-US To: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthew Auld References: <20220125193530.3272386-1-bob.beckett@collabora.com> <20220125193530.3272386-3-bob.beckett@collabora.com> <9f011e69-2d6d-d6a1-db78-d4a061b4ef2c@shipmail.org> From: Robert Beckett In-Reply-To: <9f011e69-2d6d-d6a1-db78-d4a061b4ef2c@shipmail.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/01/2022 15:45, Thomas Hellström (Intel) wrote: > > On 1/25/22 20:35, Robert Beckett wrote: >> From: Matthew Auld >> >> For local-memory objects we need to align the GTT addresses >> to 64K, both for the ppgtt and ggtt. >> >> We need to support vm->min_alignment > 4K, depending >> on the vm itself and the type of object we are inserting. >> With this in mind update the GTT selftests to take this >> into account. >> >> For compact-pt we further align and pad lmem object GTT addresses >> to 2MB to ensure PDEs contain consistent page sizes as >> required by the HW. >> >> v3: >>     * use needs_compact_pt flag to discriminate between >>       64K and 64K with compact-pt >>     * add i915_vm_obj_min_alignment >>     * use i915_vm_obj_min_alignment to round up vma reservation >>       if compact-pt instead of hard coding >> v5: >>     * fix i915_vm_obj_min_alignment for internal objects which >>       have no memory region >> >> Signed-off-by: Matthew Auld >> Signed-off-by: Ramalingam C >> Signed-off-by: Robert Beckett >> Cc: Joonas Lahtinen >> Cc: Rodrigo Vivi >> --- >>   .../i915/gem/selftests/i915_gem_client_blt.c  | 23 +++-- >>   drivers/gpu/drm/i915/gt/intel_gtt.c           | 12 +++ >>   drivers/gpu/drm/i915/gt/intel_gtt.h           | 18 ++++ >>   drivers/gpu/drm/i915/i915_vma.c               |  9 ++ >>   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 96 ++++++++++++------- >>   5 files changed, 117 insertions(+), 41 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c >> b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c >> index c8ff8bf0986d..f0bfce53258f 100644 >> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c >> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_client_blt.c >> @@ -39,6 +39,7 @@ struct tiled_blits { >>       struct blit_buffer scratch; >>       struct i915_vma *batch; >>       u64 hole; >> +    u64 align; >>       u32 width; >>       u32 height; >>   }; >> @@ -410,14 +411,21 @@ tiled_blits_create(struct intel_engine_cs >> *engine, struct rnd_state *prng) >>           goto err_free; >>       } >> -    hole_size = 2 * PAGE_ALIGN(WIDTH * HEIGHT * 4); >> +    t->align = I915_GTT_PAGE_SIZE_2M; /* XXX worst case, derive from >> vm! */ >> +    t->align = max(t->align, >> +               i915_vm_min_alignment(t->ce->vm, INTEL_MEMORY_LOCAL)); >> +    t->align = max(t->align, >> +               i915_vm_min_alignment(t->ce->vm, INTEL_MEMORY_SYSTEM)); > > Don't we always end up with 2M here, regardless of the vm restrictions? agreed. I will drop the 2M worst case. > >