Re: [Qemu-devel] [PULL 0/2] OpenRISC patch queue for 2.3

2015-02-03 Thread Sebastian Macke
Hi Peter, unfortunately you are right. The correct line is this: /* invalidate lock */ -env->cpu_lock_addr = -1; +env->lock_addr = -1; I am sorry. It was most likely the last line which I added. But I forgot, that I disabled the system emulation already. Therefore my make proces

Re: [Qemu-devel] [PATCH 2/2] target-openrisc: Add l.lwa/l.swa support

2015-01-26 Thread Sebastian Macke
Hi Jia, On 1/26/2015 10:50 AM, Jia Liu wrote: Hi Sebastian, Christian On Sun, Jan 25, 2015 at 6:25 PM, Sebastian Macke wrote: From: Christian Svensson This patch adds support for atomic locks and is an adaption from https://github.com/bluecmd/or1k-qemu/commits/or32-optimize Tested via

[Qemu-devel] [PATCH 2/2] target-openrisc: Add l.lwa/l.swa support

2015-01-25 Thread Sebastian Macke
From: Christian Svensson This patch adds support for atomic locks and is an adaption from https://github.com/bluecmd/or1k-qemu/commits/or32-optimize Tested via the atomic lock implementation of musl Signed-off-by: Christian Svensson Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h

[Qemu-devel] [PATCH 1/2] target-openrisc: Separate of load/store instructions

2015-01-25 Thread Sebastian Macke
This patch separates the load and store instruction to a separate function. The repetition of the source code can be reduced and further optimizations can be implemented. In this case it checks for a zero offset and optimizes it. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c

[Qemu-devel] [PATCH 0/2] target-openrisc: Add atomic instructions

