iommu-debug: Remove trigger-fault functionality

Deprecate this option in favor of CONFIG_ARM_SMMU_SELFTEST

Change-Id: Ic5014c4bef9bb3d509bef20443281f1b57612096
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
This commit is contained in:
Patrick Daly 2020-07-09 13:50:07 -07:00
commit 698e136164
4 changed files with 0 additions and 90 deletions

View file

@ -4037,32 +4037,6 @@ static bool arm_smmu_is_iova_coherent(struct iommu_domain *domain,
return ret;
}
static void arm_smmu_trigger_fault(struct iommu_domain *domain,
unsigned long flags)
{
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
struct arm_smmu_device *smmu;
int idx = cfg->cbndx;
if (!smmu_domain->smmu) {
pr_err("Can't trigger faults on non-attached domains\n");
return;
}
smmu = smmu_domain->smmu;
if (arm_smmu_power_on(smmu->pwr))
return;
dev_err(smmu->dev, "Writing 0x%lx to FSRRESTORE on cb %d\n",
flags, cfg->cbndx);
arm_smmu_cb_write(smmu, idx, ARM_SMMU_CB_FSRRESTORE, flags);
/* give the interrupt time to fire... */
msleep(1000);
arm_smmu_power_off(smmu, smmu->pwr);
}
static void arm_smmu_tlbi_domain(struct iommu_domain *domain)
{
arm_smmu_tlb_inv_context_s1(to_smmu_domain(domain));
@ -4086,7 +4060,6 @@ static struct msm_iommu_ops arm_smmu_ops = {
.map_sg = arm_smmu_map_sg,
.iova_to_phys_hard = arm_smmu_iova_to_phys_hard,
.is_iova_coherent = arm_smmu_is_iova_coherent,
.trigger_fault = arm_smmu_trigger_fault,
.tlbi_domain = arm_smmu_tlbi_domain,
.enable_config_clocks = arm_smmu_enable_config_clocks,
.disable_config_clocks = arm_smmu_disable_config_clocks,

View file

@ -2074,35 +2074,6 @@ static const struct file_operations iommu_debug_config_clocks_fops = {
.write = iommu_debug_config_clocks_write,
};
static ssize_t iommu_debug_trigger_fault_write(
struct file *file, const char __user *ubuf, size_t count,
loff_t *offset)
{
struct iommu_debug_device *ddev = file->private_data;
unsigned long flags;
if (kstrtoul_from_user(ubuf, count, 0, &flags)) {
pr_err_ratelimited("Invalid flags format\n");
return -EFAULT;
}
mutex_lock(&ddev->state_lock);
if (!ddev->domain) {
pr_err_ratelimited("No domain. Did you already attach?\n");
mutex_unlock(&ddev->state_lock);
return -EINVAL;
}
iommu_trigger_fault(ddev->domain, flags);
mutex_unlock(&ddev->state_lock);
return count;
}
static const struct file_operations iommu_debug_trigger_fault_fops = {
.open = simple_open,
.write = iommu_debug_trigger_fault_write,
};
#ifdef CONFIG_ARM64_PTDUMP_CORE
static int ptdump_show(struct seq_file *s, void *v)
{
@ -2305,13 +2276,6 @@ static int iommu_debug_device_setup(struct device *dev)
goto err_rmdir;
}
if (!debugfs_create_file("trigger-fault", 0200, dir, ddev,
&iommu_debug_trigger_fault_fops)) {
pr_err_ratelimited("Couldn't create iommu/devices/%s/trigger-fault debugfs file\n",
dev_name(dev));
goto err_rmdir;
}
#ifdef CONFIG_ARM64_PTDUMP_CORE
if (!debugfs_create_file("iommu_page_tables", 0200, dir, ddev,
&ptdump_fops)) {

View file

@ -2234,23 +2234,6 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list)
ops->put_resv_regions(dev, list);
}
/**
* iommu_trigger_fault() - trigger an IOMMU fault
* @domain: iommu domain
*
* Triggers a fault on the device to which this domain is attached.
*
* This function should only be used for debugging purposes, for obvious
* reasons.
*/
void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags)
{
struct msm_iommu_ops *ops = to_msm_iommu_ops(domain->ops);
if (ops->trigger_fault)
ops->trigger_fault(domain, flags);
}
struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start,
size_t length, int prot,
enum iommu_resv_type type)

View file

@ -390,7 +390,6 @@ struct iommu_ops {
* to an iommu domain
* @iova_to_phys_hard: translate iova to physical address using IOMMU hardware
* @is_iova_coherent: checks coherency of the given iova
* @trigger_fault: trigger a fault on the device attached to an iommu domain
* @tlbi_domain: Invalidate all TLBs covering an iommu domain
* @enable_config_clocks: Enable all config clocks for this domain's IOMMU
* @disable_config_clocks: Disable all config clocks for this domain's IOMMU
@ -404,7 +403,6 @@ struct msm_iommu_ops {
dma_addr_t iova,
unsigned long trans_flags);
bool (*is_iova_coherent)(struct iommu_domain *domain, dma_addr_t iova);
void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags);
void (*tlbi_domain)(struct iommu_domain *domain);
int (*enable_config_clocks)(struct iommu_domain *domain);
void (*disable_config_clocks)(struct iommu_domain *domain);
@ -658,9 +656,6 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain,
gather->start = start;
}
extern void iommu_trigger_fault(struct iommu_domain *domain,
unsigned long flags);
/* PCI device grouping function */
extern struct iommu_group *pci_device_group(struct device *dev);
/* Generic device grouping function */
@ -1086,11 +1081,6 @@ static inline void iommu_device_unlink(struct device *dev, struct device *link)
{
}
static inline void iommu_trigger_fault(struct iommu_domain *domain,
unsigned long flags)
{
}
static inline void iommu_tlbiall(struct iommu_domain *domain)
{
}