blob: 3dfefd0826e9de592cd087a3acb331d76330fcb5 [file] [log] [blame]
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +02001#
Marcin Juszkiewiczb6839fb2023-05-10 10:03:01 +02002# Copyright (c) 2019-2023, Linaro Limited and Contributors. All rights reserved.
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Chris Kaye9272152021-09-28 15:52:14 +01007include common/fdt_wrappers.mk
8
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +02009CRASH_REPORTING := 1
10
11include lib/libfdt/libfdt.mk
12
Masahisa Kojima099064b2020-06-11 21:46:44 +090013ifeq (${SPM_MM},1)
14NEED_BL32 := yes
15EL3_EXCEPTION_HANDLING := 1
16GICV2_G0_FOR_EL3 := 1
17endif
18
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020019# Enable new version of image loading on QEMU platforms
20LOAD_IMAGE_V2 := 1
21
Chen Baozi58e256d2023-02-22 06:58:39 +000022CTX_INCLUDE_AARCH32_REGS := 0
23ifeq (${CTX_INCLUDE_AARCH32_REGS}, 1)
24$(error "This is an AArch64-only port; CTX_INCLUDE_AARCH32_REGS must be disabled")
25endif
26
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020027ifeq ($(NEED_BL32),yes)
28$(eval $(call add_define,QEMU_LOAD_BL32))
29endif
30
31PLAT_QEMU_PATH := plat/qemu/qemu_sbsa
32PLAT_QEMU_COMMON_PATH := plat/qemu/common
33PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
34 -I${PLAT_QEMU_COMMON_PATH}/include \
35 -I${PLAT_QEMU_PATH}/include \
36 -Iinclude/common/tbbr
37
38PLAT_INCLUDES += -Iinclude/plat/arm/common/${ARCH}
39
40PLAT_BL_COMMON_SOURCES := ${PLAT_QEMU_COMMON_PATH}/qemu_common.c \
41 ${PLAT_QEMU_COMMON_PATH}/qemu_console.c \
42 drivers/arm/pl011/${ARCH}/pl011_console.S
43
Chen Baozi58e256d2023-02-22 06:58:39 +000044# Treating this as a memory-constrained port for now
45USE_COHERENT_MEM := 0
46
47# This can be overridden depending on CPU(s) used in the QEMU image
48HW_ASSISTED_COHERENCY := 1
49
50QEMU_CPU_LIBS := lib/cpus/aarch64/cortex_a57.S \
51 lib/cpus/aarch64/cortex_a72.S \
52 lib/cpus/aarch64/neoverse_n_common.S \
53 lib/cpus/aarch64/neoverse_n1.S \
Marcin Juszkiewicz16d667d2023-07-04 15:41:40 +020054 lib/cpus/aarch64/neoverse_v1.S \
Chen Baozi58e256d2023-02-22 06:58:39 +000055 lib/cpus/aarch64/qemu_max.S
56
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020057include lib/xlat_tables_v2/xlat_tables.mk
58PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
59
60BL1_SOURCES += drivers/io/io_semihosting.c \
61 drivers/io/io_storage.c \
62 drivers/io/io_fip.c \
63 drivers/io/io_memmap.c \
64 lib/semihosting/semihosting.c \
65 lib/semihosting/${ARCH}/semihosting_call.S \
66 ${PLAT_QEMU_COMMON_PATH}/qemu_io_storage.c \
67 ${PLAT_QEMU_COMMON_PATH}/${ARCH}/plat_helpers.S \
68 ${PLAT_QEMU_COMMON_PATH}/qemu_bl1_setup.c
69
Chen Baozi58e256d2023-02-22 06:58:39 +000070BL1_SOURCES += ${QEMU_CPU_LIBS}
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020071
72BL2_SOURCES += drivers/io/io_semihosting.c \
73 drivers/io/io_storage.c \
74 drivers/io/io_fip.c \
75 drivers/io/io_memmap.c \
76 lib/semihosting/semihosting.c \
77 lib/semihosting/${ARCH}/semihosting_call.S \
78 ${PLAT_QEMU_COMMON_PATH}/qemu_io_storage.c \
79 ${PLAT_QEMU_COMMON_PATH}/${ARCH}/plat_helpers.S \
80 ${PLAT_QEMU_COMMON_PATH}/qemu_bl2_setup.c \
81 common/fdt_fixup.c \
82 $(LIBFDT_SRCS)
83ifeq (${LOAD_IMAGE_V2},1)
84BL2_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_bl2_mem_params_desc.c \
85 ${PLAT_QEMU_COMMON_PATH}/qemu_image_load.c \
86 common/desc_image_load.c
87endif
88
Alexei Fedorov84f1b5d2020-03-23 18:45:17 +000089# Include GICv3 driver files
90include drivers/arm/gic/v3/gicv3.mk
91
92QEMU_GIC_SOURCES := ${GICV3_SOURCES} \
Marcin Juszkiewicz79ee1c42023-05-15 11:07:54 +020093 plat/common/plat_gicv3.c
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020094
Chen Baozi58e256d2023-02-22 06:58:39 +000095BL31_SOURCES += ${QEMU_CPU_LIBS} \
Andrew Walbranf3a68392020-01-15 14:18:04 +000096 lib/semihosting/semihosting.c \
97 lib/semihosting/${ARCH}/semihosting_call.S \
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +020098 plat/common/plat_psci_common.c \
Marcin Juszkiewicz79ee1c42023-05-15 11:07:54 +020099 ${PLAT_QEMU_PATH}/sbsa_gic.c \
Graeme Gregory1a732232020-08-28 18:03:35 +0100100 ${PLAT_QEMU_PATH}/sbsa_pm.c \
Marcin Juszkiewiczb6839fb2023-05-10 10:03:01 +0200101 ${PLAT_QEMU_PATH}/sbsa_sip_svc.c \
Graeme Gregory10e92232020-08-28 16:37:02 +0100102 ${PLAT_QEMU_PATH}/sbsa_topology.c \
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +0200103 ${PLAT_QEMU_COMMON_PATH}/aarch64/plat_helpers.S \
104 ${PLAT_QEMU_COMMON_PATH}/qemu_bl31_setup.c \
Masahisa Kojima7e917dc2020-09-23 16:52:59 +0900105 common/fdt_fixup.c \
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +0200106 ${QEMU_GIC_SOURCES}
Chris Kaye9272152021-09-28 15:52:14 +0100107
108BL31_SOURCES += ${FDT_WRAPPERS_SOURCES}
109
Masahisa Kojima099064b2020-06-11 21:46:44 +0900110ifeq (${SPM_MM},1)
111 BL31_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_spm.c
112endif
Radoslaw Biernacki1201aba2018-05-17 22:52:49 +0200113
114SEPARATE_CODE_AND_RODATA := 1
115ENABLE_STACK_PROTECTOR := 0
116ifneq ($(ENABLE_STACK_PROTECTOR), 0)
117 PLAT_BL_COMMON_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_stack_protector.c
118endif
119
120MULTI_CONSOLE_API := 1
121
122# Disable the PSCI platform compatibility layer
123ENABLE_PLAT_COMPAT := 0
124
125# Use known base for UEFI if not given from command line
126# By default BL33 is at FLASH1 base
127PRELOADED_BL33_BASE ?= 0x10000000
128
129# Qemu SBSA plafrom only support SEC_SRAM
130BL32_RAM_LOCATION_ID = SEC_SRAM_ID
131$(eval $(call add_define,BL32_RAM_LOCATION_ID))
132
Andrew Walbran9c4d0692020-01-15 14:11:31 +0000133# Don't have the Linux kernel as a BL33 image by default
134ARM_LINUX_KERNEL_AS_BL33 := 0
135$(eval $(call assert_boolean,ARM_LINUX_KERNEL_AS_BL33))
136$(eval $(call add_define,ARM_LINUX_KERNEL_AS_BL33))
137
138ARM_PRELOADED_DTB_BASE := PLAT_QEMU_DT_BASE
139$(eval $(call add_define,ARM_PRELOADED_DTB_BASE))
140
Marcin Juszkiewicz6c8b65a2022-11-16 14:47:51 +0100141# Later QEMU versions support SME and SVE.
Jayanth Dodderi Chidanand656336b2023-03-31 10:42:10 +0100142ENABLE_SVE_FOR_NS := 2
143ENABLE_SME_FOR_NS := 2
Marcin Juszkiewicz056acb32023-02-14 09:27:59 +0100144
145# QEMU 7.2+ has support for FGT and Linux needs it enabled to boot on max
146ENABLE_FEAT_FGT := 2