@@ -779,7 +779,7 @@ static inline bool iort_iommu_driver_enabled(u8 type)
779
779
static struct acpi_iort_node * iort_get_msi_resv_iommu (struct device * dev )
780
780
{
781
781
struct acpi_iort_node * iommu ;
782
- struct iommu_fwspec * fwspec = dev -> iommu_fwspec ;
782
+ struct iommu_fwspec * fwspec = dev_iommu_fwspec_get ( dev ) ;
783
783
784
784
iommu = iort_get_iort_node (fwspec -> iommu_fwnode );
785
785
@@ -794,9 +794,10 @@ static struct acpi_iort_node *iort_get_msi_resv_iommu(struct device *dev)
794
794
return NULL ;
795
795
}
796
796
797
- static inline const struct iommu_ops * iort_fwspec_iommu_ops (
798
- struct iommu_fwspec * fwspec )
797
+ static inline const struct iommu_ops * iort_fwspec_iommu_ops (struct device * dev )
799
798
{
799
+ struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
800
+
800
801
return (fwspec && fwspec -> ops ) ? fwspec -> ops : NULL ;
801
802
}
802
803
@@ -824,6 +825,7 @@ static inline int iort_add_device_replay(const struct iommu_ops *ops,
824
825
*/
825
826
int iort_iommu_msi_get_resv_regions (struct device * dev , struct list_head * head )
826
827
{
828
+ struct iommu_fwspec * fwspec = dev_iommu_fwspec_get (dev );
827
829
struct acpi_iort_its_group * its ;
828
830
struct acpi_iort_node * iommu_node , * its_node = NULL ;
829
831
int i , resv = 0 ;
@@ -841,9 +843,9 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
841
843
* a given PCI or named component may map IDs to.
842
844
*/
843
845
844
- for (i = 0 ; i < dev -> iommu_fwspec -> num_ids ; i ++ ) {
846
+ for (i = 0 ; i < fwspec -> num_ids ; i ++ ) {
845
847
its_node = iort_node_map_id (iommu_node ,
846
- dev -> iommu_fwspec -> ids [i ],
848
+ fwspec -> ids [i ],
847
849
NULL , IORT_MSI_TYPE );
848
850
if (its_node )
849
851
break ;
@@ -874,8 +876,7 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
874
876
return (resv == its -> its_count ) ? resv : - ENODEV ;
875
877
}
876
878
#else
877
- static inline const struct iommu_ops * iort_fwspec_iommu_ops (
878
- struct iommu_fwspec * fwspec )
879
+ static inline const struct iommu_ops * iort_fwspec_iommu_ops (struct device * dev );
879
880
{ return NULL ; }
880
881
static inline int iort_add_device_replay (const struct iommu_ops * ops ,
881
882
struct device * dev )
@@ -1045,7 +1046,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
1045
1046
* If we already translated the fwspec there
1046
1047
* is nothing left to do, return the iommu_ops.
1047
1048
*/
1048
- ops = iort_fwspec_iommu_ops (dev -> iommu_fwspec );
1049
+ ops = iort_fwspec_iommu_ops (dev );
1049
1050
if (ops )
1050
1051
return ops ;
1051
1052
@@ -1084,7 +1085,7 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev)
1084
1085
* add_device callback for dev, replay it to get things in order.
1085
1086
*/
1086
1087
if (!err ) {
1087
- ops = iort_fwspec_iommu_ops (dev -> iommu_fwspec );
1088
+ ops = iort_fwspec_iommu_ops (dev );
1088
1089
err = iort_add_device_replay (ops , dev );
1089
1090
}
1090
1091
0 commit comments