CVS: cvs.openbsd.org: src

2024-05-17 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2024/05/17 10:37:11

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : if_vio.c virtiovar.h 

Log message:
vio: Fix signal handling and locking in sysctl path

Commits f0b002d01d5 "Release the netlock when sleeping for control
messages in in vioioctl()" and 126b881f71 "Insert a workaround for
per-ifp ioctl being called w/o NET_LOCK()." in vio(4) fixed a deadlock
but may cause a crash with a protection fault trap if addresses are
added/removed concurrently.

The actual issue is that signals are not handled correctly while
sleeping. After a signal, there is a race condition where sc_ctrl_inuse
is first set to FREE and then the interrupt handler sets it to DONE,
causing a hang in the next vio_wait_ctrl() call.

To fix it:

* Revert the NET_LOCK unlocking work-around.

* Remove PCATCH from the sleep call when we wait for control queue,
avoiding the race with vio_ctrleof(). To ensure that we don't hang
forever, use a 5 second timeout.

* If the timeout is hit, or if the hypervisor has set the
DEVICE_NEEDS_RESET status bit, do not try to use the control queue
until the next ifconfig down/up which resets the device.

* In order to allow reading the device status from device drivers, add a
new interface to the virtio transport drivers.

* Avoid a crash if there is outgoing traffic while doing ifconfig down.

OK bluhm@



CVS: cvs.openbsd.org: src

2023-12-02 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2023/12/02 03:01:35

Modified files:
sys/dev/pv : virtiovar.h virtio.c 

Log message:
virtio: Fix handling of feature bits >= 32

Fix handling of feature bits >= 32.  This does not yet affect any driver
as no high feature bit besides VERSION_1 is used, and that one has
special handling.

Also, with VIRTIO_DEBUG, simply walk through all transport and device
feature names, so that we don't need to adjust the if clause whenever
the standard introduces new transport features.

ok jan@ bluhm@



CVS: cvs.openbsd.org: src

2023-06-16 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2023/06/16 02:42:09

Modified files:
sys/msdosfs: msdosfs_fat.c 

Log message:
msdosfs: fixes for Undefined Behavior

>From FreeBSD commits

commit c0db7289c3de290d821311942d5533f2284af77f
Author: pfg 
Date:   Wed Aug 8 15:08:22 2018 +

commit 852150953b828e4e8c32789637061001158a8cf4
Author: kib 
Date:   Fri Oct 11 18:37:02 2019 +

ok bluhm@



CVS: cvs.openbsd.org: src

2023-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2023/05/29 02:13:35

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : if_vio.c vioblk.c viocon.c viogpu.c viomb.c 
 viornd.c vioscsi.c vmmci.c 

Log message:
virtio: Set DRIVER_OK earlier

The DRIVER_OK bit must be set before using any virt-queues. To allow
virtio device drivers to use the virt-queues in their attach functions,
set the bit there and not in the virtio transport attach function. Only
vioscsi and viogpu really need this, but let's only have one standard
way to do this.

Noticed because of hangs with vioscsi on qemu/windows and in the Oracle
cloud.  With much debugging help by Aaron Mason.

Also revert vioscsi.c 1.31 "Temporarily workaround double calls into
vioscsi_req_done()"

ok krw@



CVS: cvs.openbsd.org: src

2023-04-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2023/04/30 11:16:36

Modified files:
sys/msdosfs: msdosfs_fat.c 

Log message:
msdosfs: Never allocate clusters outside the volume

- Assert that usemap_alloc() and usemap_free() cluster number argument
is valid.
- In chainlength(), return 0 if cluster start is after the max cluster.
- In chainlength(), cut the calculated cluster chain length at the max
cluster.

Adapted from FreeBSD commit 097a1d5fbb7990980f8f806c6878537c964adf32

ok miod@



CVS: cvs.openbsd.org: src

2019-09-05 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/09/05 02:41:20

Modified files:
sys/dev/pci: if_em_hw.c 

Log message:
em: Fix potential endless loop

If the NIC is in some error state (seen on a i219LM when em_read_phy_reg_ex()
returns at "MDI Error"), it can happen that we loop endlessly because the loop
variable is modified again somewhere down in the call stack. Use a separate
variable to make the attach fail with "Hardware Initialization Failed" instead
of hanging.

yes deraadt@



CVS: cvs.openbsd.org: src

2019-09-03 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/09/03 03:00:44

Modified files:
sys/dev/pci: if_bnxt.c 

Log message:
bnxt: Support MSI-X

Tested on a BCM57412

ok jmatthew@



CVS: cvs.openbsd.org: src

2019-05-28 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/28 02:44:27

Modified files:
sys/arch/i386/conf: GENERIC 

Log message:
Enable virtio again since the compilation problems have been fixed.

ok deraadt@



CVS: cvs.openbsd.org: src

2019-05-27 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/27 09:55:01

Modified files:
sys/dev/pci: virtio_pci.c 

Log message:
fix virtio_pci on 32bit archs

bus_space_read/write_8 do not exist there, use two 32bit operations.



CVS: cvs.openbsd.org: src

2019-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/26 09:22:31

Modified files:
share/man/man4 : virtio.4 
sys/dev/pci: virtio_pci.c virtio_pcireg.h 
sys/dev/pv : virtiovar.h if_vio.c 

Log message:
Support virtio 1.0 for virtio_pci

virtio 1.0 for virtio_mmio it not yet implemented, but 0.9 devices
continue to work.



CVS: cvs.openbsd.org: src

2019-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/26 09:20:04

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : if_vio.c vioblk.c viocon.c viomb.c viornd.c 
 vioscsi.c virtio.c virtiovar.h vmmci.c 

Log message:
Rework virtio_negotiate_features()

Add a sc_driver_features field that is automatically used by
virtio_negotiate_features() and during reinit.

Make virtio_negotiate_features() return an error code.  Virtio 1.0 has a
special status bit for feature negotiation that means that negotiation
can fail. Make virtio_negotiate_features() return an error code instead
of the features.

Make virtio_reinit_start() automatically call
virtio_negotiate_features().

Add a convenience function virtio_has_feature() to make checking bits
easier.

Add an error check in viomb for virtio_negotiate_features because it has
some feature bits that may cause negotiation to fail. More error
checking in the child drivers is still missing.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/26 09:14:50

Modified files:
sys/dev/pci: virtio_pci.c 

Log message:
virtio_pci: Move msix vector config into functions

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/05/26 09:14:16

Modified files:
sys/dev/pci: virtio_pci.c 

Log message:
virtio_pci: Split bus space handles

In virtio_pci 1.0, different parts of the register set may be located in
different BARs. Use subregions to make the access independent of the
virtio version.



CVS: cvs.openbsd.org: src

2019-04-17 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/04/17 15:44:32

Modified files:
sys/dev/pv : virtio.c 

Log message:
Remove unused parameter from virtio_init_vq()



CVS: cvs.openbsd.org: src

2019-04-17 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/04/17 15:43:46

Modified files:
sys/dev/pv : virtio.c 

Log message:
Initialize virtqueue before passing it to device

Reported by Gary Zibrat



CVS: cvs.openbsd.org: src

2019-03-24 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/03/24 12:22:36

Modified files:
sys/dev/pv : if_vio.c vioblk.c vioblkreg.h virtio.c 

Log message:
virtio: Add a few feature bit defines and names

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-03-24 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/03/24 12:21:12

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : if_vio.c vioblk.c vioblkreg.h viocon.c viomb.c 
 vioscsireg.h virtio.c virtioreg.h virtiovar.h 
 vmmci.c 

Log message:
virtio: Prepare for 64 feature bits

virtio 1.0 supports an arbitrary number of feature bits. However, so far
no more than 64 are used (compared to 32 in virtio 0.9). Adjust data
types to support 64 feature bits.

Later, we may want to use bitmaps and setbit(), ... to support even more
feature bits.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-03-24 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/03/24 12:17:24

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : virtio.c virtiovar.h 

Log message:
virtio: adjust virtio_setup_queue prototype for 1.0

Make it take an address instead of a PFN.
Pass the virtqueue pointer. In virtio 1.0, more information has to be
configured in the device. Also call virtio_setup_queue() after the
information has been filled in.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-01-19 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/19 09:23:46

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : if_vio.c virtiovar.h 

Log message:
virtio: Introduce defines for config(8) flags



CVS: cvs.openbsd.org: src

2019-01-19 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/19 09:21:00

Modified files:
sys/dev/pv : viomb.c 

Log message:
viomb: tweak feature negotiation

VIRTIO_F_RING_INDIRECT_DESC is always negotiated by the transport
driver, no need to specify it explicitly.

VIRTIO_BALLOON_F_MUST_TELL_HOST is not offered but is handled in the
code. Offer it during negotiation, too.



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:59:56

Modified files:
usr.sbin/vmd   : vioscsi.c virtio.c 

Log message:
unbreak vmd build

include new virtio_pcireg.h header



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:36:53

Modified files:
sys/dev/pci: pcidevs_data.h pcidevs.h 

Log message:
regen pcidevs*.h



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:35:56

Modified files:
sys/dev/pci: pcidevs 

Log message:
Add virtio 1.x PCI IDs

Everything above 0x1040 is 1.x only.

Also tweak descriptoin of memory balloon device. There will be a memory
device, too

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:22:17

Modified files:
sys/dev/pv : virtioreg.h 

Log message:
Fix previous

It accidentally contained a part of a different diff.



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:11:42

Modified files:
sys/dev/pci: virtio_pci.c 
sys/dev/pv : virtioreg.h 
Added files:
sys/dev/pci: virtio_pcireg.h 

Log message:
Move some PCI-specific defines to a new virtio_pcireg.h file

Also add some virtio 1.0 status and feature bits



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:06:56

Modified files:
sys/dev/pv : virtio.c virtiovar.h 

