summaryrefslogtreecommitdiff
path: root/pci-arbiter
AgeCommit message (Collapse)Author
2023-12-29Fix printf format specifiersFlavio Cruz
Message-ID: <20231229212105.858759-4-flaviocruz@gmail.com>
2023-12-29pfinet and pci-arbiter: update server handlers to return kern_return_t to ↵Flavio Cruz
fix -Werror=enum-int-mismatch warnings Message-ID: <20231229161211.312389-1-flaviocruz@gmail.com>
2023-07-05pci-arbiter: Prevent mapping IO regionsJoan Lledó
* pci-arbiter/netfs_impl.c: * get_filemap_region(): Return MACH_PORT_NULL and set errno to EOPNOTSUPP when the client tries to map a IO region file. Message-Id: <20230705193812.6384-2-jlledom@mailfence.com>
2023-05-10More prototypes fixesSamuel 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-09-11pci-arbiter: Fix type of printf paramDamien Zammit
Message-Id: <20220908093034.499415-1-damien@zamaudio.com>
2022-08-30Fix types of read write and readables methodsSamuel Thibault
This completes 5adb4b834b1e
2022-08-20Note how we will be able to keep only one pci-arbiter translatorSamuel Thibault
2022-08-15Implement mapping for ROM filesJoan Lledó
* pci-arbiter/device_map.h: * pci-arbiter/device_map.c: * New function: device_map_rom * Copies the whole rom in the arbiter space. * pci-arbiter/pcifs.h: * struct pcifs_dirent: * New field to store the mapping address for each device rom. o pci-arbiter/func_files.h: * pci-arbiter/func_files.c: * read_rom_file: * Retrieves the rom contents from the local space instead of libpciaccess. * pci-arbiter/netfs_impl.c: * netfs_attempt_read:get_filemap_region * Update call to read_rom_file. * get_filemap_region: * Uses the old code at netfs_get_filemap to get a proxy to the device memory region. * get_filemap_rom: * Returns a proxy to the locally mapped device rom. * netfs_get_filemap: * Checks the requested file to map and calls get_filemap_rom, get_filemap_region or returns en error. Message-Id: <20220815161520.6059-2-jlledom@mailfence.com>
2022-02-28pci-arbiter: Remove invalid pci_device_closeDamien Zammit
pci_control_port is not a port info so calling deref on it is invalid. There seems no reason to have a device_close for the pci device currently so remove it. TESTED via booting a rump disk Message-Id: <20220227075155.30750-1-damien@zamaudio.com>
2022-02-07FIXME noteSamuel Thibault
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-09pci-arbiter: Pave the way for installing the bootstrap pci-arbiter on ↵Samuel Thibault
/servers/bus/pci
2022-01-08pci-arbiter: Stop using deprecated region memory pointerJoan Lledó
Use a internal array of pointers instead * pci-arbiter/device_map.h: * Update device_map_region() prototype * Now it receives an output address as parameter * pci-arbiter/device_map.c: * Update device_map_region() definition to match the new prototype * Support for legacy mappings * When the base address is lower than 1 mb * pci-arbiter/func_files.c: * pci-arbiter/netfs_impl.c: * Update calls to device_map_region to match the new prototype * Use the internal array of pointers instead of region->memory * pci-arbiter/pcifs.h: * struct pcifs_dirent: Declare the internal array of pointers Message-Id: <20220108121537.6277-2-jlledom@mailfence.com>
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-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-25pci-arbiter: Implement memory mapping over region filesJoan Lledó
* pci-arbiter/Makefile: * Add device_map.c to sources * pci-arbiter/device_map.c: * pci-arbiter/device_map.h: * New module for device mapping * Relies on libpciaccess mapping methods * pci-arbiter/func_files.c: * io_region_file(): Use the new device mapping module * pci-arbiter/netfs_impl.c: * Implements netfs_get_filemap(): * Uses the device mapping module to map the region to the arbiter space * Calls the kernel RPC vm_region_create_proxy() to obtain the memory object proxy * Only region files are mapped for now Message-Id: <20211219112647.11512-4-jlledom@mailfence.com>
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-11pci-arbiter: do not install as translator for nowSamuel Thibault
machdev installs the trivfs translator, not the netfs translator, and thus pci-arbiter would only show up as the pci device, not the pci filesystem.
2021-08-11pci-arbiter: Use _SERVERS_BUS macroSamuel 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-05pci-arbiter: Fix --device-master-port option nameSamuel Thibault
for coherency with ext2fs and rumpdisk * pci-arbiter/options.h (options): Rename --dev-master-port option to --device-master-port option.
2021-04-04pci-arbiter: restore code that allows it to run non-bootstrapSamuel Thibault
* pci-arbiter/pcifs.h (init_root_node): Restore underlying_node parameter. * pci-arbiter/pcifs.c (underlying_stat): Drop global variable. (init_root_node): Restore getting the stat from the underlying node. * pci-arbiter/main.c (main): Restore calling netfs_startup in non-bootstrap case, and pass underlying node to init_root_node. Only call pcifs_startup in bootstrap case.
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-08pci-arbiter: Introduce machdev into this serverDamien Zammit
* pci-arbiter/Makefile Add machdev lib and simplify * pci-arbiter/main.c (pci_device_{open,close,shutdown}): New methods (netfs_server_func): Thread the demuxer loop (pcifs_startup): Custom startup method (main): Use machdev for server and detach worker threads * pci-arbiter/options.{c,h} Add disk-server-task and priv ports * pci-arbiter/startup-ops.c Delete file Message-Id: <20210308130457.693821-4-damien@zamaudio.com>
2021-03-08acpi, pci-arbiter: Fix get_direntsDamien Zammit
* acpi/netfs_impl.c (get_dirents): Fix computing number of elements to be returned. Simplify computing the data size. * pci-arbiter/netfs_impl.c (get_dirents): Likewise. (netfs_get_dirents): Fix passing max_data_len rather than max_entries a second time.
2021-03-07pci-arbiter: Accept not having an underlying node.Damien Zammit
* pci-arbiter/pcifs.c (underlying_stat): New variable. (init_file_system): When underlying_node is nul, use the underlying_stat content.
2021-03-07TypoDamien Zammit
* pci-arbiter/pci-ops.c: Fix typo in comment.
2020-09-13pci-arbiter: Probe devices and map regionsJoan Lledó
This adapts the arbiter to a bug fixed in libpciaccess. We were relying on the library to probe devices and map regions but it's the arbiter who should do it. * pci-arbiter/pcifs.c: * create_fs_tree(): probe the device to find regions and rom * pci-arbiter/func_files.c: * io_region_file(): map region on the first access attempt
2020-05-02pci-arbiter: Remove obsolete TODO itemsJoan Lledó
* pci-arbiter/TODO: Remove --pci and memset+snprintf TODO items which are already done.
2020-05-02Memset directory entries to zero during their creationJoan Lledó
* pci-arbiter/pcifs.c: * create_dir_entry: Add memset() * create_fs_tree: Remove memset() Message-Id: <20200502172713.18654-2-jlledom@mailfence.com>
2020-04-12pci-arbiter: Remove done TODO itemDamien Zammit
2020-04-12pci-ops.c: Use compatible pointersDamien Zammit
2020-04-11pci-arbiter: Fix bug on option parsing.Joan Lledó
A misuse of strtol() caused wrong parameters to be interpreted as '0' * pci-arbiter/options.c: * New function parse_number() to handle wrong input * Call parse_number() from all places where strtol was being called Message-Id: <20200411113654.6360-2-jlledom@mailfence.com>
2020-03-31Fix build with -fno-commonSamuel Thibault
which will be the default in gcc-10. * acpi/acpifs.h (fs, acpifs_maptime): Add extern qualifier. * boot/private.h (verbose): Likewise. * eth-multiplexer/netfs_impl.h (multiplexer_maptime): Likewise. * eth-multiplexer/vdev.h (port_bucket, vdev_portclass): Likewise. * exec/priv.h (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.h (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, zeroblock, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, node_to_page_lock, generation_lock, next_generation, group_desc_image, global_pokel, modified_global_blocks, use_xattr_translator_records): Likewise. * hostmux/hostmux.h (hostmux_maptime): Likewise. * isofs/isofs.h (host_name, mounted_on, disk_image, disk_image_len, logical_block_size, sblock): Likewise. * libdiskfs/diskfs.h (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Likewise. * libnetfs/callbacks.h (_netfs_translator_callback1, _netfs_translator_callback2): Likewise. * libnetfs/priv.h (netfs_mtime): Likewise. * libpager/priv.h (_pager_class): Likewise. * libtrivfs/trivfs.h (trivfs_check_access_hook, trivfs_check_open_hook, trivfs_open_hook, trivfs_protid_create_hook, trivfs_peropen_create_hook, trivfs_protid_destroy_hook, trivfs_peropen_destroy_hook, trivfs_getroot_hook): Likewise. * lwip/lwip-hurd.h (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_protid_portclasses, lwip_cntl_portclasses, lwip_bootstrap_portclass, fsys_identity, lwipcntl, lwip_owner, lwip_group): Likewise. * lwip/port/include/netif/hurdtunif.h (tunnel_cntlclass, tunnel_class): Likewise. * nfs/nfs.h (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/nfsd.h (mapped_time, authserver): Likewise. * pci-arbiter/pcifs.h (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.h (pci_shutdown_notify_class, arrange_shutdown_notification): Likewise. * pfinet/pfinet.h (pfinet_bucket, addrport_class, socketport_class, fsys_identity, pfinetctl, pfinet_owner, pfinet_group): Likewise. * pflocal/sserver.h (sock_port_bucket): Likewise. * proc/proc.h (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/term.h (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, inputq, rawq, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.h (usermux_maptime): Likewise. * utils/msgids.h (msgid_argp): Likewise. * libdiskfs/priv.h (_diskfs_mtime): Remove definition. * lwip/options.h (lwip_argp): Add prototype. * mach-defpager/priv.h (partitions): Name structure. (all_partitions): Add extern qualifier. * acpi/main.c (acpifs_maptime, fs): New variables. * exec/main.c (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.c (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, next_generation, group_desc_image, global_pokel, use_xattr_translator_records): Likewise. * isofs/main.c (host_name, mounted_on, logical_block_size, sblock): Likewise. * libpager/pager-create.c (_pager_class): Likewise. * lwip/port/netif/hurdtunif.c (tunnel_cntlclass, tunnel_class): Likewise. * mach-defpager/default_pager.c (all_partitions): Likewise. * nfs/main.c (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/main.c (mapped_time, authserver): Likewise. * pci-arbiter/main.c (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.c (*pci_shutdown_notify_class): Likewise. * pfinet/main.c (pfinetctl, pfinet_owner, pfinet_group, pfinet_bucket, addrport_class, socketport_class, fsys_identity): Likewise. * proc/main.c (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/main.c (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.c (usermux_mapped_time): Rename to usermux_maptime. * lwip/main.c: Include "options.h". (lwip_argp, netif_list): Remove declarations. (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_cntl_portclasses, lwip_bootstrap_portclass, lwip_owner, lwip_group, fsys_identity, lwipcntl): New variables. * eth-multiplexer/multiplexer.c (multiplexer_maptime): Add variable. * hostmux/hostmux.c (hostmux_mapped_time): Rename variable to hostmux_maptime * libdiskfs/extra-version.c: Rename file to... * libdiskfs/priv.c: ... new file. (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Add weak variables. * libdiskfs/Makefile (OTHERSRCS): Replace extra-version.c with priv.c. * libtrivfs/priv.c: New file. * libtrivfs/Makefile (OTHERSRCS): Add priv.c * libcons/extra-version.c: Rename file to... * libcons/priv.c: ... new file. * libcons/Makefile (SRCS): Replace extra-version.c with priv.c. Fix build with #
2020-03-29pci-arbiter: Fix short reads from libpciaccessDamien Zammit
* pci-arbiter/pci-ops.c (S_pci_conf_read): Record and pass amount actually read from config memory. (S_pci_conf_write): Likewise for write.
2020-02-23pci-arbiter: Add --device command line optionJoan Lledó
Shortcut for -d, -b, -s and -f Usage: --device [<domain>:]<bus>:<slot>.<func> E.G. --device 00:05.0 is shortcut for -d 0 -b 0 -s 5 -f 0 * pci-arbiter/options.c: Implement --slot option * pci-arbiter/options.h: Add --slot to options list
2020-02-23pci-arbiter: Rename command line optionsJoan Lledó
Rename some CLI options in order to add the new -D --device arg. Replace -s by -c for subclasses. Replace -D by -d for domains. Domains are optional from now on, default to 0. Replace -d by -s for devices. The formerly called "devices" are now called "slots", and "device" will refer to a combination of Domain + Bus + Slot + Function Only -G and -U options create new permission scopes. * pci-arbiter/options.c: parse_opts(): Rename options * pci-arbiter/options.h: struct argp_option options[]: Likewise
2019-11-24pci-arbiter: Fix memory bugsJoan Lledó
* pci-arbiter/pcifs.c: * init_file_system: Remove unnecessary free() * create_fs_tree: Fix a boundary overrun where no devices are found. Message-Id: <20191124194721.4982-2-jlledom@mailfence.com>
2019-11-09pci-arbiter: remove unneeded memset.Joan Lledó
* pci-arbiter/pcifs.c (create_fs_tree): Remove all memset() previous to snprintf() calls.
2019-11-03pciaccess: properly detect and useSamuel Thibault
* configure.ac: Detect pciaccess pkg module. Define HAVE_LIBPCIACCESS, libpciaccess_CFLAGS, libpciaccess_LIBS variables. * config.make.in (HAVE_LIBPCIACCESS, libpciaccess_CFLAGS, libpciaccess_LIBS): Add variables. * Makefile (prog-subdirs) [!HAVE_LIBPCIACCESS]: Do not add pci-arbiter. * pci-arbiter/Makefile (LDLIBS): Use $(libpciaccess_LIBS) instead of -lpciaccess. (CFLAGS): Use $(libpciaccess_CFLAGS).
2019-11-03pci-arbiter: Fix warningJoan Lledó
* pci-arbiter/netfs_impl.c: * netfs_attempt_write: Cast op function to pci_io_op_t
2019-11-03pci-arbiter: Cleanup at shutdown.Joan Lledó
* pci-arbiter/startup-ops.c: * S_startup_dosync: Call pci_system_cleanup().
2019-11-03pci-arbiter: Use libpciaccess instead of embedding itDamien Zammit
This patch removes all embedded pciaccess code from the arbiter and instead uses the external pciaccess library. * pci-arbiter/Makefile: * Remove pci_access.c and x86_pci.c from the sources. * pci-arbiter/func_files.c: * io_config_file: Use a harcoded PCI config size. * read_rom_file: Grab the full rom first, then return the requested amount. * pci-arbiter/main.c: * main: Call create_fs_tree() w/o pci_sys. Since it's not part of the translator anymore. * pci-arbiter/netfs_impl.c: * netfs_attempt_read: Send pci_device_cfg_read() as the read op. * netfs_attempt_write: Send pci_device_cfg_write() as the write op. * pci-arbiter/pci-ops.c: * S_pci_conf_read: Call libpciaccess' pci_device_cfg_read(). * S_pci_conf_write: Call libpciaccess' pci_device_cfg_write(). * S_pci_get_dev_rom: Set rom.base_addr to zero for the moment, until libpciaccess esposes it properly. * pci-arbiter/pci_access.c: Deleted * pci-arbiter/pci_access.h: Deleted * pci-arbiter/pcifs.c: * create_fs_tree: Remove the pci_sys parameter. Use libpciaccess' iterator. Use a hardcoded config space size. * pci-arbiter/pcifs.h: Definitions for changes in pcifs.c. * pci-arbiter/x86_pci.c: Deleted. * pci-arbiter/x86_pci.h: Deleted.
2019-11-03pci-arbiter Revert snprintf truncation changeSamuel Thibault
snprintf guarantees to add a trailing \0, so there is no need to add one * pci-arbiter/pcifs.c (create_fs_tree): Give whole buffer to snprintf.
2019-11-03pci-arbiter: Fix a -Wstringop-truncation warningJoan Lledó
* pci-arbiter/pcifs.c: * create_dir_entry: Limit to NAME_SIZE-1 when calling strncpy(). Finish entry->name with '\0'. * create_fs_tree: memset() to 0 the directory entry. Limit to NAME_SIZE-1 all calls to snprintf() and strncpy(). Message-Id: <20191103093756.9672-4-jlledom@mailfence.com>