linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Microblaze image hanging in qemu with 3.15-rc
@ 2014-04-22 17:23 Guenter Roeck
  2014-04-23  5:32 ` Michal Simek
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-22 17:23 UTC (permalink / raw)
  To: Michal Simek; +Cc: linux-kernel

Hi all,

when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
I get the following hangup. This used to work with earlier kernels
with the same configuration.

Is this a known problem, or is something wrong with my configuration 
or with my qemu command line ?

Thanks,
Guenter

---
Qemu console log:

Early console on uartlite at 0x84000000
bootconsole [earlyser0] enabled
Ramdisk addr 0x00000000, 
FDT at 0x90543814
Linux version 3.15.0-rc1 (groeck@hyperion) (gcc version 4.8.0 (GCC) ) #1 Mon Apr 14 02:48:03 PDT 2014
setup_cpuinfo: initialising
setup_cpuinfo: No PVR support. Using static CPU info from FDT
wt_msr
setup_memory: max_mapnr: 0x8000
setup_memory: min_low_pfn: 0x90000
setup_memory: max_low_pfn: 0x98000
setup_memory: max_pfn: 0x98000
Zone ranges:
  DMA      [mem 0x90000000-0x97ffffff]
  Normal   empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x90000000-0x97ffffff]
On node 0 totalpages: 32768
free_area_init_node: node 0, pgdat c03b688c, node_mem_map c0577000
  DMA zone: 256 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 32768 pages, LIFO batch:7
early_printk_console remapping from 0x84000000 to 0xffffd000
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyUL0,115200
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 124172K/131072K available (2887K kernel code, 116K rwdata, 760K rodata, 1574K init, 202K bss, 6900K reserved)
Kernel virtual memory layout:
  * 0xffffe000..0xfffff000  : fixmap
  * 0xffffd000..0xffffe000  : early ioremap
  * 0xf0000000..0xffffd000  : vmalloc & ioremap
NR_IRQS:33
/plb@0/interrupt-controller@81800000: num_irq=4, edge=0xa
ERROR: CPU CCF input clock not found
/plb@0/timer@83c00000: irq=1
ERROR: timer CCF input clock not found
ERROR: Using CPU clock frequency
xilinx_timer_set_mode: shutdown
xilinx_timer_set_mode: periodic
sched_clock: 32 bits at 62MHz, resolution 16ns, wraps every 68719476720ns
Calibrating delay loop...

The image hangs here, and I have to kill qemu to get out.
Note the ERROR messages in the log.

---

Configuration file:

CONFIG_EXPERIMENTAL=y
CONFIG_SYSVIPC=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_SYSFS_DEPRECATED_V2=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="rootfs.cpio"
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y
# CONFIG_HOTPLUG is not set
# CONFIG_BASE_FULL is not set
# CONFIG_FUTEX is not set
# CONFIG_EPOLL is not set
# CONFIG_SIGNALFD is not set
# CONFIG_SHMEM is not set
CONFIG_SLAB=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_OPT_LIB_ASM=y
CONFIG_XILINX_MICROBLAZE0_FAMILY="spartan3adsp"
CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1
CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=1
CONFIG_HZ_100=y
CONFIG_MMU=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE_FORCE=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
# CONFIG_INET_LRO is not set
# CONFIG_IPV6 is not set
CONFIG_PROC_DEVICETREE=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=8192
CONFIG_NETDEVICES=y
CONFIG_NET_ETHERNET=y
CONFIG_XILINX_EMACLITE=y
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
CONFIG_SERIAL_UARTLITE=y
CONFIG_SERIAL_UARTLITE_CONSOLE=y
# CONFIG_HW_RANDOM is not set
# CONFIG_HWMON is not set
# CONFIG_USB_SUPPORT is not set
CONFIG_EXT2_FS=y
# CONFIG_DNOTIFY is not set
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_CIFS=y
CONFIG_CIFS_STATS=y
CONFIG_CIFS_STATS2=y
CONFIG_PARTITION_ADVANCED=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_INFO=y
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
CONFIG_EARLY_PRINTK=y
# CONFIG_CRYPTO_ANSI_CPRNG is not set

---

Qemu command line:

qemu-system-microblaze -M petalogix-s3adsp1800 \
	-kernel arch/microblaze/boot/linux.bin -no-reboot \
	-append "console=ttyUL0,115200" -nographic 


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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-22 17:23 Microblaze image hanging in qemu with 3.15-rc Guenter Roeck
@ 2014-04-23  5:32 ` Michal Simek
  2014-04-23 13:38   ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Simek @ 2014-04-23  5:32 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

