[tip:tools/kvm] kvm tools: make _FDT macro usable by other architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  ba60018e120423677223c19da4192ab4b6c05c39
Gitweb:     http://git.kernel.org/tip/ba60018e120423677223c19da4192ab4b6c05c39
Author:     Will Deacon <will.deacon@xxxxxxx>
AuthorDate: Mon, 12 Nov 2012 11:57:23 +0000
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Tue, 13 Nov 2012 09:27:33 +0200

kvm tools: make _FDT macro usable by other architectures

The _FDT macro is useful when generating device trees for a guest, so
make it available to other architectures.

Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/include/kvm/fdt.h              | 26 ++++++++++++++++++++++++++
 tools/kvm/powerpc/include/kvm/kvm-arch.h | 11 -----------
 tools/kvm/powerpc/kvm.c                  |  2 +-
 tools/kvm/powerpc/spapr_pci.c            |  2 +-
 4 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/tools/kvm/include/kvm/fdt.h b/tools/kvm/include/kvm/fdt.h
new file mode 100644
index 0000000..19f95ac
--- /dev/null
+++ b/tools/kvm/include/kvm/fdt.h
@@ -0,0 +1,26 @@
+#ifndef KVM__FDT_H
+#define KVM__FDT_H
+
+#include "libfdt.h"
+
+#include <linux/types.h>
+
+#define FDT_MAX_SIZE	0x10000
+
+/* Helper for the various bits of code that generate FDT nodes */
+#define _FDT(exp)							\
+	do {								\
+		int ret = (exp);					\
+		if (ret < 0) {						\
+			die("Error creating device tree: %s: %s\n",	\
+			    #exp, fdt_strerror(ret));			\
+		}							\
+	} while (0)
+
+static inline u32 fdt__alloc_phandle(void)
+{
+	static u32 phandle = 0;
+	return ++phandle;
+}
+
+#endif /* KVM__FDT_H */
diff --git a/tools/kvm/powerpc/include/kvm/kvm-arch.h b/tools/kvm/powerpc/include/kvm/kvm-arch.h
index 97181c4..dd8a307 100644
--- a/tools/kvm/powerpc/include/kvm/kvm-arch.h
+++ b/tools/kvm/powerpc/include/kvm/kvm-arch.h
@@ -27,7 +27,6 @@
 #define KERNEL_SECONDARY_START_ADDR     0x0000000000000060
 #define INITRD_LOAD_ADDR        	0x0000000002800000
 
-#define FDT_MAX_SIZE            	0x10000
 #define RTAS_MAX_SIZE           	0x10000
 
 #define TIMEBASE_FREQ           	512000000ULL
@@ -55,14 +54,4 @@ struct kvm_arch {
 	struct spapr_phb	*phb;
 };
 
-/* Helper for the various bits of code that generate FDT nodes */
-#define _FDT(exp)							\
-	do {								\
-		int ret = (exp);					\
-		if (ret < 0) {						\
-			die("Error creating device tree: %s: %s\n",	\
-			    #exp, fdt_strerror(ret));			\
-		}							\
-	} while (0)
-
 #endif /* KVM__KVM_ARCH_H */
diff --git a/tools/kvm/powerpc/kvm.c b/tools/kvm/powerpc/kvm.c
index d675265..d8dfc01 100644
--- a/tools/kvm/powerpc/kvm.c
+++ b/tools/kvm/powerpc/kvm.c
@@ -11,9 +11,9 @@
  * by the Free Software Foundation.
  */
 
+#include "kvm/fdt.h"
 #include "kvm/kvm.h"
 #include "kvm/util.h"
-#include "libfdt.h"
 #include "cpu_info.h"
 
 #include "spapr.h"
diff --git a/tools/kvm/powerpc/spapr_pci.c b/tools/kvm/powerpc/spapr_pci.c
index b74790e..9f0ce7a 100644
--- a/tools/kvm/powerpc/spapr_pci.c
+++ b/tools/kvm/powerpc/spapr_pci.c
@@ -15,9 +15,9 @@
 
 #include "spapr.h"
 #include "spapr_pci.h"
+#include "kvm/fdt.h"
 #include "kvm/util.h"
 #include "kvm/pci.h"
-#include "libfdt.h"
 
 #include <linux/pci_regs.h>
 #include <linux/byteorder.h>
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux