summaryrefslogtreecommitdiff
path: root/big-little/virtualisor/include/virtualisor.h
blob: 6b84eb805f6f2f2332e45f03e40fb08b08db5e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (c) 2012, ARM Limited. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with
 * or without modification, are permitted provided that the
 * following conditions are met:
 *
 * Redistributions of source code must retain the above
 * copyright notice, this list of conditions and the
 * following disclaimer.
 *
 * Redistributions in binary form must reproduce the
 * above copyright notice, this list of conditions and
 * the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * Neither the name of ARM nor the names of its
 * contributors may be used to endorse or promote products
 * derived from this software without specific prior written
 * permission.
 */

#ifndef __VIRTUALISOR_H__
#define __VIRTUALISOR_H__

#include "misc.h"
#include "virt_helpers.h"

/*
 * Data structure that holds a copy of the virtualized regs
 */
typedef struct virt_regs {
	unsigned cluster_id;
	unsigned mpidr;
	unsigned midr;
} virt_reg_data;

/*
 * Data structure that holds all the trap registers exported
 * by the Virtualisation Extensions.
 */
typedef struct trap_regs {
	unsigned hcr;
	unsigned hdcr;
	unsigned hcptr;
	unsigned hstr;
} reg_trap_data;

typedef struct gp_regs {
	unsigned r[15];
} gp_regs;

/*
 * Descriptor exported by each processor describing
 * which traps it wants to implement along with
 * handlers for saving and restoring for each conf-
 * -igured trap.
 */
typedef struct virt_desc {
	/* cpu midr contents */
	unsigned cpu_no;
	/*
	 * Bitmask to inidicate that Virtualisor setup has been
	 * done on both host & target cpus.
	 */
	unsigned char init[NUM_CPUS];
	unsigned (*trap_setup) (unsigned, unsigned);
	unsigned (*trap_handle) (gp_regs * regs, unsigned, unsigned);
	unsigned (*trap_save) (unsigned, unsigned);
	unsigned (*trap_restore) (unsigned, unsigned);
} virt_descriptor;

extern void SetupVirtualisor(unsigned);
extern void SaveVirtualisor(unsigned);
extern void RestoreVirtualisor(unsigned);
extern void HandleVirtualisor(gp_regs *);
extern void handle_vgic_distif_abort(unsigned, unsigned *, unsigned);
extern void handle_kfscb_abort(unsigned, unsigned *, unsigned);
extern unsigned find_sibling_cpu(void);
extern virt_descriptor virt_desc_section$$Base;
extern unsigned virt_desc_section$$Length;
extern unsigned host_cluster;
extern unsigned switcher;

#endif				/* __VIRTUALISOR_H__ */