From patchwork Fri Feb 25 14:55:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12760444 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 504D9C433FE for ; Fri, 25 Feb 2022 14:56:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D041E10E510; Fri, 25 Feb 2022 14:56:35 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FAB210E378; Fri, 25 Feb 2022 14:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645800978; x=1677336978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fPsSg2xzh36cNsoqe1PXqRxKogmPAHMiwVNDn8suB2Q=; b=jh5emiMj/wINZH/vNipUYqQR9m65jloJTxi4QKM4QB2hyZ8QMgVa4jGS WChgnG8yFq/qaKG/VP9jmh78Vxv4SEWV+YfUaTzcTzbx+/cmY8GYrBOjY hcNLuz3aEwfXTuE3Shaw67f+B2LofNqEp5qEQU0BEJAPNhxB/AmNGCT+h hqT+4btjX/Gg2kPHgSFX3v0DHUopeMeDtVDOUwh12XBNt8BH0hq1ztyN/ 3ZRIZhurf51DNfplIDuNzOpRS96HoHDHcgDKljlyEhmnp5WQ06R7AezPT yNl1CP8zjS7EFDJmc6LAoIWiTyNxGBk+9hI7yltDUUqlVUO68CuY9GbCB A==; X-IronPort-AV: E=McAfee;i="6200,9189,10268"; a="252237248" X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="252237248" 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:18 -0800 X-IronPort-AV: E=Sophos;i="5.90,136,1643702400"; d="scan'208";a="707882141" 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:17 -0800 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Subject: [CI 6/7] drm/i915/buddy: tweak 2big check Date: Fri, 25 Feb 2022 14:55:01 +0000 Message-Id: <20220225145502.331818-6-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" Otherwise we get -EINVAL, instead of the more useful -E2BIG if the allocation doesn't fit within the pfn range, like with mappable lmem. The hugepages selftest, for example, needs this to know if a smaller size is needed. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c index 0ac6b2463fd5..92d49a3c378c 100644 --- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c +++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c @@ -82,7 +82,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man, lpfn = pages; } - if (size > mm->size) { + if (size > lpfn << PAGE_SHIFT) { err = -E2BIG; goto err_free_res; }