Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4323466ybl; Mon, 26 Aug 2019 08:45:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvQ4CpD3y2dcRw3T5PJr0t99CaCmXB3ERHMuhuJDsFDS2JbRSxTGJa/fibFeOjifq0H/61 X-Received: by 2002:a63:a346:: with SMTP id v6mr17023298pgn.57.1566834329580; Mon, 26 Aug 2019 08:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566834329; cv=none; d=google.com; s=arc-20160816; b=I6eZNU/5uqEmh1PzEsWFqbIEkOqntMuuzuAznqdNo6BILDSz9yeCkL1+sKVla9OUbD ++gv1ApP619D8CFGkIs4loAG1k+hnIxKZzJ5UkdOpk+WeQlFB5j6SqYXeKFyzU0Qr941 QQVIxbBIiuSNm4JqxESNunYzLWnpCIGPD/1lSOWchUSPQM7G9mYhK2uYO+bb0xdWFbnP NuibzHySw0FtepsJsk/9Ah5xVEEOBpzfJRxIh3otE1XQFAU5BS9eQH1vmf2b6RNLS5m7 /5NXjOXplgFOyVwC5fbSkzAV/ptjBz59SIWwPqDEkhZXiFZ3U90mnKPWevfu4XrNLMr7 ggaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=OFHbZ4oNFSxjFZCVr96ZdpAMPyMgbA9Alsj60HdaewI=; b=JMRMJ+3HAtUAqdc4PbkKDR4cRvBn+YI7e4LQXGYctCfqrbV0HbCH4w19aqmzqnbj68 4uhgX0x+pHUACoDTKVF8WiiGvLXWtXqqQQ00U2RwSNlTXabizZ1jum1DkwR7GmUv35ey Tse6BZAQgxFZHjj1GcjPrgXV2ziTHPOO1J5zzaeDYGNSoYSHcruWg1+8TydUebhJv8xG hD49Q6L/7/b6mUyvWglUIEvL18nBLprPF4rfPdYdIyeq/XgyjRvTKOdg0UeXjj5o4BMF PjToyaQStQwsdGF/iftzaT0SLhqXvGOOALEzS5Ui9cZaeCQ9X679DhR6nPTewf8P028g pDfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ByyjV9JH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si9398234pgi.588.2019.08.26.08.45.13; Mon, 26 Aug 2019 08:45:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ByyjV9JH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731942AbfHZPls (ORCPT + 99 others); Mon, 26 Aug 2019 11:41:48 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35891 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729514AbfHZPlr (ORCPT ); Mon, 26 Aug 2019 11:41:47 -0400 Received: by mail-pf1-f193.google.com with SMTP id w2so12044227pfi.3 for ; Mon, 26 Aug 2019 08:41:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=OFHbZ4oNFSxjFZCVr96ZdpAMPyMgbA9Alsj60HdaewI=; b=ByyjV9JHG63hj8brWPvTOWRMkb07LDwqViT/wl+ByOyHsb6BiCQgFeLQTJMzmddT7M LVHh3S1tn5tPnNPijiJYPg6diPhUhy4mAPULE1m88x1z5o8TtM2UHOW0324cmi17jDC5 ppqTzE3a7/9LRhb/jRjWbldP9oSdeEYf6z1lQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=OFHbZ4oNFSxjFZCVr96ZdpAMPyMgbA9Alsj60HdaewI=; b=SzA8i0I4VqjJNKWjp/6Y4vjJxwTRQv/HiospP6FrSqHUEA+5ZF1Ks/Ak1UqjOstF/4 lsMFCbWakvdy5wx5X2YX7EcDkhMv0kN7v3n2qtZmESwmIvDPT32kGRNrhk71NUtC6pdb Hzrj3rfT1wMb2zrdC104OkYJq8SA+WHXBpVRA5urXYPhTchTyBYk4kMtbsNxU7xYl0EB cqjsie0ri37VJDxKRrJCzA2CdnQb2Rjyj9Xgr/0TUwMUKfdQZeUhP4co425PtDdnfhDz K2aVQ+kZ37825pVOraIXRu6KNpsl5Y215Q1sGGmdYxDY8Lmey6yNrd0JPz0dFN3XXIT3 IExA== X-Gm-Message-State: APjAAAVNnaixmQc/rAxVSYg0+sgg8n8+rxbkBxdIOvntfAqiIr9SCwj+ WKG6jERcOGQBEs1iywTgrl9hfg== X-Received: by 2002:a17:90a:b781:: with SMTP id m1mr14092341pjr.141.1566834106841; Mon, 26 Aug 2019 08:41:46 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id v189sm12729023pfv.176.2019.08.26.08.41.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Aug 2019 08:41:44 -0700 (PDT) Subject: Re: [PATCH 2/7] firmware: add offset to request_firmware_into_buf To: Takashi Iwai Cc: Luis Chamberlain , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , linux-kselftest@vger.kernel.org References: <20190822192451.5983-1-scott.branden@broadcom.com> <20190822192451.5983-3-scott.branden@broadcom.com> <10461fcf-9eca-32b6-0f9d-23c63b3f3442@broadcom.com> From: Scott Branden Message-ID: <93b8285a-e5eb-d4a4-545d-426bbbeb8008@broadcom.com> Date: Mon, 26 Aug 2019 08:41:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org HI Takashi, On 2019-08-26 8:20 a.m., Takashi Iwai wrote: > On Fri, 23 Aug 2019 21:44:42 +0200, > Scott Branden wrote: >> Hi Takashi, >> >> Thanks for review.  comments below. >> >> On 2019-08-23 3:05 a.m., Takashi Iwai wrote: >>> On Thu, 22 Aug 2019 21:24:46 +0200, >>> Scott Branden wrote: >>>> Add offset to request_firmware_into_buf to allow for portions >>>> of firmware file to be read into a buffer. Necessary where firmware >>>> needs to be loaded in portions from file in memory constrained systems. >>> AFAIU, this won't work with the fallback user helper, right? >> Seems to work fine in the fw_run_tests.sh with fallbacks. > But how? You patch doesn't change anything about the fallback loading > mechanism. Correct - I didn't change any of the underlying mechanisms, so however request_firmware_into_buf worked before it still does. > Or, if the expected behavior is to load the whole content > and then copy a part, what's the merit of this API? The merit of the API is that the entire file is not copied into a buffer. In my use case, the buffer is a memory region in PCIe space that isn't even large enough for the whole file.  So the only way to get the file is to read it in portions. > >>> Also it won't work for the compressed firmware files as-is. >> Although unnecessary, seems to work fine in the fw_run_tests.sh with >> "both" and "xzonly" options. > This looks also suspicious. Loading a part of the file from the > middle and decompression won't work together, from obvious reasons. I don't know what the underlying mechanisms are doing right now. If they decompress the whole file then that is why it's working. An obvious improvement that could be made later is to only read a portion of the file before writing it into the buffer in the non-xz case. > > If the test passes, it means that the test itself is more likely > incorrect, I'm afraid. Then all of the tests for "both" and "xzonly" could be broken. > > > thanks, > > Takashi Regards,  Scott