IOS: Adjust IPC timing based on hardware tests

This adjusts IOS IPC timing to be closer to actual hardware:

* Emulate the IPC interrupt delay. On a real Wii, from the point of
  view of the PPC, the IPC interrupt appears to fire about 100 TB ticks
  after Y1/Y2 is seen.

* Fix the IPC acknowledgement delay. Dolphin was much, much too fast.

* Fix Device::GetDefaultReply to return more reasonable delays. Again,
  Dolphin was way too fast. We now use a more realistic, average reply
  time for most requests.

  Note: the previous result from https://dolp.in/pr6374 is flawed.
  GetTicketViews definitely takes more than 25µs to reply.
  The reason the reply delay was so low is because an invalid
  parameter was passed to the libogc wrapper, which causes it to
  immediately return an error code (-4100).

* Fix the response delay for various replies that come from the kernel:
  fd table full, unknown resource manager / device, invalid fd,
  unknown IPC command.

Source: af320e4/iostest/ipc_timing.cpp
This commit is contained in:
Léo Lam 2018-02-25 23:51:06 +01:00
commit fa89614b07
3 changed files with 28 additions and 9 deletions

View file

@ -213,7 +213,9 @@ void GenerateAck(u32 _Address)
ctrl.Y2 = 1;
DEBUG_LOG(WII_IPC, "GenerateAck: %08x | %08x [R:%i A:%i E:%i]", ppc_msg, _Address, ctrl.Y1,
ctrl.Y2, ctrl.X1);
CoreTiming::ScheduleEvent(1000, updateInterrupts, 0);
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
// after Y2 is seen in the control register.
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
}
void GenerateReply(u32 _Address)
@ -222,7 +224,9 @@ void GenerateReply(u32 _Address)
ctrl.Y1 = 1;
DEBUG_LOG(WII_IPC, "GenerateReply: %08x | %08x [R:%i A:%i E:%i]", ppc_msg, _Address, ctrl.Y1,
ctrl.Y2, ctrl.X1);
UpdateInterrupts();
// Based on a hardware test, the IPC interrupt takes approximately 100 TB ticks to fire
// after Y1 is seen in the control register.
CoreTiming::ScheduleEvent(100 * SystemTimers::TIMER_RATIO, updateInterrupts);
}
bool IsReady()