1 /*
2  * Copyright (C) 2012      Citrix Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; version 2.1 only. with the special
7  * exception on linking described in file LICENSE.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  */
14 
15 #ifndef LIBXL_ARCH_H
16 #define LIBXL_ARCH_H
17 
18 /* fill the arch specific configuration for the domain */
19 _hidden
20 int libxl__arch_domain_prepare_config(libxl__gc *gc,
21                                       libxl_domain_config *d_config,
22                                       struct xen_domctl_createdomain *config);
23 
24 /* save the arch specific configuration for the domain */
25 _hidden
26 int libxl__arch_domain_save_config(libxl__gc *gc,
27                                    libxl_domain_config *d_config,
28                                    libxl__domain_build_state *state,
29                                    const struct xen_domctl_createdomain *config);
30 
31 /* arch specific internal domain creation function */
32 _hidden
33 int libxl__arch_domain_create(libxl__gc *gc,
34                               libxl_domain_config *d_config,
35                               libxl__domain_build_state *state,
36                               uint32_t domid);
37 
38 /* setup arch specific hardware description, i.e. DTB on ARM */
39 _hidden
40 int libxl__arch_domain_init_hw_description(libxl__gc *gc,
41                                            libxl_domain_config *d_config,
42                                            libxl__domain_build_state *state,
43                                            struct xc_dom_image *dom);
44 /* finalize arch specific hardware description. */
45 _hidden
46 int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
47                                       uint32_t domid,
48                                       libxl_domain_config *d_config,
49                                       struct xc_dom_image *dom);
50 
51 /* perform any pending hardware initialization */
52 _hidden
53 int libxl__arch_build_dom_finish(libxl__gc *gc,
54                                  libxl_domain_build_info *info,
55                                  struct xc_dom_image *dom,
56                                  libxl__domain_build_state *state);
57 
58 /* build vNUMA vmemrange with arch specific information */
59 _hidden
60 int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc,
61                                       uint32_t domid,
62                                       libxl_domain_build_info *b_info,
63                                       libxl__domain_build_state *state);
64 
65 /* arch specific irq map function */
66 _hidden
67 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
68 
69 _hidden
70 void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
71                                                libxl_domain_create_info *c_info);
72 
73 _hidden
74 int libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
75                                              libxl_domain_build_info *b_info,
76                                              const libxl_physinfo *physinfo);
77 
78 _hidden
79 int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc,
80                                      uint32_t domid /* for logging, only */,
81                                             libxl_domain_config *d_config,
82                                             const libxl_physinfo *physinfo);
83 
84 _hidden
85 int libxl__arch_extra_memory(libxl__gc *gc,
86                              const libxl_domain_build_info *info,
87                              uint64_t *out);
88 
89 _hidden
90 void libxl__arch_update_domain_config(libxl__gc *gc,
91                                       libxl_domain_config *dst,
92                                       const libxl_domain_config *src);
93 
94 #if defined(__i386__) || defined(__x86_64__)
95 
96 #define LAPIC_BASE_ADDRESS  0xfee00000
97 #define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
98 #define EXTRA_DEFAULT_PAGING_MEM_MB 0
99 
100 int libxl__dom_load_acpi(libxl__gc *gc,
101                          const libxl_domain_build_info *b_info,
102                          struct xc_dom_image *dom);
103 
104 #else
105 
106 /*
107  * 128MB extra default paging memory on Arm for extended regions. This
108  * value is normally enough for domains that are not running backend.
109  * See the `shadow_memory` in xl.cfg documentation for more information.
110  */
111 #define EXTRA_DEFAULT_PAGING_MEM_MB 128
112 
113 #endif
114 
115 #endif
116