mirror of https://gitee.com/openkylin/linux.git
Merge branch 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu into x86/urgent
This commit is contained in:
commit
e0b5f80dd4
|
@ -31,6 +31,7 @@ extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
|
|||
extern int amd_iommu_init_devices(void);
|
||||
extern void amd_iommu_uninit_devices(void);
|
||||
extern void amd_iommu_init_notifier(void);
|
||||
extern void amd_iommu_init_api(void);
|
||||
#ifndef CONFIG_AMD_IOMMU_STATS
|
||||
|
||||
static inline void amd_iommu_stats_init(void) { }
|
||||
|
|
|
@ -980,7 +980,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
|
|||
{
|
||||
int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
|
||||
struct amd_iommu *iommu;
|
||||
int i;
|
||||
unsigned long i;
|
||||
|
||||
#ifdef CONFIG_IOMMU_STRESS
|
||||
populate = false;
|
||||
|
@ -1489,11 +1489,14 @@ static void __detach_device(struct device *dev)
|
|||
{
|
||||
struct iommu_dev_data *dev_data = get_dev_data(dev);
|
||||
struct iommu_dev_data *alias_data;
|
||||
struct protection_domain *domain;
|
||||
unsigned long flags;
|
||||
|
||||
BUG_ON(!dev_data->domain);
|
||||
|
||||
spin_lock_irqsave(&dev_data->domain->lock, flags);
|
||||
domain = dev_data->domain;
|
||||
|
||||
spin_lock_irqsave(&domain->lock, flags);
|
||||
|
||||
if (dev_data->alias != dev) {
|
||||
alias_data = get_dev_data(dev_data->alias);
|
||||
|
@ -1504,13 +1507,15 @@ static void __detach_device(struct device *dev)
|
|||
if (atomic_dec_and_test(&dev_data->bind))
|
||||
do_detach(dev);
|
||||
|
||||
spin_unlock_irqrestore(&dev_data->domain->lock, flags);
|
||||
spin_unlock_irqrestore(&domain->lock, flags);
|
||||
|
||||
/*
|
||||
* If we run in passthrough mode the device must be assigned to the
|
||||
* passthrough domain if it is detached from any other domain
|
||||
* passthrough domain if it is detached from any other domain.
|
||||
* Make sure we can deassign from the pt_domain itself.
|
||||
*/
|
||||
if (iommu_pass_through && dev_data->domain == NULL)
|
||||
if (iommu_pass_through &&
|
||||
(dev_data->domain == NULL && domain != pt_domain))
|
||||
__attach_device(dev, pt_domain);
|
||||
}
|
||||
|
||||
|
@ -2218,6 +2223,12 @@ static struct dma_map_ops amd_iommu_dma_ops = {
|
|||
/*
|
||||
* The function which clues the AMD IOMMU driver into dma_ops.
|
||||
*/
|
||||
|
||||
void __init amd_iommu_init_api(void)
|
||||
{
|
||||
register_iommu(&amd_iommu_ops);
|
||||
}
|
||||
|
||||
int __init amd_iommu_init_dma_ops(void)
|
||||
{
|
||||
struct amd_iommu *iommu;
|
||||
|
@ -2253,8 +2264,6 @@ int __init amd_iommu_init_dma_ops(void)
|
|||
/* Make the driver finally visible to the drivers */
|
||||
dma_ops = &amd_iommu_dma_ops;
|
||||
|
||||
register_iommu(&amd_iommu_ops);
|
||||
|
||||
amd_iommu_stats_init();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void)
|
|||
ret = amd_iommu_init_passthrough();
|
||||
else
|
||||
ret = amd_iommu_init_dma_ops();
|
||||
|
||||
if (ret)
|
||||
goto free;
|
||||
|
||||
amd_iommu_init_api();
|
||||
|
||||
amd_iommu_init_notifier();
|
||||
|
||||
enable_iommus();
|
||||
|
|
|
@ -587,7 +587,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
|
|||
return count;
|
||||
}
|
||||
|
||||
const struct file_operations filter_fops = {
|
||||
static const struct file_operations filter_fops = {
|
||||
.read = filter_read,
|
||||
.write = filter_write,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue