Turbulent mixing layers over cavities can couple with acoustic waves and lead to undesired oscillations. To understand the nonlinear aspects of this phenomenon, a turbulent mixing layer over a deep cavity is considered and its response to harmonic forcing is analysed with large-eddy simulations (LES) and linearised Navier-Stokes equations (LNSE). The Reynolds number is Re=150 000. As a model of incoming acoustic perturbations, spatially uniform time-harmonic velocity forcing is applied at the cavity end, with amplitudes spanning the wide range 0.045-8.9% of the main channel bulk velocity. Compressible LES provide reference nonlinear responses of the shear layer, and the associated mean flows. Linear responses are calculated with the incompressible LNSE around the LES mean flows; they predict well the amplification (both measured with kinetic energy and with a proxy for vortex sound production in the mixing layer) and capture the nonlinear saturation observed as the forcing amplitude increases and the mixing layer thickens. Perhaps surprisingly, LNSE calculations based on a monochromatic (single frequency) assumption yield a good agreement even though higher harmonics and their nonlinear interaction (Reynolds stresses) are not negligible. However, it is found that the leading Reynolds stresses do not force the mixing layer efficiently, as shown by a comparison with the optimal volume forcing obtained from a resolvent analysis. Therefore they cannot fully benefit from the potential for amplification available in the flow. Finally, the sensitivity of the optimal harmonic forcing at the cavity end is computed with an adjoint method. The sensitivities to mean flow modification and to a localised feedback (structural sensitivity) both identify the upstream cavity corner as the region where a smallamplitude modification has the strongest effect. This can guide in a systematic way the design of strategies aiming at controlling the amplification and saturation mechanisms.