Skip to content

Commit

Permalink
Merge tag 'iommu-fixes-v3.6-rc7' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/joro/iommu

Pull IOMMU fixes from Joerg Roedel:
 "Two small patches:

	* One patch to fix the function declarations for
	  !CONFIG_IOMMU_API. This is causing build errors
	  in linux-next and should be fixed for v3.6.

	* Another patch to fix an IOMMU group related NULL pointer
	  dereference."

* tag 'iommu-fixes-v3.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/amd: Fix wrong assumption in iommu-group specific code
  iommu: static inline iommu group stub functions
  • Loading branch information
Linus Torvalds committed Sep 29, 2012
2 parents 21e9893 + 0774e39 commit 6a3e3db
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
6 changes: 4 additions & 2 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)

static int iommu_init_device(struct device *dev)
{
struct pci_dev *dma_pdev, *pdev = to_pci_dev(dev);
struct pci_dev *dma_pdev = NULL, *pdev = to_pci_dev(dev);
struct iommu_dev_data *dev_data;
struct iommu_group *group;
u16 alias;
Expand All @@ -293,7 +293,9 @@ static int iommu_init_device(struct device *dev)
dev_data->alias_data = alias_data;

dma_pdev = pci_get_bus_and_slot(alias >> 8, alias & 0xff);
} else
}

if (dma_pdev == NULL)
dma_pdev = pci_dev_get(pdev);

/* Account for quirked devices */
Expand Down
42 changes: 24 additions & 18 deletions include/linux/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,72 +256,78 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain,
{
}

int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group)
static inline int iommu_attach_group(struct iommu_domain *domain,
struct iommu_group *group)
{
return -ENODEV;
}

void iommu_detach_group(struct iommu_domain *domain, struct iommu_group *group)
static inline void iommu_detach_group(struct iommu_domain *domain,
struct iommu_group *group)
{
}

struct iommu_group *iommu_group_alloc(void)
static inline struct iommu_group *iommu_group_alloc(void)
{
return ERR_PTR(-ENODEV);
}

void *iommu_group_get_iommudata(struct iommu_group *group)
static inline void *iommu_group_get_iommudata(struct iommu_group *group)
{
return NULL;
}

void iommu_group_set_iommudata(struct iommu_group *group, void *iommu_data,
void (*release)(void *iommu_data))
static inline void iommu_group_set_iommudata(struct iommu_group *group,
void *iommu_data,
void (*release)(void *iommu_data))
{
}

int iommu_group_set_name(struct iommu_group *group, const char *name)
static inline int iommu_group_set_name(struct iommu_group *group,
const char *name)
{
return -ENODEV;
}

int iommu_group_add_device(struct iommu_group *group, struct device *dev)
static inline int iommu_group_add_device(struct iommu_group *group,
struct device *dev)
{
return -ENODEV;
}

void iommu_group_remove_device(struct device *dev)
static inline void iommu_group_remove_device(struct device *dev)
{
}

int iommu_group_for_each_dev(struct iommu_group *group, void *data,
int (*fn)(struct device *, void *))
static inline int iommu_group_for_each_dev(struct iommu_group *group,
void *data,
int (*fn)(struct device *, void *))
{
return -ENODEV;
}

struct iommu_group *iommu_group_get(struct device *dev)
static inline struct iommu_group *iommu_group_get(struct device *dev)
{
return NULL;
}

void iommu_group_put(struct iommu_group *group)
static inline void iommu_group_put(struct iommu_group *group)
{
}

int iommu_group_register_notifier(struct iommu_group *group,
struct notifier_block *nb)
static inline int iommu_group_register_notifier(struct iommu_group *group,
struct notifier_block *nb)
{
return -ENODEV;
}

int iommu_group_unregister_notifier(struct iommu_group *group,
struct notifier_block *nb)
static inline int iommu_group_unregister_notifier(struct iommu_group *group,
struct notifier_block *nb)
{
return 0;
}

int iommu_group_id(struct iommu_group *group)
static inline int iommu_group_id(struct iommu_group *group)
{
return -ENODEV;
}
Expand Down

0 comments on commit 6a3e3db

Please sign in to comment.