linux-surface / linux-surface

Linux Kernel for Surface Devices
4.68k stars 205 forks source link

Enable UFSHCD in kernel #1371

Closed g3blv closed 3 months ago

g3blv commented 4 months ago

Microsoft Surface Go 4 uses Universal Flash Storage for storage. UFSHCD and UFSHCD_PCI needs to be enabled in the kernel to be able to boot. Would it be possible to enable these two (= y rather than = m) when building the Surface on Linux kernel?

StollD commented 4 months ago

We can enable these I guess, but wouldn't it make more sense to enable these "upstream", so in the distributions?

Because building them only into the surface kernel won't let you install the system to the internal storage, or boot to it to install the surface kernel.

StollD commented 4 months ago

There is also the consideration of support: Are you certain that enabling these options makes the storage work?

I know on some Android devices you need vendor patches to access the UFS storage. If you try to access it without those patches, it wipes the UFS clean, bricking the device. Granted, it's a bit of a freak example (and wiping the storage won't brick an x86 device), but nonetheless, some verification would be nice.

g3blv commented 4 months ago

I agree with you, that it would make sense to "upstream". I was trying to find out how to get Fedora (I know there is currently the NX issue with the Fedora kernel) and Ubuntu to enable it, but I wasn't able to find any repos for the kernel configs. Do you know how I get in contact with the different kernel teams?

I have tried UFSHCD and UFSHCD_PCI with a custom kernel that I complied in Alpine Linux, and it worked (menuconfig also suggests dependencies to some SCSI modules). There is also an Ask Ubuntu post on how to enable the modules that I've tried on Ubuntu and it works.

StollD commented 4 months ago

For Fedora, the repository is https://gitlab.com/cki-project/kernel-ark, but I don't know about Ubuntu. I think their bugtracker is on launchpad? But that UI is so confusing, I never understood it.

StollD commented 4 months ago

I just checked this, and Fedora already enables the options you mentioned since 6.5.9. https://gitlab.com/cki-project/kernel-ark/-/commit/a604e426d738016c5b4994663f51adb97af3d25d and https://src.fedoraproject.org/rpms/kernel/c/ab53549bdddfd022744935bdc682a8fc754e0ad9?branch=f39.

Unfortunately, Fedora 39 launched with 6.5.6, so the official images don't have these modules. You might want to try one of the respin images that are built from up to date packages: https://dl.fedoraproject.org/pub/alt/live-respins/

g3blv commented 4 months ago

That is great news. I'll give it try and report back. Maybe even the NX issue has been solved. Fingers crossed ;).

g3blv commented 3 months ago

I tried the latest live respin, but I didn't boot. I guess it didn't boot due to the NX issue. Is the NX issue tracked somewhere on the Fedora side? I'll close this issue for now.

g3blv commented 1 month ago

@StollD I had another look at this. This, here ⇾ https://github.com/linux-surface/kernel/issues/153 might be the issue now (wasn't maybe the case before)