Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4918858pxb; Wed, 26 Jan 2022 00:11:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuWaJINu9dXHrq81RQ1btjXa70c3eIjic54itooU4XCYOMC7BO/ANZ0rhpt0EMVnYnTXNF X-Received: by 2002:a62:180d:0:b0:4bb:dafb:ff50 with SMTP id 13-20020a62180d000000b004bbdafbff50mr21874217pfy.45.1643184684023; Wed, 26 Jan 2022 00:11:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643184684; cv=none; d=google.com; s=arc-20160816; b=QGG+mysEQdr4q4MwMinc0hABIdKnigentpZlk1c1OsAbIYengLHwcN+6x0ymK6jTxX q3JKF6nZIEZm1Ykr2+QztDPEjJxQh2Xxr7o2uY8EV+zR8YbsXLOT530r19b5inO+/E8R u6t5fJIOTkqNRZPlsoBamkprf/paF4dvkHiou0r0lxFyv3aaI0atsYHSv1wxSDiiPLzY WN+7eYEYnvxN/o3hHFsDs2Vc0O/6cTXUykBM2iI+QjDqJZyG19GXd9TRvzypU9CJIabQ 60Oohs75mj93jxGyF5Z2Cd8qThj/hQpZJn0n5806eFl9cqcPN8o+rAXG0ZQLXWfwzrkE Rp2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yTcsfz7Ud13aXdvHjgzwhC9eph72laMOuXJxML3Hr7U=; b=iR3JF3NETBDQdO94B5RMZoINuee7dxU4BzE8g+OB2clXQvVmIsc6shVweiSOl6PMwD 8OiRlmzbzRkHBQbWa4BIjZgRM+4OnI/XL5pL1w95KDfRjn0KLJ1OmVxpQB6OuZ0BYM0B zfBSHZiklLZd422X46XrvGqo/ddCVSIvNk4Icj1R2b+AYBrT//9BME2Por3lytE6p5Ab Zw1LabuiCU+OX++DaYqVMV+qJCN6C772zwfR2ff7VFczJNAV0QRw5JOJSJ4BVKERvJ51 C1uzmBHSTgxdCdos7f6ZXSsWxblLnPVJ7uGYw2jmZsMdnWRuJJJjJHS18loSUisuON6p rbjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=R95goKgz; 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 y2si1026228pfi.316.2022.01.26.00.11.12; Wed, 26 Jan 2022 00:11:24 -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=R95goKgz; 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 S230320AbiAYTha (ORCPT + 99 others); Tue, 25 Jan 2022 14:37:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230336AbiAYTgE (ORCPT ); Tue, 25 Jan 2022 14:36:04 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBD2CC06175B for ; Tue, 25 Jan 2022 11:35:56 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 3F67E1F44551 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643139355; bh=mZPnCcNyP7YHjGx5er41lmSPG9xmDAql7AreGVobiw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R95goKgztrs+LJQfxIz65Z9251rc2ojUhSAT8MkJLPZxcruDJCW8Tj6JEiJdvG9Dh 6Ov/PJ5vvqm3pJd8tkivISZfqXOWj/2SyC8T+pRETqwh/dw+B3MqhGkNDhbIo8bx6y GLT65/nfYRzAQTm1NgFg/04mR3v0ZmYKRuUc0GgsOK2gTN2qnVroAnUnLFX4hs8fCw RpmzbThjfN8vWme2TonE5CxyEmhbsHROH4XeGqypCYaCG3eRFWH2vKki8cvh+6xY9x hqmdmhHA43v9CX2QjsMqTDaGuZBjWnQ2yhlxHppCkl/KH/TlMtPv/mtMI0Ec6mZzLS qKr+GxOO+VCzg== From: Robert Beckett To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: Matthew Auld , Ramalingam C , Robert Beckett , Jordan Justen , 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: [PATCH v5 5/5] drm/i915/uapi: document behaviour for DG2 64K support Date: Tue, 25 Jan 2022 19:35:30 +0000 Message-Id: <20220125193530.3272386-6-bob.beckett@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220125193530.3272386-1-bob.beckett@collabora.com> References: <20220125193530.3272386-1-bob.beckett@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. v3: fix typos and less emphasis v2: Fixed suggestions on formatting [Daniel] Signed-off-by: Matthew Auld Signed-off-by: Ramalingam C Signed-off-by: Robert Beckett Acked-by: Jordan Justen Reviewed-by: Ramalingam C 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..77e5e74c32c1 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: + * + * 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 to 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 DG2, this + * is deemed to be a good compromise. */ __u64 size; /** -- 2.25.1