Log message:
Remove some more code if VIRTIO_DEBUG is 0



CVS: cvs.openbsd.org: src

2019-01-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/10 11:05:43

Modified files:
sys/dev/fdt: virtio_mmio.c 
sys/dev/pci: virtio_pci.c 
sys/dev/pv : virtio.c virtiovar.h 

Log message:
Move some common defines to virtiovar.h

And fix some comments



CVS: cvs.openbsd.org: src

2019-01-08 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/08 09:24:09

Modified files:
sys/dev/pv : viocon.c 

Log message:
viocon: Remove obsolete handling of sc_intrhand



CVS: cvs.openbsd.org: src

2019-01-08 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2019/01/08 09:23:01

Modified files:
sys/dev/pv : if_vio.c vioblk.c viocon.c viomb.c 

Log message:
virtio: Don't include feature strings without VIRTIO_DEBUG

They are only used if VIRTIO_DEBUG is enabled.
This should make the kernel slightly smaller.



CVS: cvs.openbsd.org: src

2018-07-22 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/22 03:09:18

Modified files:
sys/net: pfvar.h pf_ioctl.c pf.c 

Log message:
Fix arguments of pf_purge_expired_{src_nodes,rules}()

Due to the missing "void", this

extern void pf_purge_expired_src_nodes();

is no prototype but a declaration. It is enough to suppress the
'implicit declaration' warning but it does not allow the compiler to
check the arguments passed to the calls of the function.

Fix the prototypes and don't pass the waslocked argument anymore. It has
been removed a year ago.

ok sashan henning



CVS: cvs.openbsd.org: src

2018-07-13 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/13 02:30:34

Modified files:
sys/arch/amd64/amd64: codepatch.c mainbus.c 
sys/arch/amd64/conf: ld.script 
sys/arch/amd64/include: codepatch.h 

Log message:
Disable codepatching infrastructure after boot

This way, it is not available for use in ROP attacks.  This diff puts the
codepatching code into a separate section and unmaps that section after boot.
In the future, the memory could potentially be reused but that would require
larger changes.

ok pguenther@



CVS: cvs.openbsd.org: src

2018-07-11 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/11 08:20:18

Modified files:
sys/net: if_vlan.c 

Log message:
Fix comment about VLAN encapsulation and checksum offload

Document that some chips actually could do hardware checksum offload for
encapsulated packets, though that would need special handling in those
drivers.

discussions and ok naddy@



CVS: cvs.openbsd.org: src

2018-07-10 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/10 03:36:58

Modified files:
usr.bin/ssh: kex.h monitor_wrap.c 

Log message:
re-remove some pre-auth compression bits

This time, make sure to not remove things that are necessary for
pre-auth compression on the client. Add a comment that pre-auth
compression is still supported in the client.

ok markus@



CVS: cvs.openbsd.org: src

2018-07-09 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/09 07:37:10

Modified files:
usr.bin/ssh: kex.c kex.h monitor_wrap.c packet.c servconf.c 
 sshconnect2.c 

Log message:
Revert previous two commits

It turns out we still support pre-auth compression on the client.
Therefore revert the previous two commits:

date: 2018/07/06 09:06:14;  author: sf;  commitid: yZVYKIRtUZWD9CmE;
Rename COMP_DELAYED to COMP_ZLIB

Only delayed compression is supported nowadays.

ok markus@

date: 2018/07/06 09:05:01;  author: sf;  commitid: rEGuT5UgI9f6kddP;
Remove leftovers from pre-authentication compression

Support for this has been removed in 2016.
COMP_DELAYED will be renamed in a later commit.

ok markus@



CVS: cvs.openbsd.org: src

2018-07-06 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/06 03:06:14

Modified files:
usr.bin/ssh: kex.c kex.h packet.c servconf.c 

Log message:
Rename COMP_DELAYED to COMP_ZLIB

Only delayed compression is supported nowadays.

ok markus@



CVS: cvs.openbsd.org: src

2018-07-06 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/06 03:05:01

Modified files:
usr.bin/ssh: kex.c kex.h monitor_wrap.c packet.c 
 sshconnect2.c 

Log message:
Remove leftovers from pre-authentication compression

Support for this has been removed in 2016.
COMP_DELAYED will be renamed in a later commit.

ok markus@



CVS: cvs.openbsd.org: src

2018-07-06 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/06 03:03:02

Modified files:
usr.bin/ssh: packet.c packet.h opacket.h 

Log message:
Remove unused ssh_packet_start_compression()

ok markus@



CVS: cvs.openbsd.org: src

2018-07-03 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/07/03 10:42:51

Modified files:
usr.sbin/hostctl: hostctl.c 

Log message:
hostctl: Don't crash if key is empty string

ok reyk@



CVS: cvs.openbsd.org: src

2018-04-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/29 02:47:11

Modified files:
sys/dev/pci: if_em_hw.c 

Log message:
em: Add magic delay for HP elitebook 820 G3

