* [Qemu-devel] qemu/target-ppc cpu.h exec.h helper.c op.c op_h... @ 2007-03-17 14:02 Jocelyn Mayer 2007-03-17 14:53 ` Wessel, Jason 0 siblings, 1 reply; 6+ messages in thread From: Jocelyn Mayer @ 2007-03-17 14:02 UTC (permalink / raw) To: qemu-devel CVSROOT: /sources/qemu Module name: qemu Changes by: Jocelyn Mayer <j_mayer> 07/03/17 14:02:15 Modified files: target-ppc : cpu.h exec.h helper.c op.c op_helper.c op_helper.h op_helper_mem.h op_mem.h translate.c Log message: Make it safe to use 64 bits GPR and/or 64 bits host registers. For "symetry", add 64 bits versions of all modified functions. As a side effect, add a lot of code provision for PowerPC 64 support. Move overflow and carry checks in common routines for simple cases. Add isel and popcntb instructions from PowerPC 2.03 specification. Remove remaining micro-operations helpers prototypes from op.c. Fix XER_BC field to be 7 bits long. Add power management support for PowerPC 603 & 604. Fix compilation warnings. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsroot=qemu&r1=1.26&r2=1.27 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/exec.h?cvsroot=qemu&r1=1.15&r2=1.16 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/helper.c?cvsroot=qemu&r1=1.32&r2=1.33 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op.c?cvsroot=qemu&r1=1.23&r2=1.24 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper.c?cvsroot=qemu&r1=1.18&r2=1.19 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper.h?cvsroot=qemu&r1=1.1&r2=1.2 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper_mem.h?cvsroot=qemu&r1=1.7&r2=1.8 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_mem.h?cvsroot=qemu&r1=1.8&r2=1.9 http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/translate.c?cvsroot=qemu&r1=1.44&r2=1.45 ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [Qemu-devel] qemu/target-ppc cpu.h exec.h helper.c op.c op_h... 2007-03-17 14:02 [Qemu-devel] qemu/target-ppc cpu.h exec.h helper.c op.c op_h Jocelyn Mayer @ 2007-03-17 14:53 ` Wessel, Jason 2007-03-18 8:23 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug J. Mayer 0 siblings, 1 reply; 6+ messages in thread From: Wessel, Jason @ 2007-03-17 14:53 UTC (permalink / raw) To: qemu-devel Hi Jocelyn, Previously it was mentioned that there is a regression that was introduced by your original merge on March 8, 2007. I tested this latest code and it is still there. The nature of the problem is that the networking does not work when booting QEMU and using the built in slirp networking. A dhcp packet will work but the udp and tcp packets do not appear to send. It appears that the packet check sum computed by the Linux network stack is incorrect. When the code in slirp/ip_input.c checks the checksum of the udp or tcp packet it throws the packet away because the checksum was invalid. I took the code from March 7, 2007 in cvs for target-ppc/* and used it with the latest of everything else and the packet checksums are computed correct and the target boots with networking. This points to the problem being what ever instructions the kernel is using to compute the checksum are not being translated correctly by your latest changes. The next step will be to take a closer look at which instructions are used to compute the checksum. I thought I might send out some further analysis of the original stated problem in case you had an idea of where to look to fix the problem off the top of your head. If you have any ideas, please drop me some e-mail. Also with regard to the 2.6.21 kernel and the ppc-prep machine, I patched the kernel to make it send PCI interrupts the same way the prior kernels did. It seems there is a regression there inside the kernel in the way that the IRQ acknowledgements are handled. It could be that the emulation is not right in QEMU, but I figure that mystery is one for another day. If you need a kernel that boots on the ppc-prep please let me know. I also patched the prep loader in the linux kernel so I could boot an image that was larger than 4 megs. Thanks, Jason. > -----Original Message----- > From: > qemu-devel-bounces+jason.wessel=windriver.com@nongnu.org > [mailto:qemu-devel-bounces+jason.wessel=windriver.com@nongnu.o > rg] On Behalf Of Jocelyn Mayer > Sent: Saturday, March 17, 2007 9:02 AM > To: qemu-devel@nongnu.org > Subject: [Qemu-devel] qemu/target-ppc cpu.h exec.h helper.c > op.c op_h... > > CVSROOT: /sources/qemu > Module name: qemu > Changes by: Jocelyn Mayer <j_mayer> 07/03/17 14:02:15 > > Modified files: > target-ppc : cpu.h exec.h helper.c op.c op_helper.c > op_helper.h op_helper_mem.h op_mem.h > translate.c > > Log message: > Make it safe to use 64 bits GPR and/or 64 bits host registers. > For "symetry", add 64 bits versions of all modified functions. > As a side effect, add a lot of code provision for > PowerPC 64 support. > Move overflow and carry checks in common routines for > simple cases. > Add isel and popcntb instructions from PowerPC 2.03 > specification. > Remove remaining micro-operations helpers prototypes from op.c. > Fix XER_BC field to be 7 bits long. > Add power management support for PowerPC 603 & 604. > Fix compilation warnings. > > CVSWeb URLs: > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/cpu.h?cvsr > oot=qemu&r1=1.26&r2=1.27 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/exec.h?cvs > root=qemu&r1=1.15&r2=1.16 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/helper.c?c > vsroot=qemu&r1=1.32&r2=1.33 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op.c?cvsro > ot=qemu&r1=1.23&r2=1.24 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper. > c?cvsroot=qemu&r1=1.18&r2=1.19 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper. > h?cvsroot=qemu&r1=1.1&r2=1.2 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_helper_ > mem.h?cvsroot=qemu&r1=1.7&r2=1.8 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/op_mem.h?c > vsroot=qemu&r1=1.8&r2=1.9 > http://cvs.savannah.gnu.org/viewcvs/qemu/target-ppc/translate. > c?cvsroot=qemu&r1=1.44&r2=1.45 > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] Re: Qemu PPC ethernet checksum bug 2007-03-17 14:53 ` Wessel, Jason @ 2007-03-18 8:23 ` J. Mayer 2007-03-21 5:33 ` Jason Wessel 2007-03-22 17:39 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] Jason Wessel 0 siblings, 2 replies; 6+ messages in thread From: J. Mayer @ 2007-03-18 8:23 UTC (permalink / raw) To: qemu-devel On Sat, 2007-03-17 at 07:53 -0700, Wessel, Jason wrote: > Hi Jocelyn, > > Previously it was mentioned that there is a regression that was > introduced by your original merge on March 8, 2007. I tested this > latest code and it is still there. The nature of the problem is that > the networking does not work when booting QEMU and using the built in > slirp networking. A dhcp packet will work but the udp and tcp packets > do not appear to send. > It appears that the packet check sum computed by the Linux network stack > is incorrect. When the code in slirp/ip_input.c checks the checksum of > the udp or tcp packet it throws the packet away because the checksum was > invalid. I took the code from March 7, 2007 in cvs for target-ppc/* and > used it with the latest of everything else and the packet checksums are > computed correct and the target boots with networking. > > This points to the problem being what ever instructions the kernel is > using to compute the checksum are not being translated correctly by your > latest changes. The next step will be to take a closer look at which > instructions are used to compute the checksum. I thought I might send > out some further analysis of the original stated problem in case you had > an idea of where to look to fix the problem off the top of your head. > If you have any ideas, please drop me some e-mail. > > Also with regard to the 2.6.21 kernel and the ppc-prep machine, I > patched the kernel to make it send PCI interrupts the same way the prior > kernels did. It seems there is a regression there inside the kernel in > the way that the IRQ acknowledgements are handled. It could be that the > emulation is not right in QEMU, but I figure that mystery is one for > another day. If you need a kernel that boots on the ppc-prep please let > me know. I also patched the prep loader in the linux kernel so I could > boot an image that was larger than 4 megs. Hi, My concern is I cannot reproduce your problem for the following reasons: - the PREP machine (and the heathrow too...) is broken and cannot even boot. PCI and/or IRQ are broken, so the Linux kernel hangs. - when using the "known to work" Linux distributions on the mac99 machine (please take a look at the STATUS file), I am able to download a kernel from www.kernel.org, which makes me think TCP packets are sent and received correctly, with valid checksums. Then, it would be a great thing if you could isolate the failing routine and, for example, make a test case usable with linux-user emulation. This would be a great help to solve this issue. Thanks by advance. -- J. Mayer <l_indien@magic.fr> Never organized ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Re: Qemu PPC ethernet checksum bug 2007-03-18 8:23 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug J. Mayer @ 2007-03-21 5:33 ` Jason Wessel 2007-03-22 17:39 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] Jason Wessel 1 sibling, 0 replies; 6+ messages in thread From: Jason Wessel @ 2007-03-21 5:33 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1155 bytes --] J. Mayer wrote: > Hi, > > My concern is I cannot reproduce your problem for the following reasons: > - the PREP machine (and the heathrow too...) is broken and cannot even > boot. PCI and/or IRQ are broken, so the Linux kernel hangs. > - when using the "known to work" Linux distributions on the mac99 > machine (please take a look at the STATUS file), I am able to download a > kernel from www.kernel.org, which makes me think TCP packets are sent > and received correctly, with valid checksums. > > Then, it would be a great thing if you could isolate the failing routine > and, for example, make a test case usable with linux-user emulation. > This would be a great help to solve this issue. > > Thanks by advance. > > Attached is a test program which demonstrates the issue. You can run % ./ppc-linux-user/qemu-ppc /tmp/csum_test/main Testing Result 0x956a3263 Above is the correct result prior to 3/8/2007. If you run from CVS today, you get % ./ppc-linux-user/qemu-ppc /tmp/csum_test/main Testing Result 0x956a3264 It appears to be a result of the corruption of the xer_ca by the time you do the first adde instruction. Thanks, Jason. [-- Attachment #2: csum_test.tar.gz --] [-- Type: application/x-gzip, Size: 262810 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] 2007-03-18 8:23 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug J. Mayer 2007-03-21 5:33 ` Jason Wessel @ 2007-03-22 17:39 ` Jason Wessel 2007-03-22 19:19 ` J. Mayer 1 sibling, 1 reply; 6+ messages in thread From: Jason Wessel @ 2007-03-22 17:39 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1271 bytes --] Attached is a patch as well as an example program, where I took the code from the from the linux kernel and made a call in with a dummy packet. It appears the problem is the addic translation does not correctly set/reset the carry bit, and this is a regression vs the source base on 3/7/2007. With the change here, I can boot the ppc-prep machine again and use ethernet. If you would like a pre-compiled binary of the test case, let me know because it was too big to send to the list. signed-off-by: jason.wessel@windriver.com Jason. J. Mayer wrote: > Hi, > > My concern is I cannot reproduce your problem for the following reasons: > - the PREP machine (and the heathrow too...) is broken and cannot even > boot. PCI and/or IRQ are broken, so the Linux kernel hangs. > - when using the "known to work" Linux distributions on the mac99 > machine (please take a look at the STATUS file), I am able to download a > kernel from www.kernel.org, which makes me think TCP packets are sent > and received correctly, with valid checksums. > > Then, it would be a great thing if you could isolate the failing routine > and, for example, make a test case usable with linux-user emulation. > This would be a great help to solve this issue. > > Thanks by advance. > > [-- Attachment #2: ppc_addic_fix.patch --] [-- Type: text/x-patch, Size: 770 bytes --] Index: qemu/target-ppc/translate.c =================================================================== --- qemu.orig/target-ppc/translate.c +++ qemu/target-ppc/translate.c @@ -772,16 +772,14 @@ GEN_HANDLER(addic, 0x0C, 0xFF, 0xFF, 0x0 target_long simm = SIMM(ctx->opcode); gen_op_load_gpr_T0(rA(ctx->opcode)); - if (likely(simm != 0)) { - gen_op_move_T2_T0(); - gen_op_addi(simm); + gen_op_move_T2_T0(); + gen_op_addi(simm); #if defined(TARGET_PPC64) - if (ctx->sf_mode) - gen_op_check_addc_64(); - else + if (ctx->sf_mode) + gen_op_check_addc_64(); + else #endif - gen_op_check_addc(); - } + gen_op_check_addc(); gen_op_store_T0_gpr(rD(ctx->opcode)); } /* addic. */ [-- Attachment #3: csum_test.tar.bz2 --] [-- Type: application/x-bzip, Size: 1468 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] 2007-03-22 17:39 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] Jason Wessel @ 2007-03-22 19:19 ` J. Mayer 0 siblings, 0 replies; 6+ messages in thread From: J. Mayer @ 2007-03-22 19:19 UTC (permalink / raw) To: qemu-devel On Thu, 2007-03-22 at 12:39 -0500, Jason Wessel wrote: > Attached is a patch as well as an example program, where I took the code > from the from the linux kernel and made a call in with a dummy packet. > > It appears the problem is the addic translation does not correctly > set/reset the carry bit, and this is a regression vs the source base on > 3/7/2007. With the change here, I can boot the ppc-prep machine again > and use ethernet. OK, thanks for this detailed report, I can now see what the bug is: the carry should be reset when immediate value is zero. Your patch is not great because it disables useful optimization, but I will test another one and commit it soon. > J. Mayer wrote: > > Hi, > > > > My concern is I cannot reproduce your problem for the following reasons: > > - the PREP machine (and the heathrow too...) is broken and cannot even > > boot. PCI and/or IRQ are broken, so the Linux kernel hangs. > > - when using the "known to work" Linux distributions on the mac99 > > machine (please take a look at the STATUS file), I am able to download a > > kernel from www.kernel.org, which makes me think TCP packets are sent > > and received correctly, with valid checksums. > > > > Then, it would be a great thing if you could isolate the failing routine > > and, for example, make a test case usable with linux-user emulation. > > This would be a great help to solve this issue. > > > > Thanks by advance. > > -- J. Mayer <l_indien@magic.fr> Never organized ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-22 19:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-03-17 14:02 [Qemu-devel] qemu/target-ppc cpu.h exec.h helper.c op.c op_h Jocelyn Mayer 2007-03-17 14:53 ` Wessel, Jason 2007-03-18 8:23 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug J. Mayer 2007-03-21 5:33 ` Jason Wessel 2007-03-22 17:39 ` [Qemu-devel] Re: Qemu PPC ethernet checksum bug [PATCH] Jason Wessel 2007-03-22 19:19 ` J. Mayer
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).