summaryrefslogtreecommitdiff
path: root/rumpdisk
AgeCommit message (Collapse)Author
2024-03-01rumpdisk: do not open device if block size is 0Flavio Cruz
Currently, if we do: $ ls /dev/cd0/ The computer seems to get stuck, caused by the divide by 0 in the rumpdisk server in device_get_status. I noticed that if we have no disk in the cdrom device, we can still open it but block and media size will be 0 and the message "cd0 dos partition I/O error" will be printed to the console. To avoid this problem, we check the block size and throw an error when it is 0. This also works correctly when a disk actually exists. This should help fix the perl and likely the vim test suites that are currently failing in https://buildd.debian.org/. Message-ID: <Zd_8XjcHcbNIp5NM@mars.tail36e24.ts.net>
2023-09-13rumpdisk: Fix dependencies computationSamuel Thibault
2023-07-03rumpusbdisk: Add USB mass storage translatorDamien Zammit
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>
2023-05-23rumpdisk: Do not assume FHS /usr/lib, fixes Guix cross-build.Janneke Nieuwenhuizen
2022-09-26rumpdisk: Link in PIIX IDE driver and ATA common codeSamuel Thibault
2022-09-11machdev, pci-arbiter, rumpdisk: Fix race condition in bootstrapDamien Zammit
This fixes a known race condition in bootstrapping by separating the fsys_startup call from the server demuxer loop into two separate functions that the caller can decide when to call. Message-Id: <20220908093229.499494-1-damien@zamaudio.com>
2022-03-01rumpdisk: Note multithreading FIXME as doneSamuel Thibault
2022-03-01rumpdisk: Override machdev_server with multithread port managementDamien Zammit
This makes rumpdisk multithreaded as much as the root filesystem pager will request. Message-Id: <20220227091013.33112-4-damien@zamaudio.com>
2022-02-27rumpdisk: Protect open/close/read/write with a rwlockDamien Zammit
TESTED to boot off a rump based disk Message-Id: <20220227002655.23300-1-damien@zamaudio.com>
2022-02-25rumpdisk: Do not set a number of bytes in case of errorsSamuel Thibault
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.
2022-02-25rumpdisk: Fix warningSamuel Thibault
gcc would complain that dummy_read is unused * rumpdisk/block-rump.c (rumpdisk_device_write): Mark dummy_read with attribute unused.
2022-02-22rumpdisk: Fix BLKRRPART valueSamuel Thibault
We have always been using the Linux value, coming from the Linux glue code.
2022-02-18rumpdisk: cope with unaligned and big accessesSamuel Thibault
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.
2022-02-06rumpdisk: add missing device_close on probing kernel driversSamuel Thibault
If any device_open succeeds, we should clean its effect.
2022-02-05rumpdisk: add missing device_close on probing kernel driversSamuel Thibault
If any device_open succeeds, we should clean its effect.
2022-01-17Fix const warningsSamuel Thibault
Now that the RPCs have const, this forces us cleaning our const-meant functions.
2022-01-16Make RPC input array parameters constSamuel Thibault
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
2022-01-01Fix build warningsSamuel Thibault
No actual behavior change.
2021-12-30wire_task_self: Use in various translatorsSamuel Thibault
wire_task_self() was duplicating mach-defpager's wire_all_memory(), we can just make mach-defpager now use the former (and not mlockall either). Also pci-arbiter and rumpdisk can use it.
2021-12-28rumpdisk: Link with rumpvfs_nofifofs if presentDamien Zammit
Message-Id: <20211228055114.173039-1-damien@zamaudio.com>
2021-12-27rumpdisk: Use raw uncached character device rwdXdDamien Zammit
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>
2021-12-27rumpdisk: Fault-in the memory pagesDamien Zammit
This ensures memory pages are allocated before written to. Message-Id: <20211226113857.150525-6-damien@zamaudio.com>
2021-12-27pci-arbiter,rumpdisk: Lock all memory for swappingDamien Zammit
This locks all memory in bootstrap processes so that disk driver dependencies don't get swapped out. Message-Id: <20211226113857.150525-5-damien@zamaudio.com>
2021-12-27rumpdisk: define _STANDALONE to avoid register_tDamien Zammit
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>
2021-08-24Revert "rumpdisk: Use raw uncached character device rwdXd"Samuel Thibault
This reverts commit 517edb7fe7c614a683e18671afc52de8cabe8fdf. It seems to be actually breaking access to the disk.
2021-08-24rumpdisk: Ensure physical allocation of memory for DMA readsDamien Zammit
* rumpdisk/block-rump.c (rumpdisk_device_read): Memset the buffer after allocating it.
2021-08-24rumpdisk: Use raw uncached character device rwdXdDamien Zammit
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'.
2021-08-22rumpdisk: Simplify allocating data for device_readSamuel Thibault
* rumpdisk/block-rump.c (rumpdisk_device_read): Use vm_allocate/vm_deallocate instead of mmap/munmap.
2021-08-22rumpdisk: Add missing deallocation in device_writeSamuel Thibault
* rumpdisk/block-rump.c (rumpdisk_device_write): Call vm_deallocate after writing the data.
2021-08-11pci-arbiter, rumpdisk: Rename options for bootstrap chainSamuel Thibault
We may end up with an arbitrary series of bootstrap translators, which can know about each other through devices, and thus do not need any particular order except dependencies. The actual bootstrap order can thus be arbitrary (provided it respects dependencies), so better not hardcode it.
2021-08-11libmachdev: Fix startup_dosyncSamuel Thibault
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.
2021-08-11rumpdisk: Make sure probe abort is printedSamuel Thibault
2021-04-15libmachdev: Restore making machdev_trivfs_server blockingSamuel Thibault
netdde actually needs to control which thread runs the trivfs server, for managing per-thread state etc. Only pci-arbiter needs to run machdev_trivfs_server non-blockingly, it can create a thread by itself. * libmachdev/trivfs_server.c (machdev_trivfs_loop): Move back muxer loop to... (machdev_trivfs_server): ... here. * pci-arbiter/main.c (main): Run machdev_trivfs_server in its own thread. * rumpdisk/main.c (main): Do not call pthread_exit().
2021-04-04machdev: Pass argv through to _hurd_initDamien Zammit
Message-Id: <20210404033750.143411-1-damien@zamaudio.com>
2021-03-16machdev,rump,pci: Rework bootstrapDamien Zammit
* libmachdev/trivfs_server.c (bootstrapped): Rename to bootstrapping. (trivfs_S_fsys_startup): Call fsys_startup on the bootstrap port. (essential_task): New function. (trivfs_S_fsys_init): Call fsys_init on the bootstrap port. Configure proc. Mark us as essential when bootstrapping even without a devnode. (arrange_shutdown_notification): Do not configure proc. (machdev_trivfs_init): Always get the bootstrap port from the kernel, leave it MACH_PORT_NULL if unavailable. Call fsys_getpriv on it if it is. * pci-arbiter/Makefile (SRCS): Remove startup.c. * pci-arbiter/startup.c: Delete file. * pci-arbiter/startup.h: Delete file. * pci-arbiter/main.c: Do not include "startup.h" (pci_device_shutdown): Do not try to lokup the dosync_handle. (pcifs_startup): Always create the pci_control_port right on the control port. (main): Call machdev_device_init after machdev_trivfs_init. Do not call arrange_shutdown_notification. * rumpdisk/main.c (netfs_server_name): Don't pretend to be the arbiter anymore (main): Call machdev_device_init after machdev_trivfs_init. Message-Id: <20210316054715.788725-1-damien@zamaudio.com>
2021-03-07libmachdev: pass shutdown handle to shutdown methodDamien Zammit
* 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.
2021-03-02rumpdisk: Let server threads runDamien Zammit
* rumpdisk/main.c (main): Call pthread_exit(NULL) to let server threads continue.
2020-11-26rumpdisk: implement BLKRRPARTSamuel Thibault
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.
2020-11-16rumpdisk: automatically prepend /dev/Samuel Thibault
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/.
2020-11-15rumpdisk: auto-disable when kernel runs disk driversSamuel Thibault
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.
2020-11-14rumpdisk: Support opening a device several timesSamuel Thibault
* 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.
2020-11-14libmachdev: Avoid conflating translator name and pathSamuel Thibault
bootstrap translators may not wish to appear in the FS, and the name of the translator does not have to match the path where it is getting installed. * libmachdev/machdev.h (machdev_trivfs_init): Add path parameter. * libmachdev/trivfs_server.c (machdev_trivfs_init): Add path parameter, set devnode only if it is not NULL. (trivfs_S_fsys_init): Only call install_as_translator when devnode is not NULL. * /rumpdisk/main.c (main): Add path parameter.
2020-11-14libmachdev: Support installing translator in the FSDamien Zammit
*/libmachdev/trivfs_server.c (machdev_ctl): Rename to control_port. (trivfs_S_fsys_init): Fix accordingly. (control): New variable. (bootstrapped, underlying, devnode): New variables. (install_as_translator): New function. (trivfs_S_fsys_init): When bootstrapping, call install_as_translator. (machdev_trivfs_init): Create one port of the control class. (trivfs_S_fsys_getpriv): Use ports_get_send_right on the control port instead of creating another one. (resume_bootstrap_server): Use ports_get_send_right on the control port instead of creating another one. (machdev_trivfs_init): When bootstrapping, Use our control port as fsys.
2020-11-14rumpdisk: Comment on thread-safety requirementsSamuel Thibault
2020-11-09rumpdisk: Use rump_sys_pread/pwrite instead of lseek+r/w for atomic accessesDamien Zammit
TESTED by booting a QEMU passthrough disk via rumpdisk.static Message-Id: <20201109070906.20796-1-damien@zamaudio.com>
2020-08-02libmachdev: Introduce startup notification for clean rumpdisk shutdownDamien Zammit
Message-Id: <20200801050538.273196-1-damien@zamaudio.com>
2020-07-25rumpdisk: Use bootstrap resume of fs task in machdevDamien Zammit
Message-Id: <20200725011847.186969-4-damien@zamaudio.com>
2020-07-18rumpdisk: link the bd on success onlyDamien Zammit
Otherwise we would crash after an unsuccessful device_open call.
2020-07-18rumpdisk: Simplify codeDamien Zammit
There is no need to store the error only to return it.
2020-04-11Rumpdisk: fix buffer sizeSamuel Thibault
* rumpdisk/block-rump.c (device_open): Reduce the dev_name buffer size by one (unused) byte.