Received: by 10.213.65.68 with SMTP id h4csp629159imn; Fri, 6 Apr 2018 06:26:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4879WdQpHPCKaEUbplEn6yvn1zZoe7QKQcszj1DasBb7vdpgbedrlbICz87+Lv172kcQbkz X-Received: by 10.98.157.6 with SMTP id i6mr20674727pfd.52.1523021162709; Fri, 06 Apr 2018 06:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523021162; cv=none; d=google.com; s=arc-20160816; b=pnI6ugfaLiGj/LvhcTR38Fy5+2TbB/Ga9VYtnnYzKCq7iMzHgxh67pIOlA22j40jau aTgzdSLfwY6/0l0QrMhKWmuOwOs+6oLK2S7sN8fTZte2JaAFMzuSS3m9+0T05ims76w2 sVSHbgvtjO/ZrsqYevGXji/X7a3Evob/YvZy+S/sFX9TVlw1tbn6tOViUCJgbqhwV7eL jVm/vr0P8YQw/flxHB2Tuv9BQi06TES7UZxE87XV2pteJeEc3oJCIEhIgTjVEE8KoFby Ldwnc7Ts+0n2j5seTxYAlbzNGtxeaHbgDU427Hvp+E/v4Bev4BJtD/t6iU05+XnVYL+Z b3Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date :arc-authentication-results; bh=BBoQQuBE3mwUxf32RWgLldn6mMr41+8wXsoFT6sTdKo=; b=c6AeVTT7GCY7ZbzjEEWNO/v+/xOaO8GIyzGDc+duCWR5tbIKdpOt5ShKDfyYmxVLjF CiJh6Goh6PXq0P8VTyTEB/I56YeegbvSdBUgpwfMN8WKB3LphSLx+aKZGbmXEdB30BOt GIHCgAsZFBIiUp9p7AsqMZ+WOSSzcs50dwUCGT2Z+EBtc9pFY9kwyeKrtetxuuh9L8QQ U9jBdxKt1ARAS8hRpgivj0XdXDM0NJDWeHmB8l3YAzX14OPOuSiUlDzPHN0G5yZR/7r1 aRjHkpump+bKL6BUOsLKKKOt6u4Pqt57/X5ZI+LDA9y3zz/0438iRIQqoYLy0gQP+JTj CI7g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n76si2879980pfi.122.2018.04.06.06.25.48; Fri, 06 Apr 2018 06:26:02 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101AbeDFNXd (ORCPT + 99 others); Fri, 6 Apr 2018 09:23:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:58182 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752848AbeDFNXc (ORCPT ); Fri, 6 Apr 2018 09:23:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CD06CAEBC; Fri, 6 Apr 2018 13:23:30 +0000 (UTC) Date: Fri, 06 Apr 2018 15:23:30 +0200 Message-ID: From: Takashi Iwai To: Stuart Hayes Cc: linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH v4] dell_rbu: make firmware payload memory uncachable In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 06 Apr 2018 15:12:21 +0200, Stuart Hayes wrote: > > 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 Looks good to me. Reviewed-by: Takashi Iwai Andrew, could you pick this one? The driver seems to have no maintainer. thanks, Takashi > --- > v2 Added include, removed extra parentheses > v3 Corrected formatting and include line > v4 Moved set_memory_uc() outside the while loop so that the memory is > definitely allocated before it is set to uncachable > > This driver has no maintainer. > > > diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c > index 2f452f1f7c8a..53f27a6e2d76 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); >