From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJU5w-0006XG-Mq for qemu-devel@nongnu.org; Sun, 26 Jul 2015 18:08:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZJU5v-0005WK-Ex for qemu-devel@nongnu.org; Sun, 26 Jul 2015 18:08:32 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]:39766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZJU5v-0005W8-8i for qemu-devel@nongnu.org; Sun, 26 Jul 2015 18:08:31 -0400 Date: Mon, 27 Jul 2015 00:08:28 +0200 From: Aurelien Jarno Message-ID: <20150726220828.GA19504@aurel32.net> References: <1437763343-7980-1-git-send-email-hpoussin@reactos.org> <1437763343-7980-3-git-send-email-hpoussin@reactos.org> <20150726201105.GA13016@aurel32.net> <55B544AE.7000709@reactos.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <55B544AE.7000709@reactos.org> Subject: Re: [Qemu-devel] [PATCH for 2.4 2/3] net/dp8393x: specify memory operations for PROM PROM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-15?Q?Herv=E9?= Poussineau Cc: Paolo Bonzini , Leon Alrae , qemu-devel@nongnu.org On 2015-07-26 22:35, Herv=E9 Poussineau wrote: > >How does it crashes in that case? I would have guess that write access > >to ROM are ignored by default. Looking at other code, it seems they call > >memory_region_set_readonly() instead of providing an accepts function. > >Maybe readonly should be the default for a rom device? >=20 > The stack trace is: > 0x000055555563a758 in memory_region_access_valid (mr=3Dmr@entry=3D0x55555= adb0d50, addr=3Daddr@entry=3D0, size=3Dsize@entry=3D1, is_write=3Dis_write@= entry=3Dtrue) at memory.c:1075 > 1075 if (!mr->ops->valid.unaligned && (addr & (size - 1))) { > (gdb) bt > #0 0x000055555563a758 in memory_region_access_valid (mr=3Dmr@entry=3D0x5= 5555adb0d50, addr=3Daddr@entry=3D0, size=3Dsize@entry=3D1, is_write=3Dis_wr= ite@entry=3Dtrue) at memory.c:1075 > #1 0x000055555563a968 in memory_region_dispatch_write (mr=3D0x55555adb0d= 50, addr=3D0, data=3D82, size=3D1, attrs=3D...) at memory.c:1155 > #2 0x00007fffe6516f35 in code_gen_buffer () > #3 0x000055555560e4f3 in cpu_tb_exec (tb_ptr=3D0x7fffe6516ec0 "A\213n\374\205\355\017\205\220", cpu=3D0x55555703f1c0) at = cpu-exec.c:200 > #4 cpu_mips_exec (cpu=3Dcpu@entry=3D0x55555703f1c0) at cpu-exec.c:518 > #5 0x000055555562aec6 in tcg_cpu_exec (cpu=3D0x55555703f1c0) at cpus.c:1= 402 > #6 tcg_exec_all () at cpus.c:1434 > #7 qemu_tcg_cpu_thread_fn (arg=3D) at cpus.c:1068 > #8 0x00007ffff1dbd0a4 in start_thread (arg=3D0x7fffdf8f8700) at pthread_= create.c:309 > #9 0x00007ffff1af204d in clone () at ../sysdeps/unix/sysv/linux/x86_64/c= lone.S:111 >=20 > With mr being the dp8393x prom. >=20 >=20 > I tested with memory_region_set_readonly() and a NULL operations, and the= stack trace is the same. > Only pflash devices use memory_region_init_rom_device. Other devices use = memory_region_init_ram + memory_region_set_readonly, which work. > Do you prefer the attached patch? >=20 I have to say I am not sure what is the best, I don't know this part of the code enough. I have added Paolo in Cc:, I guess he might have an idea about that. Aurelien --=20 Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net