aboutsummaryrefslogtreecommitdiff
path: root/rumpdisk/block-rump.c
Commit message (Collapse)AuthorAgeFilesLines
* rumpusbdisk: Add USB mass storage translatorDamien Zammit2023-07-031-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | This adds a second binary target to compile in the rump USB stack instead of SATA/IDE using conditional ifdefs to mostly share the code between the two translators. This can be tested by running qemu with a USB3 controller as follows: -drive if=none,id=usbstick,format=raw,file=/path/to/disk.img \ -device qemu-xhci \ -device usb-storage,drive=usbstick \ NB: /path/to/disk.img can be a block device on the host. Then call grub module rumpusbdisk.static instead of rumpdisk.static and pass ' root=part:X:device:sd0 noide' as gnumach parameters, where X is the partition number of / within the disk/image. Caveats: netdde seems to exhibit a bug when running 'ifdown /dev/eth0' simultaneously to running the rumpusbdisk translator, due to the two devices sharing the same IRQ. Message-Id: <20230703101815.925760-1-damien@zamaudio.com>
* rumpdisk: Note multithreading FIXME as doneSamuel Thibault2022-03-011-6/+2
|
* rumpdisk: Protect open/close/read/write with a rwlockDamien Zammit2022-02-271-11/+66
| | | | | | TESTED to boot off a rump based disk Message-Id: <20220227002655.23300-1-damien@zamaudio.com>
* rumpdisk: Do not set a number of bytes in case of errorsSamuel Thibault2022-02-251-9/+2
| | | | | | | The RPC stub will not read it on error anyway. * rumpdisk/block-rump.c (rumpdisk_device_write, rumpdisk_device_read): Do not set the number of bytes when returning an error.
* rumpdisk: Fix warningSamuel Thibault2022-02-251-1/+1
| | | | | | | gcc would complain that dummy_read is unused * rumpdisk/block-rump.c (rumpdisk_device_write): Mark dummy_read with attribute unused.
* rumpdisk: Fix BLKRRPART valueSamuel Thibault2022-02-221-1/+1
| | | | | We have always been using the Linux value, coming from the Linux glue code.
* rumpdisk: cope with unaligned and big accessesSamuel Thibault2022-02-181-27/+86
| | | | | | | Unaligned accesses need a copy into an aligned buffer. Accesses larger than a page currently have to be split into pages, otherwise _bus_dmamap_load_buffer assumes coherent physical allocations.
* rumpdisk: add missing device_close on probing kernel driversSamuel Thibault2022-02-061-0/+2
| | | | If any device_open succeeds, we should clean its effect.
* rumpdisk: add missing device_close on probing kernel driversSamuel Thibault2022-02-051-0/+2
| | | | If any device_open succeeds, we should clean its effect.
* Fix const warningsSamuel Thibault2022-01-171-3/+3
| | | | | Now that the RPCs have const, this forces us cleaning our const-meant functions.
* Make RPC input array parameters constSamuel Thibault2022-01-161-1/+1
| | | | | This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
* rumpdisk: Use raw uncached character device rwdXdDamien Zammit2021-12-271-2/+2
| | | | | | | | | This disables the rump buffer cache and avoids any magic translation that rump would do. * rumpdisk/block-rump.c (translate_name): Use `/dev/r%sd' format instead of `/dev/%sd'. Message-Id: <20211226113857.150525-4-damien@zamaudio.com>
* rumpdisk: Fault-in the memory pagesDamien Zammit2021-12-271-2/+12
| | | | | | This ensures memory pages are allocated before written to. Message-Id: <20211226113857.150525-6-damien@zamaudio.com>
* rumpdisk: define _STANDALONE to avoid register_tDamien Zammit2021-12-271-0/+1
| | | | | | | This works around a faulty HAVE_REGISTER_T in rump so the rump.h header can be included without errors. Message-Id: <20211226113857.150525-2-damien@zamaudio.com>
* Revert "rumpdisk: Use raw uncached character device rwdXd"Samuel Thibault2021-08-241-2/+2
| | | | | | This reverts commit 517edb7fe7c614a683e18671afc52de8cabe8fdf. It seems to be actually breaking access to the disk.
* rumpdisk: Ensure physical allocation of memory for DMA readsDamien Zammit2021-08-241-0/+3
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_read): Memset the buffer after allocating it.
* rumpdisk: Use raw uncached character device rwdXdDamien Zammit2021-08-241-2/+2
| | | | | | | | This disables the rump buffer cache and avoids any magic translation that rump would do. * rumpdisk/block-rump.c (translate_name): Use `/dev/r%sd' format instead of `/dev/%sd'.
* rumpdisk: Simplify allocating data for device_readSamuel Thibault2021-08-221-7/+7
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_read): Use vm_allocate/vm_deallocate instead of mmap/munmap.
* rumpdisk: Add missing deallocation in device_writeSamuel Thibault2021-08-221-0/+2
| | | | | * rumpdisk/block-rump.c (rumpdisk_device_write): Call vm_deallocate after writing the data.
* libmachdev: Fix startup_dosyncSamuel Thibault2021-08-111-10/+3
| | | | | | | We do not actually want to shut everything down. For instance, we still have to be able to start the acpi translator to perform the actual shutdown. What we however have to do is syncing the disks.
* rumpdisk: Make sure probe abort is printedSamuel Thibault2021-08-111-0/+2
|
* libmachdev: pass shutdown handle to shutdown methodDamien Zammit2021-03-071-1/+1
| | | | | | | | | | | | * libmachdev/machdev-device_emul.h (struct machdev_device_emulation_ops): Add shutdown method. * libmachdev/ds_routines.c (machdev_device_shutdown): Take dosync_handle handle and pass it to shutdown method. * libmachdev/machdev.h (machdev_device_shutdown): Update prototype. * libmachdev/trivfs_server.c (S_startup_dosync): Pass shutdown handle to machdev_device_shutdown call. * rumpdisk/block-rump.c (rumpdisk_device_shutdown): Take dosync_handle parameter.
* rumpdisk: implement BLKRRPARTSamuel Thibault2020-11-261-2/+18
| | | | | | | | | | This is used by parted to reload the partition table. Since we do not actually implement partition tables, we can just ignore it. * rumpdisk/block-rump.c (BLKRRPART): New macro. (rumpdisk_device_set_status): New function. (rump_block_emulation_ops): Set device_set_status field to rumpdisk_device_set_status.
* rumpdisk: automatically prepend /dev/Samuel Thibault2020-11-161-12/+9
| | | | | | | to keep coherent with other storeio translators, grub scripts, etc. * rumpdisk/block-rump.c (translate_name): Prepend /dev/ to disk name. (is_disk_device): Do not match heading /dev/.
* rumpdisk: auto-disable when kernel runs disk driversSamuel Thibault2020-11-151-28/+65
| | | | | | | | | | | | | | | | | | | | By default we do not want rumpdisk to step over the kernel drivers. * rumpdisk/block-rump.c: Include <device/device.h>. (disabled): New variable. (dev_to_port): Rename to rumpdisk_dev_to_port. (device_init): Rename to rumpdisk_init. Exit if the kernel runs SATA drivers. (device_close): Rename to rumpdisk_device_close. (device_dealloc): Rename to rumpdisk_device_dealloc. (device_shutdown): Rename to rumpdisk_device_shutdown. Do not shutdown when disabled. (device_open): Rename to rumpdisk_device_open. Return D_NO_SUCH_DEVICE when disabled. (device_write): Rename to rumpdisk_device_write. (device_read): Rename to rumpdisk_device_read. (device_get_status): Rename to rumpdisk_device_get_status. (rump_block_emulation_ops): Update refs accordingly.
* rumpdisk: Support opening a device several timesSamuel Thibault2020-11-141-55/+58
| | | | | | | | | | * rumpdisk/block-rump.c (struct block_data): Make taken field an integer instead of a boolean. (device_open): When search_bd succeeds, set a new reference and return a new port right. Separate out io_return_t err, int fd, and int ret to avoid confusions. Simplify the error handling path. (device_close): Decrement reference and close rump disk only when reaching zero. Also destroy our port.
* rumpdisk: Comment on thread-safety requirementsSamuel Thibault2020-11-141-0/+3
|
* rumpdisk: Use rump_sys_pread/pwrite instead of lseek+r/w for atomic accessesDamien Zammit2020-11-091-17/+4
| | | | | | TESTED by booting a QEMU passthrough disk via rumpdisk.static Message-Id: <20201109070906.20796-1-damien@zamaudio.com>
* libmachdev: Introduce startup notification for clean rumpdisk shutdownDamien Zammit2020-08-021-1/+15
| | | | Message-Id: <20200801050538.273196-1-damien@zamaudio.com>
* rumpdisk: Use bootstrap resume of fs task in machdevDamien Zammit2020-07-251-8/+31
| | | | Message-Id: <20200725011847.186969-4-damien@zamaudio.com>
* rumpdisk: link the bd on success onlyDamien Zammit2020-07-181-2/+2
| | | | Otherwise we would crash after an unsuccessful device_open call.
* rumpdisk: Simplify codeDamien Zammit2020-07-181-4/+1
| | | | There is no need to store the error only to return it.
* Rumpdisk: fix buffer sizeSamuel Thibault2020-04-111-1/+1
| | | | | * rumpdisk/block-rump.c (device_open): Reduce the dev_name buffer size by one (unused) byte.
* rumpdisk: Use more canonical parameter orderSamuel Thibault2020-04-111-2/+2
| | | | | | | To match snprintf parameter order. * rumpdisk/block-rump.c (translate_name): Make `name' parameter last. (device_open): Fix translate_name call accordingly.
* rumpdisk: Add userspace disk support via librumpDamien Zammit2020-04-111-0/+350