mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
msm: kgsl: Add function to get context bank number
Add a function to find the context bank a pagetable is attached to. Change-Id: I967c77e9d2f761440f28973485a8ce02c7d27dce Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
parent
e1007d065f
commit
8afc60d2e8
3 changed files with 39 additions and 0 deletions
|
|
@ -833,6 +833,25 @@ static u32 kgsl_iommu_get_contextidr(struct kgsl_pagetable *pt)
|
|||
return iommu_pt->contextidr;
|
||||
}
|
||||
|
||||
static int kgsl_iommu_get_context_bank(struct kgsl_pagetable *pt)
|
||||
{
|
||||
struct kgsl_iommu_pt *iommu_pt;
|
||||
u32 cb_num;
|
||||
int ret;
|
||||
|
||||
if (!pt)
|
||||
return -EINVAL;
|
||||
|
||||
iommu_pt = pt->priv;
|
||||
|
||||
ret = iommu_domain_get_attr(iommu_pt->domain,
|
||||
DOMAIN_ATTR_CONTEXT_BANK, &cb_num);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return (int) cb_num;
|
||||
}
|
||||
|
||||
/*
|
||||
* kgsl_iommu_destroy_pagetable - Free up reaources help by a pagetable
|
||||
* @mmu_specific_pt - Pointer to pagetable which is to be freed
|
||||
|
|
@ -2622,6 +2641,7 @@ static struct kgsl_mmu_pt_ops iommu_pt_ops = {
|
|||
.mmu_destroy_pagetable = kgsl_iommu_destroy_pagetable,
|
||||
.get_ttbr0 = kgsl_iommu_get_ttbr0,
|
||||
.get_contextidr = kgsl_iommu_get_contextidr,
|
||||
.get_context_bank = kgsl_iommu_get_context_bank,
|
||||
.get_gpuaddr = kgsl_iommu_get_gpuaddr,
|
||||
.put_gpuaddr = kgsl_iommu_put_gpuaddr,
|
||||
.set_svm_region = kgsl_iommu_set_svm_region,
|
||||
|
|
|
|||
|
|
@ -544,6 +544,14 @@ void kgsl_mmu_close(struct kgsl_device *device)
|
|||
mmu->mmu_ops->mmu_close(mmu);
|
||||
}
|
||||
|
||||
int kgsl_mmu_pagetable_get_context_bank(struct kgsl_pagetable *pagetable)
|
||||
{
|
||||
if (PT_OP_VALID(pagetable, get_context_bank))
|
||||
return pagetable->pt_ops->get_context_bank(pagetable);
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
enum kgsl_mmutype kgsl_mmu_get_mmutype(struct kgsl_device *device)
|
||||
{
|
||||
return device ? device->mmu.type : KGSL_MMU_TYPE_NONE;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ struct kgsl_mmu_pt_ops {
|
|||
void (*mmu_destroy_pagetable)(struct kgsl_pagetable *pt);
|
||||
u64 (*get_ttbr0)(struct kgsl_pagetable *pt);
|
||||
u32 (*get_contextidr)(struct kgsl_pagetable *pt);
|
||||
int (*get_context_bank)(struct kgsl_pagetable *pt);
|
||||
int (*get_gpuaddr)(struct kgsl_pagetable *pt,
|
||||
struct kgsl_memdesc *memdesc);
|
||||
void (*put_gpuaddr)(struct kgsl_memdesc *memdesc);
|
||||
|
|
@ -346,4 +347,14 @@ kgsl_mmu_pagetable_get_contextidr(struct kgsl_pagetable *pagetable)
|
|||
void kgsl_mmu_map_global(struct kgsl_device *device,
|
||||
struct kgsl_memdesc *memdesc);
|
||||
|
||||
/**
|
||||
* kgsl_mmu_pagetable_get_context_bank - Return the context bank number
|
||||
* @pagetable: A handle to a given pagetable
|
||||
*
|
||||
* This function will find the context number of the given pagetable
|
||||
|
||||
* Return: The context bank number the pagetable is attached to or
|
||||
* negative error on failure.
|
||||
*/
|
||||
int kgsl_mmu_pagetable_get_context_bank(struct kgsl_pagetable *pagetable);
|
||||
#endif /* __KGSL_MMU_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue