Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: kvm@vger.kernel.org
Cc: penberg@kernel.org, marc.zyngier@arm.com, anup@brainfault.org,
	rusty@rustcorp.com.au, pranavkumar@linaro.org,
	michael@ellerman.id.au, Will Deacon <will.deacon@arm.com>
Subject: [RFC PATCH 01/11] kvm tools: makefile: factor out libfdt inclusion
Date: Wed,  1 May 2013 16:50:06 +0100	[thread overview]
Message-ID: <1367423416-24640-2-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1367423416-24640-1-git-send-email-will.deacon@arm.com>

libfdt is used by powerpc, arm and arm64.

This patch factors out the Makefile parts including it and defines a
CONFIG_HAS_LIBFDT, so architecture-portable code can make use of fdt
if it is available.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 tools/kvm/Makefile | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index a0a0a9b..cb1a9b4 100644
--- a/tools/kvm/Makefile
+++ b/tools/kvm/Makefile
@@ -114,9 +114,6 @@ ifeq ($(ARCH),x86_64)
 	DEFINES      += -DCONFIG_X86_64
 endif
 
-LIBFDT_SRC = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o
-LIBFDT_OBJS = $(patsubst %,../../scripts/dtc/libfdt/%,$(LIBFDT_SRC))
-
 ### Arch-specific stuff
 
 #x86
@@ -150,12 +147,10 @@ ifeq ($(ARCH), powerpc)
 	OBJS	+= powerpc/spapr_hvcons.o
 	OBJS	+= powerpc/spapr_pci.o
 	OBJS	+= powerpc/xics.o
-# We use libfdt, but it's sometimes not packaged 64bit.  It's small too,
-# so just build it in:
-	CFLAGS 	+= -I../../scripts/dtc/libfdt
-	OTHEROBJS	+= $(LIBFDT_OBJS)
 	ARCH_INCLUDE := powerpc/include
 	CFLAGS 	+= -m64
+
+	ARCH_WANT_LIBFDT := y
 endif
 
 # ARM
@@ -170,8 +165,8 @@ ifeq ($(ARCH), arm)
 	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
 	ARCH_INCLUDE	+= -Iarm/aarch32/include
 	CFLAGS		+= -march=armv7-a
-	CFLAGS		+= -I../../scripts/dtc/libfdt
-	OTHEROBJS	+= $(LIBFDT_OBJS)
+
+	ARCH_WANT_LIBFDT := y
 endif
 
 # ARM64
@@ -182,8 +177,8 @@ ifeq ($(ARCH), arm64)
 	OBJS		+= arm/aarch64/kvm-cpu.o
 	ARCH_INCLUDE	:= $(HDRS_ARM_COMMON)
 	ARCH_INCLUDE	+= -Iarm/aarch64/include
-	CFLAGS		+= -I../../scripts/dtc/libfdt
-	OTHEROBJS	+= $(LIBFDT_OBJS)
+
+	ARCH_WANT_LIBFDT := y
 endif
 
 ###
@@ -196,6 +191,18 @@ endif
 
 ###
 
+# libfdt support
+
+LIBFDT_SRC = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o
+LIBFDT_OBJS = $(patsubst %,../../scripts/dtc/libfdt/%,$(LIBFDT_SRC))
+
+ifeq (y,$(ARCH_WANT_LIBFDT))
+	DEFINES		+= -DCONFIG_HAS_LIBFDT
+	OTHEROBJS	+= $(LIBFDT_OBJS)
+endif
+
+###
+
 # Detect optional features.
 # On a given system, some libs may link statically, some may not; so, check
 # both and only build those that link!
@@ -285,7 +292,7 @@ DEFINES	+= -DKVMTOOLS_VERSION='"$(KVMTOOLS_VERSION)"'
 DEFINES	+= -DBUILD_ARCH='"$(ARCH)"'
 
 KVM_INCLUDE := include
-CFLAGS	+= $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -O2 -fno-strict-aliasing -g
+CFLAGS	+= $(CPPFLAGS) $(DEFINES) -I$(KVM_INCLUDE) -I$(ARCH_INCLUDE) -I$(KINCL_PATH)/include/uapi -I$(KINCL_PATH)/include -I$(KINCL_PATH)/arch/$(ARCH)/include/uapi -I$(KINCL_PATH)/arch/$(ARCH)/include/ -I$(KINCL_PATH)/scripts/dtc/libfdt -O2 -fno-strict-aliasing -g
 
 WARNINGS += -Wall
 WARNINGS += -Wformat=2
-- 
1.8.0


  reply	other threads:[~2013-05-01 15:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 15:50 [RFC PATCH 00/11] kvm tools: allow ioport emulation to be used on ARM Will Deacon
2013-05-01 15:50 ` Will Deacon [this message]
2013-05-01 15:50 ` [RFC PATCH 02/11] kvm tools: virtio: move fdt node generation into core mmio code Will Deacon
2013-05-01 15:50 ` [RFC PATCH 03/11] kvm tools: arm: add ioport window to virtual memory map Will Deacon
2013-05-01 15:50 ` [RFC PATCH 04/11] kvm tools: console: unconditionally output to any console Will Deacon
2013-05-03  9:19   ` Pekka Enberg
2013-05-03 16:02     ` Sasha Levin
2013-05-03 16:09       ` Will Deacon
2013-05-06 21:04         ` Sasha Levin
2013-05-07  2:48           ` Anup Patel
2013-05-05 10:16     ` Asias He
2013-05-01 15:50 ` [RFC PATCH 05/11] kvm tools: allow ioports to be offset from 0 Will Deacon
2013-05-01 15:50 ` [RFC PATCH 06/11] kvm tools: ioport: add arch callback to remap IRQ lines for ioport devices Will Deacon
2013-05-01 15:50 ` [RFC PATCH 07/11] kvm tools: ioport: allow ioport devices to generate fdt nodes Will Deacon
2013-05-01 15:50 ` [RFC PATCH 08/11] kvm tools: 8250: add fdt node generation Will Deacon
2013-05-01 15:50 ` [RFC PATCH 09/11] kvm tools: 8250: add address qualifier to uart name in fdt node Will Deacon
2013-05-01 15:50 ` [RFC PATCH 10/11] kvm tools: ARM: generate fdt nodes for ioport devices Will Deacon
2013-05-01 15:50 ` [RFC PATCH 11/11] kvm tools: ARM: add 8250 console callback to periodic poll Will Deacon
2013-05-03  6:53 ` [RFC PATCH 00/11] kvm tools: allow ioport emulation to be used on ARM Michael Ellerman
2013-05-14 15:29   ` Pekka Enberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367423416-24640-2-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=anup@brainfault.org \
    --cc=kvm@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=michael@ellerman.id.au \
    --cc=penberg@kernel.org \
    --cc=pranavkumar@linaro.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox