iPXE
arch-riscv.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Guest OS interface to RISC-V Xen.
4 * Initially based on the ARM implementation.
5 */
6
7#ifndef __XEN_PUBLIC_ARCH_RISCV_H__
8#define __XEN_PUBLIC_ARCH_RISCV_H__
9
11FILE_SECBOOT ( PERMITTED );
12
13#if defined(__XEN__) || defined(__XEN_TOOLS__) || defined(__GNUC__)
14#define int64_aligned_t int64_t __attribute__((__aligned__(8)))
15#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
16#endif
17
18#ifndef __ASSEMBLY__
19#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
20 typedef union { type *p; unsigned long q; } \
21 __guest_handle_ ## name; \
22 typedef union { type *p; uint64_aligned_t q; } \
23 __guest_handle_64_ ## name
24
25/*
26 * XEN_GUEST_HANDLE represents a guest pointer, when passed as a field
27 * in a struct in memory. On RISCV is always 8 bytes sizes and 8 bytes
28 * aligned.
29 * XEN_GUEST_HANDLE_PARAM represents a guest pointer, when passed as an
30 * hypercall argument. It is 4 bytes on riscv32 and 8 bytes on riscv64.
31 */
32#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
33 ___DEFINE_XEN_GUEST_HANDLE(name, type); \
34 ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
35#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
36#define __XEN_GUEST_HANDLE(name) __guest_handle_64_ ## name
37#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
38#define XEN_GUEST_HANDLE_PARAM(name) __guest_handle_ ## name
39#define set_xen_guest_handle_raw(hnd, val) \
40 do { \
41 typeof(&(hnd)) sxghr_tmp_ = &(hnd); \
42 sxghr_tmp_->q = 0; \
43 sxghr_tmp_->p = (val); \
44 } while ( 0 )
45#define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
46
47typedef uint64_t xen_pfn_t;
48#define PRI_xen_pfn PRIx64
49#define PRIu_xen_pfn PRIu64
50
51typedef uint64_t xen_ulong_t;
52#define PRI_xen_ulong PRIx64
53
54#if defined(__XEN__) || defined(__XEN_TOOLS__)
55
56struct vcpu_guest_context {
57};
60
62};
63
64#endif
65
66/* TODO: add a placeholder entry if no real ones surface */
67struct arch_vcpu_info {
68};
69typedef struct arch_vcpu_info arch_vcpu_info_t;
70
71/* TODO: add a placeholder entry if no real ones surface */
72struct arch_shared_info {
73};
75
76/*
77 * Maximum number of virtual CPUs in legacy multi-processor guests.
78 * Only one. All other VCPUS must use VCPUOP_register_vcpu_info.
79 */
80#define XEN_LEGACY_MAX_VCPUS 1
81
82/* Stub definition of PMU structure */
84#endif
85
86#endif /* __XEN_PUBLIC_ARCH_RISCV_H__ */
87
88/*
89 * Local variables:
90 * mode: C
91 * c-file-style: "BSD"
92 * c-basic-offset: 4
93 * tab-width: 4
94 * indent-tabs-mode: nil
95 * End:
96 */
struct arch_vcpu_info arch_vcpu_info_t
Definition arch-arm.h:366
struct arch_shared_info arch_shared_info_t
Definition arch-arm.h:370
struct xen_pmu_arch xen_pmu_arch_t
struct vcpu_guest_context vcpu_guest_context_t
Definition arch-ppc.h:93
#define DEFINE_XEN_GUEST_HANDLE(name)
Definition arch-riscv.h:35
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
unsigned long xen_ulong_t
Definition nonxen.h:30
unsigned long xen_pfn_t
Definition nonxen.h:28
uint8_t dummy
Definition arch-arm.h:550