Add another magic 1ms delay that seems to help with some remaining "Hardware
Initialization Failed" issues on an HP elitebook 820 G3 with i219LM. A printf()
at the same place helps, too.

ok mikeb@



CVS: cvs.openbsd.org: src

2018-04-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/29 02:45:01

Modified files:
sys/dev/pci: if_em_hw.c if_em_hw.h 

Log message:
em: Make em_get_software_flag() recursive

The em driver calls em_get_software_flag() recursively, which causes the
semaphore to be unlocked too early. Make em_get_software_flag and
em_release_software_flag handle this correctly.  Freebsd does not do
this, but they have a mutex that probably allows them to detect
recursive calls to e1000_acquire_swflag_ich8lan().  Reworking the
openbsd driver to not recursively get the semaphore would be very
invasive.

ok mikeb@



CVS: cvs.openbsd.org: src

2018-04-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/29 02:42:16

Modified files:
sys/dev/pci: if_em_hw.c if_em_hw.h 

Log message:
em: Improve access logic for software flag

Some em chips have a semaphore ("software flag") to synchronize access
to certain registers between OS and firmware (ME/AMT).

Make the logic to get the flag match the logic in freebsd. This includes
higher timeouts and waiting for a previous unlock to complete before
trying a lock again.

ok mikeb@



CVS: cvs.openbsd.org: src

2018-04-07 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/07 05:56:40

Modified files:
sys/dev/pci: if_em.c if_em_hw.h 

Log message:
em: Port an i219 errata workaround from FreeBSD

https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/i218-i219-ethernet-connection-spec-update.pdf?asset=9561

ok mikeb@ jsg@



CVS: cvs.openbsd.org: src

2018-04-07 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/07 05:55:14

Modified files:
sys/dev/pci: if_em_hw.c 

Log message:
em: Add em_check_phy_reset_block() quirk

Port the logic from freebsd to em_check_phy_reset_block(). A single
read does not seem to be reliable.

ok mikeb@ jsg@



CVS: cvs.openbsd.org: src

2018-04-07 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/07 05:53:53

Modified files:
sys/dev/pci: if_em_hw.c 

Log message:
em: Increase delay after reset to 20ms

This is the value in freebsd for ich8lan.

ok mikeb@ jsg@



CVS: cvs.openbsd.org: src

2018-04-07 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2018/04/07 05:52:24

Modified files:
sys/dev/pci: if_em.c 

Log message:
em: Print error code and phy/mac type

Print the error code if hardware initialization failed.

If EM_DEBUG is defined, print the phy/mac type during attach.

ok mikeb@ jsg@



CVS: cvs.openbsd.org: src

2017-09-08 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/09/08 02:37:52

Modified files:
sys/dev/isa: fdc.c 

Log message:
fdc: Print warning if kthread_create fails

Other drivers do this, too. Fixes coverity CID 1455436.



CVS: cvs.openbsd.org: src

2017-09-03 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/09/03 14:03:58

Modified files:
sys/dev/isa: fdc.c fd.c 

Log message:
fdc: defer probing of floppy drives

Defer probing of the drives to a kthread. This avoids several seconds of
delay() during boot. However, drives may now appear only after init has
started. But this does not affect installs from floppy. In that case the root
ramdisk is linked into the kernel and loaded by the boot loader.

Approach suggested by deraadt@, tested by miod@



CVS: cvs.openbsd.org: src

2017-08-21 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/21 18:30:16

Modified files:
sbin/reboot: reboot.c 

Log message:
reboot: don't wait for processes to die if there are none

If processes are already dead, reduce wait times between SIGTERM and
SIGKILL and wait time after SIGKILL.  The reboot syscall will cause
another sync later on, therefore the long wait times are not necessary
for disk i/o, either.

"makes sense" deraadt@



CVS: cvs.openbsd.org: src

2017-08-21 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/21 18:18:56

Modified files:
share/man/man9 : buffercache.9 
sys/kern   : vfs_bio.c 

Log message:
Add some buffercache docs

* add clarifications and bread_cluster() buffercache(9)
* add some comments to vfs_bio.c

ok tedu@



CVS: cvs.openbsd.org: src

2017-08-15 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/15 11:16:39

Modified files:
regress/sys/fileops: Makefile.inc 
Added files:
regress/sys/fileops: fileops2.pl 

Log message:
Add test cases for msdosfs bug

Add a test that writes a big file, reads it again, and compares the result.
This detects the bug that briefly was in msdosfs.

Also add tests that create lots of files in a directory. Do this in the root
dir and a subdir because these work completely differently on msdosfs.  Need to
enlarge the used disk images for this test.

ok bluhm@



CVS: cvs.openbsd.org: src

2017-08-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/14 16:45:12

Modified files:
sys/msdosfs: fat.h 

Log message:
msdofs: Add new CLUST_END constant

(forgot to commit fat.h)

Add new CLUST_END and use it as parameter to pcbmap() when searching
for end cluster, instead of explicitly passing 0x. This fixes potential
problem for FAT32, where cluster number may be legally bigger than 0x.