Hi Guenter,


On 04/22/2014 07:23 PM, Guenter Roeck wrote:
> Hi all,
> 
> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
> I get the following hangup. This used to work with earlier kernels
> with the same configuration.
> 
> Is this a known problem, or is something wrong with my configuration 
> or with my qemu command line ?

Is this BE/LE version? Which qemu do you use?
There is endian autodetection in timer and intc driver
which can caused this problem.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-23  5:32 ` Michal Simek
@ 2014-04-23 13:38   ` Guenter Roeck
  2014-04-23 14:12     ` Michal Simek
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-23 13:38 UTC (permalink / raw)
  To: monstr; +Cc: linux-kernel

On 04/22/2014 10:32 PM, Michal Simek wrote:
> Hi Guenter,
>
>
> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
>> Hi all,
>>
>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
>> I get the following hangup. This used to work with earlier kernels
>> with the same configuration.
>>
>> Is this a known problem, or is something wrong with my configuration
>> or with my qemu command line ?
>
> Is this BE/LE version? Which qemu do you use?

BE.

file vmlinux:

vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped

qemu-system-microblaze --version:

QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard

gcc --version:

microblaze-linux-gcc (GCC) 4.8.0
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> There is endian autodetection in timer and intc driver
> which can caused this problem.
>
Is this new code ? I didn't see the problem in 3.13 (same compile options,
same configuration, same compiler, same qemu version).

Thanks,
Guenter


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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-23 13:38   ` Guenter Roeck
@ 2014-04-23 14:12     ` Michal Simek
  2014-04-23 15:45       ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Simek @ 2014-04-23 14:12 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2062 bytes --]

On 04/23/2014 03:38 PM, Guenter Roeck wrote:
> On 04/22/2014 10:32 PM, Michal Simek wrote:
>> Hi Guenter,
>>
>>
>> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
>>> Hi all,
>>>
>>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
>>> I get the following hangup. This used to work with earlier kernels
>>> with the same configuration.
>>>
>>> Is this a known problem, or is something wrong with my configuration
>>> or with my qemu command line ?
>>
>> Is this BE/LE version? Which qemu do you use?
> 
> BE.
> 
> file vmlinux:
> 
> vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped
> 
> qemu-system-microblaze --version:
> 
> QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
> 
> gcc --version:
> 
> microblaze-linux-gcc (GCC) 4.8.0
> Copyright (C) 2013 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
>> There is endian autodetection in timer and intc driver
>> which can caused this problem.
>>
> Is this new code ? I didn't see the problem in 3.13 (same compile options,
> same configuration, same compiler, same qemu version).

yes it was added to 3.15-rc1.

Try to rever this one
a66a626 microblaze: Use asm-generic/io.h

but the problem is probably here because you are not getting proper
reaction from qemu model.
a1715bb microblaze: Make timer driver endian aware
1aa1243 microblaze: Make intc driver endian aware

I have tested it on the latest petalinux qemu and there shouldn't be
any problem.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-23 14:12     ` Michal Simek
@ 2014-04-23 15:45       ` Guenter Roeck
  2014-04-24  6:16         ` Michal Simek
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-23 15:45 UTC (permalink / raw)
  To: Michal Simek; +Cc: linux-kernel

On Wed, Apr 23, 2014 at 04:12:59PM +0200, Michal Simek wrote:
> On 04/23/2014 03:38 PM, Guenter Roeck wrote:
> > On 04/22/2014 10:32 PM, Michal Simek wrote:
> >> Hi Guenter,
> >>
> >>
> >> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
> >>> Hi all,
> >>>
> >>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
> >>> I get the following hangup. This used to work with earlier kernels
> >>> with the same configuration.
> >>>
> >>> Is this a known problem, or is something wrong with my configuration
> >>> or with my qemu command line ?
> >>
> >> Is this BE/LE version? Which qemu do you use?
> > 
> > BE.
> > 
> > file vmlinux:
> > 
> > vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped
> > 
> > qemu-system-microblaze --version:
> > 
> > QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
> > 
> > gcc --version:
> > 
> > microblaze-linux-gcc (GCC) 4.8.0
> > Copyright (C) 2013 Free Software Foundation, Inc.
> > This is free software; see the source for copying conditions.  There is NO
> > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> > 
> >> There is endian autodetection in timer and intc driver
> >> which can caused this problem.
> >>
> > Is this new code ? I didn't see the problem in 3.13 (same compile options,
> > same configuration, same compiler, same qemu version).
> 
> yes it was added to 3.15-rc1.
> 
> Try to rever this one
> a66a626 microblaze: Use asm-generic/io.h
> 
> but the problem is probably here because you are not getting proper
> reaction from qemu model.
> a1715bb microblaze: Make timer driver endian aware
> 1aa1243 microblaze: Make intc driver endian aware
> 
> I have tested it on the latest petalinux qemu and there shouldn't be
> any problem.
> 
Hi Michal,

