Skip to content

Commit

Permalink
iommu: Remove pasid validity check for STALL model page response msg
Browse files Browse the repository at this point in the history
This is a temp fix to remove the pasid validity checking on page
response msg because, an implementation that supports only STALL
model, but no PRI, page response deosn't need pasid param.
eg. smmuv3 identifies the stalled transaction using StreamID
and STAG(grpid) parameter.

Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
  • Loading branch information
shamiali2008 committed May 4, 2020
1 parent cf182df commit 99ff961
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions drivers/iommu/arm-smmu-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,8 @@ static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt)

if (ssid_valid)
flt->prm.flags |= IOMMU_FAULT_PAGE_REQUEST_PASID_VALID;
if (master->pri_supported)
flt->prm.flags |= IOMMU_FAULT_PAGE_REQUEST_PRI_SUPPORT;
} else {
flt->type = IOMMU_FAULT_DMA_UNRECOV;
flt->event = (struct iommu_fault_unrecoverable) {
Expand Down
15 changes: 12 additions & 3 deletions drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,8 +1196,7 @@ int iommu_page_response(struct device *dev,
if (!param || !param->fault_param)
return -EINVAL;

if (msg->version != IOMMU_PAGE_RESP_VERSION_1 ||
msg->flags & ~IOMMU_PAGE_RESP_PASID_VALID)
if (msg->version != IOMMU_PAGE_RESP_VERSION_1)
return -EINVAL;

/* Only send response if there is a fault report pending */
Expand All @@ -1212,7 +1211,17 @@ int iommu_page_response(struct device *dev,
*/
list_for_each_entry(evt, &param->fault_param->faults, list) {
prm = &evt->fault.prm;
pasid_valid = prm->flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID;
pasid_valid = false;

/*
* For an implementation that supports only STALL model, but
* no PRI, page response doesn't need pasid param. eg. smmuv3
* identifies the stalled transaction using StreamID and
* STAG(grpid) parameter.
*/
if ((prm->flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID) &&
(prm->flags & IOMMU_FAULT_PAGE_REQUEST_PRI_SUPPORT))
pasid_valid = true;

if ((pasid_valid && prm->pasid != msg->pasid) ||
prm->grpid != msg->grpid)
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ struct iommu_fault_page_request {
#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
#define IOMMU_FAULT_PAGE_REQUEST_PRIV_DATA (1 << 2)
#define IOMMU_FAULT_PAGE_REQUEST_PRI_SUPPORT (1 << 3)
__u32 flags;
__u32 pasid;
__u32 grpid;
Expand Down

0 comments on commit 99ff961

Please sign in to comment.