Also change clusteralloc() so that fillwith is not explicitly passed by caller
anymore (there is no need to use anything other than CLUST_EOFE).

>From NetBSD commit by jdole...@netbsd.org

ok tb@ mpi@



CVS: cvs.openbsd.org: src

2017-08-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/14 16:43:56

Modified files:
sys/msdosfs: msdosfs_denode.c msdosfs_fat.c msdosfs_vnops.c 

Log message:
msdofs: Add new CLUST_END constant

Add new CLUST_END and use it as parameter to pcbmap() when searching
for end cluster, instead of explicitly passing 0x. This fixes potential
problem for FAT32, where cluster number may be legally bigger than 0x.

Also change clusteralloc() so that fillwith is not explicitly passed by caller
anymore (there is no need to use anything other than CLUST_EOFE).

>From NetBSD commit by jdole...@netbsd.org

ok tb@ mpi@



CVS: cvs.openbsd.org: src

2017-08-13 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/13 17:36:27

Modified files:
sys/msdosfs: msdosfs_fat.c 

Log message:
minor msdosfs tweaks

* add to comments for pcbmap()
* remove useless ";"

ok tb@



CVS: cvs.openbsd.org: src

2017-08-12 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/08/12 10:40:55

Modified files:
sys/dev/pci: if_em_hw.c if_em_hw.h 

Log message:
em: Disable ultra-low-power mode on boot

With i219V, it sometimes happens that em fails to attach with this error:

em0: Hardware Initialization Failed
em0: Unable to initialize the hardware

This happens always if booting native Windows 10 first and then rebooting into
openbsd without switching the laptop off. But it has also been seen in other
cases.

This change ports the e1000_disable_ulp_lpt_lp() logic from the FreeBSD driver
to disable ultra-low-power (ULP) mode.  This seems to fix the problem in many
(but not all) cases.

The code has been merged in a way to make the diff from FreeBSD minimal.  For
example, the SWFW register is called H2ME on newer chips, so a new define is
introduced. Also, the em_toggle_lanphypc_pch_lpt() function is left as separate
function even if only used in one place at the moment.

ok tom@
"commit it" deraadt@



CVS: cvs.openbsd.org: src

2017-07-18 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/07/18 13:20:26

Modified files:
sys/sys: selinfo.h 

Log message:
Re-order members of struct selinfo

This reduces its size from 24 to 16 on 64bit archs.

ok deraadt@



CVS: cvs.openbsd.org: src

2017-07-01 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/07/01 13:42:59

Modified files:
sys/arch/i386/i386: codepatch.c 
sys/arch/i386/include: codepatch.h 

Log message:
Use absolute pointers in codepatch entries

Instead of offsets to KERNBASE, store absolute pointers in the
codepatch entries. KERNBASE will go away when ASLR is introduced.

Requested by deraadt@



CVS: cvs.openbsd.org: src

2017-07-01 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/07/01 13:38:41

Modified files:
sys/arch/amd64/amd64: codepatch.c 
sys/arch/amd64/include: codepatch.h 

Log message:
Use absolute pointers in codepatch entries

Instead of offsets to KERNBASE, store absolute pointers in the
codepatch entries. This makes the resulting kernel a few KB larger on
amd64, but KERNBASE will go away when ASLR is introduced.

Requested by deraadt@



CVS: cvs.openbsd.org: src

2017-06-13 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/06/13 12:13:18

Modified files:
sys/msdosfs: denode.h msdosfs_vnops.c 

Log message:
Revert 'Implement VFS read clustering for MSDOSFS' again

This has again caused regressions, this time when reading from msdosfs.

This reverts

denode.h 1.31
msdosfs_vnops.c 1.114

Requested by deraadt@



CVS: cvs.openbsd.org: src

2017-06-04 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/06/04 00:21:37

Modified files:
sys/arch/amd64/include: bus.h 

Log message:
Re-arrange struct bus_dmamap members

This reduces holes/padding and makes the struct smaller by 8 bytes.

ok kettenis@



CVS: cvs.openbsd.org: src

2017-06-03 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/06/03 02:50:38

Modified files:
sys/dev/pv : vioblk.c virtiovar.h 

Log message:
vioblk/virtio: Re-arrange some struct members

This reduces holes/padding and makes the structs smaller.



CVS: cvs.openbsd.org: src

2017-05-31 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/31 02:57:48

Modified files:
sys/dev/pci: virtio_pci.c 

Log message:
virtio_pci: Support IPL_MPSAFE interrupt handlers



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 13:28:09

Modified files:
sys/dev/pv : vioblk.c vioscsi.c virtio.c 

Log message:
More minor virtio tweaks

* add some comments about virtio_enqueue_trim
* include mutex.h explicitly
* make VIRTIO_DEBUG == 1 less verbose in vioblk

ok krw@



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 05:02:39

Modified files:
sys/dev/pv : virtio.c 

