heads icon indicating copy to clipboard operation
heads copied to clipboard

Enable NVMe support for ThinkPads

Open snmcmillan opened this issue 4 years ago • 6 comments

This will enable NVMe support on ThinkPads when used in conjunction with a NVMe to Expresscard adapter.

Tested working on X230, X220, and T420.

snmcmillan avatar Jan 06 '21 16:01 snmcmillan

@SebastianMcMillan that product https://thinkmods.store/products/expresscard-to-nvme-adapter ? Speeds? Rough size change of compressed kernel change? @paulmenzel wants to know this kind of stuff. :)

Why not compiled as a module and be switched on/off as a module like e1000e and usb drivers in board configs? That way it could be always compiled, but not necessarily included, but stated in boards configs for users to turn on/off? Size change of compressed initrd in that case?

After knowing this, we might want to add it to all other boards configs, and switch it off by default in builds when space become scarce?

tlaurion avatar Jan 06 '21 20:01 tlaurion

@SebastianMcMillan : Have you followed your repo under CircleCI? That permits to know right (after caches are created on first run) away if an actual board fails building because of your commit.

tlaurion avatar Jan 06 '21 20:01 tlaurion

That is the product. I currently have a prototype to work with.

In terms of speed, it'll have slightly less than SATA 3, but far less latency. It's ideal if you want more data storage or want low-latency storage.

I don't know the exact size of the change in kernel or initrd currently.

