1 /*
2  * Copyright (C) 2016      Linaro Ltd.
3  *
4  * Author: Shannon Zhao <shannon.zhao@linaro.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published
8  * by the Free Software Foundation; version 2.1 only. with the special
9  * exception on linking described in file LICENSE.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  */
16 
17 #include "libxl_internal.h"
18 #include "libxl_arch.h"
19 
20 _hidden
21 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
22                         struct xc_dom_image *dom);
23 
24 _hidden
25 int libxl__get_acpi_size(libxl__gc *gc,
26                          const libxl_domain_build_info *info,
27                          uint64_t *out);
28 
libxl__compute_mpdir(unsigned int cpuid)29 static inline uint64_t libxl__compute_mpdir(unsigned int cpuid)
30 {
31     /*
32      * According to ARM CPUs bindings, the reg field should match
33      * the MPIDR's affinity bits. We will use AFF0 and AFF1 when
34      * constructing the reg value of the guest at the moment, for it
35      * is enough for the current max vcpu number.
36      */
37     return (cpuid & 0x0f) | (((cpuid >> 4) & 0xff) << 8);
38 }
39 
40 /*
41  * Local variables:
42  * mode: C
43  * c-basic-offset: 4
44  * indent-tabs-mode: nil
45  * End:
46  */
47