Log message:
virtio: Put entries in freelist in reverse order

This avoids breaking krw@'s ongoing work on improving virtio_enqueue_trim().



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 04:32:53

Modified files:
sys/ufs/ext2fs : ext2fs_vfsops.c 

Log message:
ext2fs: Mark superblock as not modified when written

I have seen spurious "file system not clean; please fsck(8)" warnings
during "mount -ur". Set e2fs_fmod = 0 when writing the superblock (as
ffs does).

"Makes sense" deraadt@



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 02:44:58

Modified files:
regress/sys/fileops: Makefile 
Added files:
regress/sys/fileops/ext2: Makefile 

Log message:
fileops test: Also run on ext2fs

Also sort subdirs in makefile



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 02:43:52

src/regress/sys/fileops/ext2

Update of /cvs/src/regress/sys/fileops/ext2
In directory cvs.openbsd.org:/tmp/cvs-serv78569/ext2

Log Message:
Directory /cvs/src/regress/sys/fileops/ext2 added to the repository



CVS: cvs.openbsd.org: src

2017-05-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/30 02:35:32

Modified files:
sys/dev/pv : virtio.c virtiovar.h 

Log message:
virtio: Do LIFO in the freelist

Use a SLIST instead of a SIMPLEQ and use LIFO instead of FIFO. This should
improve cache usage.



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 08:08:49

Modified files:
sys/scsi   : sd.c 

Log message:
sd: flush cache when closing writable FD

Don't skip the cache flush until the last opening of the device is
closed. Otherwise, when umounting a writable partition while a different
partition is still mounted read-only, the necessary disk flush may be
delayed for a very long time.

ok krw@ deraadt@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 08:07:16

Modified files:
sys/msdosfs: msdosfs_vfsops.c 
sys/ufs/ffs: ffs_vfsops.c 

Log message:
msdosfs & ffs: flush cache if updating mount from r/w to r/o

ok deraadt@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 08:05:31

Modified files:
sys/dev/ata: wd.c 
sys/scsi   : sd.c 
sys/sys: dkio.h 

Log message:
Add an ioctl to tell storage devices to flush their internal caches

Currently implemented for wd and sd.
Initially ported from netbsd by pedro@

ok deraadt@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 07:48:12

Modified files:
sys/msdosfs: denode.h msdosfs_vnops.c 

Log message:
Implement VFS read clustering for MSDOSFS

This is the reverted commit by mpi@ from msdosfs_vnops.c 1.105 plus some
additional tweaks to fix some cluster/block number confusion that lead
to regressions when seeking past the end of a file.

The original commit message was:

The logic used in msdosfs_bmap() to loop calling pcbmap() comes from
FreeBSD and is not really efficient but it is good enough since it is
only called when generating I/O.

With this diff I get a 100% improvement when reading big files from a
crappy USB stick.

With this and bread_cluster(9) modified to not re-fetch B_CACHED buffers,
reading large contiguous files with chunk sizes of MAXPHYS is almost as
fast as physio(9) on the same device.

For a 'real world' example, when copying music files from a USB stick I
see a speed jump from 15MB/s on -current to 24Mb/s with this diff.

While here rename some 'lbn' variables into 'cn' to better reflect what
we're dealing with.

Tested by Mathieu, with support from deraadt@

ok mpi@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 05:59:32

Modified files:
regress/sys: Makefile 

Log message:
Re-add line continuation \ that went missing in the previous commit



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 05:01:16

Added files:
regress/sys/fileops: Makefile Makefile.inc fileops.c 
regress/sys/fileops/ffs: Makefile 
regress/sys/fileops/msdos16: Makefile 
regress/sys/fileops/msdos32: Makefile 

Log message:
Regress test for sparse files & mmap with different FSs

This test creates a file with a hole in the middle and then checks that
when reading or mmaping the whole file, the data is correct.

This catches the bug introduced by the
"Implement VFS read clustering for MSDOSFS" commit that hat to be
reverted.

For now, we run the test with FAT16, FAT32, FFS

With much advice from bluhm@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 05:00:04

Modified files:
regress/sys: Makefile 

Log message:
Regress test for sparse files & mmap with different FSs

This test creates a file with a hole in the middle and then checks that
when reading or mmaping the whole file, the data is correct.

This catches the bug introduced by the
"Implement VFS read clustering for MSDOSFS" commit that hat to be
reverted.

For now, we run the test with FAT16, FAT32, FFS

With much advice from bluhm@



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 04:57:09

src/regress/sys/fileops/msdos16

Update of /cvs/src/regress/sys/fileops/msdos16
In directory cvs.openbsd.org:/tmp/cvs-serv44546/regress/sys/fileops/msdos16

Log Message:
Directory /cvs/src/regress/sys/fileops/msdos16 added to the repository



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 04:57:09

src/regress/sys/fileops/msdos32

Update of /cvs/src/regress/sys/fileops/msdos32
In directory cvs.openbsd.org:/tmp/cvs-serv44546/regress/sys/fileops/msdos32

