Commit 1299331a authored by Will Deacon's avatar Will Deacon
Browse files

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: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent 5b403dbf
#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 */
......@@ -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 */
......@@ -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"
......
......@@ -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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment