mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-06 19:20:09 +00:00
hw_vea9x4: re-enable TrustZone support
This commit is contained in:
parent
7bf73fb0c1
commit
23ce6dad50
33
base-hw/include/platform/vea9x4/drivers/trustzone.h
Normal file
33
base-hw/include/platform/vea9x4/drivers/trustzone.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* \brief TrustZone specific definitions for the Versatile Express board
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2013-11-15
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE__PLATFORM__VEA9X4__DRIVERS__TRUSTZONE_H_
|
||||||
|
#define _INCLUDE__PLATFORM__VEA9X4__DRIVERS__TRUSTZONE_H_
|
||||||
|
|
||||||
|
/* Genode includes */
|
||||||
|
#include <drivers/board_base.h>
|
||||||
|
|
||||||
|
namespace Trustzone
|
||||||
|
{
|
||||||
|
enum {
|
||||||
|
VM_STATE_SIZE = 1 << 20,
|
||||||
|
SECURE_RAM_BASE = Genode::Board_base::RAM_3_BASE,
|
||||||
|
SECURE_RAM_SIZE = Genode::Board_base::RAM_3_SIZE - VM_STATE_SIZE,
|
||||||
|
VM_STATE_BASE = SECURE_RAM_BASE + SECURE_RAM_SIZE,
|
||||||
|
NONSECURE_RAM_BASE = Genode::Board_base::RAM_1_BASE,
|
||||||
|
NONSECURE_RAM_SIZE = 0x40000000,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _INCLUDE__PLATFORM__VEA9X4__DRIVERS__TRUSTZONE_H_ */
|
||||||
|
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/service.h>
|
#include <base/service.h>
|
||||||
|
#include <drivers/trustzone.h>
|
||||||
|
|
||||||
/* Core includes */
|
/* Core includes */
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
@ -29,7 +30,15 @@ void Genode::platform_add_local_services(Genode::Rpc_entrypoint *ep,
|
|||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
static Vm_root vm_root(ep, sh, platform()->ram_alloc());
|
/*
|
||||||
|
* We use an extra portion of RAM for the VM state,
|
||||||
|
* so we can map it non-cached to core instead of normal, cached RAM.
|
||||||
|
* In future, when core only maps memory on demand, this extra allocator,
|
||||||
|
* can be eliminated.
|
||||||
|
*/
|
||||||
|
static Synchronized_range_allocator<Allocator_avl> vm_alloc(0);
|
||||||
|
vm_alloc.add_range(Trustzone::VM_STATE_BASE, Trustzone::VM_STATE_SIZE);
|
||||||
|
static Vm_root vm_root(ep, sh, &vm_alloc);
|
||||||
static Local_service vm_ls(Vm_session::service_name(), &vm_root);
|
static Local_service vm_ls(Vm_session::service_name(), &vm_root);
|
||||||
ls->insert(&vm_ls);
|
ls->insert(&vm_ls);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
* under the terms of the GNU General Public License version 2.
|
* under the terms of the GNU General Public License version 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <drivers/trustzone.h>
|
||||||
|
|
||||||
/* core includes */
|
/* core includes */
|
||||||
#include <board.h>
|
#include <board.h>
|
||||||
#include <cpu.h>
|
#include <cpu.h>
|
||||||
@ -60,7 +62,7 @@ Native_region * Platform::_ram_regions(unsigned const i)
|
|||||||
{
|
{
|
||||||
static Native_region _regions[] =
|
static Native_region _regions[] =
|
||||||
{
|
{
|
||||||
{ Board::RAM_3_BASE, Board::RAM_3_SIZE }
|
{ Trustzone::SECURE_RAM_BASE, Trustzone::SECURE_RAM_SIZE },
|
||||||
};
|
};
|
||||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||||
}
|
}
|
||||||
@ -72,9 +74,7 @@ Native_region * Platform::_mmio_regions(unsigned const i)
|
|||||||
{
|
{
|
||||||
{ Board::MMIO_0_BASE, Board::MMIO_0_SIZE },
|
{ Board::MMIO_0_BASE, Board::MMIO_0_SIZE },
|
||||||
{ Board::MMIO_1_BASE, Board::MMIO_1_SIZE },
|
{ Board::MMIO_1_BASE, Board::MMIO_1_SIZE },
|
||||||
{ 0x60000000, 0x40000000 },
|
{ Trustzone::NONSECURE_RAM_BASE, Trustzone::NONSECURE_RAM_SIZE },
|
||||||
{ Board::TZASC_MMIO_BASE, Board::TZASC_MMIO_SIZE },
|
|
||||||
{ Board::TZPC_MMIO_BASE, Board::TZPC_MMIO_SIZE },
|
|
||||||
};
|
};
|
||||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,10 @@ Native_region * Platform::_core_only_mmio_regions(unsigned const i)
|
|||||||
Board::CORTEX_A9_PRIVATE_MEM_SIZE },
|
Board::CORTEX_A9_PRIVATE_MEM_SIZE },
|
||||||
|
|
||||||
/* Core UART */
|
/* Core UART */
|
||||||
{ Board::PL011_0_MMIO_BASE, Board::PL011_0_MMIO_SIZE }
|
{ Board::PL011_0_MMIO_BASE, Board::PL011_0_MMIO_SIZE },
|
||||||
|
|
||||||
|
/* vm state memory */
|
||||||
|
{ Trustzone::VM_STATE_BASE, Trustzone::VM_STATE_SIZE },
|
||||||
};
|
};
|
||||||
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
return i < sizeof(_regions)/sizeof(_regions[0]) ? &_regions[i] : 0;
|
||||||
}
|
}
|
||||||
|
51
base-hw/src/core/vea9x4/trustzone/tlb.h
Normal file
51
base-hw/src/core/vea9x4/trustzone/tlb.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* \brief Translation lookaside buffer
|
||||||
|
* \author Martin Stein
|
||||||
|
* \author Stefan Kalkowski
|
||||||
|
* \date 2012-04-23
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is part of the Genode OS framework, which is distributed
|
||||||
|
* under the terms of the GNU General Public License version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _VEA9X4__TLB_H_
|
||||||
|
#define _VEA9X4__TLB_H_
|
||||||
|
|
||||||
|
#include <drivers/trustzone.h>
|
||||||
|
|
||||||
|
/* core includes */
|
||||||
|
#include <board.h>
|
||||||
|
#include <tlb/arm_v7.h>
|
||||||
|
|
||||||
|
namespace Genode
|
||||||
|
{
|
||||||
|
struct Page_flags : Arm::Page_flags { };
|
||||||
|
|
||||||
|
class Tlb : public Arm_v7::Section_table { };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translation lookaside buffer of core
|
||||||
|
*/
|
||||||
|
class Core_tlb : public Tlb
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor - ensures that core never gets a pagefault
|
||||||
|
*/
|
||||||
|
Core_tlb()
|
||||||
|
{
|
||||||
|
map_core_area(Trustzone::SECURE_RAM_BASE, Trustzone::SECURE_RAM_SIZE, 0);
|
||||||
|
map_core_area(Board::MMIO_0_BASE, Board::MMIO_0_SIZE, 1);
|
||||||
|
map_core_area(Board::MMIO_1_BASE, Board::MMIO_1_SIZE, 1);
|
||||||
|
map_core_area(Trustzone::VM_STATE_BASE, Trustzone::VM_STATE_SIZE, 1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _VEA9X4__TLB_H_ */
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user