msm/drm: Add secure support to GPU IOMMU
Add support for creating a secure domain in the GPU IOMMU. By default the secure domain is bound to context bank name "gfx3d_secure". Change-Id: Ic0dedbad19f69ec4175624dc80f2114bfda2e195 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
0bea8c919a
commit
8e00aa10d2
2 changed files with 28 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <soc/qcom/secure_buffer.h>
|
||||
#include "msm_drv.h"
|
||||
#include "msm_iommu.h"
|
||||
|
||||
|
@ -142,6 +143,20 @@ static int msm_iommu_attach_dynamic(struct msm_mmu *mmu, const char **names,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int msm_iommu_attach_secure(struct msm_mmu *mmu, const char **names,
|
||||
int cnt)
|
||||
{
|
||||
struct msm_iommu *iommu = to_msm_iommu(mmu);
|
||||
int ret, vmid = VMID_CP_PIXEL;
|
||||
|
||||
ret = iommu_domain_set_attr(iommu->domain, DOMAIN_ATTR_SECURE_VMID,
|
||||
&vmid);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return iommu_attach_device(iommu->domain, mmu->dev);
|
||||
}
|
||||
|
||||
static void msm_iommu_detach(struct msm_mmu *mmu)
|
||||
{
|
||||
struct msm_iommu *iommu = to_msm_iommu(mmu);
|
||||
|
@ -250,6 +265,14 @@ static const struct msm_mmu_funcs user_funcs = {
|
|||
.disable = msm_iommu_clocks_disable,
|
||||
};
|
||||
|
||||
static const struct msm_mmu_funcs secure_funcs = {
|
||||
.attach = msm_iommu_attach_secure,
|
||||
.detach = msm_iommu_detach,
|
||||
.map = msm_iommu_map,
|
||||
.unmap = msm_iommu_unmap,
|
||||
.destroy = msm_iommu_destroy,
|
||||
};
|
||||
|
||||
static const struct msm_mmu_funcs dynamic_funcs = {
|
||||
.attach = msm_iommu_attach_dynamic,
|
||||
.detach = msm_iommu_detach_dynamic,
|
||||
|
@ -270,6 +293,10 @@ static const struct {
|
|||
.cbname = "gfx3d_user",
|
||||
.funcs = &user_funcs,
|
||||
},
|
||||
[MSM_IOMMU_DOMAIN_SECURE] = {
|
||||
.cbname = "gfx3d_secure",
|
||||
.funcs = &secure_funcs
|
||||
},
|
||||
};
|
||||
|
||||
static struct msm_mmu *iommu_create(struct device *dev,
|
||||
|
|
|
@ -33,6 +33,7 @@ enum msm_mmu_domain_type {
|
|||
enum msm_iommu_domain_type {
|
||||
MSM_IOMMU_DOMAIN_DEFAULT,
|
||||
MSM_IOMMU_DOMAIN_USER,
|
||||
MSM_IOMMU_DOMAIN_SECURE,
|
||||
};
|
||||
|
||||
struct msm_mmu_funcs {
|
||||
|
|
Loading…
Add table
Reference in a new issue