From patchwork Fri Nov 6 00:24:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 7564981 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65A98C05C6 for ; Fri, 6 Nov 2015 00:25:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76D9420784 for ; Fri, 6 Nov 2015 00:25:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B40B207BD for ; Fri, 6 Nov 2015 00:25:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966067AbbKFAZg (ORCPT ); Thu, 5 Nov 2015 19:25:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966051AbbKFAZe (ORCPT ); Thu, 5 Nov 2015 19:25:34 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 4A283A4508; Fri, 6 Nov 2015 00:25:34 +0000 (UTC) Received: from hawk.localdomain.com (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tA60Olmu016750; Thu, 5 Nov 2015 19:25:31 -0500 From: Andrew Jones To: pbonzini@redhat.com, kvm@vger.kernel.org Cc: alex.bennee@linaro.org, cov@codeaurora.org Subject: [kvm-unit-tests PATCH 16/18] lib: link in linux kernel headers (uapi) Date: Thu, 5 Nov 2015 18:24:41 -0600 Message-Id: <1446769483-21586-17-git-send-email-drjones@redhat.com> In-Reply-To: <1446769483-21586-1-git-send-email-drjones@redhat.com> References: <1446769483-21586-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rather than import uapi headers, e.g. lib/arm/asm/uapi-psci.h, just include them. For cross compilation we'll need the headers explicitly added to the include path, but doing -I /usr/include won't work, as some of our local header names will collide with /usr/include names. Even just doing -I /usr/include/linux would leave too many potential name collisions. So we create a lib/linux link, and do *not* add -I lib/linux. Doing it this way requires code to include the uapi headers with , putting them in their own "linux" namespace. Signed-off-by: Andrew Jones --- .gitignore | 1 + Makefile | 4 ++-- configure | 9 +++++++++ lib/arm/asm/page.h | 2 +- lib/arm/asm/psci.h | 2 +- lib/arm64/asm/page.h | 2 +- lib/arm64/asm/psci.h | 2 +- lib/asm-generic/page.h | 2 +- lib/const.h | 11 ----------- 9 files changed, 17 insertions(+), 18 deletions(-) delete mode 100644 lib/const.h diff --git a/.gitignore b/.gitignore index acbb9055212aa..b193802488003 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ patches cscope.* *.swp /lib/asm +/lib/linux /config.mak /*-run /test.log diff --git a/Makefile b/Makefile index 3e60b4f8e4a57..2e76c90bdcea5 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,10 @@ libfdt_clean: $(LIBFDT_objdir)/.*.d distclean: clean libfdt_clean - $(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* + $(RM) lib/linux lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* $(RM) -r tests -cscope: common_dirs = lib lib/libfdt lib/asm lib/asm-generic +cscope: common_dirs = lib lib/libfdt lib/linux lib/asm lib/asm-generic cscope: $(RM) ./cscope.* find -L $(TEST_DIR) lib/$(TEST_DIR) lib/$(ARCH) $(common_dirs) -maxdepth 1 \ diff --git a/configure b/configure index 078b70ce096a6..667cc1b30e119 100755 --- a/configure +++ b/configure @@ -91,6 +91,15 @@ if [ -f $testdir/run ]; then ln -fs $testdir/run $testdir-run fi +# link uapi/linux +rm -f lib/linux +if [ ! -d /usr/include/linux ]; then + echo kernel-headers not installed, aborting... + exit 1 +else + ln -s /usr/include/linux lib/linux +fi + # check for dependent 32 bit libraries if [ "$arch" != "arm" ]; then cat << EOF > lib_test.c diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h index 039e2ddfb8e0f..df76969964ed3 100644 --- a/lib/arm/asm/page.h +++ b/lib/arm/asm/page.h @@ -6,7 +6,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include +#include #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h index c5fe78184b5ac..11ac45028d787 100644 --- a/lib/arm/asm/psci.h +++ b/lib/arm/asm/psci.h @@ -1,7 +1,7 @@ #ifndef _ASMARM_PSCI_H_ #define _ASMARM_PSCI_H_ #include -#include +#include #define PSCI_INVOKE_ARG_TYPE u32 #define PSCI_FN_CPU_ON PSCI_0_2_FN_CPU_ON diff --git a/lib/arm64/asm/page.h b/lib/arm64/asm/page.h index 29ad1f1f720c4..3144e8efcc7ae 100644 --- a/lib/arm64/asm/page.h +++ b/lib/arm64/asm/page.h @@ -11,7 +11,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include +#include #define PGTABLE_LEVELS 2 #define VA_BITS 42 diff --git a/lib/arm64/asm/psci.h b/lib/arm64/asm/psci.h index 940d61d34c05d..0a7d7c854e2b3 100644 --- a/lib/arm64/asm/psci.h +++ b/lib/arm64/asm/psci.h @@ -1,7 +1,7 @@ #ifndef _ASMARM64_PSCI_H_ #define _ASMARM64_PSCI_H_ #include -#include +#include #define PSCI_INVOKE_ARG_TYPE u64 #define PSCI_FN_CPU_ON PSCI_0_2_FN64_CPU_ON diff --git a/lib/asm-generic/page.h b/lib/asm-generic/page.h index 66c72a62bb0f7..f872f6fa0dad2 100644 --- a/lib/asm-generic/page.h +++ b/lib/asm-generic/page.h @@ -9,7 +9,7 @@ * This work is licensed under the terms of the GNU LGPL, version 2. */ -#include "const.h" +#include #define PAGE_SHIFT 12 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) diff --git a/lib/const.h b/lib/const.h deleted file mode 100644 index 5cd94d7067541..0000000000000 --- a/lib/const.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _CONST_H_ -#define _CONST_H_ -#ifdef __ASSEMBLY__ -#define _AC(X,Y) X -#define _AT(T,X) X -#else -#define __AC(X,Y) (X##Y) -#define _AC(X,Y) __AC(X,Y) -#define _AT(T,X) ((T)(X)) -#endif -#endif