diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-09 14:34:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-09 14:34:15 -0500 |
commit | 189addce85330208bea50ea7f1483b58822e93cf (patch) | |
tree | 39455d91caa0463c7c4fdcd9c76b81e18541b29d | |
parent | 59e8f10ac16186c226ef81937994534b28b976f4 (diff) | |
parent | 930a42ded3fede7ca3acafc9153f4f2d0f56a92c (diff) |
Merge tag 'vfio-v4.10-final' of git://github.com/awilliam/linux-vfio
Pull VFIO fix from Alex Williamson:
"Fix regression in attaching groups to existing container for SPAPR
IOMMU backend (Alexey Kardashevskiy)"
* tag 'vfio-v4.10-final' of git://github.com/awilliam/linux-vfio:
vfio/spapr_tce: Set window when adding additional groups to container
-rw-r--r-- | drivers/vfio/vfio_iommu_spapr_tce.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 7690e5bf3cf1..59b3f62a2d64 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c | |||
@@ -1245,6 +1245,8 @@ static void tce_iommu_release_ownership_ddw(struct tce_container *container, | |||
1245 | static long tce_iommu_take_ownership_ddw(struct tce_container *container, | 1245 | static long tce_iommu_take_ownership_ddw(struct tce_container *container, |
1246 | struct iommu_table_group *table_group) | 1246 | struct iommu_table_group *table_group) |
1247 | { | 1247 | { |
1248 | long i, ret = 0; | ||
1249 | |||
1248 | if (!table_group->ops->create_table || !table_group->ops->set_window || | 1250 | if (!table_group->ops->create_table || !table_group->ops->set_window || |
1249 | !table_group->ops->release_ownership) { | 1251 | !table_group->ops->release_ownership) { |
1250 | WARN_ON_ONCE(1); | 1252 | WARN_ON_ONCE(1); |
@@ -1253,7 +1255,27 @@ static long tce_iommu_take_ownership_ddw(struct tce_container *container, | |||
1253 | 1255 | ||
1254 | table_group->ops->take_ownership(table_group); | 1256 | table_group->ops->take_ownership(table_group); |
1255 | 1257 | ||
1258 | /* Set all windows to the new group */ | ||
1259 | for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) { | ||
1260 | struct iommu_table *tbl = container->tables[i]; | ||
1261 | |||
1262 | if (!tbl) | ||
1263 | continue; | ||
1264 | |||
1265 | ret = table_group->ops->set_window(table_group, i, tbl); | ||
1266 | if (ret) | ||
1267 | goto release_exit; | ||
1268 | } | ||
1269 | |||
1256 | return 0; | 1270 | return 0; |
1271 | |||
1272 | release_exit: | ||
1273 | for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) | ||
1274 | table_group->ops->unset_window(table_group, i); | ||
1275 | |||
1276 | table_group->ops->release_ownership(table_group); | ||
1277 | |||
1278 | return ret; | ||
1257 | } | 1279 | } |
1258 | 1280 | ||
1259 | static int tce_iommu_attach_group(void *iommu_data, | 1281 | static int tce_iommu_attach_group(void *iommu_data, |