Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 1 | # |
Marcin Juszkiewicz | b6839fb | 2023-05-10 10:03:01 +0200 | [diff] [blame] | 2 | # Copyright (c) 2019-2023, Linaro Limited and Contributors. All rights reserved. |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Chris Kay | e927215 | 2021-09-28 15:52:14 +0100 | [diff] [blame] | 7 | include common/fdt_wrappers.mk |
| 8 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 9 | CRASH_REPORTING := 1 |
| 10 | |
| 11 | include lib/libfdt/libfdt.mk |
| 12 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 13 | ifeq (${SPM_MM},1) |
| 14 | NEED_BL32 := yes |
| 15 | EL3_EXCEPTION_HANDLING := 1 |
| 16 | GICV2_G0_FOR_EL3 := 1 |
| 17 | endif |
| 18 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 19 | # Enable new version of image loading on QEMU platforms |
| 20 | LOAD_IMAGE_V2 := 1 |
| 21 | |
Chen Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 22 | CTX_INCLUDE_AARCH32_REGS := 0 |
| 23 | ifeq (${CTX_INCLUDE_AARCH32_REGS}, 1) |
| 24 | $(error "This is an AArch64-only port; CTX_INCLUDE_AARCH32_REGS must be disabled") |
| 25 | endif |
| 26 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 27 | ifeq ($(NEED_BL32),yes) |
| 28 | $(eval $(call add_define,QEMU_LOAD_BL32)) |
| 29 | endif |
| 30 | |
| 31 | PLAT_QEMU_PATH := plat/qemu/qemu_sbsa |
| 32 | PLAT_QEMU_COMMON_PATH := plat/qemu/common |
| 33 | PLAT_INCLUDES := -Iinclude/plat/arm/common/ \ |
| 34 | -I${PLAT_QEMU_COMMON_PATH}/include \ |
| 35 | -I${PLAT_QEMU_PATH}/include \ |
| 36 | -Iinclude/common/tbbr |
| 37 | |
| 38 | PLAT_INCLUDES += -Iinclude/plat/arm/common/${ARCH} |
| 39 | |
| 40 | PLAT_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 Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 44 | # Treating this as a memory-constrained port for now |
| 45 | USE_COHERENT_MEM := 0 |
| 46 | |
| 47 | # This can be overridden depending on CPU(s) used in the QEMU image |
| 48 | HW_ASSISTED_COHERENCY := 1 |
| 49 | |
| 50 | QEMU_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 Juszkiewicz | 16d667d | 2023-07-04 15:41:40 +0200 | [diff] [blame] | 54 | lib/cpus/aarch64/neoverse_v1.S \ |
Chen Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 55 | lib/cpus/aarch64/qemu_max.S |
| 56 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 57 | include lib/xlat_tables_v2/xlat_tables.mk |
| 58 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
| 59 | |
| 60 | BL1_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 Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 70 | BL1_SOURCES += ${QEMU_CPU_LIBS} |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 71 | |
| 72 | BL2_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) |
| 83 | ifeq (${LOAD_IMAGE_V2},1) |
| 84 | BL2_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 |
| 87 | endif |
| 88 | |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 89 | # Include GICv3 driver files |
| 90 | include drivers/arm/gic/v3/gicv3.mk |
| 91 | |
| 92 | QEMU_GIC_SOURCES := ${GICV3_SOURCES} \ |
Marcin Juszkiewicz | 79ee1c4 | 2023-05-15 11:07:54 +0200 | [diff] [blame] | 93 | plat/common/plat_gicv3.c |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 94 | |
Chen Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 95 | BL31_SOURCES += ${QEMU_CPU_LIBS} \ |
Andrew Walbran | f3a6839 | 2020-01-15 14:18:04 +0000 | [diff] [blame] | 96 | lib/semihosting/semihosting.c \ |
| 97 | lib/semihosting/${ARCH}/semihosting_call.S \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 98 | plat/common/plat_psci_common.c \ |
Marcin Juszkiewicz | 79ee1c4 | 2023-05-15 11:07:54 +0200 | [diff] [blame] | 99 | ${PLAT_QEMU_PATH}/sbsa_gic.c \ |
Graeme Gregory | 1a73223 | 2020-08-28 18:03:35 +0100 | [diff] [blame] | 100 | ${PLAT_QEMU_PATH}/sbsa_pm.c \ |
Marcin Juszkiewicz | b6839fb | 2023-05-10 10:03:01 +0200 | [diff] [blame] | 101 | ${PLAT_QEMU_PATH}/sbsa_sip_svc.c \ |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 102 | ${PLAT_QEMU_PATH}/sbsa_topology.c \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 103 | ${PLAT_QEMU_COMMON_PATH}/aarch64/plat_helpers.S \ |
| 104 | ${PLAT_QEMU_COMMON_PATH}/qemu_bl31_setup.c \ |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 105 | common/fdt_fixup.c \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 106 | ${QEMU_GIC_SOURCES} |
Chris Kay | e927215 | 2021-09-28 15:52:14 +0100 | [diff] [blame] | 107 | |
| 108 | BL31_SOURCES += ${FDT_WRAPPERS_SOURCES} |
| 109 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 110 | ifeq (${SPM_MM},1) |
| 111 | BL31_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_spm.c |
| 112 | endif |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 113 | |
| 114 | SEPARATE_CODE_AND_RODATA := 1 |
| 115 | ENABLE_STACK_PROTECTOR := 0 |
| 116 | ifneq ($(ENABLE_STACK_PROTECTOR), 0) |
| 117 | PLAT_BL_COMMON_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_stack_protector.c |
| 118 | endif |
| 119 | |
| 120 | MULTI_CONSOLE_API := 1 |
| 121 | |
| 122 | # Disable the PSCI platform compatibility layer |
| 123 | ENABLE_PLAT_COMPAT := 0 |
| 124 | |
| 125 | # Use known base for UEFI if not given from command line |
| 126 | # By default BL33 is at FLASH1 base |
| 127 | PRELOADED_BL33_BASE ?= 0x10000000 |
| 128 | |
| 129 | # Qemu SBSA plafrom only support SEC_SRAM |
| 130 | BL32_RAM_LOCATION_ID = SEC_SRAM_ID |
| 131 | $(eval $(call add_define,BL32_RAM_LOCATION_ID)) |
| 132 | |
Andrew Walbran | 9c4d069 | 2020-01-15 14:11:31 +0000 | [diff] [blame] | 133 | # Don't have the Linux kernel as a BL33 image by default |
| 134 | ARM_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 | |
| 138 | ARM_PRELOADED_DTB_BASE := PLAT_QEMU_DT_BASE |
| 139 | $(eval $(call add_define,ARM_PRELOADED_DTB_BASE)) |
| 140 | |
Marcin Juszkiewicz | 6c8b65a | 2022-11-16 14:47:51 +0100 | [diff] [blame] | 141 | # Later QEMU versions support SME and SVE. |
Jayanth Dodderi Chidanand | 656336b | 2023-03-31 10:42:10 +0100 | [diff] [blame] | 142 | ENABLE_SVE_FOR_NS := 2 |
| 143 | ENABLE_SME_FOR_NS := 2 |
Marcin Juszkiewicz | 056acb3 | 2023-02-14 09:27:59 +0100 | [diff] [blame] | 144 | |
| 145 | # QEMU 7.2+ has support for FGT and Linux needs it enabled to boot on max |
| 146 | ENABLE_FEAT_FGT := 2 |