Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1193725pxb; Fri, 21 Jan 2022 11:58:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiVDiptBnzeG/ujCiolIhS90hURmJflSfG280vchO+W4dhIlMF0dbDTwLuyGym507OMpFc X-Received: by 2002:a17:90b:4d88:: with SMTP id oj8mr2256922pjb.194.1642795098381; Fri, 21 Jan 2022 11:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642795098; cv=none; d=google.com; s=arc-20160816; b=q9gtgCob1ZrYBAaEl2Ck3azibgKlcSYIqANvblYtenjkP4UVH4TP/4VtbOiWBOTbY9 KSjpjd2WwAa/z5hJzNtceY72/++/3kbY7GBf6Sb5gUw3saDgH01A7zbakhw6PYIp73DS saq5hJ/e28D4sHAL0+8xZ1XVwi0+XT13BrBpl7GmVFqSb2hZYki9MzapvUD2btdhLkWu ZZ3QfbeyA7qHrv664Di/Pr3S+ufdF5ioHiXqIeajwYpd7zQGQrdLAH7/4kSVP2BLPGKg n2I2BGJcK/Zcu1QSqjh8uSJL0yL11a1dCmxW5rtZDsDZzF3r4z9EOfzuhfbu+KNrKb9b hKbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=L7h9jSkmrXsCE44TYVkOsrDssfnB7Q/4KWWzDLBqQ34=; b=dC8BqN1G0N49dbQSflN76ZqENgxTU4gdkMIf33ucEf6tSewUC8UCMbrFWcLQFJzZIq DE0JW3/S1LohZORiTD8w4PJdFm1d4Tc6AODF+VhhRnTLb49gvY9isIFreuWTIh25EuYs 2wvNwqvSrVM6ikEaPnPyAsoFhialaPAX7acCGnLg03e5TywO6n0YWS0O8BF5IYBJRMAO mS2QS0paHVW3VKSd+WSzJNEGgngrPfwWfCv8352+amKDgGRfG2u/ji8NG9AdktkKH+Hy UbDt18R3juL1HgIZg58OUiRZefGOzFKguJ1KT/cPWcApyf7lOoyBrsA1eKQ6k3UjJbFi PkPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KS9p0rzb; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 18si12320967pjb.116.2022.01.21.11.58.06; Fri, 21 Jan 2022 11:58:18 -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=@intel.com header.s=Intel header.b=KS9p0rzb; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiASTKi (ORCPT + 99 others); Wed, 19 Jan 2022 14:10:38 -0500 Received: from mga11.intel.com ([192.55.52.93]:13904 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbiASTKh (ORCPT ); Wed, 19 Jan 2022 14:10:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642619437; x=1674155437; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=ehDVQFRTJkDWYbGMwd5bnrsZ2JNon9bvJmDRvBkD0gc=; b=KS9p0rzbl+ahzLuYn0Z4DxnzUtV0iWbYxlGZcnmMzLz0WNILchq7x8zm YVHTSszDg1Gnx3M8L+5IChajTmWzP+AxlRDpl5YKQwKIuppilVMtQfGt/ k9q8+oyrbkKoMCWSR7IvvK45pbtAxZe2CbjbLmpHGQa11b2Fzo17pa9BD 6kogS4+/Ag3OMaTAGfEXqRDeIrxZLjrxSYuyzjxgWmDBdvC9d5axjmWhR hyu5GE7LJ2wqcVhoXWuf0jNvLeTHL7DYeuH8ePc0zalsMhwK6HTb3V3JE y6QzO5u+fqPlRyYP33T/Yb/ROCnUuUpyI8JJ6E6oJYr7xpCb//YjExAa3 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10231"; a="242723478" X-IronPort-AV: E=Sophos;i="5.88,300,1635231600"; d="scan'208";a="242723478" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2022 10:36:09 -0800 X-IronPort-AV: E=Sophos;i="5.88,300,1635231600"; d="scan'208";a="615798507" Received: from mmansuri-mobl1.amr.corp.intel.com (HELO localhost) ([10.209.1.138]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2022 10:36:08 -0800 From: Jordan Justen To: Robert Beckett , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: Matthew Auld , Ramalingam C , Robert Beckett , Simon Ser , Pekka Paalanen , Kenneth Graunke , mesa-dev@lists.freedesktop.org, Tony Ye , Slawomir Milczarek , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] drm/i915/uapi: document behaviour for DG2 64K support In-Reply-To: <20220118175036.3840934-5-bob.beckett@collabora.com> References: <20220118175036.3840934-1-bob.beckett@collabora.com> <20220118175036.3840934-5-bob.beckett@collabora.com> Date: Wed, 19 Jan 2022 10:36:07 -0800 Message-ID: <87zgnrefoo.fsf@jljusten-skl> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Robert Beckett writes: > From: Matthew Auld > > On discrete platforms like DG2, we need to support a minimum page size > of 64K when dealing with device local-memory. This is quite tricky for > various reasons, so try to document the new implicit uapi for this. > > v2: Fixed suggestions on formatting [Daniel] > > Signed-off-by: Matthew Auld > Signed-off-by: Ramalingam C > Signed-off-by: Robert Beckett > cc: Simon Ser > cc: Pekka Paalanen > Cc: Jordan Justen > Cc: Kenneth Graunke > Cc: mesa-dev@lists.freedesktop.org > Cc: Tony Ye > Cc: Slawomir Milczarek > --- > include/uapi/drm/i915_drm.h | 44 ++++++++++++++++++++++++++++++++----- > 1 file changed, 39 insertions(+), 5 deletions(-) > > diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h > index 5e678917da70..486b7b96291e 100644 > --- a/include/uapi/drm/i915_drm.h > +++ b/include/uapi/drm/i915_drm.h > @@ -1118,10 +1118,16 @@ struct drm_i915_gem_exec_object2 { > /** > * When the EXEC_OBJECT_PINNED flag is specified this is populated by > * the user with the GTT offset at which this object will be pinned. > + * > * When the I915_EXEC_NO_RELOC flag is specified this must contain the > * presumed_offset of the object. > + * > * During execbuffer2 the kernel populates it with the value of the > * current GTT offset of the object, for future presumed_offset writes. > + * > + * See struct drm_i915_gem_create_ext for the rules when dealing with > + * alignment restrictions with I915_MEMORY_CLASS_DEVICE, on devices with > + * minimum page sizes, like DG2. > */ > __u64 offset; > > @@ -3145,11 +3151,39 @@ struct drm_i915_gem_create_ext { > * > * The (page-aligned) allocated size for the object will be returned. > * > - * Note that for some devices we have might have further minimum > - * page-size restrictions(larger than 4K), like for device local-memory. > - * However in general the final size here should always reflect any > - * rounding up, if for example using the I915_GEM_CREATE_EXT_MEMORY_REGIONS > - * extension to place the object in device local-memory. > + * > + * **DG2 64K min page size implications:** Long term, I'm not sure that the "**" (for emphasis) is needed here or below. It's interesting at the moment, but will be just another thing baked into the kernel/user code in a month from now. :) > + * > + * On discrete platforms, starting from DG2, we have to contend with GTT > + * page size restrictions when dealing with I915_MEMORY_CLASS_DEVICE > + * objects. Specifically the hardware only supports 64K or larger GTT > + * page sizes for such memory. The kernel will already ensure that all > + * I915_MEMORY_CLASS_DEVICE memory is allocated using 64K or larger page > + * sizes underneath. > + * > + * Note that the returned size here will always reflect any required > + * rounding up done by the kernel, i.e 4K will now become 64K on devices > + * such as DG2. > + * > + * **Special DG2 GTT address alignment requirement:** > + * > + * The GTT alignment will also need be at least 2M for such objects. > + * > + * Note that due to how the hardware implements 64K GTT page support, we > + * have some further complications: > + * > + * 1) The entire PDE(which covers a 2MB virtual address range), must > + * contain only 64K PTEs, i.e mixing 4K and 64K PTEs in the same > + * PDE is forbidden by the hardware. > + * > + * 2) We still need to support 4K PTEs for I915_MEMORY_CLASS_SYSTEM > + * objects. > + * > + * To keep things simple for userland, we mandate that any GTT mappings > + * must be aligned to and rounded up to 2MB. As this only wastes virtual > + * address space and avoids userland having to copy any needlessly > + * complicated PDE sharing scheme (coloring) and only affects GD2, this > + * id deemed to be a good compromise. typos: GD2, id Isn't much of this more relavent to the vma offset at exec time? Is there actually any new restriction on the size field during buffer creation? I see Matthew references these notes from the offset comments, so if the kernel devs prefer it here, then you can add my Acked-by on this patch. -Jordan > */ > __u64 size; > /** > -- > 2.25.1