9front - general discussion about 9front
 help / color / mirror / Atom feed
* bug: audiohda broken in qemu
@ 2020-10-27  4:39 Nick Owens
  2020-10-27  8:16 ` Anthony Martin
  2020-10-27  9:48 ` [9front] " cinap_lenrek
  0 siblings, 2 replies; 8+ messages in thread
From: Nick Owens @ 2020-10-27  4:39 UTC (permalink / raw)
  To: 9front

there have been multiple reports of audio not working in qemu.

https://9fans.topicbox.com/groups/9fans/T3f4bbef90063aae9-Maeb867180b0aa1fbf97ea7f7
https://www.reddit.com/r/plan9/comments/jipk3b/plan_9_qemu_and_audio/

indeed i tested it and it does not work, so i poked around in qemu:

qemu-system-x86_64 -m 512 -enable-kvm -device intel-hda,debug=2
-device hda-duplex,debug=2 -kernel /tmp/9pc64 -initrd /tmp/plan9.ini
-serial mon:stdio -vnc :1

in enumcodec() we try to get the vendor id:

cmderr(id, Getparm, Vendorid, &vid)

but that fails:

intel-hda: read  RIRBWP          : 0x0 (ffff)
intel-hda: read  CORBRP          : 0x0 (ffff)
intel-hda: read  CORBWP          : 0x0 (ffff)
intel-hda: write CORBWP          : 0x1 (ffff)
intel-hda: intel_hda_corb_run: rirb count reached
intel-hda: read  RIRBWP          : 0x0 (ffff)
#A0: no audio codecs found

i looked a bit at this 'rirb count reached' message and surmised that
we needed to change RINTCNT. i looked at the linux driver and they set
it to 1, and to 0xC0 for some 'quirky' cards. i tried 1 but that just
makes subsequent commands after Getparam/Vendorid fail, but setting it
to 0xC0 made all commands work and the device is enumerated, and
#A/audio works.

diff --git a/sys/src/9/pc/audiohda.c b/sys/src/9/pc/audiohda.c
--- a/sys/src/9/pc/audiohda.c
+++ b/sys/src/9/pc/audiohda.c
@@ -1732,6 +1732,7 @@ hdastart(Ctlr *ctlr)
     csr32(ctlr, Rirblbase) = pa;
     csr32(ctlr, Rirbubase) = pa >> 32;
     csr16(ctlr, Rirbwp) = Rirbptrrst;
+    csr16(ctlr, Rintcnt) = 0xC0;
     csr8(ctlr, Rirbctl) = Rirbdma;
     waitup8(ctlr, Rirbctl, Rirbdma, Rirbdma);

note that i have no idea what i am doing.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-27 20:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27  4:39 bug: audiohda broken in qemu Nick Owens
2020-10-27  8:16 ` Anthony Martin
2020-10-27  9:04   ` Anthony Martin
2020-10-27  9:30   ` [9front] " Nick Owens
2020-10-27  9:48 ` [9front] " cinap_lenrek
2020-10-27 10:23   ` Nick Owens
2020-10-27 10:53     ` Nick Owens
2020-10-27 20:00       ` Nick Owens

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).