base-hw: reduce hardware-specific include paths

For base-hw Core, we used to add quite some hardware-specific include paths
to 'INC_DIR'. Generic code used to include, for instance, '<cpu.h>' and
'<translation_table.h>' using these implicit path resolutions. This commit
removes hardware-specific include paths except for

1) the '<board.h>' include paths (e.g., 'src/core/board/pbxa9'),
2) most architecture-specific include paths (e.g., 'src/core/spec/arm_v7'),
3) include paths that reflect usage of virtualization or ARM Trustzone
   (e.g., 'src/core/spec/arm/virtualization').

The first category is kept because, in contrast to the former "spec"-mechanism,
the board variable used for this type of resolution is not deprecated and the
board headers are meant to be the front end of hardware-specific headers
towards generic code which is why they must be available generically via
'<board.h>'.

The second category is kept because it was suggested by other maintainers that
simple arch-dependent headers (like for the declaration of a CPU state) should
not imply the inclusion of the whole '<board.h>' and because the architecture
is given also without the former "spec"-mechanism through the type of the build
directory. I think this is questionable but am fine with it.

The third category is kept because the whole way of saying whether
virtualization resp. ARM Trustzone is used is done in an out-dated manner and
changing it now would blow up this commit a lot and exceed the time that I'm
willing to spend. This category should be subject to a future issue.

Ref #4217
This commit is contained in:
Martin Stein 2021-09-27 15:55:55 +02:00 committed by Norman Feske
parent 49b09702b8
commit ad059362d2
32 changed files with 74 additions and 47 deletions

View File

@ -4,9 +4,6 @@
# \date 2014-12-15
#
# add include paths
REP_INC_DIR += src/core/spec/zynq
# add C++ sources
SRC_CC += platform_services.cc

View File

@ -1,5 +1,10 @@
REP_INC_DIR += src/core/spec/arm_v8
#
# \brief Build config for Genodes core process
# \author Stefan Kalkowski
# \date 2019-05-21
#
# add libraries
LIBS += syscall-hw
# add C++ sources

View File

@ -4,9 +4,6 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a15
# add C++ sources
SRC_CC += spec/cortex_a15/cpu.cc
SRC_CC += kernel/cpu_mp.cc

View File

@ -4,9 +4,6 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a8
# add C++ sources
SRC_CC += kernel/cpu_up.cc
SRC_CC += kernel/lock.cc

View File

@ -4,9 +4,6 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a9
# add C++ sources
SRC_CC += spec/cortex_a9/board.cc
SRC_CC += spec/cortex_a9/cpu.cc

View File

@ -23,6 +23,8 @@
#include <spec/arm/imx_epit.h>
#include <spec/arm/trustzone_board.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a8/cpu.h>
#include <spec/cortex_a8/translation_table.h>
namespace Board { using namespace Hw::Imx53_qsb_board; }

View File

