lkml.org 
[lkml]   [2022]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCHv8 14/30] x86: Consolidate port I/O helpers
On Sun, Apr 10, 2022 at 12:58:17PM +0200, Borislav Petkov wrote:
> On Wed, Apr 06, 2022 at 02:29:23AM +0300, Kirill A. Shutemov wrote:
> > There are two implementations of port I/O helpers: one in the kernel and
> > one in the boot stub.
> >
> > Move the helpers required for both to <asm/shared/io.h> and use the one
> > implementation everywhere.
> >
> > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> > ---
> > arch/x86/boot/boot.h | 35 +-------------------------------
> > arch/x86/boot/compressed/misc.h | 2 +-
> > arch/x86/include/asm/io.h | 22 ++------------------
> > arch/x86/include/asm/shared/io.h | 34 +++++++++++++++++++++++++++++++
> > 4 files changed, 38 insertions(+), 55 deletions(-)
> > create mode 100644 arch/x86/include/asm/shared/io.h
>
> This complains with clang-13 here, config attached.
>
> And yap, this is the damn include hell I keep talking about. That
> lib/kalsr.c thing includes the kernel proper io.h header ...

Right. <asm/shared/io.h> is enough for lib/kaslr.c.

What about this:

From 164de295599f8befa2ee1ff05dc03542c02b0800 Mon Sep 17 00:00:00 2001
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date: Sun, 10 Apr 2022 22:49:28 +0300
Subject: [PATCH] x86/kaslr: Fix build warning in KASLR code in boot stub

lib/kaslr.c used by both the main kernel and the boot stub. It includes
<asm/io.h> that intended to be used in the main kernel. It leads to
build warnings like this:

warning: implicit declaration of function 'outl' is invalid in
C99 [-Wimplicit-function-declaration]

Replace <asm/io.h> with <asm/shared/io.h> which is suitable for both
cases.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fixes: 1e8f93e18379 ("x86: Consolidate port I/O helpers")
---
arch/x86/lib/kaslr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/lib/kaslr.c b/arch/x86/lib/kaslr.c
index 2b3eb8c948a3..a58f451a7dd3 100644
--- a/arch/x86/lib/kaslr.c
+++ b/arch/x86/lib/kaslr.c
@@ -11,7 +11,7 @@
#include <asm/msr.h>
#include <asm/archrandom.h>
#include <asm/e820/api.h>
-#include <asm/io.h>
+#include <asm/shared/io.h>

/*
* When built for the regular kernel, several functions need to be stubbed out
--
Kirill A. Shutemov
\
 
 \ /
  Last update: 2022-04-10 21:59    [W:0.301 / U:1.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site