Skip to content

Instantly share code, notes, and snippets.

@JeremyGrosser
Last active December 25, 2024 00:05
Show Gist options
  • Save JeremyGrosser/dff7991668d80220b4a3429590eb59a3 to your computer and use it in GitHub Desktop.
Save JeremyGrosser/dff7991668d80220b4a3429590eb59a3 to your computer and use it in GitHub Desktop.
MSI Prestige 13 AI+ Evo A2VMG-029US Debian notes 2024-11-28

MSI Prestige 13 AI+ Evo A2VMG-029US

Purchased from Costco.com Nov 25 2024 for $1,199.99. Amazon has the variant with 2TB SSD for $1,399.99. I don't think it's soldered, so it shouldn't cost that much to upgrade it later if I need more storage.

BIOS

https://us.msi.com/Business-Productivity/Prestige-13-AI-plus-Evo-A2VM/support?sku_id=95244#bios

Updated to E13Q3IMS.10C with the image from the MSI website. You need to unzip the files before putting them on the USB stick.

The BIOS release notes refer to this device as MS-13Q3, which also shows up in DMI.

Needed to disable CPU C-states to fix stuttering (see below)

Disabled Secure Boot for the Debian installer and custom kernel. Could re-enable if a signed Debian release kernel that works is available.

Debian

Installed from debian-12.8.0-amd64-DVD-1.iso (bookworm) on a USB stick. No networking available in the installer... Missing both firmware and an updated iwlwifi kernel driver.

Wayland/Gnome worked slowly with the bookworm 6.1 kernel, in 800x600 VGA mode with no acceleration. After updating the kernel, gdm3 failed to start. Mashed combos of Ctrl+Alt+Shift+Fn+F2 until I got a login shell on VT.

Used a very old and slow Realtek USB wifi adapter to get new iwlwifi firmware and kernel loaded from the trixie repository after install. Switched to a USB-C gigabit ethernet adapter and dist-upgraded all the way to trixie.

Kernel

Debian trixie kernel did not have the Intel Xe DRM driver enabled, so we need a custom kernel. Lots of other things seem to be improved with the newer kernel too.

Mainline 6.12.0 kernel (28eb75e178d389d325f1666e422bc13bbbb9804c)

  • Started with Debian trixie 6.11.9-1 config
  • yes "" | make oldconfig
  • Enabled CONFIG_DRM_XE and associated flags

Firmware

Debian firmware packages were all outdated by a couple months. Intel merged most of the LNL (Lunar Lake) artifacts we need starting in September 2024.

firmware-intel-graphics
firmware-sof-signed
firmware-iwlwifi

Wifi

latest iwlwifi "bz" firmware (d12506ffda7a36b484ca4e440abacf16f6f32068) git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

Graphics

drm-xe firmware from the drm-firmware intel-staging branch (d12506ffda7a36b484ca4e440abacf16f6f32068) https://gitlab.com/kernel-firmware/drm-firmware/-/tree/intel-staging?ref_type=heads

CONFIG_INTEL_MEI_GSC_PROXY - the Xe2 GSC (Graphics Security Controller) needs to talk to the ME (Management Engine) using this proxy driver for DRM playback. Still fails with this enabled, but it gets a bit further:

xe 0000:00:02.0: [drm] *ERROR* GT1: GSC proxy component not bound!

Audio

rsync v2.11.x sof firmware on top of the firmware-sof-signed directories. /lib/firmware/intel/sof-ipc4-lib didn't exist, needed to be created.

Stuttering

The system seemed to stutter for about a second fairly often. It misses keyboard events during this period.

Disabling CPU C-states in the BIOS fixes the stuttering, so I guess it has something to do with one of the low power states.

The C3 low power state is what causes the stuttering, disable it with:

apt install linux-cpupower
cpupower idle-set -d 3

Intel Sensor Hub

This is a little microcontroller with UART, SPI, I2C, GPIO for accessing things like accelerometers and gyros. The OEM builds firmware for it using an Intel provided SDK.

intel_ish_ipc throws some errors in dmesg after loading firmware. I downloaded the Windows ISH driver from the MSI website and found two .bin files inside it. One of them is very close in size to the firmware file from Debian, so I dropped that in and reloaded the kernel module. No change in behavior. Same thing with the other .bin file.

Zephyr Project supports ISH as a build target, so maybe we can develop an open firmware for it!

Camera

TPS68470

This is a power management IC. The kernel driver has some hardcoded voltage limits depending on the device we're running. Looks like it only has definitions for the Microsoft Surface Go devices (drivers/platform/x86/intel/int3472/tps68470_board_data.c).

I'm pretty sure this regulator powers the camera module and flash, but I don't know how it's wired up and what voltages need to be configured. It might be the same as the Surface Go in the existing driver, but I'm not brave enough to just try it... Don't want to blow up my camera with out of range voltages. The Windows camera driver package from MSI contains iactrllogic64 which I'm pretty sure configures this PMIC. Maybe we can reverse engineer the settings from that.

Once the camera power management is sorted, the ipu7-drivers kernel module needs to be built and installed along with it's firmware and userspace.

