Age | Commit message (Collapse) | Author |
|
ok mikeb@
|
|
|
|
only active during hibernation, preallocating the the submission and completion
queues during attach as they need to be page-aligned.
tested on an x270 that successfully hibernates now.
ok dlg@
|
|
NVM_ADMIN_DEL_IOCQ does not need prp1 (just as NVM_ADMIN_DEL_IOSQ).
Remove what is likely a cut'n'paste error from the *_ADD_* code.
tested by claudio@
ok jmatthew@
|
|
Based on an initial patch by ehrhardt@ . Thanks to claudio@ for testing
and deraadt@ for advice.
"go ahead" deraadt@
|
|
scsi layer, which will add one sector back
fixes incorrect disk size reporting which was causing fdisk to
create a protective MBR of one too many sectors, which caused our
EFI bootloader to fail to recognize it as a GPT disk
ok dlg
|
|
Errors will result in nice clean panic messages so we know what's wrong.
Reviewed by dhill visa natano jsg.
|
|
some (broken) controllers require ordered split transfers.
From linux a310acd7a7ea53533886c11bb7edd11ffd61a036
Tested by gonzalo@, ok dlg@
|
|
Makes gonzalo@'s Macbookair7,1 NVMe report the correct version.
ok dlg@
|
|
it seems devices using levelled intx interrupts need to explicitely ack
interrupts by masking and unmasking the source around the completion
ring handling. without this completions can be lost, which in turn
causes long (permanent?) stalls in the block layer under heavy write
load.
ive experienced this problem with an intel nvme part that only has
intx and msix support. because we dont support msix yet we only
use intx on it. it appeared to lock up before this fix.
this has been tested on both that intel board and a samsung with msi.
this fix was based on work found in code by nonaka
|
|
found by NONAKA Kimihiro while he was porting nvme to netbsd.
|
|
this solves my memory corruption problem with a samsung sm951 in a
particular slot on a dell 2950.
hilariously, i had picked values which masked this problem on
sparc64. i randomly picked 128 as the number of entries on the
queues, and dmamem allocs get rounded up to PAGE_SIZE. on amd64 and
sparc64 this meant i was asking for 128 * 8 (sizeof pointer), or
1024 bytes, which got rounded up to 4096 and 8192 on each arch
respectively. 128 * 64 (the size of a submission queue entry) is
8192, so it worked fine on sparc64 for that reason, but randomly
blows up on amd64. the 2950 above allocated mbufs out of the page
after the submission queue, which i ended over overwriting.
anyway. let's move on.
|
|
|
|
|
|
|
|
|
|
still a bit magical, but good enough for now.
|
|
this should be enough to make io reliable
|
|
we run with 2 entries for the nvme controller identify, and then bump it
up to cover the maxphys divided by the page size we negotiate.
|
|
|
|
prpe is short for Physical Region Page Entry. this is where long
lists of dma regions go when they wont fit into a submission queue
entry.
|
|
nvme and the host cpu need to agree on the page size because its
the implicit size of the elements in the chips scatter gather lists.
if the min nvme size is greater than the cpus page size then we
cant guarantee that io buffers are contig for nvme pages.
nvme 1.1 provides an alternative sgl mechanism, so if this really
becomes a problem in the future we can fix it on 1.1 and later
devices.
|
|
it ends up being a use after free, which disagrees with the midlayer.
|
|
again, only called during autoconf which is a kind of process context.
|
|
nvme 1.0 does not use conventional scatter gather lists of
address+length pairs. instead, it simply expects a list of page
addresses. this should be ok if we only feed it single VA chunks
which map directly to only whole physical pages.
nvme 1.1 introduced another scather format, but still accepts the
1.0 format too. we'll stick to the 1.0 format so we can support 1.0
devs.
|
|
this means we'll notice io completions.
|
|
|
|
ive only tested reads, and not very big ones.
nvme 1.0 has a very stupid/naive idea about what constitutes a
scatter gather list. it assumes io is in whole pages in memory, but
i dont know if that is true in our kernel.
this could be cleaned up a bit, and it currently runs with a single
opening for the whole scsi layer and a bunch of magic values for
the size and number of the io queues.
|
|
|
|
this is necessary to run reads and writes against the device.
|
|
|
|
at the moment this just pretends the commands completed fine.
|
|
read cap 16 claims the devices are thin.
|
|
most values are as per the nvm to scsi mapping guide. this doesnt
do vpd at all, so no devids or serial numbers just yet.
|
|
probe issues a namespace identify against the "target". if it works
it stashes a copy of the info, otherwise it tells the midlayer to
avoid it.
free gets rid of the stashed info.
|
|
|
|
so far the only useful info is namespace identify info
|
|
the nn is used to size the scsi bus, and the controller identify is used
to build responses for various scsi commands.
|
|
|
|
|
|
|
|
it's still 0 on success, but is the actual bits rather than a mashup of it
|
|
|
|
make it a u_int16_t like the hw while here.
|
|
|
|
most importantly this gets the proper timeout for chip enables/disables.
|
|
|
|
dont need a billion tabs for the function prototypes. just some
akward line wrappings.
|
|
|
|
|