Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5500269pxb; Wed, 26 Jan 2022 13:30:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpkkX4asBmwPtUy20Cxm+JyLrnl1DJnmR4nsZxmROW+uQe4LrPdpM3zI3tAhpQXwjvKeS4 X-Received: by 2002:a17:902:7784:: with SMTP id o4mr786176pll.173.1643232648410; Wed, 26 Jan 2022 13:30:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643232648; cv=none; d=google.com; s=arc-20160816; b=toEp4lNImVLENFlHcTOHFk4M1fwhctP4qNXwTubVTHMg3TveZpePcoj0EJEuAhNNB9 0Kt6pScROGDNM6NwyuwI+jk9J/Eh1yEIMFnt25r3pspXQtRRzHnjFGopfT6w/zYgu18A 4e/5QFQxI8KLLME9+NevVP3qv5cBs7DipSJo2GSVo37M87QcwSFqueVn+TAuINTUM5hZ dMIObiOAjJ0sOmoJM1yXMTHzbMlGal4FkC5fFm9aljWenhZqP5fvqCJNDfLl/btwySA3 EBlpzqiLgGI5No28wXRcs2VwjqqbTn7XYANQqgu8SPZugG5xfDje/6qOkKyNNUrt7G+w 7fvQ== 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=WNZuQsN5sCmsjeKgHvTJM+sLNsuTADmG6tjDrnVulc8=; b=iUUehZWj6UgP5GAR5EmY6P8MyyHIX2iXnSGU5wbet9Srbr0NbDURwcfF6RitYAdrxr ooVW63lcMvj4m+mNACu0QU6LDn9FHpIjKbhMg1+RwT5l+EAMf3HvtL4vUCuJmVuZUuFl adGIS1v/BtuVgaGlegGXS1m7m4JJ/dmRqIG64Y4Fb6+uBE9Z7O/4NpRewgq7pw6X8Hac wbQf1mO76UWTa5wmt8cBa0J8jKL7alcXxYdsBmAx5015DDcUUPNlUPeTbfOMaTH0TkDb aDu5iVW/ElddPXVa2K2UVCYx/h4duL3Waib63IJitbJ5xqRGGPajifLOCQ0c1la+ISJs ZTJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=RsLQLxny; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oc10si4256849pjb.183.2022.01.26.13.30.36; Wed, 26 Jan 2022 13:30:48 -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=fail (test mode) header.i=@shipmail.org header.s=mail header.b=RsLQLxny; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241978AbiAZONv (ORCPT + 99 others); Wed, 26 Jan 2022 09:13:51 -0500 Received: from ste-pvt-msa1.bahnhof.se ([213.80.101.70]:31022 "EHLO ste-pvt-msa1.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232541AbiAZONu (ORCPT ); Wed, 26 Jan 2022 09:13:50 -0500 X-Greylist: delayed 471 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Jan 2022 09:13:50 EST Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id E2CB73F689; Wed, 26 Jan 2022 15:05:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.1 X-Spam-Level: X-Spam-Status: No, score=-2.1 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Authentication-Results: ste-pvt-msa1.bahnhof.se (amavisd-new); dkim=pass (1024-bit key) header.d=shipmail.org Received: from ste-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (ste-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hMX6J1oMPg-X; Wed, 26 Jan 2022 15:05:56 +0100 (CET) Received: by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 293F03F66F; Wed, 26 Jan 2022 15:05:53 +0100 (CET) Received: from [192.168.0.209] (unknown [192.55.55.54]) by mail1.shipmail.org (Postfix) with ESMTPSA id 2B3B33626AA; Wed, 26 Jan 2022 15:05:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1643205953; bh=0MTfgcCysP/q4eVXnuzFoCi2k0Jnuri0D10FI7Hd3AM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RsLQLxnyua74FxEE2/64ThYR5+k3uN1bMz9T9qsxrPQ1BBbccs1J23+KBzWmVyycK fpvxv6rm07BNAZdm2ViUlwSDsmVVJQAtVlSH4bjf5Q7Hx6dKWMn3UeKr4FAXKxk811 oaT7tYG4JF1jHX1nFr7EF/NUCkPQpW/pox9SPkCE= Message-ID: Date: Wed, 26 Jan 2022 15:05:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [Intel-gfx] [PATCH v5 4/5] drm/i915: add gtt misalignment test Content-Language: en-US To: Robert Beckett , 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: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= In-Reply-To: <20220125193530.3272386-5-bob.beckett@collabora.com> 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 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