You did install Ubuntu using the BIOS/legacy boot option -- that's what "CSM" is. (This acronym expands to "Compatibility Support Module," which is EFI-speak for BIOS compatibility mode.) Thus, setting the "OS mode selection" in your firmware to "CSM" for the installation essentially tells your computer to boot only in BIOS/legacy mode.
There are a number of possible solutions. These include:
Install my rEFInd boot manager in Windows. Edit the refind.conf file: Uncomment the scanfor line and add hdbios to its options. When you reboot, rEFInd should come up and show at least two boot options. One should boot Windows and the other should start up GRUB in BIOS mode, which should in turn launch Linux. If you try this and want to experiment more, you could try tweaking the configuration to boot Linux directly in EFI mode.
Convert your existing Ubuntu installation to boot in EFI mode by adding a suitable EFI-mode boot loader. rEFInd can serve this purpose, or you could install ELILO or the EFI version of GRUB 2. The trick is registering the EFI boot loader with the firmware, which requires an EFI-mode boot of Linux or doing the work from Windows. (The preceding option does this for rEFInd by doing the work in Windows.) See my EFI Boot Loaders for Linux site for more on your options on this score. This approach has a fairly steep learning curve, but it's a fairly clean approach. There's the caveat about EFI-mode boots possibly having problems on your system, though.
Re-install Ubuntu in EFI mode. This will require overcoming your kernel panic problem, though, and I don't have any specific suggestions on doing that. Perhaps adding (or removing) a kernel option would do the trick, or switching to another kernel version (but this is awkward for an installer's kernel).
Overall, I'd say your easiest course of action is to install rEFInd. It will probably enable you to boot Linux in EFI mode, and it provides a path to experiment with EFI-mode booting if you decide to pursue that.
Disable UEFI boot support . Now try to install again. If not working follow these steps...
Shrink your Windows partition
Windows takes up the whole of the drive when it is first installed. In order to install Ubuntu you will need to make space for it.
Press the "super key" (Windows key) on your keyboard and click the magnifying glass in the top right corner. In the search box start typing "Partitions".
Click on the option called "Create and format partitions". This will bring up the "Disk Management" screen.
To shrink the drive, right click on the "OS (C:)" volume and select "Shrink volume".
A screen will appear showing how much you can shrink the drive by. You can of course choose to shrink the drive by less than offered but never go for any more than offered as you will break your Windows 8.1 operating system if you do.
Click "Shrink" to continue.
When you are finished you will see that there is a lot of unpartitioned space. This is where Ubuntu will be installed.
Turn off fast boot
Turn off secure boot