xref: /kvmtool/powerpc/include/kvm/kvm-arch.h (revision 63e158a0a0a05551e8e983826bb26a2c0a78ef4b)
1 /*
2  * PPC64 architecture-specific definitions
3  *
4  * Copyright 2011 Matt Evans <matt@ozlabs.org>, IBM Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published
8  * by the Free Software Foundation.
9  */
10 
11 #ifndef KVM__KVM_ARCH_H
12 #define KVM__KVM_ARCH_H
13 
14 #include <stdbool.h>
15 #include <linux/types.h>
16 #include <time.h>
17 
18 #define KVM_NR_CPUS			(255)
19 
20 /*
21  * MMIO lives after RAM, but it'd be nice if it didn't constantly move.
22  * Choose a suitably high address, e.g. 63T...  This limits RAM size.
23  */
24 #define PPC_MMIO_START			0x3F0000000000UL
25 #define PPC_MMIO_SIZE			0x010000000000UL
26 
27 #define KERNEL_LOAD_ADDR        	0x0000000000000000
28 #define KERNEL_START_ADDR       	0x0000000000000000
29 #define KERNEL_SECONDARY_START_ADDR     0x0000000000000060
30 #define INITRD_LOAD_ADDR        	0x0000000002800000
31 
32 #define FDT_MAX_SIZE            	0x10000
33 #define RTAS_MAX_SIZE           	0x10000
34 
35 #define TIMEBASE_FREQ           	512000000ULL
36 
37 #define KVM_MMIO_START			PPC_MMIO_START
38 
39 /*
40  * This is the address that pci_get_io_space_block() starts allocating
41  * from.  Note that this is a PCI bus address.
42  */
43 #define KVM_PCI_MMIO_AREA		0x1000000
44 
45 struct kvm {
46 	int			sys_fd;		/* For system ioctls(), i.e. /dev/kvm */
47 	int			vm_fd;		/* For VM ioctls() */
48 	timer_t			timerid;	/* Posix timer for interrupts */
49 
50 	int			nrcpus;		/* Number of cpus to run */
51 
52 	u32			mem_slots;	/* for KVM_SET_USER_MEMORY_REGION */
53 
54 	u64			ram_size;
55 	void			*ram_start;
56 
57 	bool			nmi_disabled;
58 
59 	bool			single_step;
60 
61 	const char		*vmlinux;
62 	struct disk_image       **disks;
63 	int                     nr_disks;
64 	unsigned long		rtas_gra;
65 	unsigned long		rtas_size;
66 	unsigned long		fdt_gra;
67 	unsigned long		initrd_gra;
68 	unsigned long		initrd_size;
69 	const char		*name;
70 };
71 
72 #endif /* KVM__KVM_ARCH_H */
73