Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3538895rwa; Tue, 23 Aug 2022 06:24:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR6eK9GGxxhUEnV/pB8MiNIsklr7pBHEX7PaOArFO305XYamEL0MBIPJ5yvDJGLxBMbe1Acv X-Received: by 2002:a05:6a00:17aa:b0:537:27e:625b with SMTP id s42-20020a056a0017aa00b00537027e625bmr2504953pfg.12.1661261094679; Tue, 23 Aug 2022 06:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661261094; cv=none; d=google.com; s=arc-20160816; b=SzDzCW7DSC0ATZMM5G5MXD5uTSLUgtNC6FvOM8oHFptR0nD6nDaLefYHY/KxI2SQtX arkCW52yiDgnQddo0cw8sw5Wozjf0uxl69pnt9fgBetm4LyEQ657+XFgA0o9Nz3zH7lk v/HPLBlmiGcIdDMEL8kvnvN8bVUequCKxL7nYEEDZ3IgOkPk7/9QkluA2D5Yqz7+Clwp tpO/1qvI8xXQI/XVEkRJiZIX7ltaSsEDiLxp1J3kNd1Ny38QyjS8MycZusM5Fb153yIC 610Q0r8aHsfPo7/YoNqHgF8xmuM9eCYTrbMILoIm+puka3Ze6ogmHJ27L1ZDS+2fUN93 jcmg== 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=Mha7nfgwoEurWR/xdG27QQ1JNPsLur7GXU5r2Exm8co=; b=PHn1cPSI+IWEbps42aj0UJoHWqUcp7m2AaMiaSKLdjAHOozUXWDIpyjPCJ7l6CW1Sn E/beS7nPbo4uJYgxm/WlShxqoBhecUcHI/DzrVVodgrQZe57b+jyDULcAIVXW/86PWkw uw3RLJNc24G7mMlPtzRAYSLJ3QHRiDsFAAL/STBf0+6z8ZGwh6YrOGwDIlVEpcWHg/df cPoPJAdCmuq8+N5DVSspkTsbVwVGTRXykoqbEhXtyn9S2CbnwMnB2I9wvtpRivkuAzz3 jm6wTnBzBd/Om8pJof4cI5JnNP/+wS5q3M/7lSy9sv18ujJTYcv7sv+wY67x9PaqZ0io ipXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=n+iiFlmp; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a056a00148d00b005107cf64e1dsi14049118pfu.212.2022.08.23.06.24.43; Tue, 23 Aug 2022 06:24:54 -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=@intel.com header.s=Intel header.b=n+iiFlmp; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241607AbiHWNUv (ORCPT + 99 others); Tue, 23 Aug 2022 09:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240087AbiHWNUR (ORCPT ); Tue, 23 Aug 2022 09:20:17 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA1B140CBF for ; Tue, 23 Aug 2022 03:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661249952; x=1692785952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xXWYIOHPKolHy/g3/53FzAfI4f56T3QhlqwnvSbksEw=; b=n+iiFlmpkT3Tk30H/HDhMGigHp4ki3vBGCaxCQOyaazxzvn9dng2+oFf JBuFK49Ei2EVWt709eb6uIGPxyJC39+e3PVaeaWECW17cP/cxk+SS5wg0 dXC0khTXyeUy++Fv6yBCRwbUftsdQz8gWnaFKEc/jxC34CdGWN3K4xcaJ mcw7/iqPNDQzPpMKUSinF4be9W4zV9+CSE8ab5xwAst9SQxGHoGX1mcv7 lOXNUuSjsk2pvyuhssCXYQSrUaITXoEL9jSeFGRAO2mnkq5Fhvp2/j2Nj kT7OY4kJx3hFJu722ewV9jeUg1LQ7jy9C568EFAjqtrFE+1umJYiiON9/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10447"; a="291206661" X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="291206661" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 03:18:22 -0700 X-IronPort-AV: E=Sophos;i="5.93,257,1654585200"; d="scan'208";a="751639998" Received: from jabish-mobl2.amr.corp.intel.com (HELO paris.amr.corp.intel.com) ([10.254.9.209]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2022 03:18:18 -0700 From: Gwan-gyeong Mun To: intel-gfx@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, mchehab@kernel.org, chris@chris-wilson.co.uk, matthew.auld@intel.com, thomas.hellstrom@linux.intel.com, jani.nikula@intel.com, nirmoy.das@intel.com, airlied@linux.ie, daniel@ffwll.ch, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, keescook@chromium.org, mauro.chehab@linux.intel.com, intel-gfx-trybot@lists.freedesktop.org Subject: [PATCH v8 7/8] drm/i915: Use error code as -E2BIG when the size of gem ttm object is too large Date: Tue, 23 Aug 2022 19:17:28 +0900 Message-Id: <20220823101729.2098841-8-gwan-gyeong.mun@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220823101729.2098841-1-gwan-gyeong.mun@intel.com> References: <20220823101729.2098841-1-gwan-gyeong.mun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,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 The ttm_bo_init_reserved() functions returns -ENOSPC if the size is too big to add vma. The direct function that returns -ENOSPC is drm_mm_insert_node_in_range(). To handle the same error as other code returning -E2BIG when the size is too large, it converts return value to -E2BIG. Signed-off-by: Gwan-gyeong Mun Cc: Chris Wilson Cc: Matthew Auld Cc: Thomas Hellström Reviewed-by: Nirmoy Das Reviewed-by: Mauro Carvalho Chehab Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 615541b650fa..e3046e02b47a 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -1210,6 +1210,17 @@ int __i915_gem_ttm_object_init(struct intel_memory_region *mem, ret = ttm_bo_init_reserved(&i915->bdev, i915_gem_to_ttm(obj), bo_type, &i915_sys_placement, page_size >> PAGE_SHIFT, &ctx, NULL, NULL, i915_ttm_bo_destroy); + + /* + * XXX: The ttm_bo_init_reserved() functions returns -ENOSPC if the size + * is too big to add vma. The direct function that returns -ENOSPC is + * drm_mm_insert_node_in_range(). To handle the same error as other code + * that returns -E2BIG when the size is too large, it converts -ENOSPC to + * -E2BIG. + */ + if (size >> PAGE_SHIFT > INT_MAX && ret == -ENOSPC) + ret = -E2BIG; + if (ret) return i915_ttm_err_to_gem(ret); -- 2.37.1