And for building as a module, I can take a look at it further (or if anyone can do it faster I'll gladly take other contributions). I'm not 100% familiar with setting up modules in the config.

On Wed, Jan 6, 2021, 14:22 tlaurion [email protected] wrote:

@SebastianMcMillan https://github.com/SebastianMcMillan that product https://thinkmods.store/products/expresscard-to-nvme-adapter ? Speeds? Rough size change of compressed kernel change? @paulmenzel https://github.com/paulmenzel wants to know this kind of stuff. :)

Why not compiled as a module and be switched on/off as a module like e1000e and usb drivers? That way it could be always compiled, but not necessarily included in boards configs. But stated in boards configs for users to add/remove? Size change of compressed initrd in that case?

After knowing this, we might want to add it to all other boards configs, and switch it off by default in builds when space become scarce?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/osresearch/heads/pull/956#issuecomment-755635324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNTUNA55CFZKSIACU75LDLSYTA6RANCNFSM4VXX2Q3A .

snmcmillan avatar Jan 06 '21 20:01 snmcmillan

@SebastianMcMillan Build is happening here: https://app.circleci.com/pipelines/github/tlaurion/heads/688/workflows/59073559-cc4f-4767-9aed-2e601016e263/jobs/759

Since you modifies linux-x230.config and that all xx30 and xx20 boards depend on it, we will see if that change needs to be put as module, since boards depending on it would fail in that case:

user@localhost:~/heads$ grep linux-x230 boards/*/*.config
boards/t420-hotp-maximized/t420-hotp-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/t420-maximized/t420-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/t420/t420.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/t430-flash/t430-flash.config:CONFIG_LINUX_CONFIG=config/linux-x230-flash.config
boards/t430-hotp-maximized/t430-hotp-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/t430-maximized/t430-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/t430/t430.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x220-hotp-maximized/x220-hotp-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x220-maximized/x220-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x220/x220.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x230-flash/x230-flash.config:CONFIG_LINUX_CONFIG=config/linux-x230-flash.config
boards/x230-hotp-maximized/x230-hotp-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x230-hotp-verification/x230-hotp-verification.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x230-maximized/x230-maximized.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x230-nkstorecli/x230-nkstorecli.config:CONFIG_LINUX_CONFIG=config/linux-x230.config
boards/x230/x230.config:CONFIG_LINUX_CONFIG=config/linux-x230.config

You said you tested on x220, where x220 is not build per CI. But the artifacts and the output of coreboot builds for other boards when compared against master latest builds will inform us of the size difference (in free space and occupied rom space) Let's see! Result in an hour from now! :)

tlaurion avatar Jan 06 '21 20:01 tlaurion

This PR: https://app.circleci.com/pipelines/github/tlaurion/heads/688/workflows/59073559-cc4f-4767-9aed-2e601016e263/jobs/759

Built lenovo/x230 (ThinkPad X230)
make[1]: Leaving directory '/root/project/build/coreboot-4.8.1'
2021-01-06 21:23:37+00:00 DONE coreboot
touch /root/project/build/coreboot-4.8.1/x230/.build 
"/root/project/build/coreboot-4.8.1/x230/cbfstool" "/root/project/build/coreboot-4.8.1/x230/coreboot.rom" print
Name                           Offset     Type           Size   Comp
cbfs master header             0x0        cbfs header        32 none
fallback/romstage              0x80       stage           85220 none
cpu_microcode_blob.bin         0x14e00    microcode       25600 none
fallback/ramstage              0x1b280    stage           81926 none
config                         0x2f2c0    raw               567 none
revision                       0x2f540    raw               582 none
cmos.default                   0x2f7c0    cmos_default      256 none
cmos_layout.bin                0x2f900    cmos_layout      1804 none
fallback/dsdt.aml              0x30080    raw             13646 none
fallback/payload               0x33640    simple elf    6882244 none
(empty)                        0x6c3a40   null           113048 none
bootblock                      0x6df400   bootblock        3000 none

Master: https://app.circleci.com/pipelines/github/osresearch/heads/274/workflows/a676dfe4-b55d-48a3-9e53-01cd3d45bd0f/jobs/302

2021-01-06 03:18:10+00:00 DONE coreboot
touch /root/project/build/coreboot-4.8.1/x230/.build 
"/root/project/build/coreboot-4.8.1/x230/cbfstool" "/root/project/build/coreboot-4.8.1/x230/coreboot.rom" print
Name                           Offset     Type           Size   Comp
cbfs master header             0x0        cbfs header        32 none
fallback/romstage              0x80       stage           85220 none
cpu_microcode_blob.bin         0x14e00    microcode       25600 none
fallback/ramstage              0x1b280    stage           81921 none
config                         0x2f2c0    raw               567 none
revision                       0x2f540    raw               582 none
cmos.default                   0x2f7c0    cmos_default      256 none
cmos_layout.bin                0x2f900    cmos_layout      1804 none
fallback/dsdt.aml              0x30080    raw             13646 none
fallback/payload               0x33640    simple elf    6865860 none
(empty)                        0x6bfa40   null           129432 none
bootblock                      0x6df400   bootblock        3000 none

Before: 6865860 Now:: 6882244 Difference: 16384

@SebastianMcMillan This should be added in commit.

tlaurion avatar Jan 07 '21 01:01 tlaurion

My memory is full of mandala effects: I cannot find notes stating what I think was already here :(

A lot of people are proposing board ports at a faster pace, and try to reuse linux-x230-maximized config. This is great and could be practical on a maintainership perspective, but would require Heads codebase to adapt a bit.

  • The shared linux config file could compile those additionally desired drivers as modules (=m instead of =y) so they are compiled as modules at linux kernel compilation time for a specific kernel version.
  • The modules/linux config could be modified to encompass desired additional modules with a clear additional function (CONFIG_LINUX_NVME) and declare the needed modules as additional modules.cpio modules to be packed under initrd when rom is constructed per Makefile
  • the same CONFIG_LINUX_NVME variable would need to be introduced into board config for those modules to be actually included into modules.cpio and then packed under initrd.cpio.xz into coreboot linux payload
  • initrd/init would need to introduce some dynamic modules loading early at boot

Otherwise the other option is to duplicate the linux kernel config and make it board specific, or specialized for a family of platforms (this was the goal with linux-x230-maximized, which was used to be shared by Lenovo Thinkpads xx30/xx20 who share most of the same chipsets. Even there today, it could be interesting to seperate them into xx20 and xx30 variants, since space constraints and performance difference of including specific modules changes a lot of things. AVX, AES-NI etc etc exist from sandy bridge. But newer platforms will have AVX2 (Haswell+) and other more optimized options should probably be setuped accordingly. Same applying for older platforms (x200) that should disable those options to economize firmware space.

tlaurion avatar May 09 '23 16:05 tlaurion