Loading drivers/iommu/iommu-debug.c +44 −2 Original line number Diff line number Diff line Loading @@ -424,7 +424,8 @@ static const char * const _size_to_string(unsigned long size) return "unknown size, please add to _size_to_string"; } static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev) static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, bool secure) { unsigned long sizes[] = { SZ_4K, SZ_64K, SZ_2M, SZ_1M * 12, SZ_1M * 20, 0 }; Loading Loading @@ -458,6 +459,17 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev) goto out_domain_free; } if (secure) { int secure_vmid = VMID_CP_PIXEL; if (iommu_domain_set_attr(domain, DOMAIN_ATTR_SECURE_VMID, &secure_vmid)) { seq_printf(s, "Couldn't set secure vmid to %d\n", secure_vmid); goto out_domain_free; } } if (iommu_attach_device(domain, dev)) { seq_puts(s, "Couldn't attach new domain to device. Is it already attached?\n"); Loading Loading @@ -551,7 +563,7 @@ static int iommu_debug_profiling_show(struct seq_file *s, void *ignored) { struct iommu_debug_device *ddev = s->private; iommu_debug_device_profiling(s, ddev->dev); iommu_debug_device_profiling(s, ddev->dev, false); return 0; } Loading @@ -568,6 +580,29 @@ static const struct file_operations iommu_debug_profiling_fops = { .release = single_release, }; static int iommu_debug_secure_profiling_show(struct seq_file *s, void *ignored) { struct iommu_debug_device *ddev = s->private; iommu_debug_device_profiling(s, ddev->dev, true); return 0; } static int iommu_debug_secure_profiling_open(struct inode *inode, struct file *file) { return single_open(file, iommu_debug_secure_profiling_show, inode->i_private); } static const struct file_operations iommu_debug_secure_profiling_fops = { .open = iommu_debug_secure_profiling_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int iommu_debug_attach_do_attach(struct iommu_debug_device *ddev, int val, bool is_secure) { Loading Loading @@ -946,6 +981,13 @@ static int snarf_iommu_devices(struct device *dev, const char *name) goto err_rmdir; } if (!debugfs_create_file("secure_profiling", S_IRUSR, dir, ddev, &iommu_debug_secure_profiling_fops)) { pr_err("Couldn't create iommu/devices/%s/secure_profiling debugfs file\n", name); goto err_rmdir; } if (!debugfs_create_file("attach", S_IRUSR, dir, ddev, &iommu_debug_attach_fops)) { pr_err("Couldn't create iommu/devices/%s/attach debugfs file\n", Loading Loading
drivers/iommu/iommu-debug.c +44 −2 Original line number Diff line number Diff line Loading @@ -424,7 +424,8 @@ static const char * const _size_to_string(unsigned long size) return "unknown size, please add to _size_to_string"; } static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev) static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev, bool secure) { unsigned long sizes[] = { SZ_4K, SZ_64K, SZ_2M, SZ_1M * 12, SZ_1M * 20, 0 }; Loading Loading @@ -458,6 +459,17 @@ static void iommu_debug_device_profiling(struct seq_file *s, struct device *dev) goto out_domain_free; } if (secure) { int secure_vmid = VMID_CP_PIXEL; if (iommu_domain_set_attr(domain, DOMAIN_ATTR_SECURE_VMID, &secure_vmid)) { seq_printf(s, "Couldn't set secure vmid to %d\n", secure_vmid); goto out_domain_free; } } if (iommu_attach_device(domain, dev)) { seq_puts(s, "Couldn't attach new domain to device. Is it already attached?\n"); Loading Loading @@ -551,7 +563,7 @@ static int iommu_debug_profiling_show(struct seq_file *s, void *ignored) { struct iommu_debug_device *ddev = s->private; iommu_debug_device_profiling(s, ddev->dev); iommu_debug_device_profiling(s, ddev->dev, false); return 0; } Loading @@ -568,6 +580,29 @@ static const struct file_operations iommu_debug_profiling_fops = { .release = single_release, }; static int iommu_debug_secure_profiling_show(struct seq_file *s, void *ignored) { struct iommu_debug_device *ddev = s->private; iommu_debug_device_profiling(s, ddev->dev, true); return 0; } static int iommu_debug_secure_profiling_open(struct inode *inode, struct file *file) { return single_open(file, iommu_debug_secure_profiling_show, inode->i_private); } static const struct file_operations iommu_debug_secure_profiling_fops = { .open = iommu_debug_secure_profiling_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int iommu_debug_attach_do_attach(struct iommu_debug_device *ddev, int val, bool is_secure) { Loading Loading @@ -946,6 +981,13 @@ static int snarf_iommu_devices(struct device *dev, const char *name) goto err_rmdir; } if (!debugfs_create_file("secure_profiling", S_IRUSR, dir, ddev, &iommu_debug_secure_profiling_fops)) { pr_err("Couldn't create iommu/devices/%s/secure_profiling debugfs file\n", name); goto err_rmdir; } if (!debugfs_create_file("attach", S_IRUSR, dir, ddev, &iommu_debug_attach_fops)) { pr_err("Couldn't create iommu/devices/%s/attach debugfs file\n", Loading