Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp731054imw; Wed, 13 Jul 2022 07:04:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vQaot4hsJA+DskgKnKl7RsqG5d+UmdaspNgMBDpx+RPrci90W1GKpYkZM8ksqEZ2JzIIZB X-Received: by 2002:a17:902:9044:b0:16b:d7e4:cf7a with SMTP id w4-20020a170902904400b0016bd7e4cf7amr3568187plz.74.1657721078031; Wed, 13 Jul 2022 07:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657721078; cv=none; d=google.com; s=arc-20160816; b=UyZT2o+R4tu7kl47F919pWg/Kai75R16hU55UDog+KaXfH2hFuAEc8qj4PWRT1Z0FK 3fH7AetXu4PVorGqQRtS8yYGVgetLR3MNlaRni5iMy1EHAXxOu6w0IzTrEsvX64C/r7C gCVr9Hj8aTMuYRGJmEQTRjZwE4OXW1GBGu0DvcQYn72s+FSr5MoJBPVgwlFgs1Yw2Oti D11y8kPqqOIKl3lKm3wKqY4tveQhro5RQJ91X5IB+m9oWbRZa/1rN0dOaq7K0NayEb6C Z1HpExr/QTvcuPw2ZIjMw2iZCAGh8kwZB2E4JKpGf+VCetDvZgO/u4OI/BbqazlJpTUF zILQ== 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=I9NZtKkRGWYdOaSkhG8cX1K0QhBLKLQ2rDVywWyInxk=; b=VS5y7TFcLDspYIQfQBvauppYnP7TlosfrU2cp/gxJauYNUeF0yFlwxGyt8EDEeT5EM igcmnLJsHcZt4bXkHEFkYVw1eZZ8bXGpNmNWSXm2IFOwfnngZcz5hZ+yfYn6GotV/KlR Oa47gYX6AjeqXDok1RzUtwLpnyfV7m5VJ0LRg4noPltbN3XjTV5/HJhco571HC2avK3v Zvz/MZ9tCLR2gmNecQeCCJ0XM2zb4Z7auajrgTllrgwpKkJ4QDDHehxXDbNQZ7P0OT55 yF9U7/MPHqytCFUHVhVhUB6/XbdDQiOGlvY3FCvZQJ1pnIzDI/aSitxcKM5ZirY32kjX a81A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eENa0Hlm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc2-20020a17090325c200b0016bf01a662asi15105819plb.499.2022.07.13.07.04.25; Wed, 13 Jul 2022 07:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eENa0Hlm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235820AbiGMNjS (ORCPT + 99 others); Wed, 13 Jul 2022 09:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235567AbiGMNiq (ORCPT ); Wed, 13 Jul 2022 09:38:46 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ABA665B9 for ; Wed, 13 Jul 2022 06:38:45 -0700 (PDT) Received: from hermes-devbox.fritz.box (82-71-8-225.dsl.in-addr.zen.co.uk [82.71.8.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbeckett) by madras.collabora.co.uk (Postfix) with ESMTPSA id B61A86601A43; Wed, 13 Jul 2022 14:38:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657719524; bh=pC7awPtmZC2mFd+19i2l1IB+tj4ajR5y+F+FffFXf70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eENa0HlmOE2bYpysdWfOu0JXSA4dc4rHgxYQgeSFirIzEHhI2rQj5YMjvTK5ZRM/E aVQb0tXNjuiZDc2VI8YP+NWJVZkuYBXYv/cZzgWt5Car68qHFem2UtPMoa0B5vwZBs oFsn1amUKSJSHnmCYZUuTFedl5ykMygB8kCoV2YjQhoqQes/Wc8opghkNiH3Xh5mZc rP+F7GXh6VQAaAerlfadxcdRVCGyNqhMmLRwHF+lV7LHgBpzS6cS4RzduTN/3LVgKC 8zZzal98S/w0CyidXsNBxSpnZlOJJf0Y+P7x4mCdVziwx7JER0+ha4Fe5uGiJkYCF2 omxz5EStibk4w== From: Robert Beckett To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: kernel@collabora.com, Robert Beckett , Matthew Auld , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , linux-kernel@vger.kernel.org Subject: [PATCH v4 7/8] drm/i915/gem: further fix mman selftest Date: Wed, 13 Jul 2022 14:38:17 +0100 Message-Id: <20220713133818.3699604-8-bob.beckett@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220713133818.3699604-1-bob.beckett@collabora.com> References: <20220713133818.3699604-1-bob.beckett@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit 450cede7f380 ("drm/i915/gem: Fix the mman selftest") we fixed up the mman selftest to allocate user buffers via smem only if we have lmem, otherwise it uses internal buffers. As the commit message asserts, we should only be using buffers that userland should be able to create. Internal buffers are not intended to be used by userland. Instead, fix the code to always create buffers from smem. In the case of integrated, this will create them from the shmem non-ttm backend, which is fine. This also fixes up the code to allow conversion of internal backend to ttm without breaking this test. Signed-off-by: Robert Beckett --- .../gpu/drm/i915/gem/selftests/i915_gem_mman.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c index 3ced9948a331..e529eb8461ff 100644 --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c @@ -596,17 +596,12 @@ static enum i915_mmap_type default_mapping(struct drm_i915_private *i915) } static struct drm_i915_gem_object * -create_sys_or_internal(struct drm_i915_private *i915, - unsigned long size) +create_sys(struct drm_i915_private *i915, unsigned long size) { - if (HAS_LMEM(i915)) { - struct intel_memory_region *sys_region = - i915->mm.regions[INTEL_REGION_SMEM]; + struct intel_memory_region *sys_region = + i915->mm.regions[INTEL_REGION_SMEM]; - return __i915_gem_object_create_user(i915, size, &sys_region, 1); - } - - return i915_gem_object_create_internal(i915, size); + return __i915_gem_object_create_user(i915, size, &sys_region, 1); } static bool assert_mmap_offset(struct drm_i915_private *i915, @@ -617,7 +612,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915, u64 offset; int ret; - obj = create_sys_or_internal(i915, size); + obj = create_sys(i915, size); if (IS_ERR(obj)) return expected && expected == PTR_ERR(obj); @@ -719,7 +714,7 @@ static int igt_mmap_offset_exhaustion(void *arg) } /* Fill the hole, further allocation attempts should then fail */ - obj = create_sys_or_internal(i915, PAGE_SIZE); + obj = create_sys(i915, PAGE_SIZE); if (IS_ERR(obj)) { err = PTR_ERR(obj); pr_err("Unable to create object for reclaimed hole\n"); -- 2.25.1