From patchwork Thu Nov 28 21:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13888341 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 DCC85D70DEB for ; Thu, 28 Nov 2024 21:13:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52E5F10ED6A; Thu, 28 Nov 2024 21:13:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="AaG/bbno"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id C63BD10ED62 for ; Thu, 28 Nov 2024 21:12:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1732828362; cv=none; d=zohomail.com; s=zohoarc; b=UBXITQU65g5yMW5WrvLWYjJdwBnXfy1k89KraOMGAAfn7hn3/06ofEZa/MPSw/Q/3k/pAQdmAQABoWdCXJ68KhNM6KrdIQm73qAkP9dkJgaZPhUZlceqnqwlEJuXJu3jFMqw4Du+Iqil5aLc+Nit61HPIx1m1uguX2jqj0yql0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732828362; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=R39w5zBfj7DJRcNWotPOClY5HZfoNtPYpt/6Md6nCH0=; b=S+Bo7jeNYPh6Dzq2ND382HRlh1G102LCMzUrCdPXlDuAHaP3CFIKst5ze6yevoyVJkZtMOH2cBjfY7TOrOA7UaPh5G+hppq6BMChmlPdEyjj6oveoWEgfCyRPAVeiStbqfGcNK0MKG/fOh7lXlsRwxykU5+tJLG46n7wFnG92VM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1732828362; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=R39w5zBfj7DJRcNWotPOClY5HZfoNtPYpt/6Md6nCH0=; b=AaG/bbno0AhoQDzzXA3kpe5GSFtr/z93KwKgy46ut0HovS/tCkYKMIaDPgPuDCJL G/9fA7J+hva/D3PF0tQScYgKh482js0q0jhOWJfczoUhZ0MyNlwPDE+J/HLU+CWAf+u Y2tLZ9BHsHUbWBbjwTm/mj7pARrxm1UZPVulu6aQ= Received: by mx.zohomail.com with SMTPS id 1732828362107162.7255296598679; Thu, 28 Nov 2024 13:12:42 -0800 (PST) From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: Boris Brezillon , Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel Cc: kernel@collabora.com, =?utf-8?q?Adri=C3=A1n_Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] drm/panfrost: Handle inexistent GPU during probe Date: Thu, 28 Nov 2024 21:06:17 +0000 Message-ID: <20241128211223.1805830-3-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241128211223.1805830-1-adrian.larumbe@collabora.com> References: <20241128211223.1805830-1-adrian.larumbe@collabora.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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Just in case we're dealing with a yet not recognised device. Signed-off-by: Adrián Larumbe Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index 69425104ca97..da55dc7c0552 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -236,9 +236,10 @@ static const struct panfrost_model gpu_models[] = { */ GPU_MODEL(g57, 0x9003, GPU_REV(g57, 0, 0)), + {0}, }; -static void panfrost_gpu_init_features(struct panfrost_device *pfdev) +static int panfrost_gpu_init_features(struct panfrost_device *pfdev) { u32 gpu_id, num_js, major, minor, status, rev; const char *name = "unknown"; @@ -323,6 +324,12 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev) break; } + if (!model->name) { + dev_err(pfdev->base.dev, "GPU model not found: mali-%s id rev %#x %#x\n", + name, gpu_id, rev); + return -ENODEV; + } + bitmap_from_u64(pfdev->features.hw_features, hw_feat); bitmap_from_u64(pfdev->features.hw_issues, hw_issues); @@ -343,6 +350,8 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev) dev_info(pfdev->base.dev, "shader_present=0x%0llx l2_present=0x%0llx", pfdev->features.shader_present, pfdev->features.l2_present); + + return 0; } void panfrost_cycle_counter_get(struct panfrost_device *pfdev) @@ -485,7 +494,9 @@ int panfrost_gpu_init(struct panfrost_device *pfdev) if (err) return err; - panfrost_gpu_init_features(pfdev); + err = panfrost_gpu_init_features(pfdev); + if (err) + return err; err = dma_set_mask_and_coherent(pfdev->base.dev, DMA_BIT_MASK(FIELD_GET(0xff00,