Log Message:
Directory /cvs/src/regress/sys/fileops/msdos32 added to the repository



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 04:57:08

src/regress/sys/fileops/ffs

Update of /cvs/src/regress/sys/fileops/ffs
In directory cvs.openbsd.org:/tmp/cvs-serv44546/regress/sys/fileops/ffs

Log Message:
Directory /cvs/src/regress/sys/fileops/ffs added to the repository



CVS: cvs.openbsd.org: src

2017-05-29 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/29 04:56:46

src/regress/sys/fileops

Update of /cvs/src/regress/sys/fileops
In directory cvs.openbsd.org:/tmp/cvs-serv49186/regress/sys/fileops

Log Message:
Directory /cvs/src/regress/sys/fileops added to the repository



CVS: cvs.openbsd.org: src

2017-05-27 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/27 13:27:45

Modified files:
sys/dev/ic : nvme.c 

Log message:
nvme: Don't set prp1 for DEL_IOCQ

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@



CVS: cvs.openbsd.org: src

2017-05-27 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/27 06:40:51

Modified files:
sys/dev/ic : nvme.c nvmevar.h 

Log message:
nvme: Add suspend/resume code

Based on an initial patch by ehrhardt@ . Thanks to claudio@ for testing
and deraadt@ for advice.

"go ahead" deraadt@



CVS: cvs.openbsd.org: src

2017-05-27 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/27 04:24:31

Modified files:
sys/dev/pv : virtiovar.h virtio.c 

Log message:
virtio: remove unused vq_maxsegsize



CVS: cvs.openbsd.org: src

2017-05-27 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/27 04:22:06

Modified files:
sys/dev/pv : virtio.c 

Log message:
virtio: Remove MINSEG_INDIRECT

Remove MINSEG_INDIRECT as a tweakable define. Always use indirect
descriptors if we have more than 1 segment. Add a comment to document
the way if_vio.c uses maxnsegs in virtio_alloc_vq() to disable
indirect descriptors for a queue.

Based on a diff from krw@



CVS: cvs.openbsd.org: src

2017-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/26 09:30:21

Modified files:
sys/dev/pv : virtio.c 

Log message:
virtio: minor tweak

use qe_desc_base instead of calculating the address again



CVS: cvs.openbsd.org: src

2017-05-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/26 09:26:28

Modified files:
sys/dev/pv : vioblk.c 

Log message:
vioblk: set VIOBLK_DONE from vioblk_vq_done1

If the device needs to be reset due to a poll timeout, we need accurate
information which requests are already completed. Otherwise, there will
be a panic "scsi_done called twice on xs", as found out by mpi@



CVS: cvs.openbsd.org: src

2017-05-19 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/19 02:31:43

Modified files:
sys/scsi   : scsiconf.h 

Log message:
Add some comments about the assumptions of the scsi mid layer

ok krw@



CVS: cvs.openbsd.org: src

2017-05-15 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/05/15 13:02:16

Modified files:
sys/dev/pv : vioscsi.c 

Log message:
vioscsi: Fix allocation of segments

Port the logic to calculate the number of segments in virtqueue and
dmamaps from vioblk.

This fixes the virtqueue indirect descriptors being two entries too
small the dmamaps being much larger than necessary.

If the device does not support the required number of segments, refuse
to use it.



CVS: cvs.openbsd.org: src

2017-03-16 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/03/16 15:08:50

Modified files:
sys/dev/pv : vioscsi.c 

Log message:
vioscsi: Negotiate features during attach

While vioscsi does not support any virtio-scsi features, we need to call
virtio_negotiate_features() in order to negotiate device-independent
features like VIRTIO_F_RING_INDIRECT_DESC.



CVS: cvs.openbsd.org: src

2017-03-16 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/03/16 15:08:03

Modified files:
sys/dev/pv : vioscsi.c 

Log message:
vioscsi: return XS_NO_CCB if out of space

If there is not enough space in the vring, don't return
XS_DRIVER_STUFFUP but XS_NO_CCB, so that the operation will
be retried later.



CVS: cvs.openbsd.org: src

2017-03-16 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2017/03/16 15:07:07

Modified files:
sys/dev/pv : vioscsi.c 

Log message:
vioscsi: Don't call virtio_dequeue_commit on not-queued slots

Also, add some debug asserts all over the place.



CVS: cvs.openbsd.org: src

2016-11-26 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/11/26 09:05:11

Modified files:
usr.sbin/vmd   : virtio.c 

Log message:
virtio-net: Partially implement device reset

Implement some bits of the device reset and don't do DMA if the DRIVER_OK bit
is not set. This is enough to avoid vio(4) panicking on if down/up.

Tested by rzalamena@ and mikeb@
OK reyk@



CVS: cvs.openbsd.org: src

2016-08-30 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/08/30 13:47:23

Modified files:
sys/msdosfs: denode.h msdosfs_vnops.c 

Log message:
Revert "Implement VFS read clustering for MSDOSFS"

