From patchwork Thu Apr 21 11:38:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 12821501 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 262EEC433F5 for ; Thu, 21 Apr 2022 11:37:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1DE410EA92; Thu, 21 Apr 2022 11:37:23 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31CB110EAA1; Thu, 21 Apr 2022 11:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650541042; x=1682077042; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C9KppufqNBcoOEqlw1a11aEo0DAHKPArEfFcrfmgFlI=; b=AtT1nqUtFKzsfmYHt+SKmxYkZEZ15nV/NSPXH6n9NYR48ann4q8ddtmW LscF2bDN9B44aqbf6KCNfb451N1hFjyN7QyNQ6whocaD2Z5rC+AXIhyxD ADC1fig/jNDYbW50jPkWr26fha1fZHbmZB9rSVPvJSPnRzNkNBmCW2et8 UAL+5VGDLOqIPVrYK2qEXW38ZcjD0276HUKeCG4FkieJGL+6y8VzvYEz7 8zqea/Y9nJtUM1DFQpTuT8fUtbljj8/9k0Z0G8ZrKL/Wdb80GlJ7ZY27R dZ+fwgmop42w5JhWeqpBJEgZjslI20+nFYK+ggk4H/IAkwmPJE5MXxNAJ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10323"; a="324766819" X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="324766819" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 04:37:21 -0700 X-IronPort-AV: E=Sophos;i="5.90,278,1643702400"; d="scan'208";a="727952096" Received: from ramaling-i9x.iind.intel.com ([10.203.144.108]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2022 04:37:19 -0700 From: Ramalingam C To: intel-gfx , dri-devel Date: Thu, 21 Apr 2022 17:08:10 +0530 Message-Id: <20220421113813.30796-2-ramalingam.c@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220421113813.30796-1-ramalingam.c@intel.com> References: <20220421113813.30796-1-ramalingam.c@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/4] drm/i915/gt: GEM_BUG_ON unexpected NULL at scatterlist walking 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: Hellstrom Thomas , Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" While locating the start of ccs scatterlist in smem scatterlist, that has to be the size of lmem obj size + corresponding ccs data size. Report bug if scatterlist terminate before that length. Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/gt/intel_migrate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c index 9d552f30b627..29d761da02c4 100644 --- a/drivers/gpu/drm/i915/gt/intel_migrate.c +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c @@ -687,6 +687,12 @@ static void get_ccs_sg_sgt(struct sgt_dma *it, u32 bytes_to_cpy) bytes_to_cpy -= len; it->sg = __sg_next(it->sg); + + /* + * scatterlist supposed to be the size of + * bytes_to_cpy + GET_CCS_BYTES(bytes_to_copy). + */ + GEM_BUG_ON(!it->sg); it->dma = sg_dma_address(it->sg); it->max = it->dma + sg_dma_len(it->sg); } while (bytes_to_cpy);