Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1172020lqd; Thu, 25 Apr 2024 07:56:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzEt+Ig4h292BB4iVluPgCIPRY5Ou5h+7/ldBt8e5TcQjdwuaweOo9uaFlSYx699/Xb9KAmM29CyK6Pbvgd/GnIFyHVDet/BeWKDClWg== X-Google-Smtp-Source: AGHT+IF0FD1/YhznB0yJ8gUajKIK+zwWISDP6WGpkifWKq1vYhcbE/OOlSBDTMxTPQkLqfuUEhON X-Received: by 2002:a05:6e02:13a4:b0:36c:caf:2b2a with SMTP id h4-20020a056e0213a400b0036c0caf2b2amr7611741ilo.12.1714057010043; Thu, 25 Apr 2024 07:56:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714057010; cv=pass; d=google.com; s=arc-20160816; b=KQljEh6JZ6xQBNv47kOjp4n00CqKMYjZKrvj2gfNassr/5RGfXvjNuVfXOqBs6h8jv gsdRTxBWDjccu8+s3Qct8aNXBFRMOoagBC9IJVxb08wSHa0q8OpKOKhl7Md4PpGZrVcB amllMyB8zU39Beg7gSKslb5MBe3AtG1gYf/pWOUG7NaCYFJsapM1Iux+tSjCEgPwM7L2 bHCsau3yYqw1HupT3wM/amjiiY2kU1bacCQjRRrxz/t5fV8MKOhS/OHmGGZUVkSHiGKy vV9gj4feHtaAvPJM6tBHwE3KzcRH2wvyToVULA1jj4JvhWAg/ei6aPS7eXsKaiNXh6PM 2WTA== 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=v4y0bc5DnAZv03QoAumf9hLgVM3G4t12Dj7coKfEsJk=; fh=QqsU/VTawLpRSabFVWWkkqW//W3/QSSC3QpzBWQrpgg=; b=OFBWfHdY9b66Ry/JFu77ojHtSa+JA9lTDh5mvIw4XYTXMBkzxQaXuW4NNdacktCQiE dVkCbtQzvT/WJV3he50giPupMFS5XhBgQPP4FpWz0wp9wPawwjxmKYBk48XWVdisnpRE Hxs2oA78KoEhirZEN9aymXkj1A6/zSO/8IL3z5SCRx7mctQHzmJurDUOK7vcrnMK1THI t3LGeIlHdzPPwybQE9uFeXI0xDE+MgmtU5l9anzXUBNrwzS47hvvn4h7q0HZZfSkC6h9 1+KAUpvNZEe/fXipcIRKmqbmFmu15qY7ARA+ejBhzN/jkUfWcrbaOqlXinXvODZ1ENDc p74g==; 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-158714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158714-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y189-20020a6364c6000000b005fdc9c65e61si8394135pgb.766.2024.04.25.07.56.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:56:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-158714-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158714-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DAEF8B2C739 for ; Thu, 25 Apr 2024 14:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2D10149E14; Thu, 25 Apr 2024 14:29:02 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40917763F1 for ; Thu, 25 Apr 2024 14:29: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=1714055342; cv=none; b=IoQ8l+NjRWU+CqdwB4M6jfXhmYY++bSVYlGAwkk08b3rZn5sJRvbgqs8cpDIHhdiuXXx5id7/xNz/NkhO+AEPXuCvPsSVmrk9pbAk/Hpos5ctdFAo8OP+W1/ssfRFZ8Sn2rTPKerUuVGfwJwZNJ6Iv5R24oI6HVSLxM0/yOjoEI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714055342; c=relaxed/simple; bh=anRUf6n0kr/5qiN5iS5iXucgjIGKMlQU3DQo8eY7VGA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f9JfyiMoEio6lx19Z5CEeCNUfNh9z+od+OPMbOJYq6Da9TgcVHjAl+ochpVZjGa4itsxVi2StXHcWt69RiCUI5l1VryJNARL+TyzBMD0xaf7l/ht7z9gddFSfmqheqcw+bfzyY074OvFayqGLp/yrBKrvBdDdQv/WfY/7R+RHZg= 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 DDE991007; Thu, 25 Apr 2024 07:29:27 -0700 (PDT) Received: from [10.57.56.40] (unknown [10.57.56.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 64C203F64C; Thu, 25 Apr 2024 07:28:57 -0700 (PDT) Message-ID: <501d18c9-3116-4cd1-8091-b9f552e9fb5a@arm.com> Date: Thu, 25 Apr 2024 15:28:56 +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: Javier Martinez Canillas , 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> <54e4a174-dea7-4588-b8a6-0310c210ffce@arm.com> <87frv9zthu.fsf@minerva.mail-host-address-is-not-set> From: Steven Price Content-Language: en-GB In-Reply-To: <87frv9zthu.fsf@minerva.mail-host-address-is-not-set> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Javier, On 25/04/2024 10:22, Javier Martinez Canillas wrote: > Steven Price writes: > > Hello Steven, > >> 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. >> > > Correct, there was not conclusion reached in that thread. So I think we need a conclusion before we start applying point fixes to individual drivers. >>> 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. >> > > In the thread you referenced I suggested to add that logic in request_firmware() > (or add a new request_firmware_defer() helper function) that changes the request > firmare behaviour to return -EPROBE_DEFER instead of -ENOENT. That would seem like a good feature if it's agreed that deferring on request_firmware is a good idea. > Since as you mentioned, this isn't specific to panthor and an issue that I also > faced with the powervr driver. I'm not in any way against the idea of deferring the probe until the firmware is around - indeed it seems like a very sensible idea in many respects. But I don't want panthor to be 'special' in this way. If the consensus is that the firmware should live with the module (i.e. either both in the initramfs or both in the rootfs) then the code is fine as it is. That seemed to be the view of Sima in that thread and seems reasonable to me - why put the .ko in the initrd if you can't actually use it until the rootfs comes along? The other option is the user fallback mechanisms for firmware loading which can wait arbitrarily for the firmware to become available. But that isn't exactly popular these days. Steve