PCI: iova: lockdep false alarm fix

lockdep goes off on the iova copy_reserved_iova() because it and a function
it calls grabs locks in the from, and the to of the copy operation.

The function grab locks of the same lock classes triggering the warning. The
first lock grabbed is for the constant reserved areas that is never accessed
after early boot. Technically you could do without grabbing the locks for the
"from" structure its copying reserved areas from.

But dropping the from locks to me looks wrong, even though it would be ok.

The affected code only runs in early boot as its setting up the DMAR
engines.

This patch gives the reserved_ioval_list locks special lockdep classes.

Signed-off-by: Mark Gross <mgross@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by Mark Gross and committed by Greg Kroah-Hartman 8a443df4 7c12c92f

+7
+7
drivers/pci/intel-iommu.c
··· 1097 } 1098 1099 static struct iova_domain reserved_iova_list; 1100 1101 static void dmar_init_reserved_ranges(void) 1102 { ··· 1108 u64 addr, size; 1109 1110 init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); 1111 1112 /* IOAPIC ranges shouldn't be accessed by DMA */ 1113 iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START),
··· 1097 } 1098 1099 static struct iova_domain reserved_iova_list; 1100 + static struct lock_class_key reserved_alloc_key; 1101 + static struct lock_class_key reserved_rbtree_key; 1102 1103 static void dmar_init_reserved_ranges(void) 1104 { ··· 1106 u64 addr, size; 1107 1108 init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); 1109 + 1110 + lockdep_set_class(&reserved_iova_list.iova_alloc_lock, 1111 + &reserved_alloc_key); 1112 + lockdep_set_class(&reserved_iova_list.iova_rbtree_lock, 1113 + &reserved_rbtree_key); 1114 1115 /* IOAPIC ranges shouldn't be accessed by DMA */ 1116 iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START),