[Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register

Michael Walle posted 1 patch 7 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180109170113.20768-1-michael@walle.cc
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
target/lm32/op_helper.c | 4 ++++
1 file changed, 4 insertions(+)
[Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register
Posted by Michael Walle 7 years, 9 months ago
Writing to these registers may raise an interrupt request. Actually,
this prevents the milkymist board from starting.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Walle <michael@walle.cc>
---
 target/lm32/op_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
index 30f670eee8..a766a1ece4 100644
--- a/target/lm32/op_helper.c
+++ b/target/lm32/op_helper.c
@@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t dc)
 
 void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
 {
+    qemu_mutex_lock_iothread();
     lm32_pic_set_im(env->pic_state, im);
+    qemu_mutex_unlock_iothread();
 }
 
 void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
 {
+    qemu_mutex_lock_iothread();
     lm32_pic_set_ip(env->pic_state, im);
+    qemu_mutex_unlock_iothread();
 }
 
 void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
-- 
2.11.0


Re: [Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register
Posted by Michael Walle 7 years, 8 months ago
Hi Peter,

do you apply this patch? Or do I have to send a pull request?

-michael

Am 2018-01-09 18:01, schrieb Michael Walle:
> Writing to these registers may raise an interrupt request. Actually,
> this prevents the milkymist board from starting.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
>  target/lm32/op_helper.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
> index 30f670eee8..a766a1ece4 100644
> --- a/target/lm32/op_helper.c
> +++ b/target/lm32/op_helper.c
> @@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t 
> dc)
> 
>  void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
>  {
> +    qemu_mutex_lock_iothread();
>      lm32_pic_set_im(env->pic_state, im);
> +    qemu_mutex_unlock_iothread();
>  }
> 
>  void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
>  {
> +    qemu_mutex_lock_iothread();
>      lm32_pic_set_ip(env->pic_state, im);
> +    qemu_mutex_unlock_iothread();
>  }
> 
>  void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)

Re: [Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register
Posted by Philippe Mathieu-Daudé 7 years, 5 months ago
On 02/01/2018 06:09 AM, Michael Walle wrote:
> 
> Hi Peter,
> 
> do you apply this patch? Or do I have to send a pull request?

Cc'ing Paolo.

> 
> -michael
> 
> Am 2018-01-09 18:01, schrieb Michael Walle:
>> Writing to these registers may raise an interrupt request. Actually,
>> this prevents the milkymist board from starting.
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Michael Walle <michael@walle.cc>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> ---
>>  target/lm32/op_helper.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
>> index 30f670eee8..a766a1ece4 100644
>> --- a/target/lm32/op_helper.c
>> +++ b/target/lm32/op_helper.c
>> @@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t
>> dc)
>>
>>  void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
>>  {
>> +    qemu_mutex_lock_iothread();
>>      lm32_pic_set_im(env->pic_state, im);
>> +    qemu_mutex_unlock_iothread();
>>  }
>>
>>  void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
>>  {
>> +    qemu_mutex_lock_iothread();
>>      lm32_pic_set_ip(env->pic_state, im);
>> +    qemu_mutex_unlock_iothread();
>>  }
>>
>>  void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
> 

Re: [Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register
Posted by Paolo Bonzini 7 years, 5 months ago
On 09/05/2018 21:45, Philippe Mathieu-Daudé wrote:
> On 02/01/2018 06:09 AM, Michael Walle wrote:
>>
>> Hi Peter,
>>
>> do you apply this patch? Or do I have to send a pull request?
> 
> Cc'ing Paolo.

Please send a pull request.

Paolo

>>
>> -michael
>>
>> Am 2018-01-09 18:01, schrieb Michael Walle:
>>> Writing to these registers may raise an interrupt request. Actually,
>>> this prevents the milkymist board from starting.
>>>
>>> Cc: qemu-stable@nongnu.org
>>> Signed-off-by: Michael Walle <michael@walle.cc>
> 
> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
>>> ---
>>>  target/lm32/op_helper.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
>>> index 30f670eee8..a766a1ece4 100644
>>> --- a/target/lm32/op_helper.c
>>> +++ b/target/lm32/op_helper.c
>>> @@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t
>>> dc)
>>>
>>>  void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
>>>  {
>>> +    qemu_mutex_lock_iothread();
>>>      lm32_pic_set_im(env->pic_state, im);
>>> +    qemu_mutex_unlock_iothread();
>>>  }
>>>
>>>  void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
>>>  {
>>> +    qemu_mutex_lock_iothread();
>>>      lm32_pic_set_ip(env->pic_state, im);
>>> +    qemu_mutex_unlock_iothread();
>>>  }
>>>
>>>  void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)
>>


Re: [Qemu-devel] [PATCH] lm32: take BQL before writing IP/IM register
Posted by Alex Bennée 7 years, 5 months ago
Michael Walle <michael@walle.cc> writes:

> Writing to these registers may raise an interrupt request. Actually,
> this prevents the milkymist board from starting.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  target/lm32/op_helper.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c
> index 30f670eee8..a766a1ece4 100644
> --- a/target/lm32/op_helper.c
> +++ b/target/lm32/op_helper.c
> @@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t dc)
>
>  void HELPER(wcsr_im)(CPULM32State *env, uint32_t im)
>  {
> +    qemu_mutex_lock_iothread();
>      lm32_pic_set_im(env->pic_state, im);
> +    qemu_mutex_unlock_iothread();
>  }
>
>  void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im)
>  {
> +    qemu_mutex_lock_iothread();
>      lm32_pic_set_ip(env->pic_state, im);
> +    qemu_mutex_unlock_iothread();
>  }
>
>  void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx)


--
Alex Bennée