From: Joerg Roedel <joerg.roedel@amd.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com,
rth@twiddle.net, paulus@samba.org, benh@kernel.crashing.org,
davem@davemloft.net,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Muli Ben-Yehuda <muli@il.ibm.com>,
linux-kernel@vger.kernel.org, Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 09/10] alpha: use iommu_num_pages function in IOMMU code
Date: Mon, 4 Aug 2008 18:04:49 +0200 [thread overview]
Message-ID: <1217865890-3593-10-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1217865890-3593-1-git-send-email-joerg.roedel@amd.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/alpha/kernel/pci_iommu.c | 17 +++++------------
1 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 2179c60..b9094da 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -41,13 +41,6 @@ mk_iommu_pte(unsigned long paddr)
return (paddr >> (PAGE_SHIFT-1)) | 1;
}
-static inline long
-calc_npages(long bytes)
-{
- return (bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
-}
-\f
-
/* Return the minimum of MAX or the first power of two larger
than main memory. */
@@ -287,7 +280,7 @@ pci_map_single_1(struct pci_dev *pdev, void *cpu_addr, size_t size,
if (!arena || arena->dma_base + arena->size - 1 > max_dma)
arena = hose->sg_isa;
- npages = calc_npages((paddr & ~PAGE_MASK) + size);
+ npages = iommu_num_pages(paddr, size, PAGE_SIZE);
/* Force allocation to 64KB boundary for ISA bridges. */
if (pdev && pdev == isa_bridge)
@@ -387,7 +380,7 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
BUG();
}
- npages = calc_npages((dma_addr & ~PAGE_MASK) + size);
+ npages = iommu_num_pages(dma_addr, size, PAGE_SIZE);
spin_lock_irqsave(&arena->lock, flags);
@@ -580,7 +573,7 @@ sg_fill(struct device *dev, struct scatterlist *leader, struct scatterlist *end,
contiguous. */
paddr &= ~PAGE_MASK;
- npages = calc_npages(paddr + size);
+ npages = iommu_num_pages(paddr, size, PAGE_SIZE);
dma_ofs = iommu_arena_alloc(dev, arena, npages, 0);
if (dma_ofs < 0) {
/* If we attempted a direct map above but failed, die. */
@@ -616,7 +609,7 @@ sg_fill(struct device *dev, struct scatterlist *leader, struct scatterlist *end,
sg++;
}
- npages = calc_npages((paddr & ~PAGE_MASK) + size);
+ npages = iommu_num_pages(paddr, size, PAGE_SIZE);
paddr &= PAGE_MASK;
for (i = 0; i < npages; ++i, paddr += PAGE_SIZE)
@@ -775,7 +768,7 @@ pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
DBGA(" (%ld) sg [%lx,%lx]\n",
sg - end + nents, addr, size);
- npages = calc_npages((addr & ~PAGE_MASK) + size);
+ npages = iommu_num_pages(addr, size, PAGE_SIZE);
ofs = (addr - arena->dma_base) >> PAGE_SHIFT;
iommu_arena_free(arena, ofs, npages);
--
1.5.3.7
next prev parent reply other threads:[~2008-08-04 16:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 16:04 [PATCH 0/10] introduce generic iommu_num_pages function Joerg Roedel
2008-08-04 16:04 ` [PATCH 01/10] x86: rename iommu_num_pages function to iommu_nr_pages Joerg Roedel
2008-08-04 16:04 ` [PATCH 02/10] sparc64: " Joerg Roedel
2008-08-04 21:27 ` David Miller
2008-08-04 16:04 ` [PATCH 03/10] powerpc: " Joerg Roedel
2008-08-04 16:04 ` [PATCH 04/10] introduce generic iommu_num_pages function Joerg Roedel
2008-08-04 16:04 ` [PATCH 05/10] x86: convert GART driver to " Joerg Roedel
2008-08-04 16:04 ` [PATCH 06/10] x86, AMD IOMMU: convert " Joerg Roedel
2008-08-04 16:04 ` [PATCH 07/10] x86: convert Calgary IOMMU " Joerg Roedel
2008-08-04 16:09 ` Muli Ben-Yehuda
2008-08-04 16:04 ` [PATCH 08/10] powerpc: use iommu_num_pages function in IOMMU code Joerg Roedel
2008-08-04 16:04 ` Joerg Roedel [this message]
2008-08-04 16:04 ` [PATCH 10/10] sparc64: " Joerg Roedel
2008-08-04 21:28 ` David Miller
2008-08-05 1:09 ` Benjamin Herrenschmidt
2008-08-05 2:04 ` FUJITA Tomonori
2008-08-05 7:49 ` Joerg Roedel
2008-08-05 8:23 ` Benjamin Herrenschmidt
2008-08-05 1:08 ` [PATCH 0/10] introduce generic iommu_num_pages function Benjamin Herrenschmidt
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=1217865890-3593-10-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=muli@il.ibm.com \
--cc=paulus@samba.org \
--cc=rth@twiddle.net \
--cc=tglx@linutronix.de \
/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