From patchwork Wed Sep 26 21:50:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stuart hayes X-Patchwork-Id: 10616925 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67758175A for ; Wed, 26 Sep 2018 21:51:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 574A82B8AE for ; Wed, 26 Sep 2018 21:51:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48A9B2B8B5; Wed, 26 Sep 2018 21:51:14 +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=-6.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E173A2B851 for ; Wed, 26 Sep 2018 21:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726076AbeI0EFi (ORCPT ); Thu, 27 Sep 2018 00:05:38 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:38681 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725722AbeI0EFh (ORCPT ); Thu, 27 Sep 2018 00:05:37 -0400 Received: by mail-oi1-f193.google.com with SMTP id u197-v6so450916oif.5; Wed, 26 Sep 2018 14:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ed58DK0mq/CUN9d7m32fybQoY77oD7EopNvBZHOohQ4=; b=ABba2hD+zc/82Pi5dsdiP13p6acwCbl/L187+mbGVE0Ed3f8Wp+Ee/5Aa2YzL/xYnm 42LHSQV7d7anAki2l/R+7sxVc31mTaNGeczxi9CVCVRrQU/lXMEEiBY/GunoYmO2Zvv0 b103leJHXWh4qypJHEsO3v5DI3EljGe9M9YNYWBJFeECChhGu+z/SNPcHrjDnXO9msxC r5bt8nWPM9YGSB1Y5xEGlzaU3zDWa9EZSPnTGxH12dXIf/4vLJXho/+R2sNdlqFKofJI SE05ZhWinyynBvJRHkh1Xoz8oOdaR4PKfM3T3tKUE2EP9RXzxWysqjxHUFFJF0R4L6iz AUAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ed58DK0mq/CUN9d7m32fybQoY77oD7EopNvBZHOohQ4=; b=HcdGnMoJ15mrXIbf5EZk3dKBmeInrGCHYbYqkIerBJ2Fdzjou9ikjatmgIGQnTFK2C +sit5IVkv49WYpVRoPCzfykhgGSkVWcB+4YcvPC2iT77TfXzaT2Wlckohj9vLz8JE3eR CPCasA7M6nea89DSQTa1F1mfKgiiEJbRCDTX3OIO6QVcZWPj4s3lRfL/bc4/Ya+JlGNh NPv5GXJgMaSMu2luIdJKPjyoRmRICJiupRhAMwZaQzJFNfeays2yLwTH2ufpGKrOJmao klelkw/eFvyjbhjAHuqDU0nIm4wo5ktaVm5lS9SQo1alvTl0wgXKJ30P7NB1aDsN4AU3 DQmw== X-Gm-Message-State: ABuFfogAVoeWGeJLKvRBnf1B078scYXkhdk2G+IfjxfDfDxLSF0QU/L5 +mYDMwwd44oG/kDwuUiuepI= X-Google-Smtp-Source: ACcGV62gOBpcnQUjm+vIyswAu33T4lndsVJpOKuSu1GpDEaNw2CwKkBJEAEnUHMGBokB35Lenk0q7Q== X-Received: by 2002:aca:a5b:: with SMTP id 88-v6mr1869650oik.324.1537998637064; Wed, 26 Sep 2018 14:50:37 -0700 (PDT) Received: from localhost.localdomain ([143.166.81.254]) by smtp.gmail.com with ESMTPSA id b124-v6sm95121oii.14.2018.09.26.14.50.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 14:50:36 -0700 (PDT) From: Stuart Hayes To: dvhart@infradead.org, Andy Shevchenko Cc: Mario Limonciello , LKML , platform-driver-x86@vger.kernel.org, Doug Warzecha , Stuart Hayes Subject: [PATCH v2 1/5] firmware: dell_rbu: Make payload memory uncachable Date: Wed, 26 Sep 2018 16:50:17 -0500 Message-Id: <20180926215021.30471-2-stuart.w.hayes@gmail.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180926215021.30471-1-stuart.w.hayes@gmail.com> References: <20180926215021.30471-1-stuart.w.hayes@gmail.com> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- This patch has been discussed previously, see history at https://patchwork.kernel.org/patch/10512079/ 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 fb8af5cb7c9b..ccefa84f7305 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);