mdesc->init_early()
각 머신에 정의되어 있는 init_early() 함수를 호출한다.
아래는 rpi2에서 사용하는 머신 정의이며 init_early 멤버 변수가 bcm2709_init_early() 함수를 가리키는 것을 보여준다.
arch/arm/mach-bcm2709/bcm2709.c
MACHINE_START(BCM2709, "BCM2709")
/* Maintainer: Broadcom Europe Ltd. */
#ifdef CONFIG_SMP
.smp = smp_ops(bcm2709_smp_ops),
#endif
.map_io = bcm2709_map_io,
.init_irq = bcm2709_init_irq,
.init_time = bcm2709_timer_init,
.init_machine = bcm2709_init,
.init_early = bcm2709_init_early,
.reserve = board_reserve,
.restart = bcm2709_restart,
.dt_compat = bcm2709_compat,
MACHINE_END
bcm2709_init_early()
arch/arm/mach-bcm2709/bcm2709.c
void __init bcm2709_init_early(void)
{
/*
* Some devices allocate their coherent buffers from atomic
* context. Increase size of atomic coherent pool to make sure such
* the allocations won't fail.
*/
init_dma_coherent_pool_size(SZ_4M);
}
- coherent 버퍼에 대한 사이즈를 기본 256K에서 4M로 증가시킨다.
init_dma_coherent_pool_size()
arch/arm/mm/dma-mapping.c
/*
* This can be called during early boot to increase the size of the atomic
* coherent DMA pool above the default value of 256KiB. It must be called
* before postcore_initcall.
*/
void __init init_dma_coherent_pool_size(unsigned long size)
{
/*
* Catch any attempt to set the pool size too late.
*/
BUG_ON(atomic_pool);
/*
* Set architecture specific coherent pool size only if
* it has not been changed by kernel command line parameter.
*/
if (atomic_pool_size == DEFAULT_DMA_COHERENT_POOL_SIZE)
atomic_pool_size = size;
}
- coherent 버퍼에 대한 사이즈가 default 256KB 상태이면 요청 size로 변경한다.
static size_t atomic_pool_size = DEFAULT_DMA_COHERENT_POOL_SIZE;
#define DEFAULT_DMA_COHERENT_POOL_SIZE SZ_256K
coherent_pool 커널 파라메터
early_coherent_pool()
arch/arm/mm/dma-mapping.c
static int __init early_coherent_pool(char *p)
{
atomic_pool_size = memparse(p, &p);
return 0;
}
early_param("coherent_pool", early_coherent_pool);
- “coherent_pool=” 커널 파라메터에 의해 coherent 버퍼 사이즈를 변경할 수 있다.
- 예) “coherent_pool=2M”