qemu 2.0.0 still has the problem. Bisect points to

commit a66a626538af65cbfc611e2b2fce500ed3f24518
Author: Michal Simek <michal.simek@xilinx.com>
Date:   Thu Feb 7 15:12:24 2013 +0100

    microblaze: Use asm-generic/io.h

as the culprit, so you were right on the money. Reverting this commit
fixes the problem.

Assuming this is in fact a problem with qemu, can you point me to a set
of qemu patches necessary to fix it ? Also, do you know if there are plans
to send the patches upstream ? I don't find anything related in the qemu
repository (though of course I may have missed it).

Thanks,
Guenter

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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-23 15:45       ` Guenter Roeck
@ 2014-04-24  6:16         ` Michal Simek
  2014-04-24 13:38           ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Simek @ 2014-04-24  6:16 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3646 bytes --]

On 04/23/2014 05:45 PM, Guenter Roeck wrote:
> On Wed, Apr 23, 2014 at 04:12:59PM +0200, Michal Simek wrote:
>> On 04/23/2014 03:38 PM, Guenter Roeck wrote:
>>> On 04/22/2014 10:32 PM, Michal Simek wrote:
>>>> Hi Guenter,
>>>>
>>>>
>>>> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
>>>>> Hi all,
>>>>>
>>>>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
>>>>> I get the following hangup. This used to work with earlier kernels
>>>>> with the same configuration.
>>>>>
>>>>> Is this a known problem, or is something wrong with my configuration
>>>>> or with my qemu command line ?
>>>>
>>>> Is this BE/LE version? Which qemu do you use?
>>>
>>> BE.
>>>
>>> file vmlinux:
>>>
>>> vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped
>>>
>>> qemu-system-microblaze --version:
>>>
>>> QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
>>>
>>> gcc --version:
>>>
>>> microblaze-linux-gcc (GCC) 4.8.0
>>> Copyright (C) 2013 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.  There is NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>>
>>>> There is endian autodetection in timer and intc driver
>>>> which can caused this problem.
>>>>
>>> Is this new code ? I didn't see the problem in 3.13 (same compile options,
>>> same configuration, same compiler, same qemu version).
>>
>> yes it was added to 3.15-rc1.
>>
>> Try to rever this one
>> a66a626 microblaze: Use asm-generic/io.h
>>
>> but the problem is probably here because you are not getting proper
>> reaction from qemu model.
>> a1715bb microblaze: Make timer driver endian aware
>> 1aa1243 microblaze: Make intc driver endian aware
>>
>> I have tested it on the latest petalinux qemu and there shouldn't be
>> any problem.
>>
> Hi Michal,
> 
> qemu 2.0.0 still has the problem. Bisect points to
> 
> commit a66a626538af65cbfc611e2b2fce500ed3f24518
> Author: Michal Simek <michal.simek@xilinx.com>
> Date:   Thu Feb 7 15:12:24 2013 +0100
> 
>     microblaze: Use asm-generic/io.h
> 
> as the culprit, so you were right on the money. Reverting this commit
> fixes the problem.

yep. But it is just side effect of previous two commits I have mentioned.
Can you just please check if you are setting up correct IO functions?

	write_fn = timer_write32;
	read_fn = timer_read32;

	write_fn(TCSR_MDT, timer_baseaddr + TCSR0);
	if (!(read_fn(timer_baseaddr + TCSR0) & TCSR_MDT)) {
		write_fn = timer_write32_be;
		read_fn = timer_read32_be;
	}
git

> Assuming this is in fact a problem with qemu, can you point me to a set
> of qemu patches necessary to fix it ? Also, do you know if there are plans
> to send the patches upstream ? I don't find anything related in the qemu
> repository (though of course I may have missed it).

Yes, it should be qemu issue. I am not aware about particular qemu patches
but you can try to use https://github.com/Xilinx/qemu
but now sure if Peter updating this repository.

