Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5533945pxb; Wed, 26 Jan 2022 14:21:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+yrCDY8OHjneqiJH5Hs1Wb7fiky62liSEzb28jy01g2/aGyhdvtdrBJfAhQD/H6oJfF58 X-Received: by 2002:a17:906:15ca:: with SMTP id l10mr645279ejd.435.1643235704170; Wed, 26 Jan 2022 14:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643235704; cv=none; d=google.com; s=arc-20160816; b=sNf66INxBOb+4XpP8kEXxKoRtu8B6u5oBJ7iWR4J5PTAHXQJwO3EOTVxMOpnv5Csa0 vLSwVsLvSn8xVUMs6pB4xCDvrspl/8XnKfr0/siC8JxsBbyLHmWm0vZIfNZTMtZm1mcO WOEZExaXVekNJiavr/LDg8uzZq+4hKGuOy+ypL9HtGcT0u/fkfLIHEErj7fopgOadxMb OOQs3BAuo3FfweDr6eV9f4Nv68wiqcKOY8WoBnfhkaUUcN/y1kIpe0IpskfbpwDB8SvN bBJoUYHPApcJ5zK7WCyslvATGJkejqrfA01u+stIAWWUISbAINjvoFaeKt5wiKmCzz8P vSJg== 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=jkta2uaZT5IpTqX2DGv2/SCncs3niYIMcakk2ss1d1U=; b=V6MqrTBHlP8CVGLEVQJ2MuBSlXcQuW18Vr5bQyvwHedObZ5ylp/PWrtiWJKaGDV3Jr QNdrMU0ldnnJ/3op+xJmA4Du8VoF7dp0MOJ9pI6d76HVrOVO4nOdP2m81yPFL8qfuGBl iigVkdFfxKUQ6cGEaDQ0JexuZo5+KupDuh+lxgiy8HVkuq46WeIeUlVa7GT6gCwt1Nfy 6tgjgBfkqS3dXnGYbwLpbhn3HK7xWIB6m2mOq0DK7smcSNj3fuclS6kDZwQcelZkR3d8 PYmE0jqSuqhCbh3+U7lMH/wLrP+88JeKCL0CD+ChVmma55zGOARbl2ySqx72UWMWD/oM C58w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=d5ECevzA; 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 e26si312341edr.119.2022.01.26.14.21.18; Wed, 26 Jan 2022 14:21:44 -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=d5ECevzA; 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 S243646AbiAZRW4 (ORCPT + 99 others); Wed, 26 Jan 2022 12:22:56 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:41860 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243638AbiAZRWy (ORCPT ); Wed, 26 Jan 2022 12:22:54 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 8A1A71F44B34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643217773; bh=KRPjC0F//Rs7+XHQCvSSYdfp5fg6sMkAfNwgxe4p6qo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=d5ECevzAgDFBVGTWmzfd0URx4elZ3RoL39HBbNFPwjtm9jCEG5/ywEJOn27gKFSLT xEQbTapy0hzenvYXZVkZVt8VQwC4AcNIuUs0CnwK4SluX3Ok8stN/Rh6qVpYOdvXIM dOjjC3F5CqhYZQAykMxy87gZGqMVwMBBl8x6LMtQKQA85NBVcZUFO2clMkWGIF6Jjv 7oJCPLsqXBxnc+tMxHxq+8jKdCpgW+B7Gu6wu3anJvwWT0Q7gcuf+3ZvAa+vUAnrPq GDIY3Z/Y78noq24e6AhHN9FqQDrqtS8cArv8aQGybu0jSLTez0S5odTB6STKQcbB1s nolWZkIiRaCcw== Message-ID: <60c29fb8-06a8-8daa-3cef-092d6b8d0323@collabora.com> Date: Wed, 26 Jan 2022 17:22: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 4/5] drm/i915: add gtt misalignment test 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, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20220125193530.3272386-1-bob.beckett@collabora.com> <20220125193530.3272386-5-bob.beckett@collabora.com> From: Robert Beckett In-Reply-To: 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 14:05, Thomas Hellström (Intel) wrote: > > On 1/25/22 20:35, Robert Beckett wrote: >> add test to check handling of misaligned offsets and sizes >> >> v4: >>     * remove spurious blank lines >>     * explicitly cast intel_region_id to intel_memory_type in >> misaligned_pin >> Reported-by: kernel test robot >> >> Signed-off-by: Robert Beckett >> --- >>   drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 128 ++++++++++++++++++ >>   1 file changed, 128 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c >> b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c >> index b80788a2b7f9..f082b5ff3b5e 100644 >> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c >> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c >> @@ -22,10 +22,12 @@ >>    * >>    */ >> +#include "gt/intel_gtt.h" >>   #include >>   #include >>   #include "gem/i915_gem_context.h" >> +#include "gem/i915_gem_region.h" >>   #include "gem/selftests/mock_context.h" >>   #include "gt/intel_context.h" >>   #include "gt/intel_gpu_commands.h" >> @@ -1067,6 +1069,120 @@ static int shrink_boom(struct >> i915_address_space *vm, >>       return err; >>   } >> +static int misaligned_case(struct i915_address_space *vm, struct >> intel_memory_region *mr, >> +               u64 addr, u64 size, unsigned long flags) >> +{ >> +    struct drm_i915_gem_object *obj; >> +    struct i915_vma *vma; >> +    int err = 0; >> +    u64 expected_vma_size, expected_node_size; >> + >> +    obj = i915_gem_object_create_region(mr, size, 0, 0); >> +    if (IS_ERR(obj)) >> +        return PTR_ERR(obj); >> + >> +    vma = i915_vma_instance(obj, vm, NULL); >> +    if (IS_ERR(vma)) { >> +        err = PTR_ERR(vma); >> +        goto err_put; >> +    } >> + >> +    err = i915_vma_pin(vma, 0, 0, addr | flags); >> +    if (err) >> +        goto err_put; >> +    i915_vma_unpin(vma); >> + >> +    if (!drm_mm_node_allocated(&vma->node)) { >> +        err = -EINVAL; >> +        goto err_put; >> +    } >> + >> +    if (i915_vma_misplaced(vma, 0, 0, addr | flags)) { >> +        err = -EINVAL; >> +        goto err_put; >> +    } >> + >> +    expected_vma_size = round_up(size, 1 << >> (ffs(vma->resource->page_sizes_gtt) - 1)); >> +    expected_node_size = expected_vma_size; >> + >> +    if (IS_DG2(vm->i915) && i915_gem_object_is_lmem(obj)) { >> +        /* dg2 should expand lmem node to 2MB */ > > Should this test be NEEDS_COMPACT_PT()? > > Otherwise LGTM. Reviewed-by: Thomas Hellström > Thanks. Good catch, forgot to retrofit the new macro here. > >