hw/usb/hcd-ohci: Implement frame number overflow event
PATCH 1/1 hw/usb/hcd-ohci: Implement frame number overflow event
According to specification 6.5.6 FrameNumberOverflow Event when bit 15 of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.
--- hw/usb/hcd-ohci.c | 3 +++ 1 file changed, 3 insertions(+)
hw/usb/hcd-ohci.c +3 -0
@@ -1246,6 +1246,9 @@ static void ohci_frame_boundary(void *opaque) hcca.frame =cpu_to_le16 (ohci->frame_number);/* When the HC updates frame number, set pad to 0. Ref OHCI Spec 4.4.1*/ hcca.pad =0 ; +if (ohci->frame_number ==0x8000 || ohci->frame_number ==0 ) { +ohci_set_interrupt (ohci,OHCI_INTR_FNO ); + }if (ohci->done_count ==0 && !(ohci->intr_status &OHCI_INTR_WD )) {if (!ohci->done) {
Signature · 1 line
2.41.3
Quoted 18 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15
of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.Signed-off-by BALATON Zoltan <[email protected]>---
hw/usb/hcd-ohci.c | 3 +++1 file changed, 3 insertions(+)hw/usb/hcd-ohci.c +0
-0@@ -1246,6 +1246,9 @@ static void ohci_frame_boundary(void *opaque) hcca.frame = cpu_to_le16(ohci->frame_number); /* When the HC updates frame number, set pad to 0. Ref OHCI Spec4.4.1*/
Quoted 8 lines
hcca.pad = 0;
+ if (ohci->frame_number==0x8000||ohci->frame_number== 0) { +ohci_set_interrupt(ohci, OHCI_INTR_FNO);
+ }
if (ohci->done_count== 0 && !(ohci->intr_status &OHCI_INTR_WD)) {
if (!ohci->done) {
While this looks enough to assure the audio stream is stable in e.g. Mac OS 9, Mac OS X seems to require an additional patch regarding page- crossing (spec 4.3.2.3.1): The start_addr > end_addr check is invalid when BP0 and BE are on different pages with BP0 at a higher physical address. So move the check inside the same-page branch.
hw/usb/hcd-ohci.c +0 -0
@@ -710,16 +710,15 @@ static int ohci_service_iso_td(OHCIState *ohci,
struct ohci_ed *ed)
end_addr = next_offset;
}- if (start_addr > end_addr) {
- trace_usb_ohci_iso_td_bad_cc_overrun(start_addr, end_addr);
- return 1;
- }
-
- if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK))
{
+ if ((start_addr & OHCI_PAGE_MASK) == (end_addr & OHCI_PAGE_MASK))
{
+ if (start_addr > end_addr) {
+ trace_usb_ohci_iso_td_bad_cc_overrun(start_addr,end_addr);
+ return 1;
+ }
+ len = end_addr - start_addr + 1;
+ } else {
len = (end_addr & OHCI_OFFSET_MASK) + 0x1001
- (start_addr & OHCI_OFFSET_MASK);
- } else {
- len = end_addr - start_addr + 1;
}
if (len > sizeof(buf)) {
len = sizeof(buf);Quoted 6 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15 of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.
Signed-off-by BALATON Zoltan <[email protected]>
Is this a bug fix for some specific problem (e.g. it fixes handling for some guest OS)? If so, we should say what it's fixing in the commit message, so that if we ever come back to this in future we know what we need to test to make sure we don't re-break it.
thanks
-- PMM
Quoted 6 lines · Peter Maydell
Quoted 5 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15 of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.
Quoted 7 lines
Quoted 1 line
Signed-off-by BALATON Zoltan <[email protected]>Is this a bug fix for some specific problem (e.g. it fixes handling for some guest OS)? If so, we should say what it's fixing in the commit message, so that if we ever come back to this in future we know what we need to test to make sure we don't re-break it.
Primarily it fixes what it says in the commit message: compliance to the actual specification but it also seems to help MacOS to be able to use usb-audio which was how Howard found it. Unless there's something else to change in the patch I'm not sending a v2 feel free to tweak commit message on merge if needed.
Regards,
BALATON Zoltan
Quoted 9 lines · BALATON Zoltan
Quoted 8 lines · Peter Maydell
Quoted 6 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15 of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.
Signed-off-by BALATON Zoltan <[email protected]>
Quoted 7 lines
Quoted 5 lines
Is this a bug fix for some specific problem (e.g. it fixes handling for some guest OS)? If so, we should say what it's fixing in the commit message, so that if we ever come back to this in future we know what we need to test to make sure we don't re-break it.
Primarily it fixes what it says in the commit message: compliance to the actual specification but it also seems to help MacOS to be able to use usb-audio which was how Howard found it. Unless there's something else to change in the patch I'm not sending a v2 feel free to tweak commit message on merge if needed.
There's also this ticket that Howard sent me:
https://gitlab.com/qemu-project/qemu/-/issues/3274
but I don't know if we can add a Resolves to this patch for that as it only solves one of the issues the patch in that ticket tries to solve but apparently this is enough for MacOS 9. I hoped those involved in that ticket could test this or comment on this patch.
Regards,
BALATON Zoltan
Quoted 40 lines · BALATON Zoltan
Quoted 17 lines · BALATON Zoltan
Quoted 8 lines · Peter Maydell
Quoted 6 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15
of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.Quoted 7 lines
Quoted 1 line
Signed-off-by BALATON Zoltan <[email protected]>Is this a bug fix for some specific problem (e.g. it fixes handling for some guest OS)? If so, we should say what it's fixing in the commit message, so that if we ever come back to this in future we know what we need to test to make sure we don't re-break it.
Quoted 9 lines
Primarily it fixes what it says in the commit message: compliance to the
actual specification but it also seems to help MacOS to be able to use
usb-audio which was how Howard found it. Unless there's something else to
change in the patch I'm not sending a v2 feel free to tweak commit message on
merge if needed.There's also this ticket that Howard sent me:
https://gitlab.com/qemu-project/qemu/-/issues/3274
but I don't know if we can add a Resolves to this patch for that as it
only solves one of the issues the patch in that ticket tries to solve but
apparently this is enough for MacOS 9. I hoped those involved in that ticket could test this or comment on this patch.Regards,
BALATON Zoltan
Quoted 8 lines
For Mac OS 9.x this patch is sufficient. But not for Mac OS X guests. They require a second patch along the lines the one I sent earlier. That second patch is also based on hcd-ohci not conforming to the standard regarding (
start_addr>end_addr) if these are not on the same page and thestart_addris higher than theend_addr. See spec 4.3.2.3.1 Buffer Addressing.Best,
Howard
Quoted 48 lines · Howard Spoelstra
Quoted 47 lines · BALATON Zoltan
Quoted 17 lines · BALATON Zoltan
Quoted 8 lines · Peter Maydell
Quoted 6 lines · BALATON Zoltan
According to specification 6.5.6 FrameNumberOverflow Event when bit 15
of frame count changes (either from 1 to 0 or 0 to 1) a FrameNumberOverflow interrupt should be generated.Quoted 7 lines
Quoted 1 line
Signed-off-by BALATON Zoltan <[email protected]>Is this a bug fix for some specific problem (e.g. it fixes handling for some guest OS)? If so, we should say what it's fixing in the commit message, so that if we ever come back to this in future we know what we need to test to make sure we don't re-break it.
Quoted 9 lines
Primarily it fixes what it says in the commit message: compliance to the
actual specification but it also seems to help MacOS to be able to use
usb-audio which was how Howard found it. Unless there's something else to
change in the patch I'm not sending a v2 feel free to tweak commit message on
merge if needed.There's also this ticket that Howard sent me:
https://gitlab.com/qemu-project/qemu/-/issues/3274
but I don't know if we can add a Resolves to this patch for that as it
only solves one of the issues the patch in that ticket tries to solve but
apparently this is enough for MacOS 9. I hoped those involved in that ticket could test this or comment on this patch.Regards,
BALATON ZoltanFor Mac OS 9.x this patch is sufficient. But not for Mac OS X guests. They require a second patch along the lines the one I sent earlier. That second patch is also based on hcd-ohci not conforming to the standard regarding (
start_addr>end_addr) if these are not on the same page and thestart_addris higher than theend_addr. See spec 4.3.2.3.1 Buffer Addressing.
Quoted 2 lines
Quoted 1 line
Best,
Howard
That change can only be merged if you make a proper patch and send it to the list as described here:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html
Putting the patch in the ticket won't help unless it at least has a signed-off-by tag but as USB is pretty much unmaintained even if you submit patches to the list it might take a while to get merged by somebody and most probably be forgotten if you just put it in a ticket.
Regards,
BALATON Zoltan