From patchwork Tue Jun 7 16:47:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9162017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6878960467 for ; Tue, 7 Jun 2016 16:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5632D27248 for ; Tue, 7 Jun 2016 16:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AFD62824F; Tue, 7 Jun 2016 16:50:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD3FF27248 for ; Tue, 7 Jun 2016 16:50:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAKBA-000260-DN; Tue, 07 Jun 2016 16:48:36 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAKAu-0001vD-6h for linux-arm-kernel@lists.infradead.org; Tue, 07 Jun 2016 16:48:21 +0000 Received: by mail-pa0-x22d.google.com with SMTP id ec8so41683737pac.0 for ; Tue, 07 Jun 2016 09:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yCXeYOPm4QxxnpD8EtTACjCxJG5lA2pdhRygJDR2J8g=; b=A1z4O1uurSK+G6AGPOEjdPw6U7F1B1l6yZzVQrk+tt2RhzRSmul/I6/8VjCi0yBZbn XrTKOUrFVk1MVuVcgVAoy3Q+KZjP7UwI7EsPwUT5S+Z1SaFyPb+HLXw8eZvYlGLJHNCV 6li43B3UhVTQdBnPPMEPu0hvqybdttefaszZE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yCXeYOPm4QxxnpD8EtTACjCxJG5lA2pdhRygJDR2J8g=; b=aA/iSUiodwIjtF6VbfKA3wsjUvKs1HKloimUkU2sG7Sf0Gs7OCcEhCiLTustu1DZsk qDvry2Gfroxd0s5P6VQXZ/+oFyFX7QM/pSQ2mrUXBFt63cWxeYvfYC0IgQhLa9R2ym0a 7ww4GbQBuMcwehdc1HkicF4gcedcvuXJcRRMtjmDcvuQmEuq4oCf4zc7EBxslj5cP94m Zj2s8XTlwhLM3mttx8RSJCR6pfO8iKXlzLDNomL2vsBt+t+4a47So4D4dL6l+JncTJnc usLm6NbmEwwSlobxDAeMQ6A+oYLydLwWb/swPPTcJtdJyOALJAU/tm0IuOVegEBg5KKg Sgrw== X-Gm-Message-State: ALyK8tJwEZivWG4rUir8Zz55SuxKURXnL/dyHWtjmHKWsRDWV6WbOQIn5HlyaII1MQu2gskR X-Received: by 10.66.245.111 with SMTP id xn15mr390495pac.76.1465318079647; Tue, 07 Jun 2016 09:47:59 -0700 (PDT) Received: from localhost.localdomain (ip68-101-172-78.sd.sd.cox.net. [68.101.172.78]) by smtp.gmail.com with ESMTPSA id fd8sm34342567pac.23.2016.06.07.09.47.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jun 2016 09:47:59 -0700 (PDT) From: Stephen Boyd To: linux-kernel@vger.kernel.org Subject: [RESEND/PATCHv4 v4 2/3] firmware: Provide infrastructure to make fw caching optional Date: Tue, 7 Jun 2016 09:47:40 -0700 Message-Id: <20160607164741.31849-3-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0-rc1 In-Reply-To: <20160607164741.31849-1-stephen.boyd@linaro.org> References: <20160607164741.31849-1-stephen.boyd@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160607_094820_413140_6C7521CE X-CRM114-Status: GOOD ( 12.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ming Lei , Vikram Mulukutla , Mark Brown , Andrew Morton , Mimi Zohar , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vikram Mulukutla Some low memory systems with complex peripherals cannot afford to have the relatively large firmware images taking up valuable memory during suspend and resume. Change the internal implementation of firmware_class to disallow caching based on a configurable option. In the near future, variants of request_firmware will take advantage of this feature. Signed-off-by: Vikram Mulukutla [stephen.boyd@linaro.org: Drop firmware_desc design and use flags] Signed-off-by: Stephen Boyd --- drivers/base/firmware_class.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 01d55723d82c..45ed20cefa10 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -112,6 +112,7 @@ static inline long firmware_loading_timeout(void) #define FW_OPT_FALLBACK 0 #endif #define FW_OPT_NO_WARN (1U << 3) +#define FW_OPT_NOCACHE (1U << 4) struct firmware_cache { /* firmware_buf instance will be added into the below list */ @@ -1065,14 +1066,16 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device, * should be fixed in devres or driver core. */ /* don't cache firmware handled without uevent */ - if (device && (opt_flags & FW_OPT_UEVENT)) + if (device && (opt_flags & FW_OPT_UEVENT) && + !(opt_flags & FW_OPT_NOCACHE)) fw_add_devm_name(device, buf->fw_id); /* * After caching firmware image is started, let it piggyback * on request firmware. */ - if (buf->fwc->state == FW_LOADER_START_CACHE) { + if (!(opt_flags & FW_OPT_NOCACHE) && + buf->fwc->state == FW_LOADER_START_CACHE) { if (fw_cache_piggyback_on_request(buf->fw_id)) kref_get(&buf->ref); }