lkml.org 
[lkml]   [2011]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[03/89] intel-iommu: Only unlink device domains from iommu
    2.6.39-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Alex Williamson <alex.williamson@redhat.com>

    commit 9b4554b21ed07e8556405510638171f0c787742a upstream.

    Commit a97590e5 added unlinking domains from iommus to reciprocate the
    iommu from domains unlinking that was already done. We actually want
    to only do this for device domains and never for the static
    identity map domain or VM domains. The SI domain is special and
    never freed, while VM domain->id lives in their own special address
    space, separate from iommu->domain_ids.

    In the current code, a VM can get domain->id zero, then mark that
    domain unused when unbound from pci-stub. This leads to DMAR
    write faults when the device is re-bound to the host driver.

    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/pci/intel-iommu.c | 11 +++++++----
    1 file changed, 7 insertions(+), 4 deletions(-)

    --- a/drivers/pci/intel-iommu.c
    +++ b/drivers/pci/intel-iommu.c
    @@ -3422,10 +3422,13 @@ static void domain_remove_one_dev_info(s
    domain_update_iommu_cap(domain);
    spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags);

    - spin_lock_irqsave(&iommu->lock, tmp_flags);
    - clear_bit(domain->id, iommu->domain_ids);
    - iommu->domains[domain->id] = NULL;
    - spin_unlock_irqrestore(&iommu->lock, tmp_flags);
    + if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) &&
    + !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)) {
    + spin_lock_irqsave(&iommu->lock, tmp_flags);
    + clear_bit(domain->id, iommu->domain_ids);
    + iommu->domains[domain->id] = NULL;
    + spin_unlock_irqrestore(&iommu->lock, tmp_flags);
    + }
    }

    spin_unlock_irqrestore(&device_domain_lock, flags);



    \
     
     \ /
      Last update: 2011-06-16 09:03    [W:4.208 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site