gpu: nvgpu: Send aligned addresses to allocator

Bug 1587090
Bug 200050711

PMU dmem start address is unaligned.
Allocator allocates aligned length amount of memory
But address alloced is nto checked to be aligned, but
free checks for alignment of addresses before free.
For dmem case, frees never actually happened. This fix
ensures addresses are aligned.

Change-Id: I8b95f89940aa4d23355c3788dc95afb5c8867373
Signed-off-by: Supriya <ssharatkumar@nvidia.com>
Reviewed-on: http://git-master/r/663140
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Supriya
2014-12-12 15:20:40 +05:30
committed by Dan Willemsen
parent 0bc513fc46
commit 402bdd57e8

View File

@@ -2706,10 +2706,16 @@ static int pmu_process_init_msg(struct pmu_gk20a *pmu,
for (i = 0; i < PMU_QUEUE_COUNT; i++)
pmu_queue_init(pmu, i, init);
if (!pmu->dmem.alloc)
gk20a_allocator_init(&pmu->dmem, "gk20a_pmu_dmem",
pv->get_pmu_init_msg_pmu_sw_mg_off(init),
pv->get_pmu_init_msg_pmu_sw_mg_size(init));
if (!pmu->dmem.alloc) {
/*Align start and end addresses*/
u32 start = ALIGN(pv->get_pmu_init_msg_pmu_sw_mg_off(init),
PMU_DMEM_ALLOC_ALIGNMENT);
u32 end = (pv->get_pmu_init_msg_pmu_sw_mg_off(init) +
pv->get_pmu_init_msg_pmu_sw_mg_size(init)) &
~(PMU_DMEM_ALLOC_ALIGNMENT - 1);
u32 size = end - start;
gk20a_allocator_init(&pmu->dmem, "gk20a_pmu_dmem", start, size);
}
pmu->pmu_ready = true;
pmu->pmu_state = PMU_STATE_INIT_RECEIVED;