From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752459AbdGRLB6 (ORCPT ); Tue, 18 Jul 2017 07:01:58 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56859 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751655AbdGRLBz (ORCPT ); Tue, 18 Jul 2017 07:01:55 -0400 Date: Tue, 18 Jul 2017 03:53:24 -0700 From: tip-bot for Tom Lendacky Message-ID: Cc: corbet@lwn.net, toshi.kani@hpe.com, brijesh.singh@amd.com, konrad.wilk@oracle.com, bp@suse.de, pbonzini@redhat.com, linux-kernel@vger.kernel.org, riel@redhat.com, glider@google.com, torvalds@linux-foundation.org, mst@redhat.com, aryabinin@virtuozzo.com, hpa@zytor.com, thomas.lendacky@amd.com, tglx@linutronix.de, lwoodman@redhat.com, matt@codeblueprint.co.uk, dvyukov@google.com, arnd@arndb.de, rkrcmar@redhat.com, dyoung@redhat.com, peterz@infradead.org, luto@kernel.org, bp@alien8.de, mingo@kernel.org Reply-To: hpa@zytor.com, thomas.lendacky@amd.com, tglx@linutronix.de, rkrcmar@redhat.com, matt@codeblueprint.co.uk, lwoodman@redhat.com, arnd@arndb.de, dvyukov@google.com, peterz@infradead.org, luto@kernel.org, dyoung@redhat.com, mingo@kernel.org, bp@alien8.de, brijesh.singh@amd.com, corbet@lwn.net, toshi.kani@hpe.com, bp@suse.de, konrad.wilk@oracle.com, glider@google.com, riel@redhat.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, mst@redhat.com, torvalds@linux-foundation.org, aryabinin@virtuozzo.com In-Reply-To: <7fbf40a9dc414d5da849e1ddcd7f7c1285e4e181.1500319216.git.thomas.lendacky@amd.com> References: <7fbf40a9dc414d5da849e1ddcd7f7c1285e4e181.1500319216.git.thomas.lendacky@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] efi: Update efi_mem_type() to return an error rather than 0 Git-Commit-ID: f99afd08a45fbbd9ce35a7624ffd1d850a1906c0 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f99afd08a45fbbd9ce35a7624ffd1d850a1906c0 Gitweb: http://git.kernel.org/tip/f99afd08a45fbbd9ce35a7624ffd1d850a1906c0 Author: Tom Lendacky AuthorDate: Mon, 17 Jul 2017 16:10:14 -0500 Committer: Ingo Molnar CommitDate: Tue, 18 Jul 2017 11:38:01 +0200 efi: Update efi_mem_type() to return an error rather than 0 The efi_mem_type() function currently returns a 0, which maps to EFI_RESERVED_TYPE, if the function is unable to find a memmap entry for the supplied physical address. Returning EFI_RESERVED_TYPE implies that a memmap entry exists, when it doesn't. Instead of returning 0, change the function to return a negative error value when no memmap entry is found. Signed-off-by: Tom Lendacky Reviewed-by: Thomas Gleixner Reviewed-by: Matt Fleming Reviewed-by: Borislav Petkov Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Andy Lutomirski Cc: Arnd Bergmann Cc: Borislav Petkov Cc: Brijesh Singh Cc: Dave Young Cc: Dmitry Vyukov Cc: Jonathan Corbet Cc: Konrad Rzeszutek Wilk Cc: Larry Woodman Cc: Linus Torvalds Cc: Michael S. Tsirkin Cc: Paolo Bonzini Cc: Peter Zijlstra Cc: Radim Krčmář Cc: Rik van Riel Cc: Toshimitsu Kani Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/7fbf40a9dc414d5da849e1ddcd7f7c1285e4e181.1500319216.git.thomas.lendacky@amd.com Signed-off-by: Ingo Molnar --- arch/ia64/kernel/efi.c | 4 ++-- arch/x86/platform/efi/efi.c | 6 +++--- include/linux/efi.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index 1212956..8141600 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c @@ -757,14 +757,14 @@ efi_memmap_intersects (unsigned long phys_addr, unsigned long size) return 0; } -u32 +int efi_mem_type (unsigned long phys_addr) { efi_memory_desc_t *md = efi_memory_descriptor(phys_addr); if (md) return md->type; - return 0; + return -EINVAL; } u64 diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index f084d87..6217b23 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -1035,12 +1035,12 @@ void __init efi_enter_virtual_mode(void) /* * Convenience functions to obtain memory types and attributes */ -u32 efi_mem_type(unsigned long phys_addr) +int efi_mem_type(unsigned long phys_addr) { efi_memory_desc_t *md; if (!efi_enabled(EFI_MEMMAP)) - return 0; + return -ENOTSUPP; for_each_efi_memory_desc(md) { if ((md->phys_addr <= phys_addr) && @@ -1048,7 +1048,7 @@ u32 efi_mem_type(unsigned long phys_addr) (md->num_pages << EFI_PAGE_SHIFT)))) return md->type; } - return 0; + return -EINVAL; } static int __init arch_parse_efi_cmdline(char *str) diff --git a/include/linux/efi.h b/include/linux/efi.h index 8e24f09..4e47f78 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -985,7 +985,7 @@ static inline void efi_esrt_init(void) { } extern int efi_config_parse_tables(void *config_tables, int count, int sz, efi_config_table_type_t *arch_tables); extern u64 efi_get_iobase (void); -extern u32 efi_mem_type (unsigned long phys_addr); +extern int efi_mem_type(unsigned long phys_addr); extern u64 efi_mem_attributes (unsigned long phys_addr); extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); extern int __init efi_uart_console_only (void);