[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 hurd] rumpusbdisk: Add USB mass storage translator
From: |
Samuel Thibault |
Subject: |
Re: [PATCH v3 hurd] rumpusbdisk: Add USB mass storage translator |
Date: |
Mon, 3 Jul 2023 13:40:46 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
We now need to add support in sd* node creation etc. just like is
already done with wd*.
Samuel
Damien Zammit, le lun. 03 juil. 2023 10:18:22 +0000, a ecrit:
> 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.
>
> ---
> rumpdisk/Makefile | 25 +++++++++++++++++++------
> rumpdisk/block-rump.c | 14 ++++++++++++--
> rumpdisk/main.c | 8 +++++++-
> 3 files changed, 38 insertions(+), 9 deletions(-)
>
> diff --git a/rumpdisk/Makefile b/rumpdisk/Makefile
> index b59aaf9a..0b496963 100644
> --- a/rumpdisk/Makefile
> +++ b/rumpdisk/Makefile
> @@ -15,7 +15,9 @@
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>
> -RUMPLIBS=rump rumpuser rumpdev rumpdev_disk rumpdev_pci rumpvfs
> rumpdev_ahcisata rumpdev_piixide rumpdev_ata
> +RUMPLIBS=rump rumpuser rumpdev rumpdev_disk rumpdev_pci rumpvfs
> +RUMPSATA=rumpdev_ahcisata rumpdev_piixide rumpdev_ata
> +RUMPUSB=rumpdev_usb rumpdev_pci_usbhc rumpdev_umass
> RUMPEXTRA=rumpdev_scsipi
>
> # If we have a configured tree, include the configuration so that we
> @@ -29,14 +31,25 @@ RUMPLIBS += rumpvfs_nofifofs
> endif
>
> dir := rumpdisk
> -makemode := server
> +makemode := servers
>
> SRCS = main.c block-rump.c
> LCLHDRS = block-rump.h ioccom-rump.h
> -target = rumpdisk
> -OBJS = $(SRCS:.c=.o)
> +targets = rumpdisk rumpusbdisk
> HURDLIBS = machdev ports trivfs shouldbeinlibc iohelp ihash fshelp
> -LDLIBS += -lpthread -lpciaccess -ldl
> -LDLIBS += -Wl,--whole-archive $(RUMPLIBS:%=-l%_pic) -Wl,--no-whole-archive
> $(RUMPEXTRA:%=-l%_pic)
> +LDLIBS += -lpthread -lpciaccess -ldl $(RUMPEXTRA:%=-l%_pic) \
> + -Wl,--whole-archive $(RUMPLIBS:%=-l%_pic) -Wl,--no-whole-archive
> +
> +%.disk.o: %.c
> + $(CC) $(CFLAGS) $(CPPFLAGS) -D_RUMP_SATA -c $< -o $@
> +rumpdisk-OBJS = $(SRCS:.c=.disk.o)
> +rumpdisk-LDLIBS += -Wl,--whole-archive $(RUMPSATA:%=-l%_pic)
> -Wl,--no-whole-archive
> +rumpdisk rumpdisk.static: $(rumpdisk-OBJS) $(HURDLIBS:%=-l%)
> +
> +%.usb.o: %.c
> + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
> +rumpusbdisk-OBJS = $(SRCS:.c=.usb.o)
> +rumpusbdisk-LDLIBS += -Wl,--whole-archive $(RUMPUSB:%=-l%_pic)
> -Wl,--no-whole-archive
> +rumpusbdisk rumpusbdisk.static: $(rumpusbdisk-OBJS) $(HURDLIBS:%=-l%)
>
> include ../Makeconf
> diff --git a/rumpdisk/block-rump.c b/rumpdisk/block-rump.c
> index 5ceb14ae..a29ebe73 100644
> --- a/rumpdisk/block-rump.c
> +++ b/rumpdisk/block-rump.c
> @@ -48,6 +48,12 @@
> #define DISK_NAME_LEN 32
> #define MAX_DISK_DEV 2
>
> +#ifdef _RUMP_SATA
> +#define RUMP_TYPE_STRING "rump SATA/IDE"
> +#else
> +#define RUMP_TYPE_STRING "rump USB"
> +#endif
> +
> static bool disabled;
>
> static mach_port_t master_host;
> @@ -107,7 +113,11 @@ is_disk_device (const char *name)
> {
> const char *dev;
> const char *allowed_devs[MAX_DISK_DEV] = {
> +#ifdef _RUMP_SATA
> "wd",
> +#else
> + "sd",
> +#endif
> "cd"
> };
> uint8_t i;
> @@ -158,7 +168,7 @@ rumpdisk_device_init (void)
> {
> device_close (device);
> mach_port_deallocate (mach_task_self (), device);
> - fprintf(stderr, "Kernel is already driving an IDE device, skipping
> probing disks\n");
> + fprintf(stderr, "Kernel is already driving an IDE device, skipping
> probing " RUMP_TYPE_STRING " disks\n");
> fflush(stderr);
> disabled = 1;
> return;
> @@ -172,7 +182,7 @@ rumpdisk_device_init (void)
> {
> device_close (device);
> mach_port_deallocate (mach_task_self (), device);
> - fprintf(stderr, "Kernel is already driving a SATA device, skipping
> probing disks\n");
> + fprintf(stderr, "Kernel is already driving a SATA device, skipping
> probing " RUMP_TYPE_STRING " disks\n");
> fflush(stderr);
> disabled = 1;
> return;
> diff --git a/rumpdisk/main.c b/rumpdisk/main.c
> index 64065c6c..ca166274 100644
> --- a/rumpdisk/main.c
> +++ b/rumpdisk/main.c
> @@ -32,6 +32,12 @@
> #include <pthread.h>
> #include <mach.h>
>
> +#ifdef _RUMP_SATA
> +#define RUMPNAME "rumpdisk"
> +#else
> +#define RUMPNAME "rumpusbdisk"
> +#endif
> +
> mach_port_t bootstrap_resume_task = MACH_PORT_NULL;
>
> static const struct argp_option options[] = {
> @@ -128,7 +134,7 @@ main (int argc, char **argv)
> }
>
> rump_register_block ();
> - machdev_trivfs_init (argc, argv, bootstrap_resume_task, "rumpdisk",
> "/dev/rumpdisk", &bootstrap);
> + machdev_trivfs_init (argc, argv, bootstrap_resume_task, RUMPNAME, "/dev/"
> RUMPNAME, &bootstrap);
>
> /* Make sure we will not swap out, in case we drive the disk used for
> swapping. */
> --
> 2.40.1
>
>
>
--
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.