Anyway if you look at code above and I expect that the problem is just
that autodetection is broken in your qemu it should be pretty simple
to fix it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-24  6:16         ` Michal Simek
@ 2014-04-24 13:38           ` Guenter Roeck
  2014-04-25  7:25             ` Michal Simek
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-24 13:38 UTC (permalink / raw)
  To: monstr; +Cc: linux-kernel

On 04/23/2014 11:16 PM, Michal Simek wrote:
> On 04/23/2014 05:45 PM, Guenter Roeck wrote:
>> On Wed, Apr 23, 2014 at 04:12:59PM +0200, Michal Simek wrote:
>>> On 04/23/2014 03:38 PM, Guenter Roeck wrote:
>>>> On 04/22/2014 10:32 PM, Michal Simek wrote:
>>>>> Hi Guenter,
>>>>>
>>>>>
>>>>> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
>>>>>> I get the following hangup. This used to work with earlier kernels
>>>>>> with the same configuration.
>>>>>>
>>>>>> Is this a known problem, or is something wrong with my configuration
>>>>>> or with my qemu command line ?
>>>>>
>>>>> Is this BE/LE version? Which qemu do you use?
>>>>
>>>> BE.
>>>>
>>>> file vmlinux:
>>>>
>>>> vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped
>>>>
>>>> qemu-system-microblaze --version:
>>>>
>>>> QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
>>>>
>>>> gcc --version:
>>>>
>>>> microblaze-linux-gcc (GCC) 4.8.0
>>>> Copyright (C) 2013 Free Software Foundation, Inc.
>>>> This is free software; see the source for copying conditions.  There is NO
>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>>>
>>>>> There is endian autodetection in timer and intc driver
>>>>> which can caused this problem.
>>>>>
>>>> Is this new code ? I didn't see the problem in 3.13 (same compile options,
>>>> same configuration, same compiler, same qemu version).
>>>
>>> yes it was added to 3.15-rc1.
>>>
>>> Try to rever this one
>>> a66a626 microblaze: Use asm-generic/io.h
>>>
>>> but the problem is probably here because you are not getting proper
>>> reaction from qemu model.
>>> a1715bb microblaze: Make timer driver endian aware
>>> 1aa1243 microblaze: Make intc driver endian aware
>>>
>>> I have tested it on the latest petalinux qemu and there shouldn't be
>>> any problem.
>>>
>> Hi Michal,
>>
>> qemu 2.0.0 still has the problem. Bisect points to
>>
>> commit a66a626538af65cbfc611e2b2fce500ed3f24518
>> Author: Michal Simek <michal.simek@xilinx.com>
>> Date:   Thu Feb 7 15:12:24 2013 +0100
>>
>>      microblaze: Use asm-generic/io.h
>>
>> as the culprit, so you were right on the money. Reverting this commit
>> fixes the problem.
>
> yep. But it is just side effect of previous two commits I have mentioned.
> Can you just please check if you are setting up correct IO functions?
>
> 	write_fn = timer_write32;
> 	read_fn = timer_read32;
>
> 	write_fn(TCSR_MDT, timer_baseaddr + TCSR0);
> 	if (!(read_fn(timer_baseaddr + TCSR0) & TCSR_MDT)) {
> 		write_fn = timer_write32_be;
> 		read_fn = timer_read32_be;
> 	}
> git
>

The read returns 0x1, so the access functions are not updated. If I change the code
to force the update to the _be versions, the calibration loop still hangs (obviously,
because then the result is 0x01000000, which is really wrong).

>> Assuming this is in fact a problem with qemu, can you point me to a set
>> of qemu patches necessary to fix it ? Also, do you know if there are plans
>> to send the patches upstream ? I don't find anything related in the qemu
>> repository (though of course I may have missed it).
>
> Yes, it should be qemu issue. I am not aware about particular qemu patches
> but you can try to use https://github.com/Xilinx/qemu
> but now sure if Peter updating this repository.
>
Last commit in that repository is from a year ago, so it looks like he doesn't
update it.

> Anyway if you look at code above and I expect that the problem is just
> that autodetection is broken in your qemu it should be pretty simple
> to fix it.
>
Not sure I understand what you'd expect qemu to return in this case,
and why it worked previously. Any idea ?

Thanks,
Guenter


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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-24 13:38           ` Guenter Roeck
@ 2014-04-25  7:25             ` Michal Simek
  2014-04-25 13:29               ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Michal Simek @ 2014-04-25  7:25 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 11212 bytes --]

On 04/24/2014 03:38 PM, Guenter Roeck wrote:
> On 04/23/2014 11:16 PM, Michal Simek wrote:
>> On 04/23/2014 05:45 PM, Guenter Roeck wrote:
>>> On Wed, Apr 23, 2014 at 04:12:59PM +0200, Michal Simek wrote:
>>>> On 04/23/2014 03:38 PM, Guenter Roeck wrote:
>>>>> On 04/22/2014 10:32 PM, Michal Simek wrote:
>>>>>> Hi Guenter,
>>>>>>
>>>>>>
>>>>>> On 04/22/2014 07:23 PM, Guenter Roeck wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>> when trying to run a microblaze image with 3.15-rc1 or 3.15-rc2 in qemu,
>>>>>>> I get the following hangup. This used to work with earlier kernels
>>>>>>> with the same configuration.
>>>>>>>
>>>>>>> Is this a known problem, or is something wrong with my configuration
>>>>>>> or with my qemu command line ?
>>>>>>
>>>>>> Is this BE/LE version? Which qemu do you use?
>>>>>
>>>>> BE.
>>>>>
>>>>> file vmlinux:
>>>>>
>>>>> vmlinux: ELF 32-bit MSB  executable, version 1 (SYSV), statically linked, BuildID[sha1]=5e1872c08df2956eddaed6fc1f6528a8540375b7, not stripped
>>>>>
>>>>> qemu-system-microblaze --version:
>>>>>
>>>>> QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard
>>>>>
>>>>> gcc --version:
>>>>>
>>>>> microblaze-linux-gcc (GCC) 4.8.0
>>>>> Copyright (C) 2013 Free Software Foundation, Inc.
>>>>> This is free software; see the source for copying conditions.  There is NO
>>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>>>>
>>>>>> There is endian autodetection in timer and intc driver
>>>>>> which can caused this problem.
>>>>>>
>>>>> Is this new code ? I didn't see the problem in 3.13 (same compile options,
>>>>> same configuration, same compiler, same qemu version).
>>>>
>>>> yes it was added to 3.15-rc1.
>>>>
>>>> Try to rever this one
>>>> a66a626 microblaze: Use asm-generic/io.h
>>>>
>>>> but the problem is probably here because you are not getting proper
>>>> reaction from qemu model.
>>>> a1715bb microblaze: Make timer driver endian aware
>>>> 1aa1243 microblaze: Make intc driver endian aware
>>>>
>>>> I have tested it on the latest petalinux qemu and there shouldn't be
>>>> any problem.
>>>>
>>> Hi Michal,
>>>
>>> qemu 2.0.0 still has the problem. Bisect points to
>>>
>>> commit a66a626538af65cbfc611e2b2fce500ed3f24518
>>> Author: Michal Simek <michal.simek@xilinx.com>
>>> Date:   Thu Feb 7 15:12:24 2013 +0100
>>>
>>>      microblaze: Use asm-generic/io.h
>>>
>>> as the culprit, so you were right on the money. Reverting this commit
>>> fixes the problem.
>>
>> yep. But it is just side effect of previous two commits I have mentioned.
>> Can you just please check if you are setting up correct IO functions?
>>
>>     write_fn = timer_write32;
>>     read_fn = timer_read32;
>>
>>     write_fn(TCSR_MDT, timer_baseaddr + TCSR0);
>>     if (!(read_fn(timer_baseaddr + TCSR0) & TCSR_MDT)) {
>>         write_fn = timer_write32_be;
>>         read_fn = timer_read32_be;
>>     }
>> git
>>
> 
> The read returns 0x1, so the access functions are not updated. If I change the code
> to force the update to the _be versions, the calibration loop still hangs (obviously,
> because then the result is 0x01000000, which is really wrong).

It means in model there is missing masking that upper bits in register
and model is just wrong.

HW behaviour

U-Boot-PetaLinux> md 41c00000
41c00000: 000000d2 000124f8 000023cb 00000000    .....$...#......
41c00010: 00000000 00000000 00000000 00000000    ................
41c00020: 000000d2 000124f8 000075b6 00000000    .....$...u......
41c00030: 00000000 00000000 00000000 00000000    ................
41c00040: 000000d2 000124f8 0000c7a4 00000000    .....$..........
41c00050: 00000000 00000000 00000000 00000000    ................
41c00060: 000000d2 000124f8 000119a8 00000000    .....$..........
41c00070: 00000000 00000000 00000000 00000000    ................
41c00080: 000000d2 000124f8 0000469b 00000000    .....$...F......
41c00090: 00000000 00000000 00000000 00000000    ................
41c000a0: 000000d2 000124f8 00009893 00000000    .....$..........
41c000b0: 00000000 00000000 00000000 00000000    ................
41c000c0: 000000d2 000124f8 0000ea8e 00000000    .....$..........
41c000d0: 00000000 00000000 00000000 00000000    ................
41c000e0: 000000d2 000124f8 0000178f 00000000    .....$..........
41c000f0: 00000000 00000000 00000000 00000000    ................
U-Boot-PetaLinux> mw 41c00010 10000000
U-Boot-PetaLinux> md 41c00000
41c00000: 000000d2 000124f8 00002e68 00000000    .....$..h.......
41c00010: 00000000 00000000 00000000 00000000    ................
41c00020: 000000d2 000124f8 00008052 00000000    .....$..R.......
41c00030: 00000000 00000000 00000000 00000000    ................
41c00040: 000000d2 000124f8 0000d245 00000000    .....$..E.......
41c00050: 00000000 00000000 00000000 00000000    ................
41c00060: 000000d2 000124f8 000123b7 00000000    .....$...#......
41c00070: 00000000 00000000 00000000 00000000    ................
41c00080: 000000d2 000124f8 0000513d 00000000    .....$..=Q......
41c00090: 00000000 00000000 00000000 00000000    ................
41c000a0: 000000d2 000124f8 0000a333 00000000    .....$..3.......
41c000b0: 00000000 00000000 00000000 00000000    ................
41c000c0: 000000d2 000124f8 0000f52e 00000000    .....$..........
41c000d0: 00000000 00000000 00000000 00000000    ................
41c000e0: 000000d2 000124f8 0000222a 00000000    .....$..*"......
41c000f0: 00000000 00000000 00000000 00000000    ................
U-Boot-PetaLinux>

QEMU behaviour:
U-Boot-PetaLinux> mw 41c00010 1
U-Boot-PetaLinux> md 41c00000
41c00000: 000000d2 000124f8 0000cfbb 00000000    .....$..........
41c00010: 00000001 00000000 ffffffff 00000000    ................
41c00020: 00000000 00000000 00000000 00000000    ................
41c00030: 00000000 00000000 00000000 00000000    ................
41c00040: 00000000 00000000 00000000 00000000    ................
41c00050: 00000000 00000000 00000000 00000000    ................
41c00060: 00000000 00000000 00000000 00000000    ................
41c00070: 00000000 00000000 00000000 00000000    ................
41c00080: 00000000 00000000 00000000 00000000    ................
41c00090: 00000000 00000000 00000000 00000000    ................
41c000a0: 00000000 00000000 00000000 00000000    ................
41c000b0: 00000000 00000000 00000000 00000000    ................
41c000c0: 00000000 00000000 00000000 00000000    ................
41c000d0: 00000000 00000000 00000000 00000000    ................
41c000e0: 00000000 00000000 00000000 00000000    ................
41c000f0: 00000000 00000000 00000000 00000000    ................
U-Boot-PetaLinux> mw 41c00010 0
U-Boot-PetaLinux> md 41c00000
41c00000: 000000d2 000124f8 00007362 00000000    .....$..bs......
41c00010: 00000000 00000000 ffffffff 00000000    ................
41c00020: 00000000 00000000 00000000 00000000    ................
41c00030: 00000000 00000000 00000000 00000000    ................
41c00040: 00000000 00000000 00000000 00000000    ................
41c00050: 00000000 00000000 00000000 00000000    ................
41c00060: 00000000 00000000 00000000 00000000    ................
41c00070: 00000000 00000000 00000000 00000000    ................
41c00080: 00000000 00000000 00000000 00000000    ................
41c00090: 00000000 00000000 00000000 00000000    ................
41c000a0: 00000000 00000000 00000000 00000000    ................
41c000b0: 00000000 00000000 00000000 00000000    ................
41c000c0: 00000000 00000000 00000000 00000000    ................
41c000d0: 00000000 00000000 00000000 00000000    ................
41c000e0: 00000000 00000000 00000000 00000000    ................
41c000f0: 00000000 00000000 00000000 00000000    ................
U-Boot-PetaLinux> mw 41c00010 10000000
U-Boot-PetaLinux> md 41c00000
41c00000: 000000d2 000124f8 0000e937 00000000    .....$..7.......
41c00010: 10000000 00000000 ffffffff 00000000    ................
41c00020: 00000000 00000000 00000000 00000000    ................
41c00030: 00000000 00000000 00000000 00000000    ................
41c00040: 00000000 00000000 00000000 00000000    ................
41c00050: 00000000 00000000 00000000 00000000    ................
41c00060: 00000000 00000000 00000000 00000000    ................
41c00070: 00000000 00000000 00000000 00000000    ................
41c00080: 00000000 00000000 00000000 00000000    ................
41c00090: 00000000 00000000 00000000 00000000    ................
41c000a0: 00000000 00000000 00000000 00000000    ................
41c000b0: 00000000 00000000 00000000 00000000    ................
41c000c0: 00000000 00000000 00000000 00000000    ................
41c000d0: 00000000 00000000 00000000 00000000    ................
41c000e0: 00000000 00000000 00000000 00000000    ................
41c000f0: 00000000 00000000 00000000 00000000    ................
U-Boot-PetaLinux> QEMU: Terminated

It should be pretty easy to fix it in timer_write function like this.

diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index 6113b97..3ff1da9 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -169,7 +169,7 @@ timer_write(void *opaque, hwaddr addr,
             if (value & TCSR_TINT)
                 value &= ~TCSR_TINT;

-            xt->regs[addr] = value;
+            xt->regs[addr] = value & 0x7ff;
             if (value & TCSR_ENT)
                 timer_enable(xt);
             break;


>>> Assuming this is in fact a problem with qemu, can you point me to a set
>>> of qemu patches necessary to fix it ? Also, do you know if there are plans
>>> to send the patches upstream ? I don't find anything related in the qemu
>>> repository (though of course I may have missed it).
>>
>> Yes, it should be qemu issue. I am not aware about particular qemu patches
>> but you can try to use https://github.com/Xilinx/qemu
>> but now sure if Peter updating this repository.
>>
> Last commit in that repository is from a year ago, so it looks like he doesn't
> update it.

That's too bad. :-(


>> Anyway if you look at code above and I expect that the problem is just
>> that autodetection is broken in your qemu it should be pretty simple
>> to fix it.
>>
> Not sure I understand what you'd expect qemu to return in this case,
> and why it worked previously. Any idea ?

Look at logs above and you will understand that.
It is just trying to write one bit in register. If it is written
correctly then you are using proper endianness. If not, you should use
different one.
Someone also pointed that maybe it is worth to also write the same bit
with BE helper functions and check it to ensure that IP is working
well.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-25  7:25             ` Michal Simek
@ 2014-04-25 13:29               ` Guenter Roeck
  2014-04-25 13:51                 ` Guenter Roeck
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-25 13:29 UTC (permalink / raw)
  To: monstr; +Cc: linux-kernel

