The SBI memory was mapped outside the kernel window. This would trigger an instruction access fault on some hardware, when the bootloader has set up PMP to protect the SBI memory. Instead of protecting a particular memory region, the PMP locks the entire page table entry that covers the region. The PADDR_LOAD and kernel base are adjusted to have the SBI memory included in the kernel window. So that the SBI memory can be mapped as part of the kernel image to a separate page table entry. This also avoids the kernel to allocate untyped memory from the SBI region.
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*
|
|
* Copyright 2018, Data61
|
|
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
|
|
* ABN 41 687 119 230.
|
|
*
|
|
* Copyright 2018, DornerWorks
|
|
*
|
|
* This software may be distributed and modified according to the terms of
|
|
* the GNU General Public License version 2. Note that NO WARRANTY is provided.
|
|
* See "LICENSE_GPLv2.txt" for details.
|
|
*
|
|
* @TAG(DATA61_DORNERWORKS_GPL)
|
|
*/
|
|
|
|
/*
|
|
*
|
|
* Copyright 2016, 2017 Hesham Almatary, Data61/CSIRO <hesham.almatary@data61.csiro.au>
|
|
* Copyright 2015, 2016 Hesham Almatary <heshamelmatary@gmail.com>
|
|
*/
|
|
|
|
#ifndef __ARCH_MODEL_STATEDATA_H
|
|
#define __ARCH_MODEL_STATEDATA_H
|
|
|
|
#include <config.h>
|
|
#include <types.h>
|
|
#include <util.h>
|
|
#include <object/structures.h>
|
|
#include <arch/types.h>
|
|
#include <plat/machine/devices.h>
|
|
|
|
|
|
NODE_STATE_BEGIN(archNodeState)
|
|
/* TODO: add RISCV-dependent fields here */
|
|
/* Bitmask of all cores should receive the reschedule IPI */
|
|
NODE_STATE_DECLARE(word_t, ipiReschedulePending);
|
|
NODE_STATE_END(archNodeState);
|
|
|
|
extern asid_pool_t *riscvKSASIDTable[BIT(asidHighBits)];
|
|
|
|
/* Kernel Page Tables */
|
|
extern pte_t kernel_root_pageTable[BIT(PT_INDEX_BITS)] VISIBLE;
|
|
|
|
/* We need to introduce a level2 pagetable in order to map the BBL to a separate
|
|
* page entry to avoid PMP exception. */
|
|
#if __riscv_xlen != 32
|
|
extern pte_t kernel_image_level2_pt[BIT(PT_INDEX_BITS)];
|
|
#endif
|
|
#endif
|