xref: /rk3399_ARM-atf/plat/qemu/qemu_sbsa/include/platform_def.h (revision b47dddd061e92054c3b2096fc8aa9688bfef68d6)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright (c) 2019-2020, Linaro Limited and Contributors.
4  * All rights reserved.
5  */
6 
7 #ifndef PLATFORM_DEF_H
8 #define PLATFORM_DEF_H
9 
10 #include <arch.h>
11 #include <plat/common/common_def.h>
12 #include <tbbr_img_def.h>
13 
14 /* Special value used to verify platform parameters from BL2 to BL3-1 */
15 #define QEMU_BL31_PLAT_PARAM_VAL	0x0f1e2d3c4b5a6978ULL
16 
17 #define PLATFORM_STACK_SIZE		0x1000
18 
19 #define PLATFORM_MAX_CPUS_PER_CLUSTER	U(8)
20 /*
21  * Define the number of cores per cluster used in calculating core position.
22  * The cluster number is shifted by this value and added to the core ID,
23  * so its value represents log2(cores/cluster).
24  * Default is 2**(3) = 8 cores per cluster.
25  */
26 #define PLATFORM_CPU_PER_CLUSTER_SHIFT	U(3)
27 #define PLATFORM_CLUSTER_COUNT		U(64)
28 #define PLATFORM_CORE_COUNT		(PLATFORM_CLUSTER_COUNT * \
29 					PLATFORM_MAX_CPUS_PER_CLUSTER)
30 #define QEMU_PRIMARY_CPU		U(0)
31 
32 #define PLAT_NUM_PWR_DOMAINS		(PLATFORM_CLUSTER_COUNT + \
33 					PLATFORM_CORE_COUNT)
34 #define PLAT_MAX_PWR_LVL		MPIDR_AFFLVL1
35 
36 #define PLAT_MAX_RET_STATE		1
37 #define PLAT_MAX_OFF_STATE		2
38 
39 /* Local power state for power domains in Run state. */
40 #define PLAT_LOCAL_STATE_RUN		0
41 /* Local power state for retention. Valid only for CPU power domains */
42 #define PLAT_LOCAL_STATE_RET		1
43 /*
44  * Local power state for OFF/power-down. Valid for CPU and cluster power
45  * domains.
46  */
47 #define PLAT_LOCAL_STATE_OFF		2
48 
49 /*
50  * Macros used to parse state information from State-ID if it is using the
51  * recommended encoding for State-ID.
52  */
53 #define PLAT_LOCAL_PSTATE_WIDTH		4
54 #define PLAT_LOCAL_PSTATE_MASK		((1 << PLAT_LOCAL_PSTATE_WIDTH) - 1)
55 
56 /*
57  * Some data must be aligned on the biggest cache line size in the platform.
58  * This is known only to the platform as it might have a combination of
59  * integrated and external caches.
60  */
61 #define CACHE_WRITEBACK_SHIFT		6
62 #define CACHE_WRITEBACK_GRANULE		(1 << CACHE_WRITEBACK_SHIFT)
63 
64 /*
65  * Define the max number of memory nodes.
66  */
67 #define PLAT_MAX_MEM_NODES	128
68 
69 /* Where QEMU starts the NS RAM */
70 #define PLAT_QEMU_DRAM0_BASE	0x10000000000ULL
71 
72 /*
73  * Partition memory into secure ROM, non-secure DRAM, secure "SRAM",
74  * and secure DRAM.
75  */
76 #define SEC_ROM_BASE			0x00000000
77 #define SEC_ROM_SIZE			0x00020000
78 
79 /*
80  * When the RME extension is enabled, the base of the NS RAM is shifted after
81  * RMM.
82  */
83 #define NS_DRAM0_BASE			(PLAT_QEMU_DRAM0_BASE + \
84 					NS_DRAM0_BASE_OFFSET)
85 #define NS_DRAM0_SIZE			0x00020000000
86 
87 #define SEC_SRAM_BASE			0x20000000
88 #define SEC_SRAM_SIZE			0x20000000
89 
90 /*
91  * RAD just placeholders, need to be chosen after finalizing mem map
92  */
93 #define SEC_DRAM_BASE			0x1000
94 #define SEC_DRAM_SIZE			0x1000
95 
96 /* Load pageable part of OP-TEE 2MB above secure DRAM base */
97 #define QEMU_OPTEE_PAGEABLE_LOAD_BASE	(SEC_DRAM_BASE + 0x00200000)
98 #define QEMU_OPTEE_PAGEABLE_LOAD_SIZE	0x00400000
99 
100 /*
101  * ARM-TF lives in SRAM, partition it here
102  */
103 
104 #define SHARED_RAM_BASE			SEC_SRAM_BASE
105 #define SHARED_RAM_SIZE			0x00002000
106 
107 #define PLAT_QEMU_TRUSTED_MAILBOX_BASE	SHARED_RAM_BASE
108 #define PLAT_QEMU_TRUSTED_MAILBOX_SIZE	(8 + PLAT_QEMU_HOLD_SIZE)
109 #define PLAT_QEMU_HOLD_BASE		(PLAT_QEMU_TRUSTED_MAILBOX_BASE + 8)
110 #define PLAT_QEMU_HOLD_SIZE		(PLATFORM_CORE_COUNT * \
111 					 PLAT_QEMU_HOLD_ENTRY_SIZE)
112 #define PLAT_QEMU_HOLD_ENTRY_SHIFT	3
113 #define PLAT_QEMU_HOLD_ENTRY_SIZE	(1 << PLAT_QEMU_HOLD_ENTRY_SHIFT)
114 #define PLAT_QEMU_HOLD_STATE_WAIT	0
115 #define PLAT_QEMU_HOLD_STATE_GO		1
116 
117 #define BL_RAM_BASE			(SHARED_RAM_BASE + SHARED_RAM_SIZE)
118 #define BL_RAM_SIZE			(SEC_SRAM_SIZE - SHARED_RAM_SIZE)
119 
120 /*
121  * BL1 specific defines.
122  *
123  * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of
124  * addresses.
125  * Put BL1 RW at the top of the Secure SRAM. BL1_RW_BASE is calculated using
126  * the current BL1 RW debug size plus a little space for growth.
127  */
128 #define BL1_SIZE			0x12000
129 #define BL1_RO_BASE			SEC_ROM_BASE
130 #define BL1_RO_LIMIT			(SEC_ROM_BASE + SEC_ROM_SIZE)
131 #define BL1_RW_BASE			(BL1_RW_LIMIT - BL1_SIZE)
132 #define BL1_RW_LIMIT			(BL_RAM_BASE + BL_RAM_SIZE - \
133 					 RME_GPT_DRAM_SIZE)
134 
135 /*
136  * BL2 specific defines.
137  *
138  * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug
139  * size plus a little space for growth.
140  */
141 #define BL2_SIZE			0x1D000
142 #define BL2_BASE			(BL31_BASE - BL2_SIZE)
143 #define BL2_LIMIT			BL31_BASE
144 
145 /*
146  * BL3-1 specific defines.
147  *
148  * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the
149  * current BL3-1 debug size plus a little space for growth.
150  */
151 #define BL31_SIZE			0x400000
152 #define BL31_BASE			(BL31_LIMIT - BL31_SIZE)
153 #define BL31_LIMIT			(BL1_RW_BASE - FW_HANDOFF_SIZE)
154 #define BL31_PROGBITS_LIMIT		BL1_RW_BASE
155 
156 #if TRANSFER_LIST
157 #define FW_HANDOFF_BASE			BL31_LIMIT
158 #define FW_HANDOFF_LIMIT		(FW_HANDOFF_BASE + FW_HANDOFF_SIZE)
159 #define FW_HANDOFF_SIZE			0x4000
160 #else
161 #define FW_HANDOFF_SIZE			0
162 #endif
163 #if TRANSFER_LIST
164 #define FW_NS_HANDOFF_BASE		(NS_IMAGE_OFFSET - FW_HANDOFF_SIZE)
165 #endif
166 
167 /*
168  * BL3-2 specific defines.
169  *
170  * BL3-2 can execute from Secure SRAM, or Secure DRAM.
171  */
172 #define BL32_SRAM_BASE			BL_RAM_BASE
173 #define BL32_SRAM_LIMIT			BL2_BASE
174 
175 #define BL32_MEM_BASE			BL_RAM_BASE
176 #define BL32_MEM_SIZE			(BL_RAM_SIZE - RME_GPT_DRAM_SIZE - \
177 					BL1_SIZE - BL2_SIZE - BL31_SIZE)
178 #define BL32_BASE			BL32_SRAM_BASE
179 #define BL32_LIMIT			BL32_SRAM_LIMIT
180 
181 #define NS_IMAGE_OFFSET			(NS_DRAM0_BASE + 0x20000000)
182 #define NS_IMAGE_MAX_SIZE		(NS_DRAM0_SIZE - 0x20000000)
183 
184 #define PLAT_PHY_ADDR_SPACE_SIZE	(1ull << 42)
185 #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ull << 42)
186 #if SPM_MM
187 #define MAX_MMAP_REGIONS		13
188 #define MAX_XLAT_TABLES			13
189 #elif ENABLE_RME
190 #define MAX_MMAP_REGIONS		15
191 #define MAX_XLAT_TABLES			15
192 #else
193 #define MAX_MMAP_REGIONS		12
194 #define MAX_XLAT_TABLES			12
195 #endif
196 #define MAX_IO_DEVICES			3
197 #define MAX_IO_HANDLES			4
198 
199 #if SPM_MM && defined(IMAGE_BL31)
200 # define PLAT_SP_IMAGE_MMAP_REGIONS	30
201 # define PLAT_SP_IMAGE_MAX_XLAT_TABLES	50
202 #endif
203 
204 /*
205  * PL011 related constants
206  */
207 #define UART0_BASE			0x60000000
208 #define UART1_BASE			0x60030000
209 #define UART0_CLK_IN_HZ			1
210 #define UART1_CLK_IN_HZ			1
211 
212 /* Secure UART */
213 #define UART2_BASE			0x60040000
214 #define UART2_CLK_IN_HZ			1
215 
216 #define PLAT_QEMU_BOOT_UART_BASE	UART0_BASE
217 #define PLAT_QEMU_BOOT_UART_CLK_IN_HZ	UART0_CLK_IN_HZ
218 
219 #define PLAT_QEMU_CRASH_UART_BASE	UART1_BASE
220 #define PLAT_QEMU_CRASH_UART_CLK_IN_HZ	UART1_CLK_IN_HZ
221 
222 #define PLAT_QEMU_CONSOLE_BAUDRATE	115200
223 
224 #define QEMU_FLASH0_BASE		0x00000000
225 #define QEMU_FLASH0_SIZE		0x10000000
226 #define QEMU_FLASH1_BASE		0x10000000
227 #define QEMU_FLASH1_SIZE		0x10000000
228 
229 #define PLAT_QEMU_FIP_BASE		BL1_SIZE
230 #define PLAT_QEMU_FIP_MAX_SIZE		(QEMU_FLASH0_SIZE - BL1_SIZE)
231 
232 /* This is map from GIC_DIST up to last CPU (255) GIC_REDISTR */
233 #define DEVICE0_BASE			0x40000000
234 #define DEVICE0_SIZE			0x04080000
235 /* This is map from NORMAL_UART up to SECURE_UART_MM */
236 #define DEVICE1_BASE			0x60000000
237 #define DEVICE1_SIZE			0x10041000
238 /* This is a map for SECURE_EC */
239 #define DEVICE2_BASE			0x50000000
240 #define DEVICE2_SIZE			0x00001000
241 
242 /*
243  * GIC related constants
244  * We use GICv3 where CPU Interface registers are not memory mapped
245  *
246  * Legacy values - on platform version 0.1+ they are read from DT
247  */
248 #define GICD_BASE			0x40060000
249 #define GICR_BASE			0x40080000
250 #define GICC_BASE			0x0
251 
252 #define QEMU_IRQ_SEC_SGI_0		8
253 #define QEMU_IRQ_SEC_SGI_1		9
254 #define QEMU_IRQ_SEC_SGI_2		10
255 #define QEMU_IRQ_SEC_SGI_3		11
256 #define QEMU_IRQ_SEC_SGI_4		12
257 #define QEMU_IRQ_SEC_SGI_5		13
258 #define QEMU_IRQ_SEC_SGI_6		14
259 #define QEMU_IRQ_SEC_SGI_7		15
260 
261 /******************************************************************************
262  * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
263  * interrupts.
264  *****************************************************************************/
265 #define PLATFORM_G1S_PROPS(grp)						\
266 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY,	\
267 					   grp, GIC_INTR_CFG_EDGE),	\
268 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY,	\
269 					   grp, GIC_INTR_CFG_EDGE),	\
270 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY,	\
271 					   grp, GIC_INTR_CFG_EDGE),	\
272 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY,	\
273 					   grp, GIC_INTR_CFG_EDGE),	\
274 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY,	\
275 					   grp, GIC_INTR_CFG_EDGE),	\
276 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY,	\
277 					   grp, GIC_INTR_CFG_EDGE),	\
278 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY,	\
279 					   grp, GIC_INTR_CFG_EDGE),	\
280 	INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY,	\
281 					   grp, GIC_INTR_CFG_EDGE)
282 
283 #define PLATFORM_G0_PROPS(grp)
284 
285 /*
286  * DT related constants
287  */
288 #define PLAT_QEMU_DT_BASE		NS_DRAM0_BASE
289 #define PLAT_QEMU_DT_MAX_SIZE		0x100000
290 
291 #if SPM_MM
292 #define PLAT_QEMU_SP_IMAGE_BASE		BL_RAM_BASE
293 #define PLAT_QEMU_SP_IMAGE_SIZE		ULL(0x300000)
294 
295 #ifdef IMAGE_BL2
296 /* In BL2 all memory allocated to the SPM Payload image is marked as RW. */
297 # define QEMU_SP_IMAGE_MMAP		MAP_REGION_FLAT( \
298 						PLAT_QEMU_SP_IMAGE_BASE, \
299 						PLAT_QEMU_SP_IMAGE_SIZE, \
300 						MT_MEMORY | MT_RW | \
301 						MT_SECURE)
302 #elif IMAGE_BL31
303 /* All SPM Payload memory is marked as code in S-EL0 */
304 # define QEMU_SP_IMAGE_MMAP		MAP_REGION2(PLAT_QEMU_SP_IMAGE_BASE, \
305 						PLAT_QEMU_SP_IMAGE_BASE, \
306 						PLAT_QEMU_SP_IMAGE_SIZE, \
307 						MT_CODE | MT_SECURE | \
308 						MT_USER,		\
309 						PAGE_SIZE)
310 #endif
311 
312 /*
313  * EL3 -> S-EL0 secure shared memory
314  */
315 #define PLAT_SPM_BUF_PCPU_SIZE		ULL(0x10000)
316 #define PLAT_SPM_BUF_SIZE		(PLATFORM_CORE_COUNT * \
317 					PLAT_SPM_BUF_PCPU_SIZE)
318 #define PLAT_SPM_BUF_BASE		(BL32_LIMIT - PLAT_SPM_BUF_SIZE)
319 
320 #define QEMU_SPM_BUF_EL3_MMAP		MAP_REGION_FLAT(PLAT_SPM_BUF_BASE, \
321 						PLAT_SPM_BUF_SIZE, \
322 						MT_RW_DATA | MT_SECURE)
323 
324 #define QEMU_SPM_BUF_EL0_MMAP		MAP_REGION2(PLAT_SPM_BUF_BASE,	\
325 						PLAT_SPM_BUF_BASE,	\
326 						PLAT_SPM_BUF_SIZE,	\
327 						MT_RO_DATA | MT_SECURE | \
328 						MT_USER,		\
329 						PAGE_SIZE)
330 
331 /*
332  * Shared memory between Normal world and S-EL0 for
333  * passing data during service requests. It will be marked as RW and NS.
334  * This buffer is allocated at the top of NS_DRAM, the base address is
335  * overridden in SPM initialization.
336  */
337 #define PLAT_QEMU_SP_IMAGE_NS_BUF_BASE	(PLAT_QEMU_DT_BASE +		\
338 						PLAT_QEMU_DT_MAX_SIZE)
339 #define PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE	ULL(0x200000)
340 
341 #define QEMU_SP_IMAGE_NS_BUF_MMAP	MAP_REGION2( \
342 					PLAT_QEMU_SP_IMAGE_NS_BUF_BASE, \
343 					PLAT_QEMU_SP_IMAGE_NS_BUF_BASE, \
344 					PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE, \
345 					MT_RW_DATA | MT_NS | \
346 					MT_USER, \
347 					PAGE_SIZE)
348 
349 #define PLAT_SP_IMAGE_NS_BUF_BASE	PLAT_QEMU_SP_IMAGE_NS_BUF_BASE
350 #define PLAT_SP_IMAGE_NS_BUF_SIZE	PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE
351 
352 #define PLAT_QEMU_SP_IMAGE_HEAP_BASE	(PLAT_QEMU_SP_IMAGE_BASE + \
353 					PLAT_QEMU_SP_IMAGE_SIZE)
354 #define PLAT_QEMU_SP_IMAGE_HEAP_SIZE	ULL(0x800000)
355 
356 #define PLAT_SP_IMAGE_STACK_BASE	(PLAT_QEMU_SP_IMAGE_HEAP_BASE + \
357 						PLAT_QEMU_SP_IMAGE_HEAP_SIZE)
358 #define PLAT_SP_IMAGE_STACK_PCPU_SIZE	ULL(0x10000)
359 #define QEMU_SP_IMAGE_STACK_TOTAL_SIZE	(PLATFORM_CORE_COUNT * \
360 						PLAT_SP_IMAGE_STACK_PCPU_SIZE)
361 
362 #define QEMU_SP_IMAGE_RW_MMAP		MAP_REGION2( \
363 					PLAT_QEMU_SP_IMAGE_HEAP_BASE, \
364 					PLAT_QEMU_SP_IMAGE_HEAP_BASE, \
365 					(QEMU_SP_IMAGE_STACK_TOTAL_SIZE + \
366 					PLAT_QEMU_SP_IMAGE_HEAP_SIZE), \
367 					MT_RW_DATA | MT_SECURE | \
368 					MT_USER, \
369 					PAGE_SIZE)
370 
371 /*
372  * Secure variable storage is located at Secure Flash.
373  */
374 #if SPM_MM
375 #define QEMU_SECURE_VARSTORE_BASE 0x01000000
376 #define QEMU_SECURE_VARSTORE_SIZE 0x00100000
377 #define MAP_SECURE_VARSTORE		MAP_REGION_FLAT( \
378 					QEMU_SECURE_VARSTORE_BASE, \
379 					QEMU_SECURE_VARSTORE_SIZE, \
380 					MT_DEVICE | MT_RW | \
381 					MT_SECURE | MT_USER)
382 #endif
383 
384 /* Total number of memory regions with distinct properties */
385 #define PLAT_QEMU_SP_IMAGE_NUM_MEM_REGIONS	6
386 
387 /*
388  * Name of the section to put the translation tables used by the S-EL1/S-EL0
389  * context of a Secure Partition.
390  */
391 #define PLAT_SP_IMAGE_XLAT_SECTION_NAME		".qemu_sp_xlat_table"
392 #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME	".qemu_sp_xlat_table"
393 
394 /* Cookies passed to the Secure Partition at boot. Not used by QEMU platforms.*/
395 #define PLAT_SPM_COOKIE_0		ULL(0)
396 #define PLAT_SPM_COOKIE_1		ULL(0)
397 #endif
398 
399 #define QEMU_PRI_BITS		2
400 #define PLAT_SP_PRI		0x20
401 
402 #if !ENABLE_RME
403 #define RME_GPT_DRAM_SIZE	0
404 #define NS_DRAM0_BASE_OFFSET	0
405 #else /* !ENABLE_RME */
406 /*
407  * SBSA RAM starts at 1TB and we support up to 1TB of RAM.  As such we
408  * have 2TB of physical address space to cover.  Since the GPT size can be
409  * 4GB, 64GB, 1TB, 4TB and so on, we need to select 4GB.  Note that it is
410  * possible to support more than 1TB of RAM but that will take more room in
411  * secure memory due to the L1 GPTES.  See PLAT_QEMU_L1_GPT_SIZE for details.
412  *
413  * 4TB / 1GB == 4096 GPTEs
414  * 4096 * 8 (bytes per GPTE) == 32768 i.e 8 pages
415  */
416 #define PLAT_QEMU_L0_GPT_SIZE	(8 * PAGE_SIZE)
417 #define PLAT_QEMU_L0_GPT_BASE	(PLAT_QEMU_L1_GPT_BASE - \
418 				 PLAT_QEMU_L0_GPT_SIZE)
419 
420 
421 /*
422  * If we have 1TB of RAM and each L1GPT covers 1GB, we need 1024 L1GPTs. With
423  * one more L1GPT to cover the other physical address spaces (see pas_regions[]
424  * in qemu_bl31_setup.c), we need a total of 1025 L1GPTs.  Each L1GPT is 131072
425  * bytes, so we need 1025 * 131072 bytes = 0x8020000 of RAM to hold the L1GPTS.
426  */
427 #define PLAT_QEMU_L1_GPT_SIZE	UL(0x08020000)
428 #define PLAT_QEMU_L1_GPT_BASE	(BL_RAM_BASE + BL_RAM_SIZE - \
429 				 PLAT_QEMU_L1_GPT_SIZE)
430 
431 #define RME_GPT_DRAM_BASE	PLAT_QEMU_L0_GPT_BASE
432 #define RME_GPT_DRAM_SIZE	(PLAT_QEMU_L1_GPT_SIZE + \
433 				 PLAT_QEMU_L0_GPT_SIZE)
434 
435 #ifndef __ASSEMBLER__
436 /* L0 table greater than 4KB must be naturally aligned */
437 CASSERT((PLAT_QEMU_L0_GPT_BASE & (PLAT_QEMU_L0_GPT_SIZE - 1)) == 0,
438 	assert_l0_gpt_naturally_aligned);
439 #endif
440 
441 /* Reserved some DRAM space for RMM (1072MB) */
442 #define REALM_DRAM_BASE			PLAT_QEMU_DRAM0_BASE
443 #define REALM_DRAM_SIZE			0x43000000
444 
445 #define PLAT_QEMU_RMM_SIZE		(REALM_DRAM_SIZE - RMM_SHARED_SIZE)
446 #define PLAT_QEMU_RMM_SHARED_SIZE	(PAGE_SIZE)	/* 4KB */
447 
448 #define RMM_BASE			(REALM_DRAM_BASE)
449 #define RMM_LIMIT			(RMM_BASE + PLAT_QEMU_RMM_SIZE)
450 #define RMM_SHARED_BASE			(RMM_LIMIT)
451 #define RMM_SHARED_SIZE			PLAT_QEMU_RMM_SHARED_SIZE
452 
453 #define MAP_GPT_L0_REGION		MAP_REGION_FLAT(		\
454 					PLAT_QEMU_L0_GPT_BASE,		\
455 					(PLAT_QEMU_L0_GPT_SIZE),	\
456 					MT_MEMORY | MT_RW | EL3_PAS)
457 
458 #define MAP_GPT_L1_REGION		MAP_REGION_FLAT(		\
459 					PLAT_QEMU_L1_GPT_BASE,		\
460 					PLAT_QEMU_L1_GPT_SIZE,		\
461 					MT_MEMORY | MT_RW | EL3_PAS)
462 /*
463  * We add the RMM_SHARED size to RMM mapping to map the region as a block.
464  * Else we end up requiring more pagetables in BL2 for ROMLIB build.
465  */
466 #define MAP_RMM_DRAM			MAP_REGION_FLAT(		\
467 					RMM_BASE,			\
468 					(PLAT_QEMU_RMM_SIZE +		\
469 					 RMM_SHARED_SIZE),		\
470 					MT_MEMORY | MT_RW | MT_REALM)
471 
472 #define MAP_RMM_SHARED_MEM		MAP_REGION_FLAT(		\
473 					RMM_SHARED_BASE,		\
474 					RMM_SHARED_SIZE,		\
475 					MT_MEMORY | MT_RW | MT_REALM)
476 
477 /* When RME is enabled, the base of NS DRAM is moved forward after the RMM */
478 #define NS_DRAM0_BASE_OFFSET	REALM_DRAM_SIZE
479 #endif /* !ENABLE_RME */
480 
481 #endif /* PLATFORM_DEF_H */
482