diff mbox series

lm32: take BQL before writing IP/IM register

Message ID 20180109170113.20768-1-michael@walle.cc
State New
Headers show
Series lm32: take BQL before writing IP/IM register | expand

Commit Message

Michael Walle Jan. 9, 2018, 5:01 p.m. UTC
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(+)

Comments

Michael Walle Feb. 1, 2018, 9:09 a.m. UTC | #1
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)
Philippe Mathieu-Daudé May 9, 2018, 7:45 p.m. UTC | #2
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)
>
Alex Bennée May 10, 2018, 1 p.m. UTC | #3
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
Paolo Bonzini May 10, 2018, 1:35 p.m. UTC | #4
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)
>>
diff mbox series

Patch

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)