mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: Move pd_cache declarations to new header
The pd_cache header declarations were originally part of the gmmu.h header. This is not good from a unit isolation perspective so this patch moves all the pd_cache specifics over to a new header file: <nvgpu/pd_cache.h>. Also a couple of static inlines that were possible when the code was part of gmmu.h were turned into real, first class functions. This allows the pd_cache.h header to not include the gmmu.h header file. Also fix an issue in the nvgpu_pd_write() function where the data was being passed as a size_t for some reason. This has now been changed to a u32. JIRA NVGPU-1444 Change-Id: Iead9a0d998396d2289ffcb3b48765d770400397b Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1965271 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
f110d6b2f1
commit
15603b9fd5
@@ -28,6 +28,7 @@
|
||||
#include <nvgpu/list.h>
|
||||
#include <nvgpu/log2.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/enabled.h>
|
||||
|
||||
#include "gk20a/mm_gk20a.h"
|
||||
|
||||
@@ -161,6 +162,34 @@ static u32 nvgpu_pd_cache_get_nr_entries(struct nvgpu_pd_mem_entry *pentry)
|
||||
return PAGE_SIZE / pentry->pd_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the _physical_ address of a page directory.
|
||||
*/
|
||||
u64 nvgpu_pd_gpu_addr(struct gk20a *g, struct nvgpu_gmmu_pd *pd)
|
||||
{
|
||||
u64 page_addr;
|
||||
|
||||
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) {
|
||||
page_addr = nvgpu_mem_get_phys_addr(g, pd->mem);
|
||||
} else {
|
||||
page_addr = nvgpu_mem_get_addr(g, pd->mem);
|
||||
}
|
||||
|
||||
return page_addr + pd->mem_offs;
|
||||
}
|
||||
|
||||
u32 nvgpu_pd_offset_from_index(const struct gk20a_mmu_level *l, u32 pd_idx)
|
||||
{
|
||||
return (pd_idx * l->entry_size) / U32(sizeof(u32));
|
||||
}
|
||||
|
||||
void nvgpu_pd_write(struct gk20a *g, struct nvgpu_gmmu_pd *pd,
|
||||
size_t w, u32 data)
|
||||
{
|
||||
nvgpu_mem_wr32(g, pd->mem,
|
||||
(u32)((pd->mem_offs / sizeof(u32)) + w), data);
|
||||
}
|
||||
|
||||
int nvgpu_pd_cache_init(struct gk20a *g)
|
||||
{
|
||||
struct nvgpu_pd_cache *cache;
|
||||
|
||||
Reference in New Issue
Block a user