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 \ |
| 54 | lib/cpus/aarch64/qemu_max.S |
| 55 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 56 | include lib/xlat_tables_v2/xlat_tables.mk |
| 57 | PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} |
| 58 | |
| 59 | BL1_SOURCES += drivers/io/io_semihosting.c \ |
| 60 | drivers/io/io_storage.c \ |
| 61 | drivers/io/io_fip.c \ |
| 62 | drivers/io/io_memmap.c \ |
| 63 | lib/semihosting/semihosting.c \ |
| 64 | lib/semihosting/${ARCH}/semihosting_call.S \ |
| 65 | ${PLAT_QEMU_COMMON_PATH}/qemu_io_storage.c \ |
| 66 | ${PLAT_QEMU_COMMON_PATH}/${ARCH}/plat_helpers.S \ |
| 67 | ${PLAT_QEMU_COMMON_PATH}/qemu_bl1_setup.c |
| 68 | |
Chen Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 69 | BL1_SOURCES += ${QEMU_CPU_LIBS} |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 70 | |
| 71 | BL2_SOURCES += drivers/io/io_semihosting.c \ |
| 72 | drivers/io/io_storage.c \ |
| 73 | drivers/io/io_fip.c \ |
| 74 | drivers/io/io_memmap.c \ |
| 75 | lib/semihosting/semihosting.c \ |
| 76 | lib/semihosting/${ARCH}/semihosting_call.S \ |
| 77 | ${PLAT_QEMU_COMMON_PATH}/qemu_io_storage.c \ |
| 78 | ${PLAT_QEMU_COMMON_PATH}/${ARCH}/plat_helpers.S \ |
| 79 | ${PLAT_QEMU_COMMON_PATH}/qemu_bl2_setup.c \ |
| 80 | common/fdt_fixup.c \ |
| 81 | $(LIBFDT_SRCS) |
| 82 | ifeq (${LOAD_IMAGE_V2},1) |
| 83 | BL2_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_bl2_mem_params_desc.c \ |
| 84 | ${PLAT_QEMU_COMMON_PATH}/qemu_image_load.c \ |
| 85 | common/desc_image_load.c |
| 86 | endif |
| 87 | |
Alexei Fedorov | 84f1b5d | 2020-03-23 18:45:17 +0000 | [diff] [blame] | 88 | # Include GICv3 driver files |
| 89 | include drivers/arm/gic/v3/gicv3.mk |
| 90 | |
| 91 | QEMU_GIC_SOURCES := ${GICV3_SOURCES} \ |
Marcin Juszkiewicz | 79ee1c4 | 2023-05-15 11:07:54 +0200 | [diff] [blame] | 92 | plat/common/plat_gicv3.c |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 93 | |
Chen Baozi | 58e256d | 2023-02-22 06:58:39 +0000 | [diff] [blame] | 94 | BL31_SOURCES += ${QEMU_CPU_LIBS} \ |
Andrew Walbran | f3a6839 | 2020-01-15 14:18:04 +0000 | [diff] [blame] | 95 | lib/semihosting/semihosting.c \ |
| 96 | lib/semihosting/${ARCH}/semihosting_call.S \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 97 | plat/common/plat_psci_common.c \ |
Marcin Juszkiewicz | 79ee1c4 | 2023-05-15 11:07:54 +0200 | [diff] [blame] | 98 | ${PLAT_QEMU_PATH}/sbsa_gic.c \ |
Graeme Gregory | 1a73223 | 2020-08-28 18:03:35 +0100 | [diff] [blame] | 99 | ${PLAT_QEMU_PATH}/sbsa_pm.c \ |
Marcin Juszkiewicz | b6839fb | 2023-05-10 10:03:01 +0200 | [diff] [blame] | 100 | ${PLAT_QEMU_PATH}/sbsa_sip_svc.c \ |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 101 | ${PLAT_QEMU_PATH}/sbsa_topology.c \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 102 | ${PLAT_QEMU_COMMON_PATH}/aarch64/plat_helpers.S \ |
| 103 | ${PLAT_QEMU_COMMON_PATH}/qemu_bl31_setup.c \ |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 104 | common/fdt_fixup.c \ |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 105 | ${QEMU_GIC_SOURCES} |
Chris Kay | e927215 | 2021-09-28 15:52:14 +0100 | [diff] [blame] | 106 | |
| 107 | BL31_SOURCES += ${FDT_WRAPPERS_SOURCES} |
| 108 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 109 | ifeq (${SPM_MM},1) |
| 110 | BL31_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_spm.c |
| 111 | endif |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 112 | |
| 113 | SEPARATE_CODE_AND_RODATA := 1 |
| 114 | ENABLE_STACK_PROTECTOR := 0 |
| 115 | ifneq ($(ENABLE_STACK_PROTECTOR), 0) |
| 116 | PLAT_BL_COMMON_SOURCES += ${PLAT_QEMU_COMMON_PATH}/qemu_stack_protector.c |
| 117 | endif |
| 118 | |
| 119 | MULTI_CONSOLE_API := 1 |
| 120 | |
| 121 | # Disable the PSCI platform compatibility layer |
| 122 | ENABLE_PLAT_COMPAT := 0 |
| 123 | |
| 124 | # Use known base for UEFI if not given from command line |
| 125 | # By default BL33 is at FLASH1 base |
| 126 | PRELOADED_BL33_BASE ?= 0x10000000 |
| 127 | |
| 128 | # Qemu SBSA plafrom only support SEC_SRAM |
| 129 | BL32_RAM_LOCATION_ID = SEC_SRAM_ID |
| 130 | $(eval $(call add_define,BL32_RAM_LOCATION_ID)) |
| 131 | |
Andrew Walbran | 9c4d069 | 2020-01-15 14:11:31 +0000 | [diff] [blame] | 132 | # Don't have the Linux kernel as a BL33 image by default |
| 133 | ARM_LINUX_KERNEL_AS_BL33 := 0 |
| 134 | $(eval $(call assert_boolean,ARM_LINUX_KERNEL_AS_BL33)) |
| 135 | $(eval $(call add_define,ARM_LINUX_KERNEL_AS_BL33)) |
| 136 | |
| 137 | ARM_PRELOADED_DTB_BASE := PLAT_QEMU_DT_BASE |
| 138 | $(eval $(call add_define,ARM_PRELOADED_DTB_BASE)) |
| 139 | |
Marcin Juszkiewicz | 6c8b65a | 2022-11-16 14:47:51 +0100 | [diff] [blame] | 140 | # Later QEMU versions support SME and SVE. |
Jayanth Dodderi Chidanand | 656336b | 2023-03-31 10:42:10 +0100 | [diff] [blame] | 141 | ENABLE_SVE_FOR_NS := 2 |
| 142 | ENABLE_SME_FOR_NS := 2 |
Marcin Juszkiewicz | 056acb3 | 2023-02-14 09:27:59 +0100 | [diff] [blame] | 143 | |
| 144 | # QEMU 7.2+ has support for FGT and Linux needs it enabled to boot on max |
| 145 | ENABLE_FEAT_FGT := 2 |