From patchwork Fri Jul 20 01:47:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 142397 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2391975ljj; Thu, 19 Jul 2018 18:47:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcQei4DVGy8ie8qzzWCDZ9G4XZdSFoONG46HyF2SzMvh6VSDNb0+gKecbMBZafuTsG91a/5 X-Received: by 2002:aa7:800f:: with SMTP id j15-v6mr118181pfi.174.1532051272555; Thu, 19 Jul 2018 18:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532051272; cv=none; d=google.com; s=arc-20160816; b=fbEHrCzeYSDyj04A/LRfi+LD/hmcGvpOCca1N3nPcAc5Ay9c3ZPsOOsk6IAyecJddy yr9u0XklHmcRW3wPN5tyhM15cn5JdpwQbMjqwnb0fDwAQ4LtcpkulujiaoMLPtGrJSrj euw6Q02erJTNnpEHil9hN0CqXnHVFFFIpVYZs/GjZynegzq8R38ede4VSbLrvYXKdTNZ p86t7Wl+Dcq+x2kC+LsXNMaNbNSMuVidV55+on5+IvXPqAjKGjArqX6gSIBWCWCvHW9Y lTaPfEBHv8lXEvHxZwqmPvHRRhQM5dXFfpH+roWLqa5ksXE+hGUziOKs9cZtEQx3dfP7 8BYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=8JrQmTJ2XjUwha1Q2uMPkyDL/BcsqKEhQ4YkdIRF1ds=; b=YAzVzkzJjQ1yJucu67bpEkP5ev6D/9sg5Es+RLNozAerpsN8u5MPCyGx10hdIavqRL 0NDxQuyC3NEsrC2e14cTq7cZez8Yucb161vAPcF8mTDsCPjdpqx3GMAV/k54f0EtHMim W6yF9GB4Yb8F5fgCObXJXxyRjymgvlXwPpZP8F1p1hcFe1tiQhbnivnmG//8Z18ZkInx rc3o+COsM2hxYItJRJgkqdPqJIunyurHZiICpUNETuWcyKH3lK4+rf1rVSQAgrfF9rzV elz08iOXB5qXZ9/eXBxFnE6UNkqQag9fYoDhVRPcAy+r2K/UX44Vf7tBCv30JjbqELP6 cXIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fU6OScGz; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z37-v6si657035pgl.390.2018.07.19.18.47.52; Thu, 19 Jul 2018 18:47:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fU6OScGz; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730982AbeGTCdl (ORCPT + 3 others); Thu, 19 Jul 2018 22:33:41 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45220 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730966AbeGTCdk (ORCPT ); Thu, 19 Jul 2018 22:33:40 -0400 Received: by mail-pg1-f195.google.com with SMTP id f1-v6so5354071pgq.12 for ; Thu, 19 Jul 2018 18:47:50 -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=VCxcDyoNvlUcvuTSjmiiZjG/8edg36zCnHJtENpLPBA=; b=fU6OScGz91asZgqmPcQ+EE8S9L2/RUvjxDv4x+MHOSBtQiGemCHooQ2fOKASeRT8/h amrEZwDOWJ5CNryd+1rIdDQtYhffwV8zPfETIjSce1XuvglsbAwB+sP1yG9bYCBwmRHp tWe+hyIi9VJQKCaqCs4VyMxLE1QTATxozVooQ= 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; bh=VCxcDyoNvlUcvuTSjmiiZjG/8edg36zCnHJtENpLPBA=; b=qmckVbAt9YxFKcM8mpA7vKGMGUxx3CXPY+LsrWVX9mkZBqwJ1OVsnbU0sRLfeXCumh 6qElOW6b+DYbUFhXSmddrnC5L4byAqEUueuk+L6t4slSr6hkNClLc2EjVT0CQRZZvbKX Sg29jga66vvFzSktwd7qgJvmxUa1L6AE42GnMzdbZONTiIOiu7NJd4GazZnqbA+Btj2C Na1wbS0AAP/BxOYD2RWEHuQWlJ2SN8THydtBiM6u8vgaAH3Fmb89AW6pBKo5ZE0KnvH/ lOKpvqF9oOFm63IR9x6V0+SSvjm64k5Gy5pWFutPTXLwN3DmjuoP+cEMIUYKbffQpOVo KXcg== X-Gm-Message-State: AOUpUlHm/go8Eawwdjf7TpOicT8+r+huUoLSlcTooIaAYrVq4kq0wxH2 ut46Bc9yqV+nyPJ7P2df+kl2F5/RmC8= X-Received: by 2002:a63:be4a:: with SMTP id g10-v6mr100066pgo.378.1532051269595; Thu, 19 Jul 2018 18:47:49 -0700 (PDT) Received: from localhost.localdomain (fs76eedbeb.tkyc508.ap.nuro.jp. [118.238.219.235]) by smtp.gmail.com with ESMTPSA id 203-v6sm475868pgb.14.2018.07.19.18.47.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 18:47:48 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Shevchenko , Hans de Goede , Lukas Wunner Subject: [PATCH 1/9] efi/x86: prevent reentrant firmware calls in mixed mode Date: Fri, 20 Jul 2018 10:47:18 +0900 Message-Id: <20180720014726.24031-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720014726.24031-1-ard.biesheuvel@linaro.org> References: <20180720014726.24031-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The UEFI spec does not permit runtime services to be called reentrantly, and so it is up to the OS to provide proper locking around such calls. For the native case, this was fixed a long time ago, but for the mixed mode case, no locking is done whatsoever. Note that the calls are made with preemption and interrupts disabled, so only SMP configurations are affected by this issue. So add a spinlock and grab it when invoking a UEFI runtime service in mixed mode. We will also need to provide non-blocking versions of SetVariable() and QueryVariableInfo(), so add those as well. Tested-by: Hans de Goede Signed-off-by: Ard Biesheuvel --- arch/x86/platform/efi/efi_64.c | 101 ++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 3 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 77873ce700ae..448267f1c073 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -636,6 +636,8 @@ void efi_switch_mm(struct mm_struct *mm) #ifdef CONFIG_EFI_MIXED extern efi_status_t efi64_thunk(u32, ...); +static DEFINE_SPINLOCK(efi_runtime_lock); + #define runtime_service32(func) \ ({ \ u32 table = (u32)(unsigned long)efi.systab; \ @@ -657,17 +659,14 @@ extern efi_status_t efi64_thunk(u32, ...); #define efi_thunk(f, ...) \ ({ \ efi_status_t __s; \ - unsigned long __flags; \ u32 __func; \ \ - local_irq_save(__flags); \ arch_efi_call_virt_setup(); \ \ __func = runtime_service32(f); \ __s = efi64_thunk(__func, __VA_ARGS__); \ \ arch_efi_call_virt_teardown(); \ - local_irq_restore(__flags); \ \ __s; \ }) @@ -702,14 +701,17 @@ static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc) { efi_status_t status; u32 phys_tm, phys_tc; + unsigned long flags; spin_lock(&rtc_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); phys_tm = virt_to_phys_or_null(tm); phys_tc = virt_to_phys_or_null(tc); status = efi_thunk(get_time, phys_tm, phys_tc); + spin_unlock_irqrestore(&efi_runtime_lock, flags); spin_unlock(&rtc_lock); return status; @@ -719,13 +721,16 @@ static efi_status_t efi_thunk_set_time(efi_time_t *tm) { efi_status_t status; u32 phys_tm; + unsigned long flags; spin_lock(&rtc_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); phys_tm = virt_to_phys_or_null(tm); status = efi_thunk(set_time, phys_tm); + spin_unlock_irqrestore(&efi_runtime_lock, flags); spin_unlock(&rtc_lock); return status; @@ -737,8 +742,10 @@ efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, { efi_status_t status; u32 phys_enabled, phys_pending, phys_tm; + unsigned long flags; spin_lock(&rtc_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); phys_enabled = virt_to_phys_or_null(enabled); phys_pending = virt_to_phys_or_null(pending); @@ -747,6 +754,7 @@ efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, status = efi_thunk(get_wakeup_time, phys_enabled, phys_pending, phys_tm); + spin_unlock_irqrestore(&efi_runtime_lock, flags); spin_unlock(&rtc_lock); return status; @@ -757,13 +765,16 @@ efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) { efi_status_t status; u32 phys_tm; + unsigned long flags; spin_lock(&rtc_lock); + spin_lock_irqsave(&efi_runtime_lock, flags); phys_tm = virt_to_phys_or_null(tm); status = efi_thunk(set_wakeup_time, enabled, phys_tm); + spin_unlock_irqrestore(&efi_runtime_lock, flags); spin_unlock(&rtc_lock); return status; @@ -781,6 +792,9 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor, efi_status_t status; u32 phys_name, phys_vendor, phys_attr; u32 phys_data_size, phys_data; + unsigned long flags; + + spin_lock_irqsave(&efi_runtime_lock, flags); phys_data_size = virt_to_phys_or_null(data_size); phys_vendor = virt_to_phys_or_null(vendor); @@ -791,6 +805,8 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor, status = efi_thunk(get_variable, phys_name, phys_vendor, phys_attr, phys_data_size, phys_data); + spin_unlock_irqrestore(&efi_runtime_lock, flags); + return status; } @@ -800,6 +816,34 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor, { u32 phys_name, phys_vendor, phys_data; efi_status_t status; + unsigned long flags; + + spin_lock_irqsave(&efi_runtime_lock, flags); + + phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); + phys_vendor = virt_to_phys_or_null(vendor); + phys_data = virt_to_phys_or_null_size(data, data_size); + + /* If data_size is > sizeof(u32) we've got problems */ + status = efi_thunk(set_variable, phys_name, phys_vendor, + attr, data_size, phys_data); + + spin_unlock_irqrestore(&efi_runtime_lock, flags); + + return status; +} + +static efi_status_t +efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor, + u32 attr, unsigned long data_size, + void *data) +{ + u32 phys_name, phys_vendor, phys_data; + efi_status_t status; + unsigned long flags; + + if (!spin_trylock_irqsave(&efi_runtime_lock, flags)) + return EFI_NOT_READY; phys_name = virt_to_phys_or_null_size(name, efi_name_size(name)); phys_vendor = virt_to_phys_or_null(vendor); @@ -809,6 +853,8 @@ efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor, status = efi_thunk(set_variable, phys_name, phys_vendor, attr, data_size, phys_data); + spin_unlock_irqrestore(&efi_runtime_lock, flags); + return status; } @@ -819,6 +865,9 @@ efi_thunk_get_next_variable(unsigned long *name_size, { efi_status_t status; u32 phys_name_size, phys_name, phys_vendor; + unsigned long flags; + + spin_lock_irqsave(&efi_runtime_lock, flags); phys_name_size = virt_to_phys_or_null(name_size); phys_vendor = virt_to_phys_or_null(vendor); @@ -827,6 +876,8 @@ efi_thunk_get_next_variable(unsigned long *name_size, status = efi_thunk(get_next_variable, phys_name_size, phys_name, phys_vendor); + spin_unlock_irqrestore(&efi_runtime_lock, flags); + return status; } @@ -835,10 +886,15 @@ efi_thunk_get_next_high_mono_count(u32 *count) { efi_status_t status; u32 phys_count; + unsigned long flags; + + spin_lock_irqsave(&efi_runtime_lock, flags); phys_count = virt_to_phys_or_null(count); status = efi_thunk(get_next_high_mono_count, phys_count); + spin_unlock_irqrestore(&efi_runtime_lock, flags); + return status; } @@ -847,10 +903,15 @@ efi_thunk_reset_system(int reset_type, efi_status_t status, unsigned long data_size, efi_char16_t *data) { u32 phys_data; + unsigned long flags; + + spin_lock_irqsave(&efi_runtime_lock, flags); phys_data = virt_to_phys_or_null_size(data, data_size); efi_thunk(reset_system, reset_type, status, data_size, phys_data); + + spin_unlock_irqrestore(&efi_runtime_lock, flags); } static efi_status_t @@ -872,10 +933,13 @@ efi_thunk_query_variable_info(u32 attr, u64 *storage_space, { efi_status_t status; u32 phys_storage, phys_remaining, phys_max; + unsigned long flags; if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION) return EFI_UNSUPPORTED; + spin_lock_irqsave(&efi_runtime_lock, flags); + phys_storage = virt_to_phys_or_null(storage_space); phys_remaining = virt_to_phys_or_null(remaining_space); phys_max = virt_to_phys_or_null(max_variable_size); @@ -883,6 +947,35 @@ efi_thunk_query_variable_info(u32 attr, u64 *storage_space, status = efi_thunk(query_variable_info, attr, phys_storage, phys_remaining, phys_max); + spin_unlock_irqrestore(&efi_runtime_lock, flags); + + return status; +} + +static efi_status_t +efi_thunk_query_variable_info_nonblocking(u32 attr, u64 *storage_space, + u64 *remaining_space, + u64 *max_variable_size) +{ + efi_status_t status; + u32 phys_storage, phys_remaining, phys_max; + unsigned long flags; + + if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION) + return EFI_UNSUPPORTED; + + if (!spin_trylock_irqsave(&efi_runtime_lock, flags)) + return EFI_NOT_READY; + + phys_storage = virt_to_phys_or_null(storage_space); + phys_remaining = virt_to_phys_or_null(remaining_space); + phys_max = virt_to_phys_or_null(max_variable_size); + + status = efi_thunk(query_variable_info, attr, phys_storage, + phys_remaining, phys_max); + + spin_unlock_irqrestore(&efi_runtime_lock, flags); + return status; } @@ -908,9 +1001,11 @@ void efi_thunk_runtime_setup(void) efi.get_variable = efi_thunk_get_variable; efi.get_next_variable = efi_thunk_get_next_variable; efi.set_variable = efi_thunk_set_variable; + efi.set_variable_nonblocking = efi_thunk_set_variable_nonblocking; efi.get_next_high_mono_count = efi_thunk_get_next_high_mono_count; efi.reset_system = efi_thunk_reset_system; efi.query_variable_info = efi_thunk_query_variable_info; + efi.query_variable_info_nonblocking = efi_thunk_query_variable_info_nonblocking; efi.update_capsule = efi_thunk_update_capsule; efi.query_capsule_caps = efi_thunk_query_capsule_caps; } From patchwork Fri Jul 20 01:47:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 142399 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2392037ljj; Thu, 19 Jul 2018 18:47:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd5mZMmRvywCcYuI+GjCIbXJaAuL/CWixlW4m5lFGGlFkleOv1d0mmyGn0ExBenBG0bP+3f X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr132323pll.66.1532051277918; Thu, 19 Jul 2018 18:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532051277; cv=none; d=google.com; s=arc-20160816; b=KUHEacuGh1hWhnWiQvNxly8G/KdGKIpJPzS6naAXqs5OX8LadlSiEhaHvXEROTmzOD s4zztjo4YLKK1/r9T+GJQ0J5yo6lLYh3nxWw9KsENhtMYtEvSOM0C0F1CqbSExsDVZ3c WFCb2eqdAsUFBwDyDseWOO6R4nWpOQPGLns2U08BgG6jwH7g/gZh7CQtgb9pvk1+KyyS 1FixEckq+bRp7ToHeKEmoitVmSktb8KHDgl6HgwYmfVejtvDcd4nKIZ6zD/QHKBE4jbs fSaHicFauq2tnWtRwhf7liTiOb64EtOFYkmYIeawessB7COwWg1rMvXOtguDPWkLbOMr cqxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=R8FjDx/5/AYorqRHRnJLtJOBe70TB1GfwZzlNyciYuw=; b=o2JWLu2ErQl6V84DkHlu5NCa9cahTirJwI1M1gY2prgUmGVR6lywnRpmiIWwLoEeGM XMggg3/s9fGHZnZeB1cueAHnWMZJcIRcP/gybTBo/EzTGIRHfn5lCAaVkTVyZTulkhvY YmI9faHusfnL2avb94bJugpNc5FPxCMa5tRhHyFC43AbmgsyntTZUC2mz7WvwbEBnlSr jYOhGoIQw4QxpwQFN05YefHK2q5/JBeyjP7Qyp0XmUhNFqvLRja+ANPUZ6JfQRgYXgp2 /k3hIeNbmGHuSgCGokAwlcdfEkcKcKroq3RorPbPg0Xe2TlJii9bur4e8WDMOMtIkh/S xIzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HnLFsnyv; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17-v6si656419pfj.104.2018.07.19.18.47.57; Thu, 19 Jul 2018 18:47:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HnLFsnyv; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731209AbeGTCdq (ORCPT + 3 others); Thu, 19 Jul 2018 22:33:46 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36652 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731147AbeGTCdp (ORCPT ); Thu, 19 Jul 2018 22:33:45 -0400 Received: by mail-pg1-f196.google.com with SMTP id s7-v6so1931834pgv.3 for ; Thu, 19 Jul 2018 18:47:55 -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=W3c4yJISsZ8njlrY27mOkZhrtgEwHQwsD2YRlK07pNU=; b=HnLFsnyvmq5bavtChtfoZG4xE36AR7SILCwwrOp2cvK4w0jROFyuOqe47PW4V2B3xm ZaMskY0oT0cuHVoypgl6eOgJR+IsXocd1P5gsd+Burz1y2JH6t/natdGZmS/wXNO5Tp5 g2PLVKhSPpAM1jbdgdtDQy4Jj9Ryl/r2VLUN4= 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; bh=W3c4yJISsZ8njlrY27mOkZhrtgEwHQwsD2YRlK07pNU=; b=pcWG7LPu3YmkohkVXQEKumMEdXW9HPD1BFRyKKbrl0+iki2jHGhMSIz9P3TLzXMStj ogJTdtME1EV3QlNRnuFYpW2ULxKHp9Qk7S2jU6t00rxlPvCFfLo4lh8zck2EHgIoS/Ni W2OeHC75CdZSX7T1sVhKS8sN5L60+CMlzUkKrzyldBB/2IaOnfBx8Krylimsdlzpzboe VBBNWsfrR1w+jPS2EOgTaxD+gXLUrCBWeNoOvFoZPsVBObIlyfdX/5C32gHK67u5dnOk AxOLVo+kVjF5y7kCIpuPKY2iWlla99GYjJnvjg+51A7Rl+EgrJUt6PZKbk2gW93qMsl5 18MA== X-Gm-Message-State: AOUpUlEWFMxqK2ZPFtyak0x2D8oVu6K2cyGLcEnWnvW+55pwxg1FlL42 b0NiyRzaJPvj6Qzf03vWcMOLAXQtxRI= X-Received: by 2002:a63:1c5f:: with SMTP id c31-v6mr73888pgm.321.1532051274708; Thu, 19 Jul 2018 18:47:54 -0700 (PDT) Received: from localhost.localdomain (fs76eedbeb.tkyc508.ap.nuro.jp. [118.238.219.235]) by smtp.gmail.com with ESMTPSA id 203-v6sm475868pgb.14.2018.07.19.18.47.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 18:47:54 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Shevchenko , Hans de Goede , Lukas Wunner Subject: [PATCH 3/9] efi/x86: align efi_uga_draw_protocol typedef names to convention Date: Fri, 20 Jul 2018 10:47:20 +0900 Message-Id: <20180720014726.24031-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720014726.24031-1-ard.biesheuvel@linaro.org> References: <20180720014726.24031-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The linux-efi subsystem uses typedefs with the _t suffix to declare data structures that originate in the UEFI spec. Our type mangling for mixed mode depends on this convention, so rename the UGA drawing protocols to allow efi_call_proto() to be used with them in a subsequent patch. Tested-by: Hans de Goede Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/eboot.c | 4 ++-- arch/x86/boot/compressed/eboot.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index c72550783c16..011d5c289449 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -321,7 +321,7 @@ static void setup_quirks(struct boot_params *boot_params) static efi_status_t setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height) { - struct efi_uga_draw_protocol *uga = NULL, *first_uga; + efi_uga_draw_protocol_t *uga = NULL, *first_uga; efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID; unsigned long nr_ugas; u32 *handles = (u32 *)uga_handle; @@ -366,7 +366,7 @@ setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height) static efi_status_t setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height) { - struct efi_uga_draw_protocol *uga = NULL, *first_uga; + efi_uga_draw_protocol_t *uga = NULL, *first_uga; efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID; unsigned long nr_ugas; u64 *handles = (u64 *)uga_handle; diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h index e799dc5c6448..8297387c4676 100644 --- a/arch/x86/boot/compressed/eboot.h +++ b/arch/x86/boot/compressed/eboot.h @@ -12,22 +12,22 @@ #define DESC_TYPE_CODE_DATA (1 << 0) -struct efi_uga_draw_protocol_32 { +typedef struct { u32 get_mode; u32 set_mode; u32 blt; -}; +} efi_uga_draw_protocol_32_t; -struct efi_uga_draw_protocol_64 { +typedef struct { u64 get_mode; u64 set_mode; u64 blt; -}; +} efi_uga_draw_protocol_64_t; -struct efi_uga_draw_protocol { +typedef struct { void *get_mode; void *set_mode; void *blt; -}; +} efi_uga_draw_protocol_t; #endif /* BOOT_COMPRESSED_EBOOT_H */ From patchwork Fri Jul 20 01:47:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 142400 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2392051ljj; Thu, 19 Jul 2018 18:47:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeBmUC0ETHljMYWNSvq0a4BUz8zhYgp/B5IPndDlD+BsD0V4ZCmFFakeojZIGepImLFhDdt X-Received: by 2002:a62:ad1:: with SMTP id 78-v6mr100457pfk.57.1532051279228; Thu, 19 Jul 2018 18:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532051279; cv=none; d=google.com; s=arc-20160816; b=Yj3qg2mJ0rRZmyORlOAZ4bRstZgigjwTGe/81DRur3zRCoXxrCSc5SNl8aGLsR+ZGw j5ZeK6QhJuWlEDN0nvDTUPBWAkDDPd/7T6R84e5mArmT+B5PmolTxOxj5yNDOSAvf0Np 5Wgg/ezdiZ2YfVE/V2TMi5eBGf81hL4+LYI0F99AtmyLKIbduQB9TYe51AqFm+lCY1QW skBTyL16vq/Ucf1zuWSKESiKZThj/vR31Z8FzVX1DT1iFSeUxPh7dtPKPwXzMXvCKvKv QnzLCb51E9keL7KjIA1mnt4W0Qt6qdthGfowt/CAZE3wbwx0rO1yeRTtWmRhVNkWyizi cGQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=LNHkWUQA6S84qp4/yqCqd/F6Q+DP5IN/kJ9RCTZqEto=; b=eWtIktwpKALnz9+apaa/+oBoqFDFSvV5z2B7CN27hIRcsFdLTrYB2olnCEIaWe36l2 WqZ65A8OBLJI1S8A1cldE2xqvgzPQXjNe6MX+Jyt7XRnz2rn00erwMiZ2AudHugpeuEr 1qlxJqiIqtE54gZUpN7YwnwD678ZdPmelbbBqDOvA6kGhs4HghSU5bDTC6YHldcFQL7I nzGqzW2hlS621sG7ESMDL+kAmlDsleyxiael+EaBUw2ViiuUt2gkV15n93CNQ8WNh5de ltzvtFcBvjkd4l0ecp1FtY59hlET+Tni+kbJ5NiWDjK667pURdQrAJWD10DJwn8h70Q5 aBEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PG+R2Cyx; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16-v6si550523pgv.561.2018.07.19.18.47.59; Thu, 19 Jul 2018 18:47:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PG+R2Cyx; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731232AbeGTCds (ORCPT + 3 others); Thu, 19 Jul 2018 22:33:48 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40258 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731221AbeGTCdr (ORCPT ); Thu, 19 Jul 2018 22:33:47 -0400 Received: by mail-pg1-f193.google.com with SMTP id x5-v6so5358020pgp.7 for ; Thu, 19 Jul 2018 18:47:57 -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=yumR4lvkykhvrfnsDUe6tO0L5ayyApzQLDr9GgxXvqY=; b=PG+R2CyxyKHJpZJKGfFin7HqTVC7Dbr3WvpbJ4UBquLOJ+mI1eEowR4b9zEap0M8so i5Nz7eKshwZmXjXWuv/iRxdawD9llNTFUbZHQQx1V7tdo+pGWmZhOFv4C1Ym6KMYDuM3 OPU3vXWnoJioX3uSFAWgZ+us99ZcnOAb1DnJc= 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; bh=yumR4lvkykhvrfnsDUe6tO0L5ayyApzQLDr9GgxXvqY=; b=HwGf6AkwuZPtAUaU6RZalez1+L7KzAIpmOcCP63rrfGWmxGaP/DYpcWo3HDM7L1r0N RVxo7ICyWdW6yE5xjIeiL20KOgaYR4CCxrLHexoZwXViuZxOUa7dkDrX3tuxYLN240rh wgm0P0XOwE1eyeCxBu7tChKj5uKkF2N67xSrnD3wINLhsegLjabfl2ARrzJZggAHMPVO oblyVoCb8M+rW18nMB4bueY4XF/qbmCWL0QpkycprDrIz8xonbSCDvY7rZCRq+T49YA2 EeZql+dYFM5fILHkOM2K8cK1isSHvYWCWDkMclaRO6pqfbFtS9/fhKvbHIuT6+1+Qh8u P1lw== X-Gm-Message-State: AOUpUlGQBYRsxjQAwOIw4uHa5AuTCCK62yQGMEHvbMVtCUikvs9ksOQS nscjoLsW7QJ5omueQEznN3G/ZYgvDlw= X-Received: by 2002:a63:1403:: with SMTP id u3-v6mr95955pgl.13.1532051277236; Thu, 19 Jul 2018 18:47:57 -0700 (PDT) Received: from localhost.localdomain (fs76eedbeb.tkyc508.ap.nuro.jp. [118.238.219.235]) by smtp.gmail.com with ESMTPSA id 203-v6sm475868pgb.14.2018.07.19.18.47.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 18:47:56 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Shevchenko , Hans de Goede , Lukas Wunner Subject: [PATCH 4/9] efi/x86: merge 32-bit and 64-bit UGA draw protocol setup routines Date: Fri, 20 Jul 2018 10:47:21 +0900 Message-Id: <20180720014726.24031-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720014726.24031-1-ard.biesheuvel@linaro.org> References: <20180720014726.24031-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The two versions of setup_uga##() are mostly identical, with the exception of the size of EFI_HANDLE. So let's merge the two, and pull the implementation into the calling function setup_uga(). Note that the 32-bit version was only mixed-mode safe by accident: it only calls the get_mode() method of the UGA draw protocol, which happens to be the first member, and so truncating the 64-bit void* at offset 0 to 32 bits happens to produce the correct value. But let's not rely on that, and use the proper API instead. Tested-by: Hans de Goede Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/eboot.c | 111 ++++++++----------------------- 1 file changed, 26 insertions(+), 85 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 011d5c289449..ac8e442db71f 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -318,81 +318,54 @@ static void setup_quirks(struct boot_params *boot_params) } } +/* + * See if we have Universal Graphics Adapter (UGA) protocol + */ static efi_status_t -setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height) +setup_uga(struct screen_info *si, efi_guid_t *uga_proto, unsigned long size) { + efi_status_t status; + u32 width, height; + void **uga_handle = NULL; efi_uga_draw_protocol_t *uga = NULL, *first_uga; - efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID; unsigned long nr_ugas; - u32 *handles = (u32 *)uga_handle; - efi_status_t status = EFI_INVALID_PARAMETER; int i; - first_uga = NULL; - nr_ugas = size / sizeof(u32); - for (i = 0; i < nr_ugas; i++) { - efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; - u32 w, h, depth, refresh; - void *pciio; - u32 handle = handles[i]; - - status = efi_call_early(handle_protocol, handle, - &uga_proto, (void **)&uga); - if (status != EFI_SUCCESS) - continue; - - efi_call_early(handle_protocol, handle, &pciio_proto, &pciio); - - status = efi_early->call((unsigned long)uga->get_mode, uga, - &w, &h, &depth, &refresh); - if (status == EFI_SUCCESS && (!first_uga || pciio)) { - *width = w; - *height = h; - - /* - * Once we've found a UGA supporting PCIIO, - * don't bother looking any further. - */ - if (pciio) - break; - - first_uga = uga; - } - } + status = efi_call_early(allocate_pool, EFI_LOADER_DATA, + size, (void **)&uga_handle); + if (status != EFI_SUCCESS) + return status; - return status; -} + status = efi_call_early(locate_handle, + EFI_LOCATE_BY_PROTOCOL, + uga_proto, NULL, &size, uga_handle); + if (status != EFI_SUCCESS) + goto free_handle; -static efi_status_t -setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height) -{ - efi_uga_draw_protocol_t *uga = NULL, *first_uga; - efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID; - unsigned long nr_ugas; - u64 *handles = (u64 *)uga_handle; - efi_status_t status = EFI_INVALID_PARAMETER; - int i; + height = 0; + width = 0; first_uga = NULL; - nr_ugas = size / sizeof(u64); + nr_ugas = size / (efi_is_64bit() ? sizeof(u64) : sizeof(u32)); for (i = 0; i < nr_ugas; i++) { efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; u32 w, h, depth, refresh; void *pciio; - u64 handle = handles[i]; + unsigned long handle = efi_is_64bit() ? ((u64 *)uga_handle)[i] + : ((u32 *)uga_handle)[i]; status = efi_call_early(handle_protocol, handle, - &uga_proto, (void **)&uga); + uga_proto, (void **)&uga); if (status != EFI_SUCCESS) continue; efi_call_early(handle_protocol, handle, &pciio_proto, &pciio); - status = efi_early->call((unsigned long)uga->get_mode, uga, - &w, &h, &depth, &refresh); + status = efi_call_proto(efi_uga_draw_protocol, get_mode, uga, + &w, &h, &depth, &refresh); if (status == EFI_SUCCESS && (!first_uga || pciio)) { - *width = w; - *height = h; + width = w; + height = h; /* * Once we've found a UGA supporting PCIIO, @@ -405,38 +378,6 @@ setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height) } } - return status; -} - -/* - * See if we have Universal Graphics Adapter (UGA) protocol - */ -static efi_status_t -setup_uga(struct screen_info *si, efi_guid_t *uga_proto, unsigned long size) -{ - efi_status_t status; - u32 width, height; - void **uga_handle = NULL; - - status = efi_call_early(allocate_pool, EFI_LOADER_DATA, - size, (void **)&uga_handle); - if (status != EFI_SUCCESS) - return status; - - status = efi_call_early(locate_handle, - EFI_LOCATE_BY_PROTOCOL, - uga_proto, NULL, &size, uga_handle); - if (status != EFI_SUCCESS) - goto free_handle; - - height = 0; - width = 0; - - if (efi_early->is64) - status = setup_uga64(uga_handle, size, &width, &height); - else - status = setup_uga32(uga_handle, size, &width, &height); - if (!width && !height) goto free_handle; From patchwork Fri Jul 20 01:47:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 142404 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2392190ljj; Thu, 19 Jul 2018 18:48:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+qvdA183dozpcqwJk7WfPw26id4PdocXBfGwtTVlrM+515fT7FfSF757c7Wk+JV7ENq8L X-Received: by 2002:a65:4c02:: with SMTP id u2-v6mr108620pgq.364.1532051290742; Thu, 19 Jul 2018 18:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532051290; cv=none; d=google.com; s=arc-20160816; b=QluKe4GSSuRrrpjqFBiiQX6m5wGFc+5rtDppX4Vqn0gRhA+XFLISr1fHxkN+X37Tpa 913Jj7kmisVbeWxAFIYHcwzCRdeys7DfzqqWyQTqUZaWM4MhXO4F69JErjGx96TJ98lj 8d1LOFevCizexvZdMW5aVaDNUCr61omyUhAZ3B6tAtB7a0P3fFRZXsuWdWKBpFo+wfaQ 1LecLwsBOMfjDDS+rk+QofBgvaehTjlzDVUqGHnlDe24/9KThEmfyoqT4OFMZIa1FS5/ ZWKoeT4ZdeaGrc8d63NOtWSWDAtxfMQOgcfMnmbkVvAgNTYU2FKim5Cvg3HtrtQXeF1y 7joA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7KQRtRFkJTUeKjcoNJurU9l4JlWFGjhUhqanbtWQ8Xk=; b=neyLoJoC+9rmAG+7lhZDjXtl+kIo28vMuwLfd5xnz5Asp0pScNk8VprB9psMQ1dFbB m2SoRXGfzGim5yIf6YrOExFix2Jmp+CNtz9LpuPzRe210/r2M7gqZ1ruAs705nPIXPo4 ZogUEFXf4r8x9KVD/P9nvMg/c6xcClYDjpA35nt9yFiCRHg7X4E26Lgb63bdja3p9hbl k4G06glJ7vbO+Snh6reBmgZ/DIcg0WlJAL/sqL1/xhGzHFGsNl7iiCbzW5kXRBAb4YqO UWK1A20BRPyu7AhCM9Lp2V+d9kIRULfkg3baHz/qX+OSqCTVLHA4lqtYXj9kVZfAvdbV 5Png== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dQ7by6O8; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j33-v6si624647pgm.584.2018.07.19.18.48.10; Thu, 19 Jul 2018 18:48:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dQ7by6O8; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731283AbeGTCd7 (ORCPT + 3 others); Thu, 19 Jul 2018 22:33:59 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:39314 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731446AbeGTCd6 (ORCPT ); Thu, 19 Jul 2018 22:33:58 -0400 Received: by mail-pl0-f66.google.com with SMTP id p23-v6so4436883plo.6 for ; Thu, 19 Jul 2018 18:48:08 -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=Eo7sVi41YgrsYz9DtX5IlTRqkFuBHV0AkwX0j3bW0Ik=; b=dQ7by6O89TB4RoqM9aJLiSQuK8ev9fl0gaox7aDzL/HtubQPtvAXYxHEdMg8EGMKBf qx637bYraG3Ld31w3vnVoiPX/TPm3aKi4gAUOjIoX9IQeymPEYdOhHKcoZMegYLP1/B7 AtdklPrIzFgWp0OaqXbfwc/lgW4DxQx2WOHLE= 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; bh=Eo7sVi41YgrsYz9DtX5IlTRqkFuBHV0AkwX0j3bW0Ik=; b=NStujrD0XB8sisedlCGtJpk9jFsB/qIiE4MbMtYRhmBaFBk1w6Rz1QAF7huWKCfPko UhuX6TD1szUAoKUqzJMnoiQyoesdfErq+v8SwadEzuG/MF6UvSH3gcxsIA1W81m/FeyR 9fN7B4woQvTK6z43qYhzDMdxHc9k9xpQ1tUyGRh4dMO2i2V4FKvirVDmwtw/9M0erblC uslTMWIuz3V9cm3V7WhyQE0ZfVzBFEON5nYFuENFrERpJjOvBXcVgiROz411dkDb0VNp c3q35C8/qjBhSDoSVoNpYfvh1uVn2Y0JsqiA0v/UPkX/vfJrtH1XrEMntk9cneIL9FJY fjUw== X-Gm-Message-State: AOUpUlHMQnIPglE7/T5MT9Yp80HaAFxRqO6D2eTFnqeqqwYdVXJmuTsu EHVPMAuQgBvcMjvE2Q6ljZtg17emwjo= X-Received: by 2002:a17:902:704c:: with SMTP id h12-v6mr77168plt.237.1532051287584; Thu, 19 Jul 2018 18:48:07 -0700 (PDT) Received: from localhost.localdomain (fs76eedbeb.tkyc508.ap.nuro.jp. [118.238.219.235]) by smtp.gmail.com with ESMTPSA id 203-v6sm475868pgb.14.2018.07.19.18.48.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 18:48:07 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Shevchenko , Hans de Goede , Lukas Wunner Subject: [PATCH 8/9] efi/cper: Use consistent types for UUIDs Date: Fri, 20 Jul 2018 10:47:25 +0900 Message-Id: <20180720014726.24031-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180720014726.24031-1-ard.biesheuvel@linaro.org> References: <20180720014726.24031-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Andy Shevchenko The commit 2f74f09bce4f ("efi: parse ARM processor error") brought inconsistency in UUID types which are used across the CPER. Fix this by moving to use guid_t API everywhere. Cc: Tyler Baicar Signed-off-by: Andy Shevchenko Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/cper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index b73fc4cab083..a7902fccdcfa 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -472,7 +472,7 @@ cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata else goto err_section_too_small; #if defined(CONFIG_ARM64) || defined(CONFIG_ARM) - } else if (!uuid_le_cmp(*sec_type, CPER_SEC_PROC_ARM)) { + } else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { struct cper_sec_proc_arm *arm_err = acpi_hest_get_payload(gdata); printk("%ssection_type: ARM processor error\n", newpfx);