From a86802d988c1aeda34ac2911200213a48b934117 Mon Sep 17 00:00:00 2001 From: Zbigniew Kempczyński Date: Fri, 11 Sep 2020 10:07:24 +0200 Subject: lib/intel_batchbuffer: use canonical addresses for 48bit ppgtt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For all EXEC_OBJECT_PINNED objects we need to be sure address passed must be in canonical form. Until IGT allocator will be written just limit 48 and 47 bit gtt tables to 46 bit only. We don't want to play with canonical addresses with 47-bit set to 1 (and then 63:48). Signed-off-by: Zbigniew Kempczyński Cc: Dominik Grzegorzek Cc: Chris Wilson Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson --- tests/i915/api_intel_bb.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests') diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c index cf7f6e91..d0c182fd 100644 --- a/tests/i915/api_intel_bb.c +++ b/tests/i915/api_intel_bb.c @@ -165,6 +165,47 @@ static void simple_bb(struct buf_ops *bops, bool use_context) gem_context_destroy(i915, ctx); } +/* + * Make sure intel-bb space allocator currently doesn't enter 47-48 bit + * gtt sizes. + */ +static void check_canonical(struct buf_ops *bops) +{ + int i915 = buf_ops_get_fd(bops); + struct intel_bb *ibb; + struct intel_buf *buf; + uint32_t offset; + uint64_t address; + bool supports_48bit; + + ibb = intel_bb_create(i915, PAGE_SIZE); + supports_48bit = ibb->supports_48b_address; + if (!supports_48bit) + intel_bb_destroy(ibb); + igt_require_f(supports_48bit, "We need 48bit ppgtt for testing\n"); + + address = 0xc00000000000; + if (debug_bb) + intel_bb_set_debug(ibb, true); + + offset = intel_bb_emit_bbe(ibb); + + buf = intel_buf_create(bops, 512, 512, 32, 0, + I915_TILING_NONE, I915_COMPRESSION_NONE); + + buf->addr.offset = address; + intel_bb_add_intel_buf(ibb, buf, true); + intel_bb_object_set_flag(ibb, buf->handle, EXEC_OBJECT_PINNED); + + igt_assert(buf->addr.offset == 0); + + intel_bb_exec(ibb, offset, + I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC, true); + + intel_buf_destroy(buf); + intel_bb_destroy(ibb); +} + #define MI_FLUSH_DW (0x26<<23) #define BCS_SWCTRL 0x22200 #define BCS_SRC_Y (1 << 0) @@ -673,6 +714,9 @@ igt_main_args("dpi", NULL, help_str, opt_handler, NULL) igt_subtest("simple-bb-ctx") simple_bb(bops, true); + igt_subtest("check-canonical") + check_canonical(bops); + igt_subtest("blit-noreloc-keep-cache") blit(bops, NORELOC, KEEP_CACHE); -- cgit v1.2.3