From patchwork Fri Feb 25 14:55:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12760442 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 3DC63C433F5 for ; Fri, 25 Feb 2022 14:56:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA67E10E49B; Fri, 25 Feb 2022 14:56:19 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id F32C310E378; Fri, 25 Feb 2022 14:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645800977; x=1677336977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hioo3YnYUtDwOYo/Nu9K5yTBpF0/WollsjmzajFhbm4=; b=WBUM0Gbzfe+pIu5jDpeN1HAuFOoZuHuZUE1ahZJM+LdAf4GCmV9fjWbB enEuGCXhsnqNkX5wCWwkUiN/citNnz8wR/c0FJwMRfE/XlqCPUx3RSi6R Scz+7O01sjPM1lKv2Kaj8+Tp+Q0MY16rZXZaWSEa5MmX2E5rZ2TvNvAl0 7/7kFL3/gBJhFx9VYs6ilr1nDMUoxW7qMiXGCyjkuOSbpY7rG1qWXpgje Wkj7g/AfYK6ylH2aLMOq3iCCsEmmSJ4BewJp/xg3YYV273lb/c7NaQPYh P/jxSEx0zkhY/lxw4qBpw7oB5FQx3+URtmAfwOeMwcB5o2Q0J1qCmgGTw A==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="252237239" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="252237239" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 06:56:16 -0800 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="707882140" Received: from phelanmi-mobl1.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.252.25.227]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 06:56:15 -0800 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [CI 5/7] drm/i915/buddy: adjust res->start Date: Fri, 25 Feb 2022 14:55:00 +0000 Message-Id: <20220225145502.331818-5-matthew.auld@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220225145502.331818-1-matthew.auld@intel.com> References: <20220225145502.331818-1-matthew.auld@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Differentiate between mappable vs non-mappable resources, also if this is an actual range allocation ensure we set res->start as the starting pfn. Later when we need to do non-mappable -> mappable moves then we want TTM to see that the current placement is not compatible, which should result in an actual move, instead of being turned into a noop. Signed-off-by: Matthew Auld Cc: Thomas Hellström Reviewed-by: Thomas Hellström Acked-by: Nirmoy Das --- drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c index e47a3d46c6ff..0ac6b2463fd5 100644 --- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c @@ -141,6 +141,13 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man, mutex_unlock(&bman->lock); } + if (place->lpfn - place->fpfn == n_pages) + bman_res->base.start = place->fpfn; + else if (lpfn <= bman->visible_size) + bman_res->base.start = 0; + else + bman_res->base.start = bman->visible_size; + *res = &bman_res->base; return 0;