@ -21,6 +21,8 @@
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a9/cpu.h>
#include <spec/cortex_a9/translation_table.h>
namespace Board {

View File

@ -23,6 +23,8 @@
#include <spec/arm/cpu/vm_state_virtualization.h>
#include <spec/arm/virtualization/board.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a15/cpu.h>
#include <spec/cortex_a15/translation_table.h>
namespace Board {

View File

@ -21,6 +21,8 @@
#include <spec/arm/generic_timer.h>
#include <spec/arm/virtualization/gicv3.h>
#include <spec/arm_v8/address_space_id_allocator.h>
#include <spec/arm_v8/cpu.h>
#include <spec/arm_v8/translation_table.h>
/* base-hw includes */
#include <spec/arm_64/cpu/vm_state_virtualization.h>

View File

@ -21,6 +21,8 @@
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a9/cpu.h>
#include <spec/cortex_a9/translation_table.h>
namespace Board {

View File

@ -21,6 +21,8 @@
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a9/cpu.h>
#include <spec/cortex_a9/translation_table.h>
namespace Board {

View File

@ -21,6 +21,8 @@
#include <spec/x86_64/pic.h>
#include <spec/x86_64/pit.h>
#include <spec/x86_64/address_space_id_allocator.h>
#include <spec/x86_64/cpu.h>
#include <spec/x86_64/translation_table.h>
namespace Board {

View File

@ -20,6 +20,8 @@
/* base-hw Core includes */
#include <spec/riscv/pic.h>
#include <spec/riscv/address_space_id_allocator.h>
#include <spec/riscv/cpu.h>
#include <spec/riscv/translation_table.h>
namespace Board { using namespace Hw::Riscv_board; }

View File

@ -22,6 +22,8 @@
#include <spec/arm/bcm2835_pic.h>
#include <spec/arm/bcm2835_system_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/arm_v6/cpu.h>
#include <spec/arm_v6/translation_table.h>
namespace Board { using namespace Hw::Rpi_board; };

View File

@ -21,6 +21,8 @@
#include <spec/arm/bcm2837_pic.h>
#include <spec/arm/generic_timer.h>
#include <spec/arm_v8/address_space_id_allocator.h>
#include <spec/arm_v8/cpu.h>
#include <spec/arm_v8/translation_table.h>
namespace Board {

View File

@ -23,6 +23,8 @@
#include <spec/arm/imx_epit.h>
#include <spec/arm/trustzone_board.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a8/cpu.h>
#include <spec/cortex_a8/translation_table.h>
namespace Board { using namespace Hw::Usb_armory_board; }

View File

@ -27,6 +27,8 @@
/* base-hw Core includes */
#include <spec/arm/virtualization/board.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a15/cpu.h>
#include <spec/cortex_a15/translation_table.h>
namespace Kernel { class Cpu; }

View File

@ -25,10 +25,11 @@
#include <spec/arm_64/cpu/vm_state_virtualization.h>
/* base-hw Core includes */
#include <translation_table.h>
#include <kernel/configuration.h>
#include <kernel/irq.h>
#include <spec/arm_v8/address_space_id_allocator.h>
#include <spec/arm_v8/cpu.h>
#include <spec/arm_v8/translation_table.h>
namespace Board {

View File

@ -22,6 +22,8 @@
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a9/cpu.h>
#include <spec/cortex_a9/translation_table.h>
namespace Board {

View File

@ -23,6 +23,8 @@
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/arm/address_space_id_allocator.h>
#include <spec/cortex_a9/cpu.h>
#include <spec/cortex_a9/translation_table.h>
namespace Board {

View File

@ -15,13 +15,13 @@
#ifndef _CORE__KERNEL__PD_H_
#define _CORE__KERNEL__PD_H_
/* core includes */
/* base-hw Core includes */
#include <hw/assert.h>
#include <cpu.h>
#include <kernel/core_interface.h>
#include <object.h>
#include <translation_table.h>
#include <board.h>
/* base includes */
#include <util/reconstructible.h>
namespace Genode { class Platform_pd; }

View File

@ -19,8 +19,7 @@
#include <base/signal.h>
#include <util/reconstructible.h>
/* core includes */
#include <cpu.h>
/* base-hw Core includes */
#include <kernel/cpu_context.h>
#include <kernel/inter_processor_work.h>
#include <kernel/signal_receiver.h>
@ -29,7 +28,7 @@
#include <kernel/interface.h>
#include <assertion.h>
/* base-local includes */
/* base internal includes */
#include <base/internal/native_utcb.h>
namespace Kernel {

View File

@ -13,24 +13,27 @@
*/
/* core includes */
/* base Core includes */
#include <boot_modules.h>
#include <core_log.h>
#include <hw/memory_region.h>
/* base-hw Core includes */
#include <map_local.h>
#include <platform.h>
#include <platform_pd.h>
#include <hw/page_flags.h>
#include <hw/util.h>
#include <translation_table.h>
#include <kernel/main.h>
/* base-internal includes */
/* base-hw internal includes */
#include <hw/page_flags.h>
#include <hw/util.h>
#include <hw/memory_region.h>
/* base internal includes */
#include <base/internal/crt0.h>
#include <base/internal/stack_area.h>
#include <base/internal/unmanaged_singleton.h>
/* Genode includes */
/* base includes */
#include <base/log.h>
#include <trace/source_registry.h>

View File

@ -15,24 +15,25 @@
#ifndef _CORE__PLATFORM_H_
#define _CORE__PLATFORM_H_
/* Genode includes */
/* base includes */
#include <base/synced_allocator.h>
#include <base/allocator_avl.h>
#include <irq_session/irq_session.h>
#include <util/xml_generator.h>
/* base-hw includes */
/* base-hw internal includes */
#include <hw/boot_info.h>
#include <hw/memory_region.h>
/* base-hw includes */
#include <kernel/configuration.h>
#include <kernel/core_interface.h>
#include <kernel/pd.h>
/* core includes */
/* base-hw Core includes */
#include <platform_generic.h>
#include <core_region_map.h>
#include <core_mem_alloc.h>
#include <translation_table.h>
#include <assertion.h>
#include <board.h>

View File

@ -15,16 +15,17 @@
#ifndef _CORE__PLATFORM_PD_H_
#define _CORE__PLATFORM_PD_H_
/* Core includes */
#include <translation_table.h>
/* base-hw Core includes */
#include <platform.h>
#include <address_space.h>
#include <hw/page_table_allocator.h>
#include <object.h>
#include <kernel/configuration.h>
#include <kernel/object.h>
#include <kernel/pd.h>
/* base-hw internal includes */
#include <hw/page_table_allocator.h>
namespace Hw {
using namespace Kernel;

View File

@ -12,13 +12,10 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
/* base-hw Core includes */
#include <pager.h>
#include <platform_pd.h>
#include <platform_thread.h>
#include <translation_table.h>
/* base-internal includes */
using namespace Genode;

View File

@ -11,8 +11,8 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* base-hw Core includes */
#include <board.h>
#include <cpu.h>
#include <platform.h>

View File

@ -11,7 +11,7 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <cpu.h>
/* base-hw Core includes */
#include <platform_pd.h>
#include <kernel/pd.h>
#include <kernel/thread.h>

View File

@ -14,10 +14,13 @@
#ifndef _CORE__SPEC__ARM__VIRTUALIZATION__BOARD_H_
#define _CORE__SPEC__ARM__VIRTUALIZATION__BOARD_H_
#include <translation_table.h>
/* base-hw Core includes */
#include <kernel/configuration.h>
#include <kernel/irq.h>
/* base-hw internal includes */
#include <hw/spec/arm/lpae.h>
namespace Board {
using Vm_page_table = Hw::Level_1_stage_2_translation_table;

View File

@ -17,7 +17,6 @@
/* base-hw Core includes */
#include <board.h>
#include <cpu.h>
#include <kernel/thread.h>

View File

@ -15,10 +15,11 @@
#ifndef _CORE__SPEC__CORTEX_A8__TRANSLATION_TABLE_H_
#define _CORE__SPEC__CORTEX_A8__TRANSLATION_TABLE_H_
/* base-hw internal includes */
#include <hw/spec/arm/page_table.h>
#include <kernel/interface.h>
#include <cpu.h>
/* base-hw Core includes */
#include <kernel/interface.h>
constexpr unsigned Hw::Page_table::Descriptor_base::_device_tex() {

View File

@ -14,21 +14,22 @@
#ifndef _CORE__VM_SESSION_COMPONENT_H_
#define _CORE__VM_SESSION_COMPONENT_H_
/* Genode includes */
/* base includes */
#include <base/allocator.h>
#include <base/allocator_avl.h>
#include <base/session_object.h>
#include <vm_session/vm_session.h>
#include <dataspace/capability.h>
/* base-hw includes */
#include <hw_native_vcpu/hw_native_vcpu.h>
/* Core includes */
/* base-hw Core includes */
#include <object.h>
#include <region_map_component.h>
#include <translation_table.h>
#include <kernel/vm.h>
/* base Core includes */
#include <trace/source_registry.h>
namespace Genode { class Vm_session_component; }