2015-01-25 Thread Sebastian Macke
This patch adds the new atomic operations of the Load-link/store-conditional type which are called l.lwa and l.swa. For a cleaner implementation, all load and store instructions are separated to a function. Christian Svensson (1): target-openrisc: Add l.lwa/l.swa support Sebastian Macke (1

Re: [Qemu-devel] [PATCH 11/13] target-openrisc: use jmp_pc as flag variable for branches

2013-10-30 Thread Sebastian Macke
On 30/10/2013 3:02 PM, Richard Henderson wrote: On 10/30/2013 02:08 PM, Sebastian Macke wrote: Do you have a publicly accessible tree with all your patches applied? I'd like to re-read the logic in the proper context. After you are the second who demanded it: https://github.com/s-macke

Re: [Qemu-devel] [PATCH 11/13] target-openrisc: use jmp_pc as flag variable for branches

2013-10-30 Thread Sebastian Macke
On 30/10/2013 12:47 PM, Richard Henderson wrote: On 10/30/2013 12:07 PM, Sebastian Macke wrote: case JUMP_BRANCH: { int l1 = gen_new_label(); -tcg_gen_brcondi_tl(TCG_COND_NE, dc->btaken, 0, l1); +tcg_gen_brcondi_tl(TCG_COND_NE, jmp_pc

Re: [Qemu-devel] [PATCH 09/13] target-openrisc: Add CPU which neglects Carry and Overflow Flag

2013-10-30 Thread Sebastian Macke
On 30/10/2013 11:14 AM, Richard Henderson wrote: On 10/29/2013 12:04 PM, Sebastian Macke wrote: The carry and overflag and the instructions l.addc and l.addic are never used in the toolchain. Linux and gcc compiled software don't need them. Really? That's quite surprising. Y

Re: [Qemu-devel] [PATCH 11/13] target-openrisc: use jmp_pc as flag variable for branches

2013-10-30 Thread Sebastian Macke
On 30/10/2013 11:33 AM, Richard Henderson wrote: On 10/29/2013 12:04 PM, Sebastian Macke wrote: { int lab = gen_new_label(); -dc->btaken = tcg_temp_local_new(); -tcg_gen_movi_tl(jmp_pc, dc->pc+8); -tcg_gen_movi_tl(dc->

Re: [Qemu-devel] [PATCH 03/13] target-openrisc: Separate of load/store instructions

2013-10-29 Thread Sebastian Macke
On 29/10/2013 3:55 PM, Max Filippov wrote: On Wed, Oct 30, 2013 at 1:36 AM, Sebastian Macke wrote: On 29/10/2013 1:05 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: Additional this patch solves a severe bug for the softmmu emulation. The pc has to be saved

Re: [Qemu-devel] [PATCH 06/13] target-openrisc: Remove TLB flush from l.rfe instruction

2013-10-29 Thread Sebastian Macke
On 29/10/2013 3:20 PM, Max Filippov wrote: On Wed, Oct 30, 2013 at 1:53 AM, Sebastian Macke wrote: On 29/10/2013 2:01 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: At the moment there are two TLBs. The OpenRISC TLB followed by the QEMU's own TLB. A

Re: [Qemu-devel] [PATCH 05/13] target-openrisc: Remove TLB flush on exception

2013-10-29 Thread Sebastian Macke
On 29/10/2013 12:47 PM, Peter Maydell wrote: On 29 October 2013 19:04, Sebastian Macke wrote: The TLB flush is not necessary as the mmu_index field already takes care of correct memory locations. Instead the tb flag field must be expanded that the exception takes the correct translation block

Re: [Qemu-devel] [PATCH 08/13] target-openrisc: Test for Overflow exception statically

2013-10-29 Thread Sebastian Macke
On 29/10/2013 2:25 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: Instead of testing the overflow exception dynamically every time The flag will be reckognized by the tcg as changed code and will recompile the code with the correct checks. Signed-off-by

Re: [Qemu-devel] [PATCH 06/13] target-openrisc: Remove TLB flush from l.rfe instruction

2013-10-29 Thread Sebastian Macke
On 29/10/2013 2:01 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: At the moment there are two TLBs. The OpenRISC TLB followed by the QEMU's own TLB. At the end of the TLB miss handler a tlb_flush of QEMUs TLB is executed which is exactly what we want to

Re: [Qemu-devel] [PATCH 03/13] target-openrisc: Separate of load/store instructions

2013-10-29 Thread Sebastian Macke
On 29/10/2013 1:05 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: This patch separates the load and store instruction to a separate function. The repetition of the source code can be reduced and further optimizations can be implemented. In this case it checks

Re: [Qemu-devel] [PATCH 07/13] target-openrisc: Correct l.cmov conditional check

2013-10-29 Thread Sebastian Macke
On 29/10/2013 2:15 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: srf is a boolean variable. Therefore the instruction should check for != 0 and not for != SR_F Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 2 +- 1 file changed, 1

Re: [Qemu-devel] [PATCH 00/13] target-openrisc: More optimizations and corrections

2013-10-29 Thread Sebastian Macke
On 29/10/2013 2:15 PM, Max Filippov wrote: On Tue, Oct 29, 2013 at 11:04 PM, Sebastian Macke wrote: Hi, This is the second part of the patches to make the openrisc target faster and more reliable. Hi Sebastian, this series doesn't apply cleanly to the current qemu git head, what tree

[Qemu-devel] [PATCH 07/13] target-openrisc: Correct l.cmov conditional check

2013-10-29 Thread Sebastian Macke
srf is a boolean variable. Therefore the instruction should check for != 0 and not for != SR_F Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c index

[Qemu-devel] [PATCH 12/13] target-openrisc: Add correct gdb information for the pc value

2013-10-29 Thread Sebastian Macke
The former patch which removed npc and ppc also removed the part in which the registers were send to gdb. But the npc parameter is necessary and the numbering of registers is fixed within gdb. The correct npc value is the current pc value. Signed-off-by: Sebastian Macke --- target-openrisc

[Qemu-devel] [PATCH 13/13] target-openrisc: Add In-circuit emulator support

2013-10-29 Thread Sebastian Macke
This patch enables single step debugging in gdb Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index ea007c7..d0d410a 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h

[Qemu-devel] [PATCH 10/13] target-openrisc: Correct target number for 64 bit llseek

2013-10-29 Thread Sebastian Macke
Signed-off-by: Sebastian Macke --- linux-user/openrisc/syscall_nr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/openrisc/syscall_nr.h b/linux-user/openrisc/syscall_nr.h index f4ac91e..72cbcf8 100644 --- a/linux-user/openrisc/syscall_nr.h +++ b/linux-user

[Qemu-devel] [PATCH 11/13] target-openrisc: use jmp_pc as flag variable for branches

2013-10-29 Thread Sebastian Macke
t together with the delayed slot flag an additional branch flag is saved to differ between slot types. In average the speed increases by around 5%. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 7 --- target-openrisc/translate.c | 34 +

[Qemu-devel] [PATCH 00/13] target-openrisc: More optimizations and corrections

2013-10-29 Thread Sebastian Macke
the uClibc library because of a segmentation fault. E.g. when setting the locale. But this failure existed also before my patches and is maybe not related to the target. Best Regards Sebastian Sebastian Macke (13): target-openrisc: Implement translation block chaining target-openrisc: Separate

[Qemu-devel] [PATCH 08/13] target-openrisc: Test for Overflow exception statically

2013-10-29 Thread Sebastian Macke
Instead of testing the overflow exception dynamically every time The flag will be reckognized by the tcg as changed code and will recompile the code with the correct checks. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 3 +- target-openrisc/translate.c | 78

[Qemu-devel] [PATCH 09/13] target-openrisc: Add CPU which neglects Carry and Overflow Flag

2013-10-29 Thread Sebastian Macke
c and l.addc This cpu violate the specification and will not run through the test cases but increases the emulation speed between 20% and 200%. The cpu is activated by the option "-cpu or1200-noflags" Signed-off-by: Sebastian Macke --- target-openrisc/cpu.c | 15 +--

[Qemu-devel] [PATCH 02/13] target-openrisc: Separate Delayed slot handling from main loop

2013-10-29 Thread Sebastian Macke
To increase the readability the delayed slot handling is separated to a function Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 46 + 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/target-openrisc/translate.c b

[Qemu-devel] [PATCH 04/13] target-openrisc: sync flags only when necessary

2013-10-29 Thread Sebastian Macke
Very often the delayed slot flag is set only to be removed one instruction later. This patch sets this flag only on instructions which could fail and at the end of a translation block if necessary. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 6 +- 1 file changed, 5

[Qemu-devel] [PATCH 03/13] target-openrisc: Separate of load/store instructions

2013-10-29 Thread Sebastian Macke
. The pc has to be saved as these instructions can fail and lead to a tlb miss exception. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 130 ++-- 1 file changed, 76 insertions(+), 54 deletions(-) diff --git a/target-openrisc/translate.c

[Qemu-devel] [PATCH 06/13] target-openrisc: Remove TLB flush from l.rfe instruction

2013-10-29 Thread Sebastian Macke
patch, I choose solution no. 2. If the first TLB register is cleared the whole TLB is cleared. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 2 +- target-openrisc/interrupt_helper.c | 8 target-openrisc/sys_helper.c | 4 3 files changed, 5 insertions(

[Qemu-devel] [PATCH 05/13] target-openrisc: Remove TLB flush on exception

2013-10-29 Thread Sebastian Macke
The TLB flush is not necessary as the mmu_index field already takes care of correct memory locations. Instead the tb flag field must be expanded that the exception takes the correct translation block. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 4 ++-- target-openrisc

[Qemu-devel] [PATCH 01/13] target-openrisc: Implement translation block chaining

2013-10-29 Thread Sebastian Macke
the delayed slot is executed. btaken: temporary flag if the branch is taken or not j_target: jump pc value j_type: Save the type of jump. Static, dynamic or branch The speed is increased by around a factor 2-3. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 40

[Qemu-devel] [Bug 1245703] Re: LD_PREFIX option reads directories recursively in an endless loop

2013-10-28 Thread Sebastian Macke
Ok, thanks for the info. For me it looks like removing the whole path code and putting a one-liner combining two string is the best solution. But maybe I am missing something. -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://b

[Qemu-devel] [Bug 1245703] [NEW] LD_PREFIX option reads directories recursively in an endless loop

2013-10-28 Thread Sebastian Macke
Public bug reported: If I run qemu user emulation with -L /path/to/my/sysroot/ in which also the proc and dev filesystem is mounted QEMU eats my memory until it gets killed by the kernel. According to the strace output it follows the symbolic links in the proc filesystem running forever in a recu

Re: [Qemu-devel] [PATCH_v2 0/9] target-openrisc: Corrections and speed improvements

2013-10-27 Thread Sebastian Macke
On 25/10/2013 5:21 PM, Jia Liu wrote: On Fri, Oct 25, 2013 at 7:23 AM, Sebastian Macke wrote: On 22/10/2013 8:47 PM, Jia Liu wrote: Hi Sebastian, On Tue, Oct 22, 2013 at 8:12 AM, Sebastian Macke wrote: This series is the first part to make the OpenRISC target more reliable and faster. It

Re: [Qemu-devel] [PATCH_v2 0/9] target-openrisc: Corrections and speed improvements

2013-10-24 Thread Sebastian Macke
On 22/10/2013 8:47 PM, Jia Liu wrote: Hi Sebastian, On Tue, Oct 22, 2013 at 8:12 AM, Sebastian Macke wrote: This series is the first part to make the OpenRISC target more reliable and faster. It corrects several severe problems which prevented the OpenRISC emulation for being useful in the

Re: [Qemu-devel] [PATCH_v2 9/9] target-openrisc: Correct carry flagcheck of l.addc and l.addic test casess

2013-10-22 Thread Sebastian Macke
On 22/10/2013 9:01 AM, Max Filippov wrote: On Tue, Oct 22, 2013 at 7:45 PM, Sebastian Macke wrote: Hi Alex, I am using a cross-compiling toolchain. It's the easiest way as I have to compile the image for QEMU anyhow. http://opencores.org/or1k/OpenRISC_GNU_tool_chain Then it's jus

Re: [Qemu-devel] [PATCH_v2 9/9] target-openrisc: Correct carry flagcheck of l.addc and l.addic test casess

2013-10-22 Thread Sebastian Macke
Hi Alex, I am using a cross-compiling toolchain. It's the easiest way as I have to compile the image for QEMU anyhow. http://opencores.org/or1k/OpenRISC_GNU_tool_chain Then it's just an "make && make test" in the corresponding tests/tcg/openrisc folder. Inside the virtual machine it would b

[Qemu-devel] [PATCH_v2 8/9] target-openrisc: Complete remove of npc and ppc variables

2013-10-21 Thread Sebastian Macke
estep mode. Because they are no longer needed and decrease the performance by using two tcg instructions per opcode they are removed. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.h | 2 -- target-openrisc/gdbstub.c | 16 ++-- target-openrisc/interrupt_hel

[Qemu-devel] [PATCH_v2 7/9] target-openrisc: Separate branch flag from Supervision register

2013-10-21 Thread Sebastian Macke
The branch flag is very often used. To increase the speed the flag is separated. This patch removes several ands and ors and branches from the generated code. The additional flag btaken is no longer necessary. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.c | 1 + target

[Qemu-devel] [PATCH_v2 5/9] openrisc-timer: Reduce overhead, Separate clock update functions

2013-10-21 Thread Sebastian Macke
The clock value is only evaluated when really necessary reducing the overhead of the timer handling. This also solves a problem in the way the Linux kernel handles the timer and the expected accuracy. The old version could lead to inaccurate timings. Signed-off-by: Sebastian Macke --- hw

[Qemu-devel] [PATCH_v2 3/9] target-openrisc: Remove executable flag for every page

2013-10-21 Thread Sebastian Macke
Pages should be flagged executable only if the tlb executable flag is set or the mmu is off. Signed-off-by: Sebastian Macke --- target-openrisc/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c index 22d7cbe..dd487bd

[Qemu-devel] [PATCH_v2 6/9] target-openrisc: Correct memory bounds checking for the tlb buffers

2013-10-21 Thread Sebastian Macke
The mtspr and mfspr routines didn't check for the correct memory boundaries. This fixes a segmentation fault while booting Linux. Signed-off-by: Sebastian Macke --- target-openrisc/sys_helper.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target-ope

[Qemu-devel] [PATCH_v2 9/9] target-openrisc: Correct carry flag check of l.addc and l.addic test cases

2013-10-21 Thread Sebastian Macke
The test cases did not correctly test for the carry flag. Signed-off-by: Sebastian Macke --- tests/tcg/openrisc/test_addc.c | 8 +--- tests/tcg/openrisc/test_addic.c | 10 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/tcg/openrisc/test_addc.c b/tests/tcg

[Qemu-devel] [PATCH_v2 1/9] target-openrisc: Speed up move instruction

2013-10-21 Thread Sebastian Macke
this special case. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 50 - 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c index 8908a2e..8276ce7 100644 --- a/tar

[Qemu-devel] [PATCH_v2 4/9] target-openrisc: Correct wrong epcr register in interrupt handler

2013-10-21 Thread Sebastian Macke
This patch corrects several misbehaviors during an interrupt process. Most of the time the pc is already correct and therefore no special treatment of the exceptions is necessary. Tested by checking crashing programs which otherwise work in or1ksim. Signed-off-by: Sebastian Macke --- target

[Qemu-devel] [PATCH_v2 0/9] target-openrisc: Corrections and speed improvements

2013-10-21 Thread Sebastian Macke
in one of the future patches. Only the patch which removes the npc and ppc variables removes a little feature from the OpenRISC target but which does not break the specification and will lead to a significant speed improvement. Sebastian Macke (9): target-openrisc: Speed up move instruction

[Qemu-devel] [PATCH_v2 2/9] target-openrisc: Remove unnecessary code generated by jump instructions

2013-10-21 Thread Sebastian Macke
The sr_f variable is only used for the l.bf and l.bnf instructions. For clarity the code is also rewritten using a switch statement instead of if chaining. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 45 ++--- 1 file changed, 26

[Qemu-devel] [PATCH] target-openrisc: Separate branch flag from Supervision register

2013-10-19 Thread Sebastian Macke
The branch flag is very often used. To increase the speed the flag is separated. This patch removes several ands and ors and branches from the generated code. The additional flag btaken is no longer necessary. Signed-off-by: Sebastian Macke --- target-openrisc/cpu.c |1

[Qemu-devel] [PATCH] target-openrisc: Correct memory bounds checking for the tlb buffers

2013-10-19 Thread Sebastian Macke
The mtspr and mfspr routines didn't check for the correct memory boundaries. This fixes a segmentation fault while booting Linux. Signed-off-by: Sebastian Macke --- target-openrisc/sys_helper.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t

[Qemu-devel] [PATCH] openrisc-timer: Reduce overhead, Separate clock update functions

2013-10-19 Thread Sebastian Macke
The clock value is only evaluated when really necessary reducing the overhead of the timer handling. This also solves a problem in the way the Linux kernel handles the timer and the expected accuracy. The old version could lead to inaccurate timings. Signed-off-by: Sebastian Macke --- hw

[Qemu-devel] [PATCH 2/2] target-openrisc: Correct wrong epcr register in interrupt handler

2013-10-18 Thread Sebastian Macke
This patch corrects several rare bugs during an interrupt process. Most of the time the pc is already correct and therefore no special treatment of the exception type is necessary. Tested by checking crashing programs which otherwise work in or1ksim. Signed-off-by: Sebastian Macke

[Qemu-devel] [PATCH 1/2] target-openrisc: Remove executable flag for every page

2013-10-18 Thread Sebastian Macke
Pages should be flagged executable only if the tlb executable flag is set or the mmu is off. Signed-off-by: Sebastian Macke --- target-openrisc/mmu.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-openrisc/mmu.c b/target-openrisc/mmu.c index 22d7cbe..dd487bd

[Qemu-devel] [PATCH 2/2] target-openrisc: Remove unnecessary code generated by jump instructions

2013-10-18 Thread Sebastian Macke
The sr_f variable is only used for the l.bf and l.bnf instructions. For clarity the code is also rewritten using a switch statement instead of if/else chaining. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 46 --- 1 file changed

[Qemu-devel] [PATCH 1/2] target-openrisc: Speed up move instruction

2013-10-18 Thread Sebastian Macke
his special case. Signed-off-by: Sebastian Macke --- target-openrisc/translate.c | 50 +++ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c index 8908a2e..8276ce7 100644 --- a/tar

Re: [Qemu-devel] [OpenRISC] [PATCH] Correction of the TLB handling of the OpenRISC target

2013-10-02 Thread Sebastian Macke
Hi Jia, On 10/1/2013 10:33 PM, Jia Liu wrote: Hi Sebastian, On Wed, Oct 2, 2013 at 1:12 PM, Sebastian Macke wrote: Hi, this patch corrects two problems for the OpenRISC Target in QEMU. The first one corrects one obvious bug concerning the handling of page faults while reading from a page

[Qemu-devel] [PATCH] Correction of the TLB handling of the OpenRISC target

2013-10-02 Thread Sebastian Macke
the newest Linux kernel and compared the output with or1ksim. Sebastian >From 4491bae7109e2b4de5a8de8a7e4b08d1f19ac70e Mon Sep 17 00:00:00 2001 From: Sebastian Macke Date: Tue, 1 Oct 2013 21:39:38 -0700 Subject: [PATCH] Correction of the TLB handling of the OpenRISC target This patch correct