NVMe probe failure?

There's a traceback in dmesg that looks like it happens during NVMe PCI probing. It seems to recover from this and I've had no issues with NVMe.

ACPI messages

A bunch of ACPI errors during boot. Some of these might be related to our C-states issues.

EC firmware driver

msi_ec: Firmware version is not supported: '13Q3EMS1.109'

It looks like MSI EC firmwares support different functionality. We'll need to figure out what this firmware expects to get fan control, enable the camera, set LEDs, and read temperature sensors. I don't know if this is something we can derive from the Windows driver or if it's just a guessing game based on similar devices.

WMI events

msi_wmi driver reports unknown events when you press the function keys (Volume Up/Down, Brightness, etc). These keys already seem to be bound properly so I don't think we even need this driver?

@JeremyGrosser
Copy link
Author

JeremyGrosser commented Nov 28, 2024

root@lunar:/sys/devices/platform/msi-ec/debug# cat ec_dump 
     | _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _a _b _c _d _e _f
-----+------------------------------------------------
0x0_ | 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2_ | 00 00 00 00 00 00 00 00 0a 05 00 00 00 2c 0b 09
0x3_ | 02 05 00 0d 00 00 50 81 48 12 78 3c d4 01 c0 00
0x4_ | 48 12 37 00 21 13 74 fe 62 0a bc 3c e3 0b 88 45
0x5_ | 11 25 5f 00 00 02 00 00 00 00 00 00 00 00 00 00
0x6_ | 00 00 00 00 00 00 00 00 23 00 25 3c 40 44 48 4c
0x7_ | 6e 25 00 25 3c 46 4b 50 5a 41 20 32 3e 42 46 4a
0x8_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x9_ | 00 00 00 00 00 00 00 00 06 32 00 00 00 00 22 00
0xa_ | 31 33 51 33 45 4d 53 31 2e 31 30 39 31 30 33 30
0xb_ | 32 30 32 34 31 33 3a 34 34 3a 31 33 00 00 00 08
0xc_ | 00 00 07 25 00 00 00 00 00 d4 00 00 00 00 00 00
0xd_ | 00 00 c1 81 0d 00 05 80 00 01 00 00 00 01 00 00
0xe_ | e2 0a 00 21 13 00 00 00 00 00 00 00 00 c0 00 00
0xf_ | 00 00 70 00 20 38 00 21 64 00 00 00 00 00 00 00
root@lunar:/sys/devices/platform/msi-ec/debug# cat fw_version 
13Q3EMS1.109

@JeremyGrosser
Copy link
Author

JeremyGrosser commented Nov 29, 2024

After some fiddling with powertop, I came up with the following to put in /etc/rc.local:

#!/bin/sh

cpupower idle-set -d 3 >/dev/null
echo '1500' >/proc/sys/vm/dirty_writeback_centisecs
echo '0' >/proc/sys/kernel/nmi_watchdog

Powertop suggests enabling PM for a bunch of PCIe devices, but it doesn't seem to make a measurable difference on power consumption.

Disabling bluetooth gets you an extra hour of runtime, so do that if you're not actively using it.

ACPI reports about 12 hours runtime with 73% battery on these settings just doing basic web browsing and terminal work. I expect about 15 hours fully charged. Not too bad.

@JeremyGrosser
Copy link
Author

New xe2 and iwlwifi firmware have been merged into linux-firmware's main branch, so I think the sof, ish, ipu, and npu are the only firmwares outside of mainline now.

@JeremyGrosser
Copy link
Author

Kernel 6.13.0-rc1 fixes the GSC issue.

@JeremyGrosser
Copy link
Author

JeremyGrosser commented Dec 16, 2024

It looks like the C3 state pauses were a hardware bug. Patched on linux-stable now. https://bugzilla.kernel.org/show_bug.cgi?id=219364
Confirmed, as of 6.13.0-rc2, I no longer need the cpupower idle-set -d 3 command in rc.local.

@gregoiregentil
Copy link

Yes, C3 has been patched in 6.13-rc2: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/x86/kernel/cpu/intel.c?h=v6.13-rc2#n560

Some complementary info here: https://forum.level1techs.com/t/suspend-w-linux-on-lunar-lake-2024-msi-prestige-13-ai-evo-a2vm/218028

I still can't make work the webcam: intel/ipu7-drivers#17 I'm womdering if ov5675 is not registered correctly because of TPS68470? In any case, some files will have to be stolen

Also, I can't control the keyboard backlight from the OS. And it turns on and off all the time.

@JeremyGrosser
Copy link
Author

JeremyGrosser commented Dec 25, 2024

Dec 24 2024

Thank you for your recent order with Costco.com.

Our records indicate you purchased a laptop from Costco.com with Copilot+ PC capabilities. Some Copilot+ PC experiences were released in late November 2024, while others are still being fine tuned. Timing varies by device and region.

We will be sending you a $25 Costco Digital Shop Card For any inconvenience this may have caused you. You will receive your digital shop card by email within 3 - 5 days.

I guess this means Microsoft is having trouble with their Intel NPU integration? Not really relevant for Linux, but interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment