• Jeffrey Lee's avatar
    Enable part one of the FIQ fix · db8357fa
    Jeffrey Lee authored
    Detail:
      This change enables the basic 'FIQ fix', where SOF interrupts are handled by a FIQ handler and all other interrupts are delegated to IRQ.
      During testing it was observed that when the FIQ fix was enabled, what appears to be the host-side VCHIQ process would randomly die. It could take anywhere from several seconds (including during ROM init) or several hours for this to happen.
      After much investigation it looks like the cause was the use of the MPHI peripheral as a mechanism to trigger an IRQ from the FIQ handler. Changing the code in dwc_otg_hcd_handle_intr() so that it 'flushes' MPHI more often (after every interrupt instead of after every 60) seemed to reduce the problem, while changing the IRQ generation mechanism to use a different IRQ source (e.g. timer) made the crash go away entirely
      In the end I've settled on the compromise of using the MPHI peripheral, but in a way in which we only need to poke it once on startup, instead of once for every desired IRQ. Once we have it generating an IRQ we then rely on masking/unmasking the IRQ in the interrupt controller to get the desired effect of downgrading FIQs to IRQs. See the RISCOS_FIQ_DOWNGRADE #define.
      Changed files:
      - c/cmodule - Use symbolic constant for the USB controller ID instead of a magic number. Get the MPHI details from HAL_USBControllerInfo. Pay attention to Service_ClaimFIQ/Service_ReleaseFIQ and enable/disable the FIQ fix as appropriate.
      - c/dwc_common_riscos - Disable some debug functions which were accidentally left in non-debug builds. Change work queue/tasklet thread initialisation to fix a deadlock issue seen on reboot.
      - c/dwc_otg_riscos - Set up the MPHI and enable/disable the FIQ handler as required
      - cmhg/modhead - Pay attention to Service_ClaimFIQ/Service_ReleaseFIQ
      - dwc/driver/c/dwc_otg_hcd_intr, dwc/driver/h/dwc_otg_mphi_fix - RISCOS_FIQ_DOWNGRADE code
      - dwc/dwc_common_port/h/dwc_os - Make sure __DWC_WARN, __DWC_ERROR, DWC_EXCEPTION are compiled out in non-debug builds
      - h/dwc_otg_riscos - declare extra functions/variables related to FIQ fix
      - s/regaccess - Routine to install the FIQ handler on the FIQ vector, and simple HAL call wrapper
    Admin:
      Tested on Raspberry Pi
      Requires Kernel-5_35-4_79_2_227, BCM2835-0_34
    
    
    Version 0.15. Tagged as 'DWCDriver-0_15'
    db8357fa
dwc_otg_riscos 22.2 KB