On 04/25/2014 12:25 AM, Michal Simek wrote:
[ ... ]

>
> It should be pretty easy to fix it in timer_write function like this.
>
> diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
> index 6113b97..3ff1da9 100644
> --- a/hw/timer/xilinx_timer.c
> +++ b/hw/timer/xilinx_timer.c
> @@ -169,7 +169,7 @@ timer_write(void *opaque, hwaddr addr,
>               if (value & TCSR_TINT)
>                   value &= ~TCSR_TINT;
>
> -            xt->regs[addr] = value;
> +            xt->regs[addr] = value & 0x7ff;
>               if (value & TCSR_ENT)
>                   timer_enable(xt);
>               break;
>

Hi Michal,

that fixes endianness detection, but the image is still hanging.

Here is the log:

NR_IRQS:33
/plb@0/interrupt-controller@81800000: num_irq=4, edge=0xa
ERROR: CPU CCF input clock not found
Reading TCSR0 returned 0x0, expected 0x1
Switch to big endian mode
/plb@0/timer@83c00000: irq=1
ERROR: timer CCF input clock not found
ERROR: Using CPU clock frequency
xilinx_timer_set_mode: shutdown
xilinx_timer_set_mode: periodic
sched_clock: 32 bits at 62MHz, resolution 16ns, wraps every 68719476720ns
Calibrating delay loop... QEMU: Terminated

I added a couple of log messages to make sure that the mode is detected correctly.
Any idea what else might be wrong ?

Thanks,
Guenter


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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-25 13:29               ` Guenter Roeck
@ 2014-04-25 13:51                 ` Guenter Roeck
  2014-04-25 14:03                   ` Michal Simek
  0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2014-04-25 13:51 UTC (permalink / raw)
  To: monstr; +Cc: linux-kernel

On 04/25/2014 06:29 AM, Guenter Roeck wrote:
> On 04/25/2014 12:25 AM, Michal Simek wrote:
> [ ... ]
>
>>
>> It should be pretty easy to fix it in timer_write function like this.
>>
>> diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
>> index 6113b97..3ff1da9 100644
>> --- a/hw/timer/xilinx_timer.c
>> +++ b/hw/timer/xilinx_timer.c
>> @@ -169,7 +169,7 @@ timer_write(void *opaque, hwaddr addr,
>>               if (value & TCSR_TINT)
>>                   value &= ~TCSR_TINT;
>>
>> -            xt->regs[addr] = value;
>> +            xt->regs[addr] = value & 0x7ff;
>>               if (value & TCSR_ENT)
>>                   timer_enable(xt);
>>               break;
>>
>
> Hi Michal,
>
> that fixes endianness detection, but the image is still hanging.
>
> Here is the log:
>
> NR_IRQS:33
> /plb@0/interrupt-controller@81800000: num_irq=4, edge=0xa
> ERROR: CPU CCF input clock not found
> Reading TCSR0 returned 0x0, expected 0x1
> Switch to big endian mode
> /plb@0/timer@83c00000: irq=1
> ERROR: timer CCF input clock not found
> ERROR: Using CPU clock frequency
> xilinx_timer_set_mode: shutdown
> xilinx_timer_set_mode: periodic
> sched_clock: 32 bits at 62MHz, resolution 16ns, wraps every 68719476720ns
> Calibrating delay loop... QEMU: Terminated
>
> I added a couple of log messages to make sure that the mode is detected correctly.
> Any idea what else might be wrong ?
>

Never mind, I found it. Same problem with interrupt handler.
Can you give me the valid bit mask for intc_baseaddr + MER ?

Thanks,
Guenter


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

* Re: Microblaze image hanging in qemu with 3.15-rc
  2014-04-25 13:51                 ` Guenter Roeck
@ 2014-04-25 14:03                   ` Michal Simek
  0 siblings, 0 replies; 11+ messages in thread
From: Michal Simek @ 2014-04-25 14:03 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]

On 04/25/2014 03:51 PM, Guenter Roeck wrote:
> On 04/25/2014 06:29 AM, Guenter Roeck wrote:
>> On 04/25/2014 12:25 AM, Michal Simek wrote:
>> [ ... ]
>>
>>>
>>> It should be pretty easy to fix it in timer_write function like this.
>>>
>>> diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
>>> index 6113b97..3ff1da9 100644
>>> --- a/hw/timer/xilinx_timer.c
>>> +++ b/hw/timer/xilinx_timer.c
>>> @@ -169,7 +169,7 @@ timer_write(void *opaque, hwaddr addr,
>>>               if (value & TCSR_TINT)
>>>                   value &= ~TCSR_TINT;
>>>
>>> -            xt->regs[addr] = value;
>>> +            xt->regs[addr] = value & 0x7ff;
>>>               if (value & TCSR_ENT)
>>>                   timer_enable(xt);
>>>               break;
>>>
>>
>> Hi Michal,
>>
>> that fixes endianness detection, but the image is still hanging.
>>
>> Here is the log:
>>
>> NR_IRQS:33
>> /plb@0/interrupt-controller@81800000: num_irq=4, edge=0xa
>> ERROR: CPU CCF input clock not found
>> Reading TCSR0 returned 0x0, expected 0x1
>> Switch to big endian mode
>> /plb@0/timer@83c00000: irq=1
>> ERROR: timer CCF input clock not found
>> ERROR: Using CPU clock frequency
>> xilinx_timer_set_mode: shutdown
>> xilinx_timer_set_mode: periodic
>> sched_clock: 32 bits at 62MHz, resolution 16ns, wraps every 68719476720ns
>> Calibrating delay loop... QEMU: Terminated
>>
>> I added a couple of log messages to make sure that the mode is detected correctly.
>> Any idea what else might be wrong ?
>>
> 
> Never mind, I found it. Same problem with interrupt handler.
> Can you give me the valid bit mask for intc_baseaddr + MER ?

yep :-) MER mask is just 0x3.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

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

end of thread, other threads:[~2014-04-25 14:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22 17:23 Microblaze image hanging in qemu with 3.15-rc Guenter Roeck
2014-04-23  5:32 ` Michal Simek
2014-04-23 13:38   ` Guenter Roeck
2014-04-23 14:12     ` Michal Simek
2014-04-23 15:45       ` Guenter Roeck
2014-04-24  6:16         ` Michal Simek
2014-04-24 13:38           ` Guenter Roeck
2014-04-25  7:25             ` Michal Simek
2014-04-25 13:29               ` Guenter Roeck
2014-04-25 13:51                 ` Guenter Roeck
2014-04-25 14:03                   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).