Bug 252253 - Intel vmd NVMe controller not detected on 13-CURRENT
Summary: Intel vmd NVMe controller not detected on 13-CURRENT
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Doug Ambrisko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-29 05:51 UTC by Neel Chauhan
Modified: 2021-02-04 18:09 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neel Chauhan freebsd_committer freebsd_triage 2020-12-29 05:51:24 UTC
I recently got a HP Spectre x360 13-aw200, and am relegating my existing x360 13-ap0053dx for running RELEASE. Going forward, I will talk about the 13-aw200

I do not see any NVMe controller.

These set of patches show the Linux implementation: https://lore.kernel.org/linux-pci/b07f1c8a3089f0b4aa43004ccf9131f407b63a7d.camel@intel.com/T/#ma2e8cc45f20403aaf76a2a3fa26725e196ceadc1
Comment 1 Neel Chauhan freebsd_committer freebsd_triage 2020-12-29 05:52:32 UTC
Pictures of the non-detection is here: https://imgur.com/a/ighTwHQ

A patch like this:

--- a/sys/dev/vmd/vmd.c
+++ b/sys/dev/vmd/vmd.c
@@ -66,13 +66,20 @@ struct vmd_type {
 #define INTEL_VENDOR_ID                0x8086
 #define INTEL_DEVICE_ID_VMD    0x201d
 #define INTEL_DEVICE_ID_VMD2   0x28c0
+#define INTEL_DEVICE_ID_VMD3   0x9a0b
 
 static struct vmd_type vmd_devs[] = {
         { INTEL_VENDOR_ID, INTEL_DEVICE_ID_VMD,  "Intel Volume Management Device" },
         { INTEL_VENDOR_ID, INTEL_DEVICE_ID_VMD2, "Intel Volume Management Device" },
+        { INTEL_VENDOR_ID, INTEL_DEVICE_ID_VMD3, "Intel Volume Management Device" },
         { 0, 0, NULL }


gave a kernel panic, showing more needs to be done to support NVMe.
Comment 2 Neel Chauhan freebsd_committer freebsd_triage 2020-12-30 03:32:07 UTC
A picture of the kernel panic from my "patch" is here: https://imgur.com/a/XUQksOi
Comment 3 Doug Ambrisko freebsd_committer freebsd_triage 2021-01-15 18:03:14 UTC
Been working with Neel to debug this situation on new HW.  Founds some issues on old HW as well.  Have a potential fix that is being tested.  An initial POC is working on Neel's HW so making progress.
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-01-28 23:14:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0c852bb9b9282b30fd047ac1de398358f33777f4

commit 0c852bb9b9282b30fd047ac1de398358f33777f4
Author:     Doug Ambrisko <ambrisko@FreeBSD.org>
AuthorDate: 2021-01-28 23:12:14 +0000
Commit:     Doug Ambrisko <ambrisko@FreeBSD.org>
CommitDate: 2021-01-28 23:12:14 +0000

    Add support for some more Intel VMD controllers.  Some of the
    newer controller have a sparce bus space that can be figured
    out by probing the HW.  This gives the starting bus number.
    When reading the PCI config. space behind the VMD controller,
    the offset of the starting bus needs to be subtracted from
    the bus being read.

    Fixed a bug in which in which not all of the devices
    directly attached to the VMD controller would be probed.
    On my initial test HW, a switch was found at bus 0, slot 0
    and function 0.  All of the NVME drives were behind that
    switch.  Now scan for all slots and functions attached to
    bus 0.  If a something was found then run attach after the
    scan.  On detach also go through all slots and functions
    on bus 0.

    Tested with device ID's: 0x201d & 0x9a0b

    Tested by:      nc@
    MFC after:      7 days
    PR:             252253

 sys/dev/vmd/vmd.c     | 75 ++++++++++++++++++++++++++++++++++++++++++++-------
 sys/dev/vmd/vmd.h     |  1 +
 sys/dev/vmd/vmd_bus.c | 73 ++++++++++++++++++++++++++++++-------------------
 3 files changed, 113 insertions(+), 36 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2021-02-04 18:05:19 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1fb5b2860444ba8954abcf14a4e2f5f1ddd2fcd3

commit 1fb5b2860444ba8954abcf14a4e2f5f1ddd2fcd3
Author:     Doug Ambrisko <ambrisko@FreeBSD.org>
AuthorDate: 2021-01-28 23:12:14 +0000
Commit:     Doug Ambrisko <ambrisko@FreeBSD.org>
CommitDate: 2021-02-04 18:04:09 +0000

    VMD support for new devices.

    Add support for some more Intel VMD controllers.  Some of the
    newer controller have a sparce bus space that can be figured
    out by probing the HW.  This gives the starting bus number.
    When reading the PCI config. space behind the VMD controller,
    the offset of the starting bus needs to be subtracted from
    the bus being read.

    Fixed a bug in which in which not all of the devices
    directly attached to the VMD controller would be probed.
    On my initial test HW, a switch was found at bus 0, slot 0
    and function 0.  All of the NVME drives were behind that
    switch.  Now scan for all slots and functions attached to
    bus 0.  If a something was found then run attach after the
    scan.  On detach also go through all slots and functions
    on bus 0.

    Tested with device ID's: 0x201d & 0x9a0b

    Tested by:      nc@
    MFC:            5c689e21361
    PR:             252253

    (cherry picked from commit 0c852bb9b9282b30fd047ac1de398358f33777f4)

 sys/dev/vmd/vmd.c     | 75 ++++++++++++++++++++++++++++++++++++++++++++-------
 sys/dev/vmd/vmd.h     |  1 +
 sys/dev/vmd/vmd_bus.c | 73 ++++++++++++++++++++++++++++++-------------------
 3 files changed, 113 insertions(+), 36 deletions(-)
Comment 6 Doug Ambrisko freebsd_committer freebsd_triage 2021-02-04 18:09:07 UTC
Merged into -current and stable/13.