From patchwork Mon Nov 22 19:13:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Zbigniew_Kempczy=C5=84ski?= X-Patchwork-Id: 12632693 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1206AC433EF for ; Mon, 22 Nov 2021 19:13:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5474689B78; Mon, 22 Nov 2021 19:13:39 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D0F389B78 for ; Mon, 22 Nov 2021 19:13:38 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10176"; a="233576650" X-IronPort-AV: E=Sophos;i="5.87,255,1631602800"; d="scan'208";a="233576650" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2021 11:13:38 -0800 X-IronPort-AV: E=Sophos;i="5.87,255,1631602800"; d="scan'208";a="496992044" Received: from mikolajk-mobl.ger.corp.intel.com (HELO localhost) ([10.213.6.157]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2021 11:13:36 -0800 From: =?utf-8?q?Zbigniew_Kempczy=C5=84ski?= To: intel-gfx@lists.freedesktop.org Date: Mon, 22 Nov 2021 20:13:14 +0100 Message-Id: <20211122191314.47254-2-zbigniew.kempczynski@intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20211122191314.47254-1-zbigniew.kempczynski@intel.com> References: <20211122191314.47254-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/1] i915/gem/i915_gem_execbuffer: Disallow passing alignment 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: , Cc: Daniel Vetter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Ensure passing alignment is not possible by UMD starting on gens4+. Inspected UMD code - Mesa, Compute (NEO), Media-Driver, xf86-intel-video seems to be alignment == 0 ready. Libdrm potentially uses alignment but it is used in some IGTs which remains intact during libdrm removal (there's no possibility to properly rewrite those tests due to specific hw requirement - dual gpus). Signed-off-by: Zbigniew KempczyƄski Cc: Jason Ekstrand Cc: Daniel Vetter --- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c index 9f7c6ecadb90..cc012d6ffa02 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c @@ -505,6 +505,14 @@ static bool platform_has_relocs_enabled(const struct i915_execbuffer *eb) return false; } +static bool platform_allows_pass_alignment(const struct i915_execbuffer *eb) +{ + if (GRAPHICS_VER(eb->i915) < 4) + return true; + + return false; +} + static int eb_validate_vma(struct i915_execbuffer *eb, struct drm_i915_gem_exec_object2 *entry, @@ -513,6 +521,9 @@ eb_validate_vma(struct i915_execbuffer *eb, if (entry->relocation_count && !platform_has_relocs_enabled(eb)) return -EINVAL; + if (entry->alignment && !platform_allows_pass_alignment(eb)) + return -EINVAL; + if (unlikely(entry->flags & eb->invalid_flags)) return -EINVAL;