* [Qemu-devel] [PATCH] sb16: fix interrupt acknowledgement
@ 2015-01-20 16:23 Paolo Bonzini
2015-01-21 9:32 ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
2015-01-22 9:56 ` [Qemu-devel] " Gerd Hoffmann
0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-01-20 16:23 UTC (permalink / raw)
To: qemu-devel; +Cc: j_bair, Gerd Hoffmann, qemu-stable
SoundBlaster 16 emulation is very broken and consumes a lot of CPU, but a
small fix was suggested offlist and it is enough to fix some games. I
got Epic Pinball to work with the "SoundBlaster Clone" option.
The processing of the interrupt register is wrong due to two missing
"not"s. This causes the interrupt flag to remain set even after the
Acknowledge ports have been read (0x0e and 0x0f).
The line was introduced by commit 85571bc (audio merge (malc), 2004-11-07),
but the code might have been broken before because I did not look closely
at the huge patches from 10 years ago.
Reported-by: Joshua Bair <j_bair@bellsouth.net>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/audio/sb16.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index bda26d0..444eb9e 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -999,7 +999,7 @@ static IO_READ_PROTO (dsp_read)
retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80;
if (s->mixer_regs[0x82] & 1) {
ack = 1;
- s->mixer_regs[0x82] &= 1;
+ s->mixer_regs[0x82] &= ~1;
qemu_irq_lower (s->pic);
}
break;
@@ -1008,7 +1008,7 @@ static IO_READ_PROTO (dsp_read)
retval = 0xff;
if (s->mixer_regs[0x82] & 2) {
ack = 1;
- s->mixer_regs[0x82] &= 2;
+ s->mixer_regs[0x82] &= ~2;
qemu_irq_lower (s->pic);
}
break;
--
2.1.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH] sb16: fix interrupt acknowledgement
2015-01-20 16:23 [Qemu-devel] [PATCH] sb16: fix interrupt acknowledgement Paolo Bonzini
@ 2015-01-21 9:32 ` Michael Tokarev
2015-01-21 10:00 ` Paolo Bonzini
2015-01-22 9:56 ` [Qemu-devel] " Gerd Hoffmann
1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2015-01-21 9:32 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: j_bair, Gerd Hoffmann, qemu-stable
20.01.2015 19:23, Paolo Bonzini wrote:
> --- a/hw/audio/sb16.c
> +++ b/hw/audio/sb16.c
> @@ -999,7 +999,7 @@ static IO_READ_PROTO (dsp_read)
> retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80;
> if (s->mixer_regs[0x82] & 1) {
> ack = 1;
> - s->mixer_regs[0x82] &= 1;
> + s->mixer_regs[0x82] &= ~1;
Shouldn't it be ~1u instead?
/mjt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Qemu-stable] [PATCH] sb16: fix interrupt acknowledgement
2015-01-21 9:32 ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
@ 2015-01-21 10:00 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-01-21 10:00 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel; +Cc: j_bair, Gerd Hoffmann, qemu-stable
On 21/01/2015 10:32, Michael Tokarev wrote:
>> > --- a/hw/audio/sb16.c
>> > +++ b/hw/audio/sb16.c
>> > @@ -999,7 +999,7 @@ static IO_READ_PROTO (dsp_read)
>> > retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80;
>> > if (s->mixer_regs[0x82] & 1) {
>> > ack = 1;
>> > - s->mixer_regs[0x82] &= 1;
>> > + s->mixer_regs[0x82] &= ~1;
> Shouldn't it be ~1u instead?
It's the same since mixer_regs is an array of uint8_t.
I'm not a fan of unsigned suffixes, especially after ~ where most of the
time they're wrong. For example if x is uint64_t:
x &= ~1 is right
x &= ~1ull is right
x &= ~1u also clears bits 32...64
x &= ~1ul also clears bits 32...64 on 32-bit machines
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] sb16: fix interrupt acknowledgement
2015-01-20 16:23 [Qemu-devel] [PATCH] sb16: fix interrupt acknowledgement Paolo Bonzini
2015-01-21 9:32 ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
@ 2015-01-22 9:56 ` Gerd Hoffmann
1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2015-01-22 9:56 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: j_bair, qemu-devel, qemu-stable
On Di, 2015-01-20 at 17:23 +0100, Paolo Bonzini wrote:
> SoundBlaster 16 emulation is very broken and consumes a lot of CPU, but a
> small fix was suggested offlist and it is enough to fix some games. I
> got Epic Pinball to work with the "SoundBlaster Clone" option.
>
> The processing of the interrupt register is wrong due to two missing
> "not"s. This causes the interrupt flag to remain set even after the
> Acknowledge ports have been read (0x0e and 0x0f).
>
> The line was introduced by commit 85571bc (audio merge (malc), 2004-11-07),
> but the code might have been broken before because I did not look closely
> at the huge patches from 10 years ago.
Looks sane, picked up.
thanks,
Gerd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-22 9:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 16:23 [Qemu-devel] [PATCH] sb16: fix interrupt acknowledgement Paolo Bonzini
2015-01-21 9:32 ` [Qemu-devel] [Qemu-stable] " Michael Tokarev
2015-01-21 10:00 ` Paolo Bonzini
2015-01-22 9:56 ` [Qemu-devel] " Gerd Hoffmann
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).