OpenBSD cvs log

created 2021-10-20T09:28:45Z
begin 2021-05-28T00:00:00Z
end 2021-05-29T00:00:00Z
path src/sys
commits 18

date 2021-05-28T01:51:11Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
src/sys/dev/ic/nvmevar.h log diff annotate
message move the nvme_read4 and nvme_write4 macros to the header.

this allows nvme bus glue to use the macros too.

ok jmatthew@

date 2021-05-28T01:54:43Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
src/sys/dev/ic/nvmevar.h log diff annotate
message let nvme_read8 and nvme_write8 get used by bus glue too.

ok jmatthew@

date 2021-05-28T01:57:20Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
src/sys/dev/ic/nvmevar.h log diff annotate
message move nvme_barrier to nvmevar.h, just to keep it with the other reg ops.

date 2021-05-28T01:58:27Z
author dlg
files src/sys/dev/ic/nvmevar.h log diff annotate
message shuffle the deck chairs. no functional change

date 2021-05-28T02:03:11Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
src/sys/dev/ic/nvmevar.h log diff annotate
message move the nvme_dmamem prototypes so bus glue can use them.

ok jmatthew@

date 2021-05-28T02:34:38Z
author dlg
files src/sys/dev/ic/nvmevar.h log diff annotate
message provide an nvme_ops struct to start trying to support apple m1 nvme.

the Apple NVME Storage (ans) controller is almost but not quite a
vanilla nvme controller. one difference is that it doesnt attach
to a pci bus, so it will need custom bus glue to attach on those
machines. the other differences are around command submission.

vanilla nvme command submission is done via rings where the host
fills in one or more entries on the ring and then posts where the
ring is up to in a doorbell. ans nvme command submission is done
via an array of command slots where the host picks a slot and then
posts every slot number it fills in to a doorbell instead. this is
kind of clever because once a command slot is allocated, you don't
need any coordination between multiple cpus using that array of
slots to fill in and post the entry they were allocated. on the
other hand, it's different, so the code needs to be specialised.

ans also seems to have some weird iommu thing that needs to be
maintained as commands are posted and completed.

the nvme_ops struct will allow vanilla and ans controllers to provide
their own backens for these different semantics.

ok jmatthew@

date 2021-05-28T03:05:01Z
author dlg
files src/sys/dev/ic/nvme.c log diff annotate
message provide nvme_ops for vanilla pci nvme, and use them in the right places.

this paves the way for supporting the apple nvme storage controllers.
hopefully most of the remaining work on that is in the bus glue for
those controllers and this code won't need more tweaks.

hibernate still works, but it's relying on luck at the moment.
hibernate on arm64 and the apple controllers in particular will
almost certainly require more work here.

ok jmatthew@

date 2021-05-28T04:36:33Z
author dlg
files src/sys/arch/arm64/conf/files.arm64 log diff annotate
src/sys/arch/arm64/dev/aplns.c log diff annotate
message start working on support for Apple NVME Storage as found in apple M1 devs

the Apple NVME Storage (aka ans) controller is almost but not quite
a vanilla nvme controller. one difference is that it doesnt attach
to a pci bus, so it needs this custom bus glue. this custom bus
glue also provides us with a nice way to provide a different set
of functions to handle other things that ans does differently to
vanilla nvme controllers.

this is different to how linux deals with ans. the linux support
fakes a pci controller for ans to attach to. i assumed that at some
point a vendor would include nvme in an soc directly and made it a
bus independent driver from day 1. turns out i was right, but i
would never have guessed that the vendor would be apple.

some of the other differences between vanilla nvme and ans are
around command submission and completion. ans nvme command submission
is done via an array of command slots where the host picks a slot
and then posts every slot number it fills in to a doorbell. this
is different to vanilla nvme controllers which use a ring, and post
the producer index in that ring to a doorbell. ans also includes
some weird iommu, the handling of which we wrap up into the command
submission and completion functions.

this code is not yet enabled because it is incomplete. i'm getting
what i've done in so people with actual hardware can start poking
it more seriously.

this implementation is based on information figured out by the guys
porting linux to apple hardware.

date 2021-05-28T04:37:32Z
author dlg
files src/sys/arch/arm64/conf/GENERIC log diff annotate
message commented out lines for aplns(4) for Apple NVME storage controllers.

date 2021-05-28T04:39:54Z
author dlg
files src/sys/dev/ic/nvmevar.h log diff annotate
message aplns needs some dmamem per queue for it's iommu.

date 2021-05-28T04:56:07Z
author dlg
files src/sys/arch/arm64/dev/aplns.c log diff annotate
message kettenis@ pointed out that i forgot to fill in the op_cq_done nvme_op.

date 2021-05-28T11:50:18Z
author patrick
files src/sys/arch/armv7/imx/files.imx log diff annotate
src/sys/arch/armv7/imx/Attic/imxdog.c log diff annotate
src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/imxdog.c log diff annotate
message Move imxdog(4) to sys/dev/fdt.

ok kettenis@

date 2021-05-28T13:03:55Z
author patrick
files src/sys/dev/fdt/imxdog.c log diff annotate
message Once i.MX's watchdog is enabled, it can never be disabled. Some 64-bit
i.MX machines with a recent U-Boot come up with the watchdog enabled, so
we have to regularly ping it to make sure the watchdog doesn't reset us.

The watchdog's timeout can be configured in 0.5s steps to a maximum of
128s. Set it to the maximum, and schedule a timeout which reloads the
counter every 120s.

This only needs to be done if the watchdog is enabled when we boot up.

Tested on Cubox-i (armv7) and MNT Reform (arm64)
ok kettenis@

date 2021-05-28T13:04:42Z
author patrick
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/RAMDISK log diff annotate
message Enable imxdog(4)

ok kettenis@

date 2021-05-28T13:08:37Z
author patrick
files src/sys/dev/fdt/imxdog.c log diff annotate
message Schedule timeout a little bit sooner. Doing this once every minute isn't
going to hurt, but might save you if you run the machine badly into swap.

Proposed by kettenis@

date 2021-05-28T15:52:11Z
author visa
files src/sys/arch/armv7/conf/GENERIC log diff annotate
src/sys/arch/armv7/conf/RAMDISK log diff annotate
src/sys/dev/fdt/files.fdt log diff annotate
src/sys/dev/fdt/if_cad.c log diff annotate
message Add cad(4), a driver for Cadence GEM.

This initial revision targets the Zynq-7000, where the GEM implements
single transmit and receive queues with 32-bit DMA addresses. The driver
uses receive checksum offload, but transmit checksum offload is disabled
because of a hardware quirk. Also, the hardware's receive path is prone
to getting stuck if input cannot be handled quickly enough. The driver
attempts to recover by restarting the receiver when no input has been
seen for a while.

OK kettenis@

date 2021-05-28T16:24:53Z
author visa
files src/sys/kern/uipc_socket.c log diff annotate
src/sys/kern/uipc_syscalls.c log diff annotate
message Add f_modify and f_process callbacks to socket filterops.

This makes kqueue use the extended callback interface with socket event
filters. Now one level of nested kernel locking is avoided, and the
callbacks run without splhigh().

The filterops no longer check NOTE_SUBMIT, and use a fixed locking
pattern instead. The f_event routines are always called with solock(),
whereas f_modify and f_process are always called without the lock.

OK mpi@

date 2021-05-28T16:33:36Z
author visa
files src/sys/arch/mips64/include/cpu.h log diff annotate
src/sys/arch/mips64/mips64/cpu.c log diff annotate
message Remove CPU and node id fields that were used with SGI Origin.