From: Joerg Roedel <joerg.roedel@amd.com>
To: Ingo Molnar <mingo@redhat.com>, Avi Kivity <avi@redhat.com>,
David Woodhouse <dwmw2@infradead.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Alexander Graf <agraf@suse.de>,
Han Weidong <weidong.han@intel.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
iommu@lists.linux-foundation.org,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 09/12] VT-d: adapt device attach and detach functions for IOMMU API
Date: Tue, 2 Dec 2008 14:01:20 +0100 [thread overview]
Message-ID: <1228222883-17207-10-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1228222883-17207-1-git-send-email-joerg.roedel@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
drivers/pci/intel-iommu.c | 28 +++++++++++++++-------------
include/linux/intel-iommu.h | 4 ----
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 59b9cdb..62ae6b1 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2809,9 +2809,11 @@ static void intel_iommu_domain_destroy(struct iommu_domain *domain)
vm_domain_exit(dmar_domain);
}
-int intel_iommu_assign_device(struct dmar_domain *domain,
- struct pci_dev *pdev)
+static int intel_iommu_attach_device(struct iommu_domain *domain,
+ struct device *dev)
{
+ struct dmar_domain *dmar_domain = domain->priv;
+ struct pci_dev *pdev = to_pci_dev(dev);
struct intel_iommu *iommu;
int addr_width;
u64 end;
@@ -2823,7 +2825,7 @@ int intel_iommu_assign_device(struct dmar_domain *domain,
old_domain = find_domain(pdev);
if (old_domain) {
- if (domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE)
+ if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE)
vm_domain_remove_one_dev_info(old_domain, pdev);
else
domain_remove_dev_info(old_domain);
@@ -2838,29 +2840,29 @@ int intel_iommu_assign_device(struct dmar_domain *domain,
addr_width = agaw_to_width(iommu->agaw);
end = DOMAIN_MAX_ADDR(addr_width);
end = end & VTD_PAGE_MASK;
- if (end < domain->max_addr) {
+ if (end < dmar_domain->max_addr) {
printk(KERN_ERR "%s: iommu agaw (%d) is not "
"sufficient for the mapped address (%llx)\n",
- __func__, iommu->agaw, domain->max_addr);
+ __func__, iommu->agaw, dmar_domain->max_addr);
return -EFAULT;
}
- ret = vm_domain_context_mapping(domain, pdev);
+ ret = vm_domain_context_mapping(dmar_domain, pdev);
if (ret)
return ret;
- ret = vm_domain_add_dev_info(domain, pdev);
+ ret = vm_domain_add_dev_info(dmar_domain, pdev);
return ret;
}
-EXPORT_SYMBOL_GPL(intel_iommu_assign_device);
-
-void intel_iommu_deassign_device(struct dmar_domain *domain,
- struct pci_dev *pdev)
+static void intel_iommu_detach_device(struct iommu_domain *domain,
+ struct device *dev)
{
- vm_domain_remove_one_dev_info(domain, pdev);
+ struct dmar_domain *dmar_domain = domain->priv;
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ vm_domain_remove_one_dev_info(dmar_domain, pdev);
}
-EXPORT_SYMBOL_GPL(intel_iommu_deassign_device);
int intel_iommu_map_pages(struct dmar_domain *domain, dma_addr_t iova,
u64 hpa, size_t size, int prot)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 5a4ce23..41d2a3b 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -337,10 +337,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
-int intel_iommu_assign_device(struct dmar_domain *domain,
- struct pci_dev *pdev);
-void intel_iommu_deassign_device(struct dmar_domain *domain,
- struct pci_dev *pdev);
int intel_iommu_map_pages(struct dmar_domain *domain, dma_addr_t iova,
u64 hpa, size_t size, int prot);
void intel_iommu_unmap_pages(struct dmar_domain *domain,
--
1.5.6.4
next prev parent reply other threads:[~2008-12-02 13:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-02 13:01 [PATCH 0/12] Factor VT-d KVM functions into a generic API (with multiple device assignment support) Joerg Roedel
2008-12-02 13:01 ` [PATCH 01/12] VT-d: Support multiple device assignment for KVM Joerg Roedel
2008-12-02 13:01 ` [PATCH 02/12] KVM: change to use new APIs for kvm vtd Joerg Roedel
2008-12-02 13:01 ` [PATCH 03/12] KVM: rename vtd.c to iommu.c Joerg Roedel
2008-12-02 13:01 ` [PATCH 04/12] introcude linux/iommu.h for an iommu api Joerg Roedel
2008-12-02 13:01 ` [PATCH 05/12] add frontend implementation for the IOMMU API Joerg Roedel
2008-12-02 13:01 ` [PATCH 06/12] select IOMMU_API when DMAR and/or AMD_IOMMU is selected Joerg Roedel
2008-12-02 13:01 ` [PATCH 07/12] KVM: change KVM iommu.c to use IOMMU API Joerg Roedel
2008-12-02 13:01 ` [PATCH 08/12] VT-d: adapt domain init and destroy functions for " Joerg Roedel
2008-12-02 13:01 ` Joerg Roedel [this message]
2008-12-02 13:01 ` [PATCH 10/12] VT-d: adapt domain map and unmap " Joerg Roedel
2008-12-02 13:01 ` [PATCH 11/12] VT-d: adapt domain iova_to_phys function " Joerg Roedel
2008-12-02 13:01 ` [PATCH 12/12] VT-d: register functions for the " Joerg Roedel
2008-12-03 3:44 ` [PATCH 0/12] Factor VT-d KVM functions into a generic API (with multiple device assignment support) Greg KH
2008-12-03 7:50 ` Joerg Roedel
2008-12-03 7:53 ` Greg KH
2008-12-03 9:03 ` Joerg Roedel
2008-12-04 10:47 ` Muli Ben-Yehuda
2008-12-03 10:17 ` Han, Weidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1228222883-17207-10-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@suse.de \
--cc=iommu@lists.linux-foundation.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=weidong.han@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome