From patchwork Tue Sep 19 17:16:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cavitt, Jonathan" X-Patchwork-Id: 13391624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91954CE79A8 for ; Tue, 19 Sep 2023 17:27:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 611EE10E24F; Tue, 19 Sep 2023 17:27:49 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35A7C10E13D for ; Tue, 19 Sep 2023 17:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695144462; x=1726680462; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gzwHTOZPveKkOJbmUsr5uSRTMUYpEhelNTSMqbP6FgE=; b=cbt8PLEsSbheHJY2hKegztduksMhLyJh1XFxeJo6qRbSuFdzuVq5cqd+ WXNaf8CW5qf5RCDdNtZCCb5UMLMp8lNPUW0gpKeu2JIFFZ3jzV7d0BOTw BFDFMIt1Ddj3v8FEqo0fN27d3OzltipRBF97v8EOQmOMA+Nlx4TMUs1Kq BJfF+aDlt+8sa0i1c+tiR8ntgfn3n4kldlpATCTKAzRNfGw7ZlOeuWSk0 4ZXMvE5PFBzg+4L3bLceSzqWw6xHjvny8ewY0fU9gKnphjALqo9elgHrl NhO2IvJZSN8sZOeBnlQ+kpd2nom6gjul1gMT4iYYQsEXcIBGVwo4J/ii0 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="360266458" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="360266458" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 10:27:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="993247472" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="993247472" Received: from dut-internal-9dd7.jf.intel.com ([10.165.21.194]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 10:27:41 -0700 From: Jonathan Cavitt To: intel-gfx@lists.freedesktop.org Date: Tue, 19 Sep 2023 10:16:53 -0700 Message-Id: <20230919171655.3308090-2-jonathan.cavitt@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230919171655.3308090-1-jonathan.cavitt@intel.com> References: <20230919171655.3308090-1-jonathan.cavitt@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v10 1/3] drm/i915: Reserve some kernel space per vm X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andi.shyti@intel.com, chris.p.wilson@linux.intel.com, tomasz.mistat@intel.com, jonathan.cavitt@intel.com, rodrigo.vivi@intel.com, gregory.f.germano@intel.com, matthew.d.roper@intel.com, nirmoy.das@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Reserve a page in each vm for kernel space to use for things such as workarounds. Signed-off-by: Jonathan Cavitt Suggested-by: Chris Wilson --- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 7 +++++++ drivers/gpu/drm/i915/gt/intel_gtt.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c index 9895e18df0435..1a85858c55639 100644 --- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c @@ -230,6 +230,7 @@ static void gen8_ppgtt_cleanup(struct i915_address_space *vm) gen8_pd_top_count(vm), vm->top); free_scratch(vm); + drm_mm_remove_node(&vm->rsvd); } static u64 __gen8_ppgtt_clear(struct i915_address_space * const vm, @@ -1011,6 +1012,12 @@ struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt, ppgtt->vm.foreach = gen8_ppgtt_foreach; ppgtt->vm.cleanup = gen8_ppgtt_cleanup; + ppgtt->vm.rsvd.start = ppgtt->vm.total - SZ_4K; + ppgtt->vm.rsvd.size = SZ_4K; + ppgtt->vm.rsvd.color = I915_COLOR_UNEVICTABLE; + GEM_BUG_ON(drm_mm_reserve_node(&ppgtt->vm.mm, &ppgtt->vm.rsvd)); + ppgtt->vm.total -= SZ_4K; + err = gen8_init_scratch(&ppgtt->vm); if (err) goto err_put; diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h index 346ec8ec2edda..ab38a158fc715 100644 --- a/drivers/gpu/drm/i915/gt/intel_gtt.h +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h @@ -246,6 +246,7 @@ struct i915_address_space { struct work_struct release_work; struct drm_mm mm; + struct drm_mm_node rsvd; struct intel_gt *gt; struct drm_i915_private *i915; struct device *dma;