From patchwork Wed May 11 15:37:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 12846386 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 A71DCC433F5 for ; Wed, 11 May 2022 15:37:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E4EC10FB8D; Wed, 11 May 2022 15:37:55 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 51D0D10FB8D for ; Wed, 11 May 2022 15:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652283474; x=1683819474; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=nN31u7MLm4SFa27Gd7CL9aP5/4RqVawITPrlE9QDtN0=; b=An96B3sS88qOz8jpGGikFmY3Pc0EZhn5AJS+25LQW9gJ/3dYvK0EPiFm pX4wU2AXzN4t3+m1n9Q9+kbBX2k/2YUswXKPPJnyIIaIbYR6t5Ar2nS9a XLRUrZvdUeWLOF33T5i+AyHxvIzBeCml8wF0+4unE39XIk9VkDnY+pea2 LUP+esOMuNq60K3gAASU+QaMktJFjqIEPvbyZ2l8gwYzIyuvJYEyWPU/P W1Ort8dAHxHXDN8ZeCzUgHJpiOPgO9Zo2aIO/bIw5ACjffBSBycd3NsXZ QrSiH8l+BHqjiGH4myAkZ6hspCu3QZ2bUQW0gC8RNBGTMrl+XjbmUdhmr w==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="257277561" X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="257277561" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:53 -0700 X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="566231912" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:51 -0700 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Wed, 11 May 2022 17:37:44 +0200 Message-Id: <20220511153746.14142-1-nirmoy.das@intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/3] drm/i915: return -EIO on lmem setup failure 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: matthew.auld@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Caller of setup_lmem() ignores -ENODEV but failing to setup lmem on dGPU isn't ignorable error. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c index f5111c0a0060..5a7c403d718a 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -108,7 +108,7 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT) * SZ_64K; if (GEM_WARN_ON(lmem_size < flat_ccs_base)) - return ERR_PTR(-ENODEV); + return ERR_PTR(-EIO); tile_stolen = lmem_size - flat_ccs_base; @@ -131,7 +131,7 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) io_start = pci_resource_start(pdev, 2); io_size = min(pci_resource_len(pdev, 2), lmem_size); if (!io_size) - return ERR_PTR(-ENODEV); + return ERR_PTR(-EIO); min_page_size = HAS_64K_PAGES(i915) ? I915_GTT_PAGE_SIZE_64K : I915_GTT_PAGE_SIZE_4K; From patchwork Wed May 11 15:37:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 12846387 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 C81E7C433F5 for ; Wed, 11 May 2022 15:37:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F5E710FB8F; Wed, 11 May 2022 15:37:58 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D0B710FB8F for ; Wed, 11 May 2022 15:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652283475; x=1683819475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cXXWC2jYNLSFm8opIdWjnqzcyI4yJpofYvjOj9WG6q0=; b=fSA+51VTDoMNhWMMDxd0vHLbM9XmOg1uFCGSL9ibXOYHLPO1wUEOpJrm d3zTOBsgkCRd5Orxf1RnBcO58jY4x5gs72ws2VtrQq5S6H7R9SIx3jqev HkJlPB3EZ6imP3gM96KAOoIC0BZEqyI36jZUZXQQBd2UHCMXQBo31nDzd KrhMh1PZq2KRngUDBsIRT0+dHj5v5BXYyuLMoIixp69fJmmUWoUY0JDU3 MbjdgK9BSr4SOLm5UlF0IW0MRDaZ/xC7/k4LKRBTI6hZf16UGb6+fg1g8 /68QtHaOwyRYIWJFWsP4N4dBGTx9aqj5Vz/ynQoSbkYrviivHeoR7JquP Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="257277571" X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="257277571" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:55 -0700 X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="566231934" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:53 -0700 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Wed, 11 May 2022 17:37:45 +0200 Message-Id: <20220511153746.14142-2-nirmoy.das@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220511153746.14142-1-nirmoy.das@intel.com> References: <20220511153746.14142-1-nirmoy.das@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/3] drm/i915: determine lmem_size properly 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: matthew.auld@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Determine lmem_size using ADDR_RANGE register so that lmem_setup() works on platform with small-bar as well. Signed-off-by: Nirmoy Das --- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c index 5a7c403d718a..cd105ec10429 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -101,9 +101,13 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) return ERR_PTR(-ENODEV); if (HAS_FLAT_CCS(i915)) { + resource_size_t lmem_range; u64 tile_stolen, flat_ccs_base; - lmem_size = pci_resource_len(pdev, 2); + lmem_range = intel_gt_read_register(&i915->gt0, XEHPSDV_TILE0_ADDR_RANGE) & 0xFFFF; + lmem_size = lmem_range >> XEHPSDV_TILE_LMEM_RANGE_SHIFT; + lmem_size *= SZ_1G; + flat_ccs_base = intel_gt_read_register(gt, XEHPSDV_FLAT_CCS_BASE_ADDR); flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT) * SZ_64K; From patchwork Wed May 11 15:37:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 12846388 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 406BBC433FE for ; Wed, 11 May 2022 15:38:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C2EAF10FB92; Wed, 11 May 2022 15:37:59 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 71C3010FB8F for ; Wed, 11 May 2022 15:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652283476; x=1683819476; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=thIhsGv4+19IoRGStAJTZBDMkFxh0bhs8YAD76vbN1A=; b=DKk6DiFG0XtzuMzid9NkZH8nsOAwJFX/p+JZ41QTENOzGW+Y4UMnWxW3 zZukh7UXSsWufwgi/jttAL01bnI/Bc5PcPuGfiyqY2+b1nMLfkZG/sg9Q kjgFjA8PuBpyK+fRxzxs8IViFhs2ja8yua1a977/eSXhfkiy2mSOjBVuF 9iB+3Y/JkfBac9ozlApcdLKkRm8kdOQwgpOgkF4E5vb7UPESdFGXHIszZ SCJA4SvhlJVDtwroRKgM6WcPW5FN8SKwAXLgrA+HAvF4mQNp7HOtEdxHP GuNq4jcPdTvA56wklX6YAOlcHWw6dm7C7AxxtrSQONDEsTmEFezerjBxR A==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="257277578" X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="257277578" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:56 -0700 X-IronPort-AV: E=Sophos;i="5.91,217,1647327600"; d="scan'208";a="566231966" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:37:55 -0700 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Wed, 11 May 2022 17:37:46 +0200 Message-Id: <20220511153746.14142-3-nirmoy.das@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220511153746.14142-1-nirmoy.das@intel.com> References: <20220511153746.14142-1-nirmoy.das@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 3/3] drm/i915: error out on platform with small-bar and CCS 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: matthew.auld@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Until we enable small-bar, we can't support CCS so error out gracefully on such platforms. Signed-off-by: Nirmoy Das Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c index cd105ec10429..43caf8052ffb 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -111,6 +111,13 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) flat_ccs_base = intel_gt_read_register(gt, XEHPSDV_FLAT_CCS_BASE_ADDR); flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT) * SZ_64K; + /* FIXME: Remove this when we have small-bar enabled */ + if (pci_resource_len(pdev, 2) < lmem_size) { + drm_err(&i915->drm, "CCS isn't supported on platforms with small-bar\n"); + return ERR_PTR(-EINVAL); + + } + if (GEM_WARN_ON(lmem_size < flat_ccs_base)) return ERR_PTR(-EIO);