Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp940710pxb; Fri, 22 Apr 2022 14:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+AQrb12TG3hm8trh+TE2Ox5uVnxdA2Okm9cwUeK+KuFwl7uo6wjAVzSLokKASdBDVZC2G X-Received: by 2002:a65:6149:0:b0:3a9:7e8f:6429 with SMTP id o9-20020a656149000000b003a97e8f6429mr5591076pgv.613.1650664534153; Fri, 22 Apr 2022 14:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650664534; cv=none; d=google.com; s=arc-20160816; b=vnCzYjcn4S/OxmdqL4meXA8WSjcEniW4D8IfVDMYPxloU7Pw29GLa4jx9nmj+peVbe hv+r1lfu7iE/IdgjhEClQLcl5P5h1gVkOJ4uV+vfP7ByyFgnh0Ct4Rtgj2VotP0Ymt3i 7DeyHhSgH5uiK9lDAE/kru/hVbIaG4zD+IQjp5PV93C7ry8qxajksoL14aBXijW+Lvuf p11xl8+7hv2H+aSBI3/slmoLD0LxCMaumjy1C9q05sPx8ylDmHg4PZiqYue66nHhgDPg XSJIOk7I230zbvJwDLT2V8dWqRLK7XvZINXE0s7oeTAe0g3vmowMq03rNQLUXvxuC0Av USGw== 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=z28VhomZbpmKV8ifW7lA3b+Nx+U9hjdAqMA/F1n0ebw=; b=ll3RW+Bjm5rmfYwUNiIAqFq1Fr3lMU5Q40N5I1zn5qrIfHD0A+qO5fodg9/jm/t+j6 nR9QD5o1okmOozIdDcAEVos/nH84uWQHhUAb4rE1nHrxFI2Bx+rAJSzk83XdWP/fGF5f dPU+RiQ77SnLx+TDVULQYJSTngEGx+Pk7y4/cd/zFlM83GvK7BYJe7a9Rr882f5ChnsF hKe7RJyK9bIjSVZhugTUK6wzr6Gv2Pq6Q78TLX1U3jMltbNiktBAd7llSconDVdiGmsy NfrSVvy7aCGdXN+eh2LpV75SPLCA9/2uwOdT8GbWSqZzSVh3eQ1JTVS1klGba2F82/Vv VaDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GJYFGwaD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z1-20020a056a00240100b0050abab7d9a4si10061069pfh.321.2022.04.22.14.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GJYFGwaD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE93723CF2C; Fri, 22 Apr 2022 13:03:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1391573AbiDUSxD (ORCPT + 99 others); Thu, 21 Apr 2022 14:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391549AbiDUSww (ORCPT ); Thu, 21 Apr 2022 14:52:52 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71CE165E5 for ; Thu, 21 Apr 2022 11:50:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: bbeckett) with ESMTPSA id 914311F45CEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1650566999; bh=26RwCYq5kVMLB9u5WcfwsPXM6g66xnWj0V4XY37l3u8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJYFGwaD9y6397xd6S/316i09OD0GlhbJC3Po8++kfO6osECXCPP9h8OhYS32OLVI T5kJgZurHxBx9RDbHF/ljN4tRcsmyXnWPCUisYUwKa4rbkgrbjL6z9PW/8+/baZvYK WQqatHIpqhU/pBBEWKnVrategu2MqZwe368XzmPGzp54LcyWmEnvQy4TihWqbhgvrq sozkGTWlR5B00FuxIQVOyXmLcDwc8MKnWuI0841+SqLKmyiTCc1C+UT/Cww1Y34/IY 8BQ/Ehf9mN3VOuwmpsTw5MMlk/AMAUGsLlSOWF4YllJLd/o0bc8tAci/JhD3qhd+hz vt48Ykw0PPn8Q== 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: Robert Beckett , Matthew Auld , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] drm/i915: sanitize mem_flags for stolen buffers Date: Thu, 21 Apr 2022 18:49:37 +0000 Message-Id: <20220421184941.428639-3-bob.beckett@collabora.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421184941.428639-1-bob.beckett@collabora.com> References: <20220421184941.428639-1-bob.beckett@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,UNPARSEABLE_RELAY autolearn=no 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 Stolen regions are not page backed or considered iomem. Prevent flags indicating such. This correctly prevents stolen buffers from attempting to directly map them. See i915_gem_object_has_struct_page() and i915_gem_object_has_iomem() usage for where it would break otherwise. Signed-off-by: Robert Beckett --- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c index 358f8a1a30ce..9fe8132de3b2 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c @@ -122,8 +122,9 @@ void i915_ttm_adjust_gem_after_move(struct drm_i915_gem_object *obj) obj->mem_flags &= ~(I915_BO_FLAG_STRUCT_PAGE | I915_BO_FLAG_IOMEM); - obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo->resource) ? I915_BO_FLAG_IOMEM : - I915_BO_FLAG_STRUCT_PAGE; + if (obj->mm.region->id != INTEL_REGION_STOLEN_SMEM) + obj->mem_flags |= i915_ttm_cpu_maps_iomem(bo->resource) ? I915_BO_FLAG_IOMEM : + I915_BO_FLAG_STRUCT_PAGE; cache_level = i915_ttm_cache_level(to_i915(bo->base.dev), bo->resource, bo->ttm); -- 2.25.1