From f5ac89326e9e011a6dc7d8f848a4297b11f51d16 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 19 Jul 2012 13:42:54 +0200 Subject: [PATCH] --- yaml --- r: 316567 b: refs/heads/master c: 2c9195e990297068d0f1f1bd8e2f1d09538009da h: refs/heads/master i: 316565: 8894d3bc629a1c14b8ccbfafbe8d1ea25d72b535 316563: 2022561c13ec688e2b6b780b007f2424aa58e7c7 316559: b02d8162d4f2888f07e0704f96093ce9e4ac348b v: v3 --- [refs] | 2 +- trunk/drivers/iommu/amd_iommu.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 098ee74b1743..d93fd0321e99 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2c13d47a1a7ee8808796016c617aef25fd1d1925 +refs/heads/master: 2c9195e990297068d0f1f1bd8e2f1d09538009da diff --git a/trunk/drivers/iommu/amd_iommu.c b/trunk/drivers/iommu/amd_iommu.c index 625626391f2d..3f365ab9f7c7 100644 --- a/trunk/drivers/iommu/amd_iommu.c +++ b/trunk/drivers/iommu/amd_iommu.c @@ -2254,6 +2254,18 @@ static int device_change_notifier(struct notifier_block *nb, iommu_init_device(dev); + /* + * dev_data is still NULL and + * got initialized in iommu_init_device + */ + dev_data = get_dev_data(dev); + + if (iommu_pass_through || dev_data->iommu_v2) { + dev_data->passthrough = true; + attach_device(dev, pt_domain); + break; + } + domain = domain_for_device(dev); /* allocate a protection domain if a device is added */ @@ -2271,10 +2283,7 @@ static int device_change_notifier(struct notifier_block *nb, dev_data = get_dev_data(dev); - if (!dev_data->passthrough) - dev->archdata.dma_ops = &amd_iommu_dma_ops; - else - dev->archdata.dma_ops = &nommu_dma_ops; + dev->archdata.dma_ops = &amd_iommu_dma_ops; break; case BUS_NOTIFY_DEL_DEVICE: