From patchwork Mon Feb 1 22:07:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 60973 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp350903lbb; Mon, 1 Feb 2016 14:09:05 -0800 (PST) X-Received: by 10.66.192.98 with SMTP id hf2mr42429939pac.116.1454364545129; Mon, 01 Feb 2016 14:09:05 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si40728597pfd.42.2016.02.01.14.09.04; Mon, 01 Feb 2016 14:09:05 -0800 (PST) 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; dkim=pass header.i=@codeblueprint-co-uk.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932781AbcBAWH3 (ORCPT + 30 others); Mon, 1 Feb 2016 17:07:29 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37283 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932665AbcBAWHX (ORCPT ); Mon, 1 Feb 2016 17:07:23 -0500 Received: by mail-wm0-f43.google.com with SMTP id l66so92388143wml.0 for ; Mon, 01 Feb 2016 14:07:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeblueprint-co-uk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YlPMEQkMgYH0cupuNp9uzS4MmO+slpwInZ/Kygyllds=; b=dbdrX8TD+eu/xS+vPMTz6Tyh5XFIVWNwMIXBvf4GFwdbPwCmB00DMIpAE1njuyByeE A7irARvrmbP0NteTFWpYKCPGceQmPoDyGOLcYsJ8IelBRRSkzCamMugz5dkpTvVs7xgH 0eRZ/5DLHlzC8QUhWDu3DvcJW4ZfB9tsx4tdut3a04wVB0we5+aTdrJiyMQpsUmyTZs/ 9nSxx1kMxd9zsX1SJ0L/cIZFgUgGZhYKFFUgxgECtq7ILGRMU0gS/t8RuzM0wslkf8/F qc4dpGUGkcdXI2KzFe9lnWgeCIO8qHBh7GfHtwyN4RZTFg1vTbXW5RUFBKrO7D3pumrg habw== 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=YlPMEQkMgYH0cupuNp9uzS4MmO+slpwInZ/Kygyllds=; b=V6dtfviRZIJBfaUrTosB1uHm1awIyvBJQG2w+O3zzlUnbG2yg7ev0GEjX/fs8NAoN4 qAoLeUTRFnJLCE73JLBR9v5B1VK5WamStNy262ObsvI1rfEUJLLbY43qUcwNHdGvu1du W706gJxGzQyFO/XLdQuStRn/pfWPEZbnvMXBgLpTX8pC+IOhh2LPimQ+OXz7bw/NtDLF zB6Ed8wcIvT6CLaRW6LtPbp73ioUwaLfInxJYZws6x3fzK3M7vU74tCim+1ac35gg7Fy X1nw7cfU8nBQ2Py6tlt0KG7Os9ihRfO6ZGGFFh3BZMxuU2EJxVLqO85+13cmJmSHPg/Y QrYA== X-Gm-Message-State: AG10YOR52JrEkl+wvJ6npVSp3vu4JrNuiX83/g2dBUTWwj3aOUqRLaj6+OE+KNf+gdubzg== X-Received: by 10.194.80.200 with SMTP id t8mr24603231wjx.74.1454364442069; Mon, 01 Feb 2016 14:07:22 -0800 (PST) Received: from localhost (5ec16434.skybroadband.com. [94.193.100.52]) by smtp.gmail.com with ESMTPSA id lh1sm30905020wjb.20.2016.02.01.14.07.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Feb 2016 14:07:21 -0800 (PST) From: Matt Fleming To: Ingo Molnar , "H . Peter Anvin" , Thomas Gleixner Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Ard Biesheuvel , Matt Fleming Subject: [PATCH 06/14] efi: runtime-wrapper: Get rid of the rtc_lock spinlock Date: Mon, 1 Feb 2016 22:07:00 +0000 Message-Id: <1454364428-494-7-git-send-email-matt@codeblueprint.co.uk> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1454364428-494-1-git-send-email-matt@codeblueprint.co.uk> References: <1454364428-494-1-git-send-email-matt@codeblueprint.co.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel The rtc_lock spinlock aims to serialize access to the CMOS RTC between the UEFI firmware and the kernel drivers that use it directly. However, x86 is the only arch that performs such direct accesses, and that never uses the time related UEFI runtime services. Since no other UEFI enlightened architectures have a legcay CMOS RTC anyway, we can remove the rtc_lock spinlock entirely. Signed-off-by: Ard Biesheuvel Signed-off-by: Matt Fleming --- drivers/firmware/efi/runtime-wrappers.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) -- 2.6.2 diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index 311f415bff51..7b8b2f2702ca 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -61,24 +61,14 @@ */ static DEFINE_SPINLOCK(efi_runtime_lock); -/* - * As per commit ef68c8f87ed1 ("x86: Serialize EFI time accesses on rtc_lock"), - * the EFI specification requires that callers of the time related runtime - * functions serialize with other CMOS accesses in the kernel, as the EFI time - * functions may choose to also use the legacy CMOS RTC. - */ -__weak DEFINE_SPINLOCK(rtc_lock); - static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) { unsigned long flags; efi_status_t status; - spin_lock_irqsave(&rtc_lock, flags); - spin_lock(&efi_runtime_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); status = efi_call_virt(get_time, tm, tc); - spin_unlock(&efi_runtime_lock); - spin_unlock_irqrestore(&rtc_lock, flags); + spin_unlock_irqrestore(&efi_runtime_lock, flags); return status; } @@ -87,11 +77,9 @@ static efi_status_t virt_efi_set_time(efi_time_t *tm) unsigned long flags; efi_status_t status; - spin_lock_irqsave(&rtc_lock, flags); - spin_lock(&efi_runtime_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); status = efi_call_virt(set_time, tm); - spin_unlock(&efi_runtime_lock); - spin_unlock_irqrestore(&rtc_lock, flags); + spin_unlock_irqrestore(&efi_runtime_lock, flags); return status; } @@ -102,11 +90,9 @@ static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled, unsigned long flags; efi_status_t status; - spin_lock_irqsave(&rtc_lock, flags); - spin_lock(&efi_runtime_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); status = efi_call_virt(get_wakeup_time, enabled, pending, tm); - spin_unlock(&efi_runtime_lock); - spin_unlock_irqrestore(&rtc_lock, flags); + spin_unlock_irqrestore(&efi_runtime_lock, flags); return status; } @@ -115,11 +101,9 @@ static efi_status_t virt_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) unsigned long flags; efi_status_t status; - spin_lock_irqsave(&rtc_lock, flags); - spin_lock(&efi_runtime_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); status = efi_call_virt(set_wakeup_time, enabled, tm); - spin_unlock(&efi_runtime_lock); - spin_unlock_irqrestore(&rtc_lock, flags); + spin_unlock_irqrestore(&efi_runtime_lock, flags); return status; }