1111#define __XEN_PUBLIC_ARCH_ARM_H__
1212
1313FILE_LICENCE ( MIT );
14+ FILE_SECBOOT ( PERMITTED );
1415
1516/*
1617 * `incontents 50 arm_abi Hypercall Calling Convention
@@ -106,6 +107,7 @@ FILE_LICENCE ( MIT );
106107 * Exactly these sub-operations are supported:
107108 * * HVMOP_set_param
108109 * * HVMOP_get_param
110+ * * HVMOP_guest_request_vm_event
109111 *
110112 * HYPERVISOR_grant_table_op
111113 * All generic sub-operations
@@ -118,6 +120,32 @@ FILE_LICENCE ( MIT );
118120 * HYPERVISOR_argo_op
119121 * All generic sub-operations
120122 *
123+ * HYPERVISOR_hypfs_op
124+ * All generic sub-operations
125+ *
126+ * HYPERVISOR_platform_op
127+ * Exactly these sub-operations are supported:
128+ * * XENPF_settime64
129+ *
130+ * HYPERVISOR_vm_assist
131+ * All generic sub-operations
132+ *
133+ * HYPERVISOR_dm_op
134+ * Exactly these sub-operations are supported:
135+ * * XEN_DMOP_create_ioreq_server
136+ * * XEN_DMOP_get_ioreq_server_info
137+ * * XEN_DMOP_map_io_range_to_ioreq_server
138+ * * XEN_DMOP_unmap_io_range_from_ioreq_server
139+ * * XEN_DMOP_set_ioreq_server_state
140+ * * XEN_DMOP_destroy_ioreq_server
141+ * * XEN_DMOP_set_irq_level
142+ * * XEN_DMOP_nr_vcpus
143+ *
144+ * HYPERVISOR_xsm_op
145+ * All generic sub-operations
146+ *
147+ * HYPERVISOR_multicall
148+ *
121149 * Other notes on the ARM ABI:
122150 *
123151 * - struct start_info is not exported to ARM guests.
@@ -154,8 +182,10 @@ FILE_LICENCE ( MIT );
154182
155183#define XEN_HYPERCALL_TAG 0XEA1
156184
157- #define int64_aligned_t int64_t __attribute__((aligned(8)))
158- #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
185+ #if defined(__XEN__ ) || defined(__XEN_TOOLS__ ) || defined(__GNUC__ )
186+ #define int64_aligned_t int64_t __attribute__((__aligned__(8)))
187+ #define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
188+ #endif
159189
160190#ifndef __ASSEMBLY__
161191#define ___DEFINE_XEN_GUEST_HANDLE (name , type ) \
@@ -182,7 +212,7 @@ FILE_LICENCE ( MIT );
182212 do { \
183213 __typeof__(&(hnd)) _sxghr_tmp = &(hnd); \
184214 _sxghr_tmp->q = 0; \
185- _sxghr_tmp->p = val; \
215+ _sxghr_tmp->p = ( val); \
186216 } while ( 0 )
187217#define set_xen_guest_handle (hnd , val ) set_xen_guest_handle_raw(hnd, val)
188218
@@ -298,10 +328,16 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
298328
299329#define XEN_DOMCTL_CONFIG_TEE_NONE 0
300330#define XEN_DOMCTL_CONFIG_TEE_OPTEE 1
331+ #define XEN_DOMCTL_CONFIG_TEE_FFA 2
332+
333+ #define XEN_DOMCTL_CONFIG_ARM_SCI_NONE 0
334+ #define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC 1
301335
302336struct xen_arch_domainconfig {
303337 /* IN/OUT */
304338 uint8_t gic_version ;
339+ /* IN - Contains SVE vector length divided by 128 */
340+ uint8_t sve_vl ;
305341 /* IN */
306342 uint16_t tee_type ;
307343 /* IN */
@@ -320,6 +356,8 @@ struct xen_arch_domainconfig {
320356 *
321357 */
322358 uint32_t clock_frequency ;
359+ /* IN */
360+ uint8_t arm_sci_type ;
323361};
324362#endif /* __XEN__ || __XEN_TOOLS__ */
325363
@@ -338,36 +376,36 @@ typedef uint64_t xen_callback_t;
338376
339377/* PSR bits (CPSR, SPSR) */
340378
341- #define PSR_THUMB (1 <<5) /* Thumb Mode enable */
342- #define PSR_FIQ_MASK (1 <<6) /* Fast Interrupt mask */
343- #define PSR_IRQ_MASK (1 <<7) /* Interrupt mask */
344- #define PSR_ABT_MASK (1 <<8) /* Asynchronous Abort mask */
345- #define PSR_BIG_ENDIAN (1<<9) /* arm32: Big Endian Mode */
346- #define PSR_DBG_MASK (1<<9) /* arm64: Debug Exception mask */
347- #define PSR_IT_MASK (0x0600fc00) /* Thumb If-Then Mask */
348- #define PSR_JAZELLE (1<< 24) /* Jazelle Mode */
349- #define PSR_Z (1<< 30) /* Zero condition flag */
379+ #define PSR_THUMB (1U <<5) /* Thumb Mode enable */
380+ #define PSR_FIQ_MASK (1U <<6) /* Fast Interrupt mask */
381+ #define PSR_IRQ_MASK (1U <<7) /* Interrupt mask */
382+ #define PSR_ABT_MASK (1U <<8) /* Asynchronous Abort mask */
383+ #define PSR_BIG_ENDIAN (1U << 9) /* arm32: Big Endian Mode */
384+ #define PSR_DBG_MASK (1U << 9) /* arm64: Debug Exception mask */
385+ #define PSR_IT_MASK (0x0600fc00U) /* Thumb If-Then Mask */
386+ #define PSR_JAZELLE (1U << 24) /* Jazelle Mode */
387+ #define PSR_Z (1U << 30) /* Zero condition flag */
350388
351389/* 32 bit modes */
352- #define PSR_MODE_USR 0x10
353- #define PSR_MODE_FIQ 0x11
354- #define PSR_MODE_IRQ 0x12
355- #define PSR_MODE_SVC 0x13
356- #define PSR_MODE_MON 0x16
357- #define PSR_MODE_ABT 0x17
358- #define PSR_MODE_HYP 0x1a
359- #define PSR_MODE_UND 0x1b
360- #define PSR_MODE_SYS 0x1f
390+ #define PSR_MODE_USR 0x10U
391+ #define PSR_MODE_FIQ 0x11U
392+ #define PSR_MODE_IRQ 0x12U
393+ #define PSR_MODE_SVC 0x13U
394+ #define PSR_MODE_MON 0x16U
395+ #define PSR_MODE_ABT 0x17U
396+ #define PSR_MODE_HYP 0x1aU
397+ #define PSR_MODE_UND 0x1bU
398+ #define PSR_MODE_SYS 0x1fU
361399
362400/* 64 bit modes */
363- #define PSR_MODE_BIT 0x10 /* Set iff AArch32 */
364- #define PSR_MODE_EL3h 0x0d
365- #define PSR_MODE_EL3t 0x0c
366- #define PSR_MODE_EL2h 0x09
367- #define PSR_MODE_EL2t 0x08
368- #define PSR_MODE_EL1h 0x05
369- #define PSR_MODE_EL1t 0x04
370- #define PSR_MODE_EL0t 0x00
401+ #define PSR_MODE_BIT 0x10U /* Set iff AArch32 */
402+ #define PSR_MODE_EL3h 0x0dU
403+ #define PSR_MODE_EL3t 0x0cU
404+ #define PSR_MODE_EL2h 0x09U
405+ #define PSR_MODE_EL2t 0x08U
406+ #define PSR_MODE_EL1h 0x05U
407+ #define PSR_MODE_EL1t 0x04U
408+ #define PSR_MODE_EL0t 0x00U
371409
372410/*
373411 * We set PSR_Z to be able to boot Linux kernel versions with an invalid
@@ -457,7 +495,7 @@ typedef uint64_t xen_callback_t;
457495#define GUEST_RAM0_SIZE xen_mk_ullong(0xc0000000)
458496
459497/* 4GB @ 4GB Prefetch Memory for VPCI */
460- #define GUEST_VPCI_ADDR_TYPE_PREFETCH_MEM xen_mk_ullong(0x42000000 )
498+ #define GUEST_VPCI_ADDR_TYPE_PREFETCH_MEM xen_mk_ullong(0x43000000 )
461499#define GUEST_VPCI_PREFETCH_MEM_ADDR xen_mk_ullong(0x100000000)
462500#define GUEST_VPCI_PREFETCH_MEM_SIZE xen_mk_ullong(0x100000000)
463501
@@ -475,6 +513,7 @@ typedef uint64_t xen_callback_t;
475513#define GUEST_MAX_VCPUS 128
476514
477515/* Interrupts */
516+
478517#define GUEST_TIMER_VIRT_PPI 27
479518#define GUEST_TIMER_PHYS_S_PPI 29
480519#define GUEST_TIMER_PHYS_NS_PPI 30
@@ -485,6 +524,19 @@ typedef uint64_t xen_callback_t;
485524#define GUEST_VIRTIO_MMIO_SPI_FIRST 33
486525#define GUEST_VIRTIO_MMIO_SPI_LAST 43
487526
527+ /*
528+ * SGI is the preferred delivery mechanism of FF-A pending notifications or
529+ * schedule recveive interrupt. SGIs 8-15 are normally not used by a guest
530+ * as they in a non-virtualized system typically are assigned to the secure
531+ * world. Here we're free to use SGI 8-15 since they are virtual and have
532+ * nothing to do with the secure world.
533+ *
534+ * For partitioning of SGIs see also Arm Base System Architecture v1.0C,
535+ * https://developer.arm.com/documentation/den0094/
536+ */
537+ #define GUEST_FFA_NOTIF_PEND_INTR_ID 8
538+ #define GUEST_FFA_SCHEDULE_RECV_INTR_ID 9
539+
488540/* PSCI functions */
489541#define PSCI_cpu_suspend 0
490542#define PSCI_cpu_off 1
0 commit comments