This caused garbage to be written instead of blocks of 0-bytes if a
file is extended by seeking past the end. This happens for example
when extracting files containing lots of 0-bytes with tar.

ok mpi@

Details of original commit:

msdosfs_vnops.c revision 1.105
denode.h revision 1.28
date: 2016/01/13 10:00:55;  author: mpi;  commitid: ru9jHQwQX09BC5Bw;

Implement VFS read clustering for MSDOSFS.

The logic used in msdosfs_bmap() to loop calling pcbmap() comes from
FreeBSD and is not really efficient but it is good enough since it is
only called when generating I/O.

With this diff I get a 100% improvement when reading big files from a
crappy USB stick.

With this and bread_cluster(9) modified to not re-fetch B_CACHED buffers,
reading large contiguous files with chunk sizes of MAXPHYS is almost as
fast as physio(9) on the same device.

For a 'real world' example, when copying music files from a USB stick I
see a speed jump from 15MB/s on -current to 24Mb/s with this diff.

While here rename some 'lbn' variables into 'cn' to better reflect what
we're dealing with.

Tested by Mathieu, with support from deraadt@



CVS: cvs.openbsd.org: src

2016-07-18 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/07/18 20:51:09

Modified files:
sys/dev/pci: virtio_pci.c 

Log message:
virtio_pci: Always allow MSI/MSI-X

For virtio devices, ignore the black/white-listing depending on the PCI
bridge.  This enables MSI-X with qemu's old "82441FX" pci-bridge.

Suggested by kettenis@



CVS: cvs.openbsd.org: src

2016-07-16 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/07/16 06:07:21

Modified files:
sys/dev/pci: virtioreg.h virtio_pci.c 

Log message:
Support MSI-X in virtio

This increases performance for interrupt heavy loads.

While suspend/resume support for MSI-X is missing, this is also missing for
virtio. So no new issue there.

Currently, qemu's old "82441FX" pci-bridge is still blacklisted for MSI. But
MSI-X is used if qemu is started with "-M q35".



CVS: cvs.openbsd.org: src

2016-07-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/07/14 06:50:07

Modified files:
sys/dev/pci: vioblk.c 

Log message:
vioblk: Properly handle poll timeout

The only way to ensure that the device does not do DMA for the timed out
request is a device reset.

Also increase the timeout to 15s



CVS: cvs.openbsd.org: src

2016-07-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/07/14 06:44:53

Modified files:
sys/dev/pci: vioblk.c vioscsi.c virtiovar.h 

Log message:
rename virtio_ops.intr to poll_intr

This describes more accurately what it is good for.

Also introduce a virtio_poll_intr macro.



CVS: cvs.openbsd.org: src

2016-07-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/07/14 06:42:00

Modified files:
sys/dev/pci: if_vio.c vioblk.c viomb.c viornd.c vioscsi.c 
 virtio.c virtio_pci.c virtiovar.h 
sys/arch/armv7/vexpress: virtio_mmio.c 

Log message:
virtio: Move interrupt handler into transport specific code

For MSI-X (and also possibly for other transports), the interrupt
handler must do different things.  Move it out of virtio.c and into
virtio_pci.

ARM part tested by patrick@



CVS: cvs.openbsd.org: src

2016-01-22 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/01/22 10:09:05

Modified files:
sys/net: if_ethersubr.c 

Log message:
Always check destination MAC address of received unicast packets, not
only when in promiscuous mode

This necessary for NICs like virtio, where the unicast MAC filter is
'best effort' only.

ok dlg@
encouragement from mpi@



CVS: cvs.openbsd.org: src

2016-01-14 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2016/01/14 02:44:08

Modified files:
sys/kern   : tty.c tty_pty.c 
sys/net: ppp_tty.c 

Log message:
Increase buffer sizes and watermarks for tty and ppp

Use 115200 the default speed for buffer sizing in ttymalloc(). A lot
of devices call ttymalloc(0) so this affects quite a few of them.

Increases the buffer size for 9600 < baud <= 115200 from 1k to 4k.

Make ppp use the lo/hi watermarks from the tty layer which are
adjusted according to speed + buffer size. The previous fixed values
of 100 and 400 were way too small

Make pty call ttymalloc() with baud == 100, which is the common
value used in the tree for "fast".

ok deraadt@



CVS: cvs.openbsd.org: src

2015-12-22 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2015/12/22 13:31:51

Modified files:
sys/kern   : tty_conf.c 

Log message:
Re-add config includes

These got lost in previous commit. This broke ppp, nmea, msts, endrun.

Found the hard way by David Coppa



CVS: cvs.openbsd.org: src

2015-12-21 Thread Stefan Fritsch
CVSROOT:/cvs
Module name:src
Changes by: s...@cvs.openbsd.org2015/12/21 15:23:24

Modified files:
share/man/man8/man8.amd64: MAKEDEV.8 
etc/etc.amd64  : MAKEDEV 

Log message:
regen MAKEDEV



  1   2   3   >