Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72154C432C3 for ; Tue, 19 Nov 2019 05:55:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A49D21783 for ; Tue, 19 Nov 2019 05:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142930; bh=ZymKRHFBH5fnM7kbEWRV6nZyVFEMsP3Qo4tBlcJZExc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EqPu1FN4mhBZXk8OU7/nq4GFPqmRi+utQYhdBhtP9Xzv7oiV+EJxdE8BsMWYJugs5 3t03VhNfcoD+7p++04rYC/W7PZ/mcogCB37G+80BbnYz4vRwV3w/suBMceUyRFGsAM NjyiSwRTe6OCK0ewl0WmBTjF5HUBT5U1U1DPw2C0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731399AbfKSFz2 (ORCPT ); Tue, 19 Nov 2019 00:55:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:53788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732269AbfKSFzX (ORCPT ); Tue, 19 Nov 2019 00:55:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD567218BA; Tue, 19 Nov 2019 05:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142922; bh=ZymKRHFBH5fnM7kbEWRV6nZyVFEMsP3Qo4tBlcJZExc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x36QMxqN8OzUZ8oSYHmdczUjudFnfOrhrGNNYcsh6pKzl56onyei5WSAJw/CixRiA VbH/bsZaugFnvsEYUzVyrs0IGHNFPE2NGDKcJ1vLsWu0QUHyS/A96D1aVouYgZo6aY SokNOhjqf6bT2cbrbVx4C35MI5rGji6bR5NBMvRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stuart Hayes , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.14 211/239] firmware: dell_rbu: Make payload memory uncachable Date: Tue, 19 Nov 2019 06:20:11 +0100 Message-Id: <20191119051338.369304742@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stuart Hayes [ Upstream commit 6aecee6ad41cf97c0270f72da032c10eef025bf0 ] The dell_rbu driver takes firmware update payloads and puts them in memory so the system BIOS can find them after a reboot. This sometimes fails (though rarely), because the memory containing the payload is in the CPU cache but never gets written back to main memory before the system is rebooted (CPU cache contents are lost on reboot). With this patch, the payload memory will be changed to uncachable to ensure that the payload is actually in main memory before the system is rebooted. Signed-off-by: Stuart Hayes Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/firmware/dell_rbu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index 2f452f1f7c8a0..53f27a6e2d761 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c @@ -45,6 +45,7 @@ #include #include #include +#include MODULE_AUTHOR("Abhay Salunke "); MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems"); @@ -181,6 +182,11 @@ static int create_packet(void *data, size_t length) packet_data_temp_buf = NULL; } } + /* + * set to uncachable or it may never get written back before reboot + */ + set_memory_uc((unsigned long)packet_data_temp_buf, 1 << ordernum); + spin_lock(&rbu_data.lock); newpacket->data = packet_data_temp_buf; @@ -349,6 +355,8 @@ static void packet_empty_list(void) * to make sure there are no stale RBU packets left in memory */ memset(newpacket->data, 0, rbu_data.packetsize); + set_memory_wb((unsigned long)newpacket->data, + 1 << newpacket->ordernum); free_pages((unsigned long) newpacket->data, newpacket->ordernum); kfree(newpacket); -- 2.20.1