-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacBook8,1 (Early 2015) and Fedora #71
Comments
This sounds like the known issue with the interrupt (21 on your system) on MB8,1 and needing
And what does the following show? grep 21: /proc/interrupts Lastly, we noted in the README, have you tried booting with all three needed drivers ( cat <<EOF | sudo tee /etc/dracut.conf.d/keyboard.conf
# load all drivers needed for the keyboard
add_drivers+="applespi spi_pxa2xx_pci spi_pxa2xx_platform"
EOF and rerun |
Booting with irqpoll I get (keyboard and mouse working):
Booting without irqpoll but with modules as part of initramfs (keyboard and mouse not working):
Every key down and up event triggers:
|
Btw., does using As to what exactly the problem is with the (not) registering of the interrupt handler, maybe @andy-shev has some ideas? |
|
No, it isn't, though I'm not 100% sure if anybody else has tested it on MB8,1. Does manually setting the brightness also not work? echo 150 | sudo tee /sys/class/leds/spi::kbd_backlight/brightness But I guess the caps-lock led works? |
That manual brightness is working! And caps-lock as well (led is lit up, keyboard produces upper case letter and vice versa). But when going to standby (e.g.
And when I try to wake the system the first time by the power key, the screen lights up. On a second time it crashes. |
Regarding the keyboard brightness working manually: if you unload and reload the systemctl restart upower Regarding the keyboard and touchpad unresponsive after resume, see #49. |
After suspend I am unable to remove the module. |
I applied roadrunner2's patch and enabled debugging and got the following output while suspending:
|
I think I see the problem (missed clearing some flags on a read error) and pushed a fix for it. Not sure exactly what code you're running, but grab the latest from #70 and it should fix the module remove hang. Btw, I presume you're running into the #49 issue despite having booted with |
Now I am running exactly this code. Without
With either of
Does the corrupted packet tell you something? With a working keyboard going
Now I can successfully When I turn on keyboard light it is switched off during standby but remains dark after resume. Trying again to turn it on fails. |
So there are two distinct issues with the keyboard/touchpad on MB8,1:
While they are both related to the interrupt for the spi bus, they are different because this issue here is about the handler not getting installed properly (or something removing it again), whereas the resume issue is about the interrupt not firing at all anymore. So sticking to the boot/irqfixup issue only here. (i.e. let's keep discussions about suspend/resume on the relevant ticket #49).
The keyboard lighting up is controlled by two things: when the driver loads (usually early in boot, if it's in the initramfs) it looks for a stored value in an EFI variable - this variable is written with the current value on shutdown. I.e. the driver tries to preserve the setting across reboots (mainly so the keyboard lights up during early boot, e.g. when entering a disk encryption password). Second, the desktop environment will generally set the light level when it starts up. But as I said above, there's a race issue with upowerd. So if the keyboard is not lighting up by itself, try these things:
Not much: it's quite rare to get a corrupted packet, but it does very occasionally happen. Ideally we'd reset things when that happens, but it's not currently known how to do that, and things seem to recover by themselves even without a reset. So I've mostly just ignored these. Now, back to the core issue of the interrupt handler not registered properly: @andy-shev, do you have any ideas here? (to summarize: on MB8,1 only, unless booted with |
@roadrunner2: I manually turned the keyboard light on in runlevel 3 (as only from there I am successfully able to reboot - otherwise some stop jobs from Fedora are hanging) and my keyboard successfully lit up automatically. But quite late: after modeswitch is done (@8s), module already loaded @2s according to dmesg. I had not to deal with upower. When display turns off and I press a key (wake up call), the keyboard light turns on as well. So this is all working fine. I see the corrupted packet once on every load of the module (thus also on a rmmod/modprobe cycle). |
@TheChatty Sorry for the slow reply. Regarding the keyboard light, if restarting upower doesn't fix the issue and after reloading the module, then I don't know what the issue is - in any case, since the driver exposes the backlight controls properly and you can manually change the brightness, it's not an issue with the driver, but some userspace issue. I'm sorry, but you'll have to debug that yourself. Regarding the corrupted packet, while it doesn't appear to be a serious issue (shows up only once), it would be nice to understand what's going on. To that end I've pushed an update to the
and then send me the output of Lastly, regarding the irqfixup issue, I've prepared a patch to print out some debug info about the irq allocation and handling (spi-debug.patch.txt). You'll need to rebuild and reinstall your kernel with this patch. Also, it will be somewhat noisy, so you'll need to grab the output from
|
I didn’t find /proc/interrupts for non-working case on most recent kernel + driver to advise something. |
@andy-shev But would adding |
Apparently, user npx001 figured out how sort out the nvme 'IO queues not created' issue on the macbook8,1 here's the patch the patch he suggested:
Does anyone have a macbook8,1 to test this out on? Let me know if you need any help creating/applying this patch. |
Forgive my ignorance, but what's the common name for macbook8,1? I have a MacBook Air (11-inch, Early 2015), and would be happy to help test the patch in any way I can if I have the right model. I would likely need a little help getting the patch created and applied though. |
Run |
I tried that command but nothing comes up in a search for 0x2001... I was doing it from an install usb though, do I need to have Fedora fully installed on a disk? macbook, and "ID" matching case also turn up no results. |
To help illustrate this point, the nvme controller on the macbook9,1 has an id of
I think only the macbook8,1 (12-inch 2015 which is not a macbook air) has an nvme controller with a |
My device (which is a 11 inch, early 2015 air) lists a device "04:00.0 0180: 106b:2001 (rev 01) (prog-if 02)" controller as the only device using the nvme driver. |
Oh really!? In your dmesg log, do you see the |
I'm a bit of a Linux noob, so idk what irqpoll/irqfixup are, but I was trying to get Linux installed on this MacBook so I could learn it by using it, and it couldn't find the SSD on newer versions of the kernel. While troubleshooting I did find the "nvme nvme0: IO queues not created" error in the dmesg log. |
@Ninja73737 Ok, no worries. This is going to be a bit painful though depending on your level of experience and what you have available to you. But, lets start by creating a live-usb stick w/ persistent storage. There's a million ways to do this....I'll present you with a method using Fedora, since that's the distro I'm familiar with. You'll need to have a system running Fedora (not on your macbook air obviously).
download a live cd image
write image to usb stick w/ 4GB of persistent storage
**substitute /dev/sdd with device of your usb stick --hopefully you have one ; ) If you're on a non-Fedora system, you should be might be able to run this script directly to write the image to the usb drive: Let me know once you've made it this far. Everything else past this point is super easy. |
btw i do test nvme patch on macbookair7,1 ( early 2015 ) not macbook8,1 |
Yes, you'll test the patch on your macbookair7,1 as it has an nvme controller with a vendor:device id of 0x106b:0x2001 (which is the exact same nvme controller on the macbook8,1). That's the only requirement. You've already confirmed that you're experiencing the 'nvme nvme0: IO queues not created' error. Which we now know (or at least suspect) affects any nvme controller with the vendor:device id of 106b:2001 |
just tested on my macbookair7,1 with latest kernel ( 5.4.14 ) |
@leifliddy As far as I understood they can't install any Linux distribution. What I can recommend here is to build a simple image based on, for example, BuildRoot (*) with a patched kernel. Perhaps I can provide one next week, but not sure if I have time for it. *) btw, I have a branch intel published on my GH repository of BuildRoot which allows easily creating disk image with external kernel. |
@andy-shev > As far as I understood they can't install any Linux distribution. I understand. I was proposing that they create they install Linux (Fedora) to a usb stick via another system (or VM) running Linux (assuming that they have another Linux system available). Once created, they could then insert that usb stick into the macbook, boot from it, verify the 'nvme0: IO queues not created' error is present, then patch the nvme module, reboot, and then verify that the issue has been resolved. |
Here we are: File: mac-nvme-0x2001-disk-image.bin Simple |
Ok, sorry, the past week has been kinda busy so I ended up putting this on hold, but yes, I do have a USB I can use and an external hard drive that I can install Fedora on. I'm a little unclear about what to do with the .bin that @andy-shev has provided though, and also a little unclear about what it is... I understand that I'm supposed to write it to a USB, but I'm not sure where to go from there. I wrote it to a USB with Etcher, and it showed up in my boot menu so I tried to boot from it but the screen just stays blank... should something else be happening? |
I would try following Andy's instructions, and writing the image to disk w/
I'll test out Andy's image later today when I get home... |
Ok, will do.
|
So I tried this, using dd (though I had to change it to "bs=1m" because apparently it's slightly different on mac) but it behaves the same way. I also tried it on a different older dell laptop that I had lying around and also goes to a black screen right away and the USB shows no signs of being read. When I manually select the "BOOTX64.EFI" option on that dell laptop it prints: |
I'm seeing the same thing. There's something wrong with this image. |
Hmm... I may try it on our mac on this week. The image itself is a compilation of kernel (eds-acpi branch on my github + nvme patch) with buildroot userspace (busybox and few tools) + GPT/MBR hybrid container with EFI shell binaries. The kernel is built with EFI mixed stub, so it should run in any environment. Btw, can you add |
@andy-shev (@leifliddy), I've got a 2015 12" MacBook 8,1 (featuring the 0x106b:0x2001 NVMe) and dd/booted your 18MBmac-nvme-0x2001-disk-image.bin image successfully - however, there's no networking support support so I'm unable to proceed with the remainder of the installation (there's only the loopback adapter available to me and adding an external USB Ethernet adapter doesn't add any further interface). If you're able to provide a 'fatter' kernel with more driver support I'd be keen to try again! In a parallel effort, I've performed a git clone of the following Ubuntu 5.5 mainline kernel: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.5/ ...patched it with the five other other Ubuntu-centric patches: 0001-base-packaging.patch ...modified the the drivers/nvme/host/pci.c file per @npx001's suggestion (leifliddy's had a couple of typos from what I can tell; i.e. a parenthesis/comma needed to be removed vs the original npx001 post comment) - please confirm the following syntax is in fact correct): { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001), ...and enabled the apple-spi input/keyboard driver within the kernel .config (as it was disabled by default, i.e. not designated to be included in the kernel or as a module). I have compiled this kernel successfully (which presents itself as a 5.4rc8) and slip-streamed it in with the Ubuntu 19.10 desktop image via cubic-wizard. I then performed a full/typical USB-based install onto my MacBook. At the moment, this particular kernel requires me to (from memory) pass the irqfixup boot parameter (now set as a grub command-line option) in order to utilise the track-pad/keyboard (I did try but can't quite recall whether irqpoll was required/effective). From (very) brief testing last night, resumption from the Ubuntu 'suspend' app worked in that the OS seemingly resumed operation (presented me with a user credential prompt) but the MacBook keyboard/track-pad wasn't functional (necessitating an external keyboard to be plugged in again). I need to perform some more testing this evening to make sure my last comments are in fact correct. Suggestions welcome! |
Yeah, there was a typo in my previous post. I've just updated it.
Wait!? So, you have compiled a new kernel w/ a modified |
@npx001, I have submitted the patch, please, respond there if I should change the form of credits. TWIMC, please test and answer there if it looks good or not. Thanks! |
Apologies for the slow response @leifliddy (as I really want to keep the momentum on this issue). Yes, in order to have a functional built-in track-pad and keyboard, I need to specify either 'irqfixup' or 'irqpoll' as a kernel parameter (currently set in /etc/default/grub). For the avoidance of doubt, this is within a freshly compiled kernel (the entire build, not just a module) featuring a patched 'drivers/nvme/host/pci.c' with 'NVME_QUIRK_SINGLE_VECTOR'). Without these two kernel parameters; I need to use an external keyboard and mouse. When I use the Ubuntu 'Suspend' applet, the machine enters a hardware suspended state. I am unable to wake it via any key on the keyboard other than the power key. When it resumes, both the built-in MacBook keyboard and track-pad are unresponsive. Again, I need to use an external keyboard and mouse to operate the machine. The aforementioned occurs within a recently installed Ubuntu 19.10 environment (apple-spi is was compiled as a module). FYI: I've installed the two header .deb packages as well as the kernel and module debs). I get the same behaviour with both the Ubuntu mainline kernel v5.5 and v5.6-rc2. Here is my current v5.5 recipe (and it's similar for the v5.6-rc2):
Any/all ideas welcome. I'm more than happy to assist any debugging efforts (just let me know the commands you'd like to execute and I'll publish the results). John |
@john-morton If you're willing to patch kernels and help debug this, then I suggest picking up from #71 (comment) (the last paragraph) where I provided a patch and some instructions to try and hopefully help narrow down the interrupts issue. Also, the output from |
@roadrunner2 I've just tried to apply your patch on the Ubuntu mainline kernel source 5.5 and 5.6.2 but get the following error (for both):
Can you please advise and potentially provide a further revised patch (such that I can provide the detailed debugging information requested)? Here are the steps I was following up until this juncture:
|
@john-morton Sorry for the delay. Here's an updated version of the patch that applies against 5.5 and 5.6 (modulo some offset warnings): spi-debug.patch.2.txt |
@roadrunner2 unfortunately, it seems there's an issue with the patch provided?
...and, I get a compilation error post patch (I've tried several times):
Any chance you can check whether you see this as well (and potentially provide a slightly revised patch)? |
@john-morton It looks like you must have some custom mods in your kernel. I just rechecked, and the patch applies cleanly (apart from the offsets) on 5.5.19 and compiles without warnings or errors.
This at least looks like the result of that Hunk 1 not getting applied - try manually applying it. |
Recent Fedora (28, 29 & 30) running kernel 4.18 or newer fail to load applespi. Here's the output from 4.20.0-1.fc30.x86_64 after compiling and loading the module:
Btw, I had it working once.
And when booting with
irqpoll
mouse and keyboard are working.The text was updated successfully, but these errors were encountered: