Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Build problem with drivers/net/au1000_eth.c
@ 2004-12-18 23:36 Josh Green
  2004-12-20  2:54 ` Fixes to drivers/net/au1000_eth.c Josh Green
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Green @ 2004-12-18 23:36 UTC (permalink / raw)
  To: linux-mips


[-- Attachment #1.1: Type: text/plain, Size: 2120 bytes --]

I'm using latest linux-mips CVS kernel (2.6.10rc3) and GCC 3.4.2 on a
AMD Alchemy DBau1100 development board (mipsel/MIPS32).  I wasn't able
to find any other location to post bugs, so please let me know if there
is a bug system or more appropriate place to post this.  The kernel
build dies with:

  CC      drivers/net/au1000_eth.o
drivers/net/au1000_eth.c: In function `au1000_init_module':
drivers/net/au1000_eth.c:100: sorry, unimplemented: inlining failed in
call to 'str2eaddr': function body not available
drivers/net/au1000_eth.c:1506: sorry, unimplemented: called from here
drivers/net/au1000_eth.c: At top level:
drivers/net/au1000_eth.c:152: warning: 'phy_link' defined but not used
make[2]: *** [drivers/net/au1000_eth.o] Error 1
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2


I was able to get things to build with the following patch, although I'm
sure this is not the proper way to do things:
$ cvs diff drivers/net/au1000_eth.c

Index: drivers/net/au1000_eth.c
===================================================================
RCS file: /home/cvs/linux/drivers/net/au1000_eth.c,v
retrieving revision 1.39
diff -r1.39 au1000_eth.c
100c100
< extern inline void str2eaddr(unsigned char *ea, unsigned char *str);
---
> extern void str2eaddr(unsigned char *ea, unsigned char *str);



I'm noticing another problem now though (a kernel oops), which could be
related to my little patch above.  I changed the definition of str2eaddr
in arch/mips/au1000/common/prom.c to also not be inline just to make
sure they matched.  I now get this oops which seems to appear/disappear
after enabling/disabling kernel options (although I have not been able
to trace it down to one particular feature).  This leads me to believe
it is some sort of alignment bug, which is what the exception refers to.
I have yet been able to build a ksymoops that will work properly, but
I'm still working on that.  If any one has any tips on how I can resolve
this issue I could use the help.  Raw oops output (not ksymoops yet) is
attached.

Best regards,
	Josh Green


