From: Joerg Roedel <joerg.roedel@amd.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 18/34] x86/amd-iommu: Remove iommu specific handling from dma_ops path
Date: Fri, 27 Nov 2009 14:55:29 +0100 [thread overview]
Message-ID: <1259330145-14865-19-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1259330145-14865-1-git-send-email-joerg.roedel@amd.com>
This patch finishes the removal of all iommu specific
handling code in the dma_ops path.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index c04dcb7..2cd5800 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1436,11 +1436,11 @@ static struct dma_ops_domain *find_protection_domain(u16 devid)
* in this function.
*/
static bool get_device_resources(struct device *dev,
- struct amd_iommu **iommu,
struct protection_domain **domain,
u16 *bdf)
{
struct dma_ops_domain *dma_dom;
+ struct amd_iommu *iommu;
struct pci_dev *pcidev;
u16 _bdf;
@@ -1450,21 +1450,21 @@ static bool get_device_resources(struct device *dev,
pcidev = to_pci_dev(dev);
_bdf = calc_devid(pcidev->bus->number, pcidev->devfn);
*bdf = amd_iommu_alias_table[_bdf];
- *iommu = amd_iommu_rlookup_table[*bdf];
+ iommu = amd_iommu_rlookup_table[*bdf];
*domain = domain_for_device(*bdf);
if (*domain == NULL) {
dma_dom = find_protection_domain(*bdf);
if (!dma_dom)
- dma_dom = (*iommu)->default_dom;
+ dma_dom = iommu->default_dom;
*domain = &dma_dom->domain;
- attach_device(*iommu, *domain, *bdf);
+ attach_device(iommu, *domain, *bdf);
DUMP_printk("Using protection domain %d for device %s\n",
(*domain)->id, dev_name(dev));
}
if (domain_for_device(_bdf) == NULL)
- attach_device(*iommu, *domain, _bdf);
+ attach_device(iommu, *domain, _bdf);
return true;
}
@@ -1776,7 +1776,6 @@ static dma_addr_t map_page(struct device *dev, struct page *page,
struct dma_attrs *attrs)
{
unsigned long flags;
- struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
dma_addr_t addr;
@@ -1785,7 +1784,7 @@ static dma_addr_t map_page(struct device *dev, struct page *page,
INC_STATS_COUNTER(cnt_map_single);
- if (!get_device_resources(dev, &iommu, &domain, &devid))
+ if (!get_device_resources(dev, &domain, &devid))
/* device not handled by any AMD IOMMU */
return (dma_addr_t)paddr;
@@ -1815,13 +1814,12 @@ static void unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
enum dma_data_direction dir, struct dma_attrs *attrs)
{
unsigned long flags;
- struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
INC_STATS_COUNTER(cnt_unmap_single);
- if (!get_device_resources(dev, &iommu, &domain, &devid))
+ if (!get_device_resources(dev, &domain, &devid))
/* device not handled by any AMD IOMMU */
return;
@@ -1864,7 +1862,6 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
struct dma_attrs *attrs)
{
unsigned long flags;
- struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
int i;
@@ -1875,7 +1872,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
INC_STATS_COUNTER(cnt_map_sg);
- if (!get_device_resources(dev, &iommu, &domain, &devid))
+ if (!get_device_resources(dev, &domain, &devid))
return map_sg_no_iommu(dev, sglist, nelems, dir);
dma_mask = *dev->dma_mask;
@@ -1927,7 +1924,6 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
struct dma_attrs *attrs)
{
unsigned long flags;
- struct amd_iommu *iommu;
struct protection_domain *domain;
struct scatterlist *s;
u16 devid;
@@ -1935,7 +1931,7 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
INC_STATS_COUNTER(cnt_unmap_sg);
- if (!get_device_resources(dev, &iommu, &domain, &devid))
+ if (!get_device_resources(dev, &domain, &devid))
return;
if (!dma_ops_domain(domain))
@@ -1962,7 +1958,6 @@ static void *alloc_coherent(struct device *dev, size_t size,
{
unsigned long flags;
void *virt_addr;
- struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
phys_addr_t paddr;
@@ -1970,7 +1965,7 @@ static void *alloc_coherent(struct device *dev, size_t size,
INC_STATS_COUNTER(cnt_alloc_coherent);
- if (!get_device_resources(dev, &iommu, &domain, &devid)) {
+ if (!get_device_resources(dev, &domain, &devid)) {
virt_addr = (void *)__get_free_pages(flag, get_order(size));
*dma_addr = __pa(virt_addr);
return virt_addr;
@@ -2022,13 +2017,12 @@ static void free_coherent(struct device *dev, size_t size,
void *virt_addr, dma_addr_t dma_addr)
{
unsigned long flags;
- struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
INC_STATS_COUNTER(cnt_free_coherent);
- if (!get_device_resources(dev, &iommu, &domain, &devid))
+ if (!get_device_resources(dev, &domain, &devid))
goto free_mem;
if (!dma_ops_domain(domain))
--
1.6.5.3
next prev parent reply other threads:[~2009-11-27 13:58 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-27 13:55 [git pull] IOMMU updates for 2.6.33 Joerg Roedel
2009-11-27 13:55 ` [PATCH 01/34] x86/amd-iommu: Separate internal interface definitions Joerg Roedel
2009-11-27 13:55 ` [PATCH 02/34] x86/amd-iommu: Update copyright headers Joerg Roedel
2009-11-27 13:55 ` [PATCH 03/34] x86/amd-iommu: Add an index field to struct amd_iommu Joerg Roedel
2009-11-27 13:55 ` [PATCH 04/34] x86/amd-iommu: Add per IOMMU reference counting Joerg Roedel
2009-11-27 13:55 ` [PATCH 05/34] x86/amd-iommu: Add function to complete a tlb flush Joerg Roedel
2009-11-27 13:55 ` [PATCH 06/34] x86/amd-iommu: Make iommu_flush_pages aware of multiple IOMMUs Joerg Roedel
2009-11-27 13:55 ` [PATCH 07/34] x86/amd-iommu: Use __iommu_flush_pages for tlb flushes Joerg Roedel
2009-11-27 13:55 ` [PATCH 08/34] x86/amd-iommu: Remove iommu_flush_domain function Joerg Roedel
2009-11-27 13:55 ` [PATCH 09/34] x86/amd-iommu: Implement protection domain list Joerg Roedel
2009-11-27 13:55 ` [PATCH 10/34] x86/amd-iommu: Reimplement amd_iommu_flush_all_domains() Joerg Roedel
2009-11-27 13:55 ` [PATCH 11/34] x86/amd-iommu: Reimplement flush_all_domains_on_iommu() Joerg Roedel
2009-11-27 13:55 ` [PATCH 12/34] x86/amd-iommu: Make np-cache a global flag Joerg Roedel
2009-11-27 13:55 ` [PATCH 13/34] x86/amd-iommu: Use check_device for amd_iommu_dma_supported Joerg Roedel
2009-11-27 13:55 ` [PATCH 14/34] x86/amd-iommu: Use check_device in get_device_resources Joerg Roedel
2009-11-27 13:55 ` [PATCH 15/34] x86/amd-iommu: Remove iommu parameter from dma_ops_domain_(un)map Joerg Roedel
2009-11-27 13:55 ` [PATCH 16/34] x86/amd-iommu: Make alloc_new_range aware of multiple IOMMUs Joerg Roedel
2009-11-27 13:55 ` [PATCH 17/34] x86/amd-iommu: Remove iommu parameter from __(un)map_single Joerg Roedel
2009-11-27 13:55 ` Joerg Roedel [this message]
2009-11-27 13:55 ` [PATCH 19/34] x86/amd-iommu: Let domain_for_device handle aliases Joerg Roedel
2009-11-27 13:55 ` [PATCH 20/34] x86/amd-iommu: Simplify get_device_resources() Joerg Roedel
2009-11-27 13:55 ` [PATCH 21/34] x86/amd-iommu: Move find_protection_domain to helper functions Joerg Roedel
2009-11-27 13:55 ` [PATCH 22/34] x86/amd-iommu: Use get_device_id and check_device where appropriate Joerg Roedel
2009-11-27 13:55 ` [PATCH 23/34] x86/amd-iommu: Remove iommu parameter from dma_ops_domain_alloc Joerg Roedel
2009-11-27 13:55 ` [PATCH 24/34] x86/amd-iommu: Move some pte allocation functions in the right section Joerg Roedel
2009-11-27 13:55 ` [PATCH 25/34] x86/amd-iommu: Rearrange dma_ops related functions Joerg Roedel
2009-11-27 13:55 ` [PATCH 26/34] x86/amd-iommu: Remove support for domain sharing Joerg Roedel
2009-11-27 13:55 ` [PATCH 27/34] x86/amd-iommu: Use dev->arch->iommu to store iommu related information Joerg Roedel
2009-11-27 13:55 ` [PATCH 28/34] x86/amd-iommu: Add device bind reference counting Joerg Roedel
2009-11-27 13:55 ` [PATCH 29/34] x86/amd-iommu: Keep devices per domain in a list Joerg Roedel
2009-11-27 13:55 ` [PATCH 30/34] x86/amd-iommu: Cleanup attach/detach_device code Joerg Roedel
2009-11-27 13:55 ` [PATCH 31/34] x86/amd-iommu: Introduce iommu_flush_device() function Joerg Roedel
2009-11-27 13:55 ` [PATCH 32/34] x86/amd-iommu: Cleanup DTE flushing code Joerg Roedel
2009-11-27 13:55 ` [PATCH 33/34] x86/amd-iommu: Move reset_iommu_command_buffer out of locked code Joerg Roedel
2009-11-27 13:55 ` [PATCH 34/34] x86/amd-iommu: Remove amd_iommu_pd_table Joerg Roedel
2009-11-27 19:27 ` [git pull] IOMMU updates for 2.6.33 Ingo Molnar
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=1259330145-14865-19-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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