aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/virtio/p9fs
Commit message (Collapse)AuthorAgeFilesLines
* virtio_p9fs: Use VIRTIO_SIMPLE_PNPINFOAndrew Turner2026-02-031-7/+3
| | | | | | | | This allows us to also use the common VIRTIO_SIMPLE_PROBE and to have devmatch load the driver when detected. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D54684
* virtio_p9fs: Support attaching to pci and mmioAndrew Turner2025-04-081-1/+1
| | | | | | | | | | Some implementations of the virtio 9p transport are implemented on virtio_mmio, e.g. the Arm FVP. Use the correct macro so the driver attaches when this is the case. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D49600
* virtio_p9fs: Simplify vt9p_req_wait() a bitMark Johnston2024-10-251-13/+13
| | | | | | | | | | | Remove an always-false check for whether the request has already completed before sleeping. Even if the request is complete, the response tag is updated while holding the channel lock, which is also held here. No functional change intended. Sponsored by: Klara, Inc.
* virtio_p9fs: Check for completions after enabling interruptsMark Johnston2024-10-251-1/+5
| | | | | | | | | | Otherwise we can end up with a lost interrupt, causing lost request completion wakeups and hangs in the filesystem layer. Continue processing until we enable interrupts and then observe an empty queue, like other virtio drivers do. Sponsored by: Klara, Inc.
* virtio_p9fs: Fix handling of a full request queueMark Johnston2024-10-251-2/+1
| | | | | | | | | | | | If, when submitting a request, the virtqueue is full, we sleep until an interrupt has fired, then restart the request. However, while sleeping the channel lock is dropped, and in the meantime another thread may have reset the per-channel SG list, so upon retrying we'd (re)submit whatever happened to be left over in the previous request. Fix the problem by rebuilding the SG list after sleeping. Sponsored by: Klara, Inc.
* virtio_p9fs: Fix some style issuesMark Johnston2024-10-251-20/+6
| | | | | | | | | | - Remove superfluous newlines. - Use bool literals. - Replace an unneeded SYSINIT with static initialization. No functional change intended. Sponsored by: Klara, Inc.
* virtio_p9fs: fix panic on qemu/kvmDanilo Egea Gondolfo2024-07-071-2/+2
| | | | | | | | | | | | | | | | When the module is loaded on a system running on qemu/kvm the "modern" virtio infrastructure is used and virtio_read_device_config() will end up calling vtpci_modern_read_dev_config(). This function cannot read values of arbitrary sizes and will panic if the p9fs mount tag size is not supported by it. Use virtio_read_device_config_array() instead. It was tested on both bhyve and qemu/kvm. PR: 280098 Co-authored-by: Mark Peek <mp@FreeBSD.org> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1320
* p9fs: use M_WAITOK where appropriateEd Maste2024-06-251-6/+1
| | | | | | | | | | | device_attach routines are allowed to sleep, and this routine already has other M_WAITOK allocations. Reported by: markj Reviewed by: markj Fixes: 1efd69f933b6 ("p9fs: move NULL check immediately after alloc...") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45721
* p9fs: move NULL check immediately after allocationEd Maste2024-06-241-6/+5
| | | | | | | Reported by: Shawn Webb (HardenedBSD) Reviewed by: dfr Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45719
* Add an implementation of the 9P filesystemDoug Rabson2024-06-192-0/+550
This is derived from swills@ fork of the Juniper virtfs with many changes by me including bug fixes, style improvements, clearer layering and more consistent logging. The filesystem is renamed to p9fs to better reflect its function and to prevent possible future confusion with virtio-fs. Several updates and fixes from Juniper have been integrated into this version by Val Packett and these contributions along with the original Juniper authors are credited below. To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The bhyve virtio-9p device allows access from the guest to files on the host by mapping a 'sharename' to a host path. It is possible to use p9fs as a root filesystem by adding this to /boot/loader.conf: vfs.root.mountfrom="p9fs:sharename" for non-root filesystems add something like this to /etc/fstab: sharename /mnt p9fs rw 0 0 In both examples, substitute the share name used on the bhyve command line. The 9P filesystem protocol relies on stateful file opens which map protocol-level FIDs to host file descriptors. The FreeBSD vnode interface doesn't really support this and we use heuristics to guess the right FID to use for file operations. This can be confused by privilege lowering and does not guarantee that the FID created for a given file open is always used for file operations, even if the calling process is using the file descriptor from the original open call. Improving this would involve changes to the vnode interface which is out-of-scope for this import. Differential Revision: https://reviews.freebsd.org/D41844 Reviewed by: kib, emaste, dch MFC after: 3 months Co-authored-by: Val Packett <val@packett.cool> Co-authored-by: Ka Ho Ng <kahon@juniper.net> Co-authored-by: joyu <joyul@juniper.net> Co-authored-by: Kumara Babu Narayanaswamy <bkumara@juniper.net>