[-- Attachment #1.2: au1000_init_oops.txt --]
[-- Type: text/plain, Size: 1521 bytes --]

Unhandled kernel unaligned access in arch/mips/kernel/unaligned.c::emulate_load_store_insn, line 475[#1]:
Cpu 0
$ 0   : 00000000 1000fc00 6e2f7373 00000000
$ 4   : 80300000 810f1400 00000003 b0500014
$ 8   : 0000561b 810f1400 b0500018 00000000
$12   : 8036fcf8 fffffffa ffffffff 0000000a
$16   : 00000022 00000001 00000020 810f1400
$20   : 810f1620 0000ffff 80326ccc b0500000
$24   : 00000001 810b9e1a
$28   : 810b8000 810b9f40 810f1620 8035a2f8
Hi    : 000301ff
Lo    : fc85b000
epc   : 8035a4d4 au1000_init_module+0x4b8/0x8bc     Not tainted
ra    : 8035a2f8 au1000_init_module+0x2dc/0x8bc
Status: 1000fc03    KERNEL EXL IE
Cause : 00800010
BadVA : 6e2f7373
PrId  : 02030204
Modules linked in:
Process swapper (pid: 1, threadinfo=810b8000, task=810adb48)
Stack : 37687465 810f1400 b0500000 0000001c 181a0000 8035c2d4 00000000 00000000
        0000001c 8036fcf8 8036158c 00000000 802f0000 802f0000 80360000 803615bc
        802f0000 802f0000 80300000 801006fc 00000000 00000000 00000000 00000000
        00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        00000000 80104d54 1000fc03 00000000 00000000 00000000 00000000 80104d44
        ...
Call Trace:
 [<8035c2d4>] devinet_init+0x24/0x64
 [<801006fc>] init+0xc4/0x254
 [<80104d54>] kernel_thread_helper+0x10/0x18
 [<80104d44>] kernel_thread_helper+0x0/0x18


Code: 00000000  8c420004  3c048030 <8c460000> 248408a0  0c049920  00008821  00001021  26850004
Kernel panic - not syncing: Attempted to kill init!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Fixes to drivers/net/au1000_eth.c
  2004-12-18 23:36 Build problem with drivers/net/au1000_eth.c Josh Green
@ 2004-12-20  2:54 ` Josh Green
  2004-12-20 17:06   ` Pete Popov
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Green @ 2004-12-20  2:54 UTC (permalink / raw)
  To: linux-mips


[-- Attachment #1.1: Type: text/plain, Size: 1376 bytes --]

On Sat, 2004-12-18 at 15:36 -0800, Josh Green wrote:
> I'm using latest linux-mips CVS kernel (2.6.10rc3) and GCC 3.4.2 on a
> AMD Alchemy DBau1100 development board (mipsel/MIPS32).  I wasn't able
> to find any other location to post bugs, so please let me know if there
> is a bug system or more appropriate place to post this.

I'm replying to my own post, since I discovered what was causing the
kernel oops with the au1000_eth.c driver.  The attached patch fixes 3
problems:

- The build problem with extern inline str2eaddr.  I just made it
non-inline, although I'm not sure if this is the best way to resolve the
issue.

- At the end of mii_probe(): aup->mii is checked to indicate whether an
ethernet device was found or not, this variable will actually always be
set, which leads to a crash when aup->mii->chip_info->name is accessed
in code following it (in the case where no device is detected).
aup->mii->chip_info seems like a better test, although I'm not positive
on that one.

- In au1000_probe() 'sizeof(dev->dev_addr)' was being used in memcpy
when copying ethernet MAC addresses.  This size is currently 32 which is
larger than the 6 byte buffers being used in the copies, leading to
kernel oopses.

If I should be sending this to the author of the driver or some other
location, please let me know. Best regards,
	Josh Green


[-- Attachment #1.2: au1000_eth_fixes.patch --]
[-- Type: text/x-patch, Size: 1391 bytes --]

Index: arch/mips/au1000/common/prom.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/au1000/common/prom.c,v
retrieving revision 1.12
diff -r1.12 prom.c
115c115
< inline void str2eaddr(unsigned char *ea, unsigned char *str)
---
> void str2eaddr(unsigned char *ea, unsigned char *str)
Index: drivers/net/au1000_eth.c
===================================================================
RCS file: /home/cvs/linux/drivers/net/au1000_eth.c,v
retrieving revision 1.39
diff -r1.39 au1000_eth.c
100,101c100
< extern inline void str2eaddr(unsigned char *ea, unsigned char *str);
< extern inline unsigned char str2hexnum(unsigned char c);
---
> extern void str2eaddr(unsigned char *ea, unsigned char *str);
1045c1044
< 	if (aup->mii == NULL) {
---
> 	if (aup->mii->chip_info == NULL) {
1497c1496
< 			memcpy(au1000_mac_addr, ethaddr, sizeof(dev->dev_addr));
---
> 			memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
1508c1507
< 						sizeof(dev->dev_addr));
---
> 						sizeof(au1000_mac_addr));
1513c1512
< 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(dev->dev_addr));
---
> 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
1523c1522
< 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(dev->dev_addr));
---
> 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fixes to drivers/net/au1000_eth.c
  2004-12-20  2:54 ` Fixes to drivers/net/au1000_eth.c Josh Green
@ 2004-12-20 17:06   ` Pete Popov
  0 siblings, 0 replies; 3+ messages in thread
From: Pete Popov @ 2004-12-20 17:06 UTC (permalink / raw)
  To: Josh Green; +Cc: linux-mips

Thanks, I'll take care of the patches.

Pete

Josh Green wrote:
> On Sat, 2004-12-18 at 15:36 -0800, Josh Green wrote:
> 
>>I'm using latest linux-mips CVS kernel (2.6.10rc3) and GCC 3.4.2 on a
>>AMD Alchemy DBau1100 development board (mipsel/MIPS32).  I wasn't able
>>to find any other location to post bugs, so please let me know if there
>>is a bug system or more appropriate place to post this.
> 
> 
> I'm replying to my own post, since I discovered what was causing the
> kernel oops with the au1000_eth.c driver.  The attached patch fixes 3
> problems:
> 
> - The build problem with extern inline str2eaddr.  I just made it
> non-inline, although I'm not sure if this is the best way to resolve the
> issue.
> 
> - At the end of mii_probe(): aup->mii is checked to indicate whether an
> ethernet device was found or not, this variable will actually always be
> set, which leads to a crash when aup->mii->chip_info->name is accessed
> in code following it (in the case where no device is detected).
> aup->mii->chip_info seems like a better test, although I'm not positive
> on that one.
> 
> - In au1000_probe() 'sizeof(dev->dev_addr)' was being used in memcpy
> when copying ethernet MAC addresses.  This size is currently 32 which is
> larger than the 6 byte buffers being used in the copies, leading to
> kernel oopses.
> 
> If I should be sending this to the author of the driver or some other
> location, please let me know. Best regards,
> 	Josh Green
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: arch/mips/au1000/common/prom.c
> ===================================================================
> RCS file: /home/cvs/linux/arch/mips/au1000/common/prom.c,v
> retrieving revision 1.12
> diff -r1.12 prom.c
> 115c115
> < inline void str2eaddr(unsigned char *ea, unsigned char *str)
> ---
> 
>>void str2eaddr(unsigned char *ea, unsigned char *str)
> 
> Index: drivers/net/au1000_eth.c
> ===================================================================
> RCS file: /home/cvs/linux/drivers/net/au1000_eth.c,v
> retrieving revision 1.39
> diff -r1.39 au1000_eth.c
> 100,101c100
> < extern inline void str2eaddr(unsigned char *ea, unsigned char *str);
> < extern inline unsigned char str2hexnum(unsigned char c);
> ---
> 
>>extern void str2eaddr(unsigned char *ea, unsigned char *str);
> 
> 1045c1044
> < 	if (aup->mii == NULL) {
> ---
> 
>>	if (aup->mii->chip_info == NULL) {
> 
> 1497c1496
> < 			memcpy(au1000_mac_addr, ethaddr, sizeof(dev->dev_addr));
> ---
> 
>>			memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
> 
> 1508c1507
> < 						sizeof(dev->dev_addr));
> ---
> 
>>						sizeof(au1000_mac_addr));
> 
> 1513c1512
> < 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(dev->dev_addr));
> ---
> 
>>		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
> 
> 1523c1522
> < 		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(dev->dev_addr));
> ---
> 
>>		memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-20 17:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-18 23:36 Build problem with drivers/net/au1000_eth.c Josh Green
2004-12-20  2:54 ` Fixes to drivers/net/au1000_eth.c Josh Green
2004-12-20 17:06   ` Pete Popov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox