Re: nvme on 2019 macbooks
Yuri Pankov wrote: I have tried booting latest -current snapshot on 2019 macbook pro 16, and noticed that nvme driver didn't attach, as class reported is 0x018002 and not 0x010802 that we expect in nvme_pci.c. The following linux changes seem to be related: https://github.com/torvalds/linux/commit/66341331ba0d2de4ff421cdc401a1e34de50502a https://github.com/torvalds/linux/commit/d38e9f04ebf667d9cb8185b45bff747485f1d3e9 I have tried adding the exact PCI IDs, but that also fails as number of msix vectors seems to be 0 in nvme_ctrlr_setup_interrupts() and nvme_ctrlr_configure_intx() fails with "unable to allocate shared IRQ". Any hints on how to proceed here? So it looks like we need to fallback to MSI if we failed to enable MSI-X. With the attached patch we still fail to attach the target device (as below) most likely due to the quirks needed as seen in linux driver, but it's definitely a start: nvme0: CREATE IO CQ (05) sqid:0 cid:15 nsid:0 cdw10:0081 cdw11:00010003 nvme0: INVALID_FIELD (00/02) sqid:0 cid:15 cdw0:0 nvme0: nvme_create_io_cq failed! diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c index 448bfda6a718..e609967b53fe 100644 --- a/sys/dev/nvme/nvme_pci.c +++ b/sys/dev/nvme/nvme_pci.c @@ -90,6 +90,7 @@ static struct _pcsid { 0x05401c5f, 0, 0, "Memblaze Pblaze4", QUIRK_DELAY_B4_CHK_RDY }, { 0xa821144d, 0, 0, "Samsung PM1725", QUIRK_DELAY_B4_CHK_RDY }, { 0xa822144d, 0, 0, "Samsung PM1725a", QUIRK_DELAY_B4_CHK_RDY }, + { 0x2005106b, 0, 0, "ANS2 NVMe Controller" }, { 0x, 0, 0, NULL } }; @@ -267,7 +268,7 @@ nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) force_intx = 0; TUNABLE_INT_FETCH("hw.nvme.force_intx", _intx); - if (force_intx || pci_msix_count(dev) < 2) { + if (force_intx) { nvme_ctrlr_configure_intx(ctrlr); return; } @@ -297,9 +298,14 @@ nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) /* One vector for per core I/O queue, plus one vector for admin queue. */ num_vectors_requested = num_io_queues + 1; num_vectors_allocated = num_vectors_requested; + + /* Try MSI-X */ if (pci_alloc_msix(dev, _vectors_allocated) != 0) { - nvme_ctrlr_configure_intx(ctrlr); - return; + /* MSI-X failed, try MSI */ + if (pci_alloc_msi(dev, _vectors_allocated) != 0) { + nvme_ctrlr_configure_intx(ctrlr); + return; + } } if (num_vectors_allocated < 2) { pci_release_msi(dev); ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: nvme on 2019 macbooks
I don't have a MacBook. I don't own one and my work gives me a ThinkPad (but runs Windows). I believe the issue on new Macs is the NVMe queue size or something. You should read the Linux driver, the FreeBSD equivalents, and then build your patch on the differences in how the hardware is handled. This is how I got my 2018 HP Spectre x360 to work (but with different subsystems), and you could do the same on newer Apple NVMe. If you get something working, consider making a patch and submitting it. That's what I done with my Spectre, and it has been in HEAD for a few months now. -Neel === https://www.neelc.org/ On 2020-04-29 10:43, Yuri Pankov wrote: I have tried booting latest -current snapshot on 2019 macbook pro 16, and noticed that nvme driver didn't attach, as class reported is 0x018002 and not 0x010802 that we expect in nvme_pci.c. The following linux changes seem to be related: https://github.com/torvalds/linux/commit/66341331ba0d2de4ff421cdc401a1e34de50502a https://github.com/torvalds/linux/commit/d38e9f04ebf667d9cb8185b45bff747485f1d3e9 I have tried adding the exact PCI IDs, but that also fails as number of msix vectors seems to be 0 in nvme_ctrlr_setup_interrupts() and nvme_ctrlr_configure_intx() fails with "unable to allocate shared IRQ". Any hints on how to proceed here? pciconf excerpt: none7@pci0:4:0:0: class=0x018002 rev=0x01 hdr=0x00 vendor=0x106b device=0x2005 subvendor=0x106b subdevice=0x1800 vendor = "Apple Inc." device = "ANS2 NVMe Controller" class = mass storage bar [10]= type Prefetchable Memory, range 64, base 0xc040, size 419304, enabled bar [18]= type Prefetchable Memory, range 64, base 0xc140, size 524288, enabled bar [20]= type Prefetchable Memory, range 64, base 0xc160, size 65536, enabled cap 01[40] = powerspec 3 supports D0 D3 current D0 cap 05[50] = MSI supports 8 messages, 64 bit cap 10[70] = PCI-Express 2 endpoint max data 256(256) RO NS link x4(x4) speed 8.0(8.0) ASPM L1(L1) ClockPM enabled ecap 0001[100] = AER 2 0 fatal 0 non-fatal 1 corrected ecap 0019[148] = PCIe Sec 1 lane errors 0 ecap 0018[168] = LTR 1 ecap 001e[170] = L1 PM Substated 1 ecap 000b[180] = Vendor [1] ID 0002 Rev 1 Length 256 ecap 0015[280] = Resizable BAR 1 ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org" ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
nvme on 2019 macbooks
I have tried booting latest -current snapshot on 2019 macbook pro 16, and noticed that nvme driver didn't attach, as class reported is 0x018002 and not 0x010802 that we expect in nvme_pci.c. The following linux changes seem to be related: https://github.com/torvalds/linux/commit/66341331ba0d2de4ff421cdc401a1e34de50502a https://github.com/torvalds/linux/commit/d38e9f04ebf667d9cb8185b45bff747485f1d3e9 I have tried adding the exact PCI IDs, but that also fails as number of msix vectors seems to be 0 in nvme_ctrlr_setup_interrupts() and nvme_ctrlr_configure_intx() fails with "unable to allocate shared IRQ". Any hints on how to proceed here? pciconf excerpt: none7@pci0:4:0:0: class=0x018002 rev=0x01 hdr=0x00 vendor=0x106b device=0x2005 subvendor=0x106b subdevice=0x1800 vendor = "Apple Inc." device = "ANS2 NVMe Controller" class = mass storage bar [10] = type Prefetchable Memory, range 64, base 0xc040, size 419304, enabled bar [18] = type Prefetchable Memory, range 64, base 0xc140, size 524288, enabled bar [20] = type Prefetchable Memory, range 64, base 0xc160, size 65536, enabled cap 01[40] = powerspec 3 supports D0 D3 current D0 cap 05[50] = MSI supports 8 messages, 64 bit cap 10[70] = PCI-Express 2 endpoint max data 256(256) RO NS link x4(x4) speed 8.0(8.0) ASPM L1(L1) ClockPM enabled ecap 0001[100] = AER 2 0 fatal 0 non-fatal 1 corrected ecap 0019[148] = PCIe Sec 1 lane errors 0 ecap 0018[168] = LTR 1 ecap 001e[170] = L1 PM Substated 1 ecap 000b[180] = Vendor [1] ID 0002 Rev 1 Length 256 ecap 0015[280] = Resizable BAR 1 ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"