Re: [PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-08-01 Thread Joerg Roedel
On Fri, Aug 01, 2008 at 08:51:23AM +0900, FUJITA Tomonori wrote:
> On Fri, 1 Aug 2008 09:43:23 +1000
> Stephen Rothwell <[EMAIL PROTECTED]> wrote:
> 
> > This reverts commit 29111f579f4f3f2a07385f931854ab0527ae7ea5.
> > 
> > This undoes the hasty addition of a global version of iommu_num_pages()
> > that broke both the powerpc and sparc builds.  This function can be
> > revisited later.
> > 
> > Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
> > ---
> >  arch/x86/kernel/amd_iommu.c   |   13 -
> >  arch/x86/kernel/pci-gart_64.c |   11 +++
> >  include/linux/iommu-helper.h  |1 -
> >  lib/iommu-helper.c|8 
> >  4 files changed, 15 insertions(+), 18 deletions(-)
> > 
> > This patch comes from
> > git revert -m 1 29111f579f4f3f2a07385f931854ab0527ae7ea5
> > 
> > I have test built powerpc ppc64_defconfig and sparc64 defconfig.  The only
> > references to iommu_num_pages() after this is applied are in the powerpc
> > and sparc code.
> > 
> > Linus, please apply.  This is impacting on both powerpc and sparc
> > development and even the author of the patches said that those patches
> > were not urgent.
> 
> Ingo has a patch to fix this problem in the x86 tree:
> 
> http://marc.info/?l=linux-kernel&m=121754062325903&w=2

FUJITA,

can you send your fix directly to Linus again please? Andrew mentioned
that the x86 maintainers are on vacation. That may be the reason that
your fix is not yet upstream.

Joerg

-- 
   |   AMD Saxony Limited Liability Company & Co. KG
 Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany
 System|  Register Court Dresden: HRA 4896
 Research  |  General Partner authorized to represent:
 Center| AMD Saxony LLC (Wilmington, Delaware, US)
   | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-08-01 Thread FUJITA Tomonori
On Fri, 01 Aug 2008 00:04:17 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:

> From: Joerg Roedel <[EMAIL PROTECTED]>
> Date: Fri, 1 Aug 2008 09:03:28 +0200
> 
> > That may be the reason that your fix is not yet upstream.
> 
> The reason is more-so because Linus simply hasn't merged more
> than a couple of patches since 2.6.27-rc1 was released.

Yeah, I think so.

I'll send the patch to Linus if necessary.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-08-01 Thread David Miller
From: Joerg Roedel <[EMAIL PROTECTED]>
Date: Fri, 1 Aug 2008 09:03:28 +0200

> That may be the reason that your fix is not yet upstream.

The reason is more-so because Linus simply hasn't merged more
than a couple of patches since 2.6.27-rc1 was released.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-07-31 Thread Stephen Rothwell
On Fri, 1 Aug 2008 08:51:23 +0900 FUJITA Tomonori <[EMAIL PROTECTED]> wrote:
>
> Ingo has a patch to fix this problem in the x86 tree:
> 
> http://marc.info/?l=linux-kernel&m=121754062325903&w=2

Then consider this a poke (to the appropriate person) to get something
merged to fix the breakage.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgptWj5KtSK52.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-07-31 Thread FUJITA Tomonori
On Fri, 1 Aug 2008 09:43:23 +1000
Stephen Rothwell <[EMAIL PROTECTED]> wrote:

> This reverts commit 29111f579f4f3f2a07385f931854ab0527ae7ea5.
> 
> This undoes the hasty addition of a global version of iommu_num_pages()
> that broke both the powerpc and sparc builds.  This function can be
> revisited later.
> 
> Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
> ---
>  arch/x86/kernel/amd_iommu.c   |   13 -
>  arch/x86/kernel/pci-gart_64.c |   11 +++
>  include/linux/iommu-helper.h  |1 -
>  lib/iommu-helper.c|8 
>  4 files changed, 15 insertions(+), 18 deletions(-)
> 
> This patch comes from
> git revert -m 1 29111f579f4f3f2a07385f931854ab0527ae7ea5
> 
> I have test built powerpc ppc64_defconfig and sparc64 defconfig.  The only
> references to iommu_num_pages() after this is applied are in the powerpc
> and sparc code.
> 
> Linus, please apply.  This is impacting on both powerpc and sparc
> development and even the author of the patches said that those patches
> were not urgent.

Ingo has a patch to fix this problem in the x86 tree:

http://marc.info/?l=linux-kernel&m=121754062325903&w=2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] Revert "Merge branch 'x86/iommu' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into for-linus"

2008-07-31 Thread Stephen Rothwell
This reverts commit 29111f579f4f3f2a07385f931854ab0527ae7ea5.

This undoes the hasty addition of a global version of iommu_num_pages()
that broke both the powerpc and sparc builds.  This function can be
revisited later.

Signed-off-by: Stephen Rothwell <[EMAIL PROTECTED]>
---
 arch/x86/kernel/amd_iommu.c   |   13 -
 arch/x86/kernel/pci-gart_64.c |   11 +++
 include/linux/iommu-helper.h  |1 -
 lib/iommu-helper.c|8 
 4 files changed, 15 insertions(+), 18 deletions(-)

This patch comes from
git revert -m 1 29111f579f4f3f2a07385f931854ab0527ae7ea5

I have test built powerpc ppc64_defconfig and sparc64 defconfig.  The only
references to iommu_num_pages() after this is applied are in the powerpc
and sparc code.

Linus, please apply.  This is impacting on both powerpc and sparc
development and even the author of the patches said that those patches
were not urgent.

diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 22d7d05..7469740 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -29,6 +29,9 @@
 
 #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28))
 
+#define to_pages(addr, size) \
+(round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)
+
 #define EXIT_LOOP_COUNT 1000
 
 static DEFINE_RWLOCK(amd_iommu_devtable_lock);
@@ -182,7 +185,7 @@ static int iommu_flush_pages(struct amd_iommu *iommu, u16 
domid,
u64 address, size_t size)
 {
int s = 0;
-   unsigned pages = iommu_num_pages(address, size);
+   unsigned pages = to_pages(address, size);
 
address &= PAGE_MASK;
 
@@ -554,8 +557,8 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct 
amd_iommu *iommu,
if (iommu->exclusion_start &&
iommu->exclusion_start < dma_dom->aperture_size) {
unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT;
-   int pages = iommu_num_pages(iommu->exclusion_start,
-   iommu->exclusion_length);
+   int pages = to_pages(iommu->exclusion_start,
+   iommu->exclusion_length);
dma_ops_reserve_addresses(dma_dom, startpage, pages);
}
 
@@ -764,7 +767,7 @@ static dma_addr_t __map_single(struct device *dev,
unsigned int pages;
int i;
 
-   pages = iommu_num_pages(paddr, size);
+   pages = to_pages(paddr, size);
paddr &= PAGE_MASK;
 
address = dma_ops_alloc_addresses(dev, dma_dom, pages);
@@ -799,7 +802,7 @@ static void __unmap_single(struct amd_iommu *iommu,
if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size))
return;
 
-   pages = iommu_num_pages(dma_addr, size);
+   pages = to_pages(dma_addr, size);
dma_addr &= PAGE_MASK;
start = dma_addr;
 
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 49285f8..744126e 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -67,6 +67,9 @@ static u32 gart_unmapped_entry;
(((x) & 0xf000) | (((x) >> 32) << 4) | GPTE_VALID | GPTE_COHERENT)
 #define GPTE_DECODE(x) (((x) & 0xf000) | (((u64)(x) & 0xff0) << 28))
 
+#define to_pages(addr, size) \
+   (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)
+
 #define EMERGENCY_PAGES 32 /* = 128KB */
 
 #ifdef CONFIG_AGP
@@ -238,7 +241,7 @@ nonforced_iommu(struct device *dev, unsigned long addr, 
size_t size)
 static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
size_t size, int dir)
 {
-   unsigned long npages = iommu_num_pages(phys_mem, size);
+   unsigned long npages = to_pages(phys_mem, size);
unsigned long iommu_page = alloc_iommu(dev, npages);
int i;
 
@@ -301,7 +304,7 @@ static void gart_unmap_single(struct device *dev, 
dma_addr_t dma_addr,
return;
 
iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;
-   npages = iommu_num_pages(dma_addr, size);
+   npages = to_pages(dma_addr, size);
for (i = 0; i < npages; i++) {
iommu_gatt_base[iommu_page + i] = gart_unmapped_entry;
CLEAR_LEAK(iommu_page + i);
@@ -384,7 +387,7 @@ static int __dma_map_cont(struct device *dev, struct 
scatterlist *start,
}
 
addr = phys_addr;
-   pages = iommu_num_pages(s->offset, s->length);
+   pages = to_pages(s->offset, s->length);
while (pages--) {
iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr);
SET_LEAK(iommu_page);
@@ -467,7 +470,7 @@ gart_map_sg(struct device *dev, struct scatterlist *sg, int 
nents, int dir)
 
seg_size += s->length;
need = nextneed;
-   pages += iommu_num_pages(s->offset, s->length);
+   pages += to_pages(s->offset, s->le