You may see a failure to lock/unlock a flash sector while using the 'alt_qspi_controller2_lock' driver API in the Intel® FPGA Quad SPI Controller II Core. This is expected behavior if a Write Enable command is not issued before the lock/unlock instruction is performed.
This also impacts the driver API for Intel FPGA Serial Flash Controller II Core.
To perform a successful lock/unlock to a flash sector, ensure the Write Enable instruction is issued prior to using the alt_qspi_controller2_lock or alt_epcq_controller2_lock driver API.
This is scheduled to be fixed in a later release of Intel® Quartus® Prime Software.