From: "Joel Soete" <soete.joel@tiscali.be>
To: "Grant Grundler" <grundler@parisc-linux.org>
Cc: parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] ccio-dma 64bit debug_init info
Date: Fri, 20 May 2005 12:42:05 +0200 [thread overview]
Message-ID: <4282FEEE00003164@mail-6-bnl.tiscali.it> (raw)
[-- Attachment #1: Type: text/plain, Size: 18931 bytes --]
Hello Grant,
Sorry for delay but I encountered some config pb with my isp imp config :-(
>
> On Tue, May 17, 2005 at 06:29:18PM +0200, Joel Soete wrote:
> > > > ccio-dma.c: failed to claim CCIO bus address space (ffffffff00000000,ffffffffffffffff)
> ...
> > > It would be interesting to know why it's asking for that range.
> > > Where are the values of that range coming from?
>
> > 32bit kernel:
> ...
> > ccio_init_resource(res=10712c68, name=GSC Bus [8/], ioaddr=fff88078)
> > ccio_init_resource() res->start f1000000
> > ccio_init_resource() res->end f17fffff
> > ccio_init_resource() res->end + 1 f1800000
> > ccio_init_resource() claimed CCIO bus address space (f1000000, f17fffff)
> > ccio_init_resource(res=10712c84, name=GSC Bus [8/], ioaddr=fff88060)
> > ccio_init_resource() res->start fc000000
> > ccio_init_resource() res->end fff7ffff
> > ccio_init_resource() res->end + 1 fff80000
> > ccio_init_resource() claimed CCIO bus address space (fc000000, fff7ffff)
> ...
>
> Ah...I forgot that U2/Uturn have two sets of range registers.
> One per GSC bus....
>
No pb ;-)
> BTW, PDC sets all of this address stuff up AFAIK.
>
Any idea where is the doc about this feature?
> ...
> > ccio_init_resource(res=1071245c, name=GSC Bus [10/], ioaddr=fff8a078)
> > ccio_init_resource() res->start f1800000
> > ccio_init_resource() res->end f1ffffff
> > ccio_init_resource() res->end + 1 f2000000
> > ccio_init_resource() claimed CCIO bus address space (f1800000, f1ffffff)
> > ccio_init_resource(res=10712478, name=GSC Bus [10/], ioaddr=fff8a060)
> > ccio_init_resource() res->start 00000000
> > ccio_init_resource() res->end ffffffff
> > ccio_init_resource() res->end + 1 00000000
> > Lasi version 0 at 0xffd00000 found.
> > ...
>
> This last one seems to be disabled.
Ah ok (any idea why? hw failure?)
> That's what this code in ccio_init_resource() is testing for:
> if (res->end + 1 == res->start)
> return;
>
> /me puts on his fortune teller hat and looks in his crystal ball:
> "Joel will be submitting a patch shortly...You must add a comment
> explaining WTF this test is doing..."
>
Ok ;-)
>
> > 64bit kernel:
> ...
> > ccio_init_resource(res=00000000109e3858, name=GSC Bus [8/], ioaddr=fffffffffff88078)
> > ccio_init_resource() res->start fffffffff1000000
> > ccio_init_resource() res->end fffffffff17fffff
> > ccio_init_resource() res->end + 1 fffffffff1800000
> > ccio_init_resource() claimed CCIO bus address space (fffffffff1000000,
> fffffffff17fffff)
> > ccio_init_resource(res=00000000109e3890, name=GSC Bus [8/], ioaddr=fffffffffff88060)
> > ccio_init_resource() res->start fffffffffc000000
> > ccio_init_resource() res->end fffffffffff7ffff
> > ccio_init_resource() res->end + 1 fffffffffff80000
> > ccio_init_resource() claimed CCIO bus address space (fffffffffc000000,
> fffffffffff7ffff)
>
> No problem with the first one.
>
(as far as i understand, yes )
> ...
> > ccio_init_resource(res=00000000109e5858, name=GSC Bus [10/], ioaddr=fffffffffff8a078)
> > ccio_init_resource() res->start fffffffff1800000
> > ccio_init_resource() res->end fffffffff1ffffff
> > ccio_init_resource() res->end + 1 fffffffff2000000
> > ccio_init_resource() claimed CCIO bus address space (fffffffff1800000,
> fffffffff1ffffff)
> > ccio_init_resource(res=00000000109e5890, name=GSC Bus [10/], ioaddr=fffffffffff8a060)
> > ccio_init_resource() res->start ffffffff00000000
> > ccio_init_resource() res->end ffffffffffffffff
> > ccio_init_resource() res->end + 1 0000000000000000
>
> This fails because io_io_low/high registers in reality are only 16 bits.
> The upper 16 bits are hardcoded to 1's.
> The conversion of res->start to 64-bit is wrong for this one case:
> res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16;
>
> __raw_readl(ioaddr) returns 0xffff0000.
> 0xffff0000 << 16 should be 0 but it's not since this is 64-bit.
> That line should read something like:
> res->start = (unsigned long) ((signed) __raw_readl(ioaddr) << 16);
>
cool ;-)
> And please add a comment here too that parenthesis *do* matter.
> Then it should fail the same test that I point out above....
>
> > ccio_init_resource() failed to claim CCIO bus address space (ffffffff00000000,
> > ffffffffffffffff)
>
> ...and we wouldn't even try to acquire this range.
>
> > ccio_init_resource() claimed CCIO bus address space (ffffffff00000000,
> ffffffffffffffff)
> > Lasi version 0 at 0xffffffffffd00000 found.
> >
> > even thought I have no doc to now what would means:
> > res->start = (unsigned long)(signed) READ_U32(ioaddr) << 16;
(==
> > 0x0 in 32bits)
> > res->end = (unsigned long)(signed) (READ_U32(ioaddr + 4) << 16)
> -
> > 1; (== 0xffffffff in 32bits too)
> >
> > but seems that test:
> > if (res->end + 1 == res->start)
> > is a stuff which not love 64bit :-(
>
> You almost got it right.
>
so here is a first patch:
--- drivers/parisc/ccio-dma.c.orig 2005-05-20 08:47:17.000000000 +0200
+++ drivers/parisc/ccio-dma.c.orig1 2005-05-20 12:15:35.000000000 +0200
@@ -1328,13 +1328,12 @@
ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->pdir_size));
if(NULL == ioc->pdir_base) {
- panic("%s:%s() could not allocate I/O Page Table\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate I/O Page Table\n", __FUNCTION__);
}
memset(ioc->pdir_base, 0, ioc->pdir_size);
BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned
long)ioc->pdir_base);
- DBG_INIT(" base %p", ioc->pdir_base);
+ DBG_INIT(" base %p\n", ioc->pdir_base);
/* resource map size dictated by pdir_size */
ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
@@ -1343,8 +1342,7 @@
ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->res_size));
if(NULL == ioc->res_map) {
- panic("%s:%s() could not allocate resource map\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate resource map\n", __FUNCTION__);
}
memset(ioc->res_map, 0, ioc->res_size);
@@ -1394,15 +1392,21 @@
res->parent = NULL;
res->flags = IORESOURCE_MEM;
- res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16;
- res->end = (unsigned long)(signed) (__raw_readl(ioaddr + 4) << 16)
- 1;
+ /*
+ * bracing ((signed) ...) are required for 64bit kernel
+ */
+ res->start = (unsigned long)((signed) READ_U32(ioaddr) << 16);
+ res->end = (unsigned long)((signed) (READ_U32(ioaddr + 4) << 16)
- 1);
res->name = name;
+ /*
+ * Check if the set of range registers is disable
+ */
if (res->end + 1 == res->start)
return;
result = request_resource(&iomem_resource, res);
if (result < 0) {
- printk(KERN_ERR "%s: failed to claim CCIO bus address space
(%08lx,%08lx)\n",
- __FILE__, res->start, res->end);
+ printk(KERN_ERR "%s() failed to claim CCIO bus address space
(%08lx,%08lx)\n",
+ __FUNCTION__, res->start, res->end);
}
}
====<>====
Some additional stuff:
--- drivers/parisc/ccio-dma.c.orig 2005-05-20 08:47:17.000000000 +0200
+++ drivers/parisc/ccio-dma.c.orig1 2005-05-20 12:15:35.000000000 +0200
@@ -1328,13 +1328,12 @@
ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->pdir_size));
if(NULL == ioc->pdir_base) {
- panic("%s:%s() could not allocate I/O Page Table\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate I/O Page Table\n", __FUNCTION__);
}
memset(ioc->pdir_base, 0, ioc->pdir_size);
BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned
long)i
oc->pdir_base);
- DBG_INIT(" base %p", ioc->pdir_base);
+ DBG_INIT(" base %p\n", ioc->pdir_base);
/* resource map size dictated by pdir_size */
ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
@@ -1343,8 +1342,7 @@
ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->res_size));
if(NULL == ioc->res_map) {
- panic("%s:%s() could not allocate resource map\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate resource map\n", __FUNCTION__);
}
memset(ioc->res_map, 0, ioc->res_size);
@@ -1394,15 +1392,21 @@
res->parent = NULL;
res->flags = IORESOURCE_MEM;
- res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16;
- res->end = (unsigned long)(signed) (__raw_readl(ioaddr + 4) << 16)
- 1;
+ /*
+ * bracing ((signed) ...) are required for 64bit kernel
+ */
+ res->start = (unsigned long)((signed) READ_U32(ioaddr) << 16);
+ res->end = (unsigned long)((signed) (READ_U32(ioaddr + 4) << 16)
- 1);
res->name = name;
+ /*
+ * Check if the set of range registers is disable
+ */
if (res->end + 1 == res->start)
return;
result = request_resource(&iomem_resource, res);
if (result < 0) {
- printk(KERN_ERR "%s: failed to claim CCIO bus address space
(%08
lx,%08lx)\n",
- __FILE__, res->start, res->end);
+ printk(KERN_ERR "%s() failed to claim CCIO bus address space
(%0
8lx,%08lx)\n",
+ __FUNCTION__, res->start, res->end);
}
}
jso@iatst001:~/work$ more ccio-dma.c.diff
--- drivers/parisc/ccio-dma.c.orig 2005-05-20 08:47:17.000000000 +0200
+++ drivers/parisc/ccio-dma.c.orig1 2005-05-20 12:15:35.000000000 +0200
@@ -1328,13 +1328,12 @@
ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->pdir_size));
if(NULL == ioc->pdir_base) {
- panic("%s:%s() could not allocate I/O Page Table\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate I/O Page Table\n", __FUNCTION__);
}
memset(ioc->pdir_base, 0, ioc->pdir_size);
BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned
long)ioc->pdir_base);
- DBG_INIT(" base %p", ioc->pdir_base);
+ DBG_INIT(" base %p\n", ioc->pdir_base);
/* resource map size dictated by pdir_size */
ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
@@ -1343,8 +1342,7 @@
ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
get_order(ioc->res_size));
if(NULL == ioc->res_map) {
- panic("%s:%s() could not allocate resource map\n", __FILE__,
- __FUNCTION__);
+ panic("%s() could not allocate resource map\n", __FUNCTION__);
}
memset(ioc->res_map, 0, ioc->res_size);
@@ -1394,15 +1392,21 @@
res->parent = NULL;
res->flags = IORESOURCE_MEM;
- res->start = (unsigned long)(signed) __raw_readl(ioaddr) << 16;
- res->end = (unsigned long)(signed) (__raw_readl(ioaddr + 4) << 16)
- 1;
+ /*
+ * bracing ((signed) ...) are required for 64bit kernel
+ */
+ res->start = (unsigned long)((signed) READ_U32(ioaddr) << 16);
+ res->end = (unsigned long)((signed) (READ_U32(ioaddr + 4) << 16)
- 1);
res->name = name;
+ /*
+ * Check if the set of range registers is disable
+ */
if (res->end + 1 == res->start)
return;
result = request_resource(&iomem_resource, res);
if (result < 0) {
- printk(KERN_ERR "%s: failed to claim CCIO bus address space
(%08lx,%08lx)\n",
- __FILE__, res->start, res->end);
+ printk(KERN_ERR "%s() failed to claim CCIO bus address space
(%08lx,%08lx)\n",
+ __FUNCTION__, res->start, res->end);
}
}
jso@iatst001:~/work$ vi ccio-dma.c.diff
jso@iatst001:~/work$ more ccio-dma.c.diff1
--- drivers/parisc/ccio-dma.c.orig1 2005-05-20 12:15:35.000000000 +0200
+++ drivers/parisc/ccio-dma.c 2005-05-20 12:14:50.000000000 +0200
@@ -387,8 +387,7 @@
__FILE__, __FUNCTION__, pages_needed);
}
- panic("%s: %s() I/O MMU is out of mapping resources.\n", __FILE__,
- __FUNCTION__);
+ panic("%s() I/O MMU is out of mapping resources.\n", __FUNCTION__);
resource_found:
@@ -578,7 +577,7 @@
** WORD 0 - high order word
*/
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
/*
** get bits 12:15 of physical address
** shift bits 16:31 of physical address
@@ -589,7 +588,7 @@
asm volatile ("depd %1,35,4,%0" : "+r" (pa) : "r" (ci));
#else
pa = 0;
-#endif
+#endif /* CONFIG_64BIT */
/*
** get CPU coherency index bits
** Grab virtual index [0:11]
@@ -1288,10 +1287,10 @@
if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {
iova_space_size = 1 << (20 - PAGE_SHIFT);
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
} else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) {
iova_space_size = 1 << (30 - PAGE_SHIFT);
-#endif
+#endif /* CONFIG_64BIT */
}
/*
@@ -1487,15 +1486,15 @@
return 0;
if (!expand_ioc_area(parent, size, min, max, align)) {
- __raw_writel(((parent->start)>>16) | 0xffff0000,
+ WRITE_U32(((parent->start)>>16) | 0xffff0000,
&ioc->ioc_regs->io_io_low);
- __raw_writel(((parent->end)>>16) | 0xffff0000,
+ WRITE_U32(((parent->end)>>16) | 0xffff0000,
&ioc->ioc_regs->io_io_high);
} else if (!expand_ioc_area(parent + 1, size, min, max, align)) {
parent++;
- __raw_writel(((parent->start)>>16) | 0xffff0000,
+ WRITE_U32(((parent->start)>>16) | 0xffff0000,
&ioc->ioc_regs->io_io_low_hv);
- __raw_writel(((parent->end)>>16) | 0xffff0000,
+ WRITE_U32(((parent->end)>>16) | 0xffff0000,
&ioc->ioc_regs->io_io_high_hv);
} else {
return -EBUSY;
====<>====
and btw some stuff which could interesting sba:
--- drivers/parisc/sba_iommu.c.orig 2005-05-20 09:07:26.000000000 +0200
+++ drivers/parisc/sba_iommu.c 2005-05-20 09:33:23.000000000 +0200
@@ -91,7 +91,7 @@
#define DBG_RES(x...)
#endif
-#if defined(__LP64__) && !defined(CONFIG_PDC_NARROW)
+#if defined(CONFIG_64BIT) && !defined(CONFIG_PDC_NARROW)
/* "low end" PA8800 machines use ZX1 chipset */
#define ZX1_SUPPORT
#endif
@@ -231,7 +231,7 @@
spinlock_t res_lock;
unsigned int res_bitshift; /* from the LEFT! */
unsigned int res_size; /* size of resource map in bytes
*/
-#if SBA_HINT_SUPPORT
+#ifdef SBA_HINT_SUPPORT
/* FIXME : DMA HINTs not used */
unsigned long hint_mask_pdir; /* bits used for DMA hints */
unsigned int hint_shift_pdir;
@@ -294,7 +294,7 @@
/* Looks nice and keeps the compiler happy */
#define SBA_DEV(d) ((struct sba_device *) (d))
-#if SBA_AGP_SUPPORT
+#ifdef SBA_AGP_SUPPORT
static int reserve_sba_gart = 1;
#endif
@@ -314,7 +314,7 @@
#define WRITE_REG32(val, addr) __raw_writel(cpu_to_le32(val), addr)
#define WRITE_REG64(val, addr) __raw_writeq(cpu_to_le64(val), addr)
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
#define READ_REG(addr) READ_REG64(addr)
#define WRITE_REG(value, addr) WRITE_REG64(value, addr)
#else
@@ -324,7 +324,7 @@
#ifdef DEBUG_SBA_INIT
-/* NOTE: When __LP64__ isn't defined, READ_REG64() is two 32-bit reads */
+/* NOTE: When CONFIG_64BIT isn't defined, READ_REG64() is two 32-bit reads
*/
/**
* sba_dump_ranges - debugging only - print ranges assigned to this IOA
@@ -364,7 +364,7 @@
#else
#define sba_dump_ranges(x)
#define sba_dump_tlb(x)
-#endif
+#endif /* DEBUG_SBA_INIT */
#ifdef ASSERT_PDIR_SANITY
@@ -674,7 +674,7 @@
*
***************************************************************/
-#if SBA_HINT_SUPPORT
+#ifdef SBA_HINT_SUPPORT
#define SBA_DMA_HINT(ioc, val) ((val) << (ioc)->hint_shift_pdir)
#endif
@@ -1245,8 +1245,10 @@
unsigned long pdir_order = get_order(pdir_size);
pdir_base = __get_free_pages(GFP_KERNEL, pdir_order);
- if (NULL == (void *) pdir_base)
- panic("sba_ioc_init() could not allocate I/O Page Table\n");
+ if (NULL == (void *) pdir_base) {
+ panic("%s() could not allocate I/O Page Table\n",
+ __FUNCTION__);
+ }
/* If this is not PA8700 (PCX-W2)
** OR newer than ver 2.2
@@ -1354,7 +1356,7 @@
u32 iova_space_mask;
u32 iova_space_size;
int iov_order, tcnfg;
-#if SBA_AGP_SUPPORT
+#ifdef SBA_AGP_SUPPORT
int agp_found = 0;
#endif
/*
@@ -1391,7 +1393,7 @@
DBG_INIT("%s() pdir %p size %x\n",
__FUNCTION__, ioc->pdir_base, ioc->pdir_size);
-#if SBA_HINT_SUPPORT
+#ifdef SBA_HINT_SUPPORT
ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
@@ -1415,7 +1417,7 @@
WRITE_REG(ioc->imask, ioc->ioc_hpa + IOC_IMASK);
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
/*
** Setting the upper bits makes checking for bypass addresses
** a little faster later on.
@@ -1448,7 +1450,7 @@
*/
WRITE_REG(ioc->ibase | 31, ioc->ioc_hpa + IOC_PCOM);
-#if SBA_AGP_SUPPORT
+#ifdef SBA_AGP_SUPPORT
/*
** If an AGP device is present, only use half of the IOV space
** for PCI DMA. Unfortunately we can't know ahead of time
@@ -1528,7 +1530,7 @@
DBG_INIT("%s() pdir %p size %x\n",
__FUNCTION__, ioc->pdir_base, pdir_size);
-#if SBA_HINT_SUPPORT
+#ifdef SBA_HINT_SUPPORT
/* FIXME : DMA HINTs not used */
ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
====<>====
(Just get rid if you dislike)
Thanks,
Joel
[-- Attachment #2: ccio-dma.c.diff.gz --]
[-- Type: application/gzip, Size: 843 bytes --]
[-- Attachment #3: ccio-dma.c.diff1.gz --]
[-- Type: application/gzip, Size: 749 bytes --]
[-- Attachment #4: sba_iommu.c.diff.gz --]
[-- Type: application/gzip, Size: 1434 bytes --]
[-- Attachment #5: Type: text/plain, Size: 169 bytes --]
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
next reply other threads:[~2005-05-20 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-20 10:42 Joel Soete [this message]
2005-05-20 15:15 ` [parisc-linux] ccio-dma 64bit debug_init info Grant Grundler
[not found] ` <428F3D4A.6000200@tiscali.be>
[not found] ` <20050522015619.GB2733@colo.lackof.org>
[not found] ` <429083BB.6010506@tiscali.be>
2005-05-23 1:40 ` Grant Grundler
[not found] <1116610441.5174.40.camel@mulgrave>
2005-06-02 16:01 ` Joel Soete
-- strict thread matches above, loose matches on Subject: below --
2005-05-17 16:29 Joel Soete
2005-05-19 5:55 ` Grant Grundler
[not found] <20050513055734.GC8675@colo.lackof.org>
2005-05-13 6:47 ` Joel Soete
2005-05-12 17:37 Joel Soete
2005-05-12 17:47 ` Grant Grundler
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=4282FEEE00003164@mail-6-bnl.tiscali.it \
--to=soete.joel@tiscali.be \
--cc=grundler@parisc-linux.org \
--cc=parisc-linux@lists.parisc-linux.org \
/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