Skip to contentSkip to conversation

PPC kernel hangs

DISCUSSION Rupesh S 4 participants 8 messages Oct 12, 2004 – Oct 14, 2004

lore
Share & tools
lore

Rupesh S

author
#0 lore raw

Hi,

To perform a Memory Mapped access of a device, I setup the OR and BR registers in the bootloader (u-boot). I am able to read and write to the device being in the u-boot prompt. However, when I try to access the device after the Linux kernel boots up (say, in a driver), it gives me a exception message as follows.
#################################################################
enabl0004, DSISR: 00000063
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000 3
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
GPR16: 00000000 00000000 00000000 00000000 00009032 C3EF5E98 10064EBC C3E2C000
GPR24: C02EEA80 00000008 C60B2000 00000060 FFFFFFEA 00000000 C60B0000 C60B0000 Call backtrace:
00000000 C60B0338 C0014DE4 C000447C 10050000 1000B27C 1000C344 10003CBC 100038C8 0FE70E88 00000000
#################################################################

My platform is MPC880 Processor.

Do I need to setup something more in the kernel?

Signature · 1 line
Rupesh S
#1 lore raw
Quoted 25 lines · Rupesh S

Hi,

To perform a Memory Mapped access of a device, I setup the OR and BR registers in the bootloader (u-boot). I am able to read and write to the device being in the u-boot prompt. However, when I try to access the device after the Linux kernel boots up (say, in a driver), it gives me a exception message as follows.
#################################################################
enabl0004, DSISR: 00000063
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000 3
TASK = c3ef4000[18] 'insmod' Last syscall: 128
last math 00000000 last altivec 00000000
GPR00: C60B0338 C3EF5E50 C3EF4000 60000004 00001032 00000001 C018009E C60B0000
GPR08: C60B0BB8 C60B085C C60B0BBC C60B0000 C0180000 10056374 00000000 00000000
GPR16: 00000000 00000000 00000000 00000000 00009032 C3EF5E98 10064EBC C3E2C000
GPR24: C02EEA80 00000008 C60B2000 00000060 FFFFFFEA 00000000 C60B0000 C60B0000 Call backtrace:
00000000 C60B0338 C0014DE4 C000447C 10050000 1000B27C 1000C344 10003CBC 100038C8 0FE70E88 00000000
#################################################################

Quoted 3 lines

My platform is MPC880 Processor.

Do I need to setup something more in the kernel?

Did you use ioremap to get valid kernel virtual address for your device registers? You generally cannot just use physical address to access device from the device driver.

--
Eugene

#2 lore raw
Quoted 3 lines · Eugene Surovegin

Did you use ioremap to get valid kernel virtual address for your device registers? You generally cannot just use physical address to access device from the device driver.

Possibly also use io_block_mapping on ppc to map a block of IO memory before ioremapping.

Jon.

#3 lore raw
Quoted 2 lines · Jon Masters

Possibly also use io_block_mapping on ppc to map a block of IO memory before ioremapping.

Actually, in this case that's a bad idea. Ignore that.

Jon.

#4 lore raw
In reply to Jon Masters
Quoted 8 lines · Jon Masters
Quoted 3 lines · Eugene Surovegin

Did you use ioremap to get valid kernel virtual address for your device registers? You generally cannot just use physical address to access device from the device driver.

Possibly also use io_block_mapping on ppc to map a block of IO memory before ioremapping.

Yes, this is possible but considered obsoleted and not-recommended way of accessing device registers.

--
Eugene

#5 lore raw
Quoted 7 lines · Eugene Surovegin
Quoted 6 lines · Jon Masters
Quoted 3 lines · Eugene Surovegin

Did you use ioremap to get valid kernel virtual address for your device registers? You generally cannot just use physical address to access device from the device driver.

Quoted 5 lines
Quoted 2 lines

Possibly also use io_block_mapping on ppc to map a block of IO memory before ioremapping.

Yes, this is possible but considered obsoleted and not-recommended way of accessing device registers.

I realised that after I said it, old habbit.

Jon.

author
#6 lore raw
In reply to Jon Masters

Thanks for the informations.
I used "ioremap" and it works !!

However, when I checked out some documentaions on this regard, I happened to notice that for "cache disabled acees in some arch", we would probably need to use "ioremap_nocache". My requirement is for a cache disabled access. Also, I read that in some processor arch, the "nocache" and the normmal version is all the same. How is it in PPC ?

I could also read that it is encouraged to use "readl", "writel" to access the memory rather than the normal pointer dereferencing. However, in my driver, the normal pointer dereferencing works, but the "readl" and "writel" doesn't work. Here is the code snippet for the write operation. Any clues ?
################################################################
volatile __u32* __fpga;

__fpga = (__u32*) ioremap_nocache(0x60000000, (4*1024));

/* writel(data, ((__u32)__fpga + 0x0C)); */ /* This does not work */

*(volatile __u32*)((__u32)__fpga + 0x0C) = data; /* This works */
#############################################################

Quoted 11 lines · Jon Masters
Quoted 3 lines · Eugene Surovegin

Did you use ioremap to get valid kernel virtual address for your device registers? You generally cannot just use physical address to access device from the device driver.

Possibly also use io_block_mapping on ppc to map a block of IO memory before ioremapping.

Jon.

Signature · 1 line
Rupesh S
#7 lore raw
Quoted 9 lines · Rupesh S

################################################################
volatile __u32* __fpga;

__fpga = (__u32*) ioremap_nocache(0x60000000, (4*1024));

/* writel(data, ((__u32)__fpga + 0x0C)); */ /* This does not work */

*(volatile __u32*)((__u32)__fpga + 0x0C) = data; /* This works */
#############################################################

Hi Rupesh,

Notice that you're casting as a pointer in one case, and in the other you're not.

Jon.