Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1294725lqp; Mon, 15 Apr 2024 01:47:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQw0h/lPjvUi9LYGYXIMumfT5v4umi2AVRzQ92XyB7Gt1uhA7AM3i6daHemZ9A2iJCnY4noclbsob7f0q5N0kKwAtz9MwrWa6b9nSstg== X-Google-Smtp-Source: AGHT+IGkvO5x4OWjopjlBhbtF/EoxJC87jcfLFnGcTy3ONRx+C63fbd8knPqzXQt4LsWG68iuYf9 X-Received: by 2002:ac8:7f92:0:b0:434:e87a:d927 with SMTP id z18-20020ac87f92000000b00434e87ad927mr12160226qtj.34.1713170844134; Mon, 15 Apr 2024 01:47:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713170844; cv=pass; d=google.com; s=arc-20160816; b=S5XC66oQk9GXl6dxYVJAnAYrPycFAUrTrrf/Vi/T28tVVKRTL6H4AqA18NXtAtOQvy vzX1p6cLrTkTFrESVVJ0DzTJ6oExRcwmOuv1yoOMZbQYDll2WsC0dsix7D7mcUkqirZe BmWCFpP839myTMWCo+yjvtyx2knGbVtvYGSz/MIpVIj2JApvRzrfP3yW55q1rfKLxKia C1HOriUMNBJKhRs+YOE5ifEoF7FDZneAbQ5JjmthG3pULn1hmoUOD3zObsMVO8io3B5M 7CSHc4Ap1nCuQJjercoqsMvVRDqx0yNo6z2TShSzNeaaE3iJkSNh0ndI07y2OqOb2lCp pX8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=AvJwjZh3SwIPhOQ6aMiH/PgEbpKPxWmlM7MG0itR2GE=; fh=3gwdnxe3e0S99UPrI0g3l8Glv3DBUjDzFovZjdqQyds=; b=ViBITDVAEKpvnrP+pKHWJ0LFKIGDtYCwSfKQajV9nQMUGtT1HL/8+XRhZJWiJzgpY6 iDg0qfgn/TCNrcxt66AKpzq3ahIqhJXla+XFaVjzyLznRaqHeHSWnPjLFZqCx7wSS+Kp rTOqOJtQDztoLBnfS5iYkcXXBc5e0cjHFcJ2zV4LrUwdhMs8iISyOLupSC27jHckncn7 vzl2C2HDRQWEYE7AgbFytqlwdnLMg3YbpIN9NTEy1RALY2Hs9BSUraP+ygpA3tAdRWh6 cPCsHdaJJYgBwaBVA/cyjkf13sUK/2IOUbhKOqDf54gRJSzh23sN1T1OYD9s119IxWZ5 xl+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-144790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o14-20020a05622a044e00b00432c71d95ddsi9120499qtx.631.2024.04.15.01.47.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 01:47:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-144790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A5A601C22925 for ; Mon, 15 Apr 2024 08:47:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EFC13DBB3; Mon, 15 Apr 2024 08:47:03 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F0E03CF73 for ; Mon, 15 Apr 2024 08:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713170822; cv=none; b=ViOkGwnpSPAAAkEnvlIgm2nNYHMsI07PqAcEOZBbBr4xBnSjjaH99NGh9rwCFlXC9Lc2tCYlwyJp95k/dATxPQaIxizGIBINk7Kp2sUDmZ+IlZ041J+Uj5zlhLtuDehenR8+/O1/+MCvw225xnsog/fz6KG5Oz3/kAIx2wEJ58A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713170822; c=relaxed/simple; bh=OQNw4LBQ/YZYiZ9fTgbcylTBMNdRue7L9lu8bUUlgY8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=glOQLOGQjHw74wvLCY+6uVFHpVIWjz385v0e9s5fXjheFoJ23SxOmyvzzP3eSE7jy6H3eSD+OnD1YoCbg43Suj777JkG/25uhL826xL3fH7H0GgdONiJVtfnfybnv7TfDWVwVLAglOZx+wTIvLY7d/NvnCDWUnH/bYdJZT1QEFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 032DD2F; Mon, 15 Apr 2024 01:47:28 -0700 (PDT) Received: from [10.57.76.98] (unknown [10.57.76.98]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 036033F64C; Mon, 15 Apr 2024 01:46:57 -0700 (PDT) Message-ID: <54e4a174-dea7-4588-b8a6-0310c210ffce@arm.com> Date: Mon, 15 Apr 2024 09:46:58 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/panthor: Add defer probe for firmware load To: Andy Yan , boris.brezillon@collabora.com Cc: daniel@ffwll.ch, airlied@gmail.com, liviu.dudau@arm.com, maarten.lankhorst@linux.intel.com, tzimmermann@suse.de, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Andy Yan References: <20240413114938.740631-1-andyshrk@163.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20240413114938.740631-1-andyshrk@163.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 13/04/2024 12:49, Andy Yan wrote: > From: Andy Yan > > The firmware in the rootfs will not be accessible until we > are in the SYSTEM_RUNNING state, so return EPROBE_DEFER until > that point. > This let the driver can load firmware when it is builtin. The usual solution is that the firmware should be placed in the initrd/initramfs if the module is included there (or built-in). The same issue was brought up regarding the powervr driver: https://lore.kernel.org/dri-devel/20240109120604.603700-1-javierm@redhat.com/T/ I'm not sure if that ever actually reached a conclusion though. The question was deferred to Greg KH but I didn't see Greg actually getting involved in the thread. > Signed-off-by: Andy Yan > --- > > drivers/gpu/drm/panthor/panthor_fw.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c > index 33c87a59834e..25e375f8333c 100644 > --- a/drivers/gpu/drm/panthor/panthor_fw.c > +++ b/drivers/gpu/drm/panthor/panthor_fw.c > @@ -1336,8 +1336,17 @@ int panthor_fw_init(struct panthor_device *ptdev) > } > > ret = panthor_fw_load(ptdev); > - if (ret) > + if (ret) { > + /* > + * The firmware in the rootfs will not be accessible until we > + * are in the SYSTEM_RUNNING state, so return EPROBE_DEFER until > + * that point. > + */ > + if (system_state < SYSTEM_RUNNING) This should really only be in the case where ret == -ENOENT - any other error and the firmware is apparently present but broken in some way, so there's no point deferring. I also suspect we'd need some change in panthor_fw_load() to quieten error messages if we're going to defer on this, in which case it might make more sense to move this logic into that function. Steve > + ret = -EPROBE_DEFER; > + > goto err_unplug_fw; > + } > > ret = panthor_vm_active(fw->vm); > if (ret)