iommu: add domain argument to page response

commit 999841cd78d3fe17bf4423c030eb3829312dadf2 Intel-BKC.

With mdev, page response needs pdev domain that is different than
the device's own domain. Extend iommu_page_response() to support
such case.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
Signed-off-by: Chen Zhuo <sagazchen@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
This commit is contained in:
Jacob Pan 2019-10-04 04:51:29 -07:00 committed by Jianping Liu
parent 06a6a66804
commit 5fe4cef489
5 changed files with 17 additions and 10 deletions

View File

@ -33,4 +33,4 @@ obj-$(CONFIG_S390_IOMMU) += s390-iommu.o
obj-$(CONFIG_QCOM_IOMMU) += qcom_iommu.o
obj-$(CONFIG_HYPERV_IOMMU) += hyperv-iommu.o
obj-$(CONFIG_VIRTIO_IOMMU) += virtio-iommu.o
obj-$(CONFIG_IOMMU_SVA) += iommu-sva-lib.o io-pgfault.o
obj-$(CONFIG_IOMMU_SVA) += iommu-sva-lib.o

View File

@ -1251,7 +1251,8 @@ u32 intel_svm_get_pasid(struct iommu_sva *sva)
return pasid;
}
int intel_svm_page_response(struct device *dev,
int intel_svm_page_response(struct iommu_domain *domain,
struct device *dev,
struct iommu_fault_event *evt,
struct iommu_page_response *msg)
{

View File

@ -1278,7 +1278,7 @@ done_unlock:
EXPORT_SYMBOL_GPL(iommu_report_device_fault);
static int iommu_page_response_prepare_msg(void __user *udata,
struct iommu_page_response *msg)
struct iommu_page_response *msg)
{
unsigned long minsz, maxsz;
@ -1312,7 +1312,8 @@ static int iommu_page_response_prepare_msg(void __user *udata,
return 0;
}
int iommu_page_response(struct device *dev,
int iommu_page_response(struct iommu_domain *domain,
struct device *dev,
void __user *uinfo)
{
bool needs_pasid;
@ -1321,7 +1322,6 @@ int iommu_page_response(struct device *dev,
struct iommu_fault_event *evt;
struct iommu_fault_page_request *prm;
struct dev_iommu *param = dev->iommu;
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
bool has_pasid;
if (!domain || !domain->ops->page_response)
@ -1367,7 +1367,7 @@ int iommu_page_response(struct device *dev,
msg.pasid = 0;
}
ret = domain->ops->page_response(dev, evt, &msg);
ret = domain->ops->page_response(domain, dev, evt, &msg);
trace_dev_page_response(dev, &msg);
list_del(&evt->list);
kfree(evt);

View File

@ -769,7 +769,8 @@ struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm,
void *drvdata);
void intel_svm_unbind(struct iommu_sva *handle);
u32 intel_svm_get_pasid(struct iommu_sva *handle);
int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt,
int intel_svm_page_response(struct iommu_domain *domain, struct device *dev,
struct iommu_fault_event *evt,
struct iommu_page_response *msg);
void intel_svm_add_pasid_notifier(void);

View File

@ -333,7 +333,8 @@ struct iommu_ops {
void (*sva_unbind)(struct iommu_sva *handle);
u32 (*sva_get_pasid)(struct iommu_sva *handle);
int (*page_response)(struct device *dev,
int (*page_response)(struct iommu_domain *domain,
struct device *dev,
struct iommu_fault_event *evt,
struct iommu_page_response *msg);
int (*cache_invalidate)(struct iommu_domain *domain, struct device *dev,
@ -548,7 +549,9 @@ extern int iommu_unregister_device_fault_handler(struct device *dev);
extern int iommu_report_device_fault(struct device *dev,
struct iommu_fault_event *evt);
extern int iommu_page_response(struct device *dev, void __user *uinfo);
extern int iommu_page_response(struct iommu_domain *domain,
struct device *dev,
void __user *uinfo);
extern int iommu_group_id(struct iommu_group *group);
extern struct iommu_domain *iommu_group_default_domain(struct iommu_group *);
@ -919,7 +922,9 @@ int iommu_report_device_fault(struct device *dev, struct iommu_fault_event *evt)
return -ENODEV;
}
static inline int iommu_page_response(struct device *dev, void __user *uinfo)
static inline int iommu_page_response(struct iommu_domain *domain,
struct device *dev,
void __user *uinfo)
{
return -ENODEV;
}