patches and low-level development discussion
 help / color / mirror / code / Atom feed
7b282e704731ba73bfafa07cf422acc76a4fbf63 blob 1047 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
#!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2
# SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>

# Assign the whole IOMMU group containing this device to the network
# VM.

if { modprobe vfio-pci }

importas -i devpath DEVPATH

foreground {
  pipeline { ls -1 /sys${devpath}/iommu_group/devices }
  forstdin -pE device
  foreground {
    redirfd -w 2 /dev/null
    redirfd -w 1 /sys/bus/pci/devices/${device}/driver/unbind
    printf "%s" $device
  }
  foreground {
    redirfd -w 1 /sys/bus/pci/devices/${device}/driver_override
    printf vfio-pci
  }
  redirfd -w 1 /sys/bus/pci/drivers/vfio-pci/bind
  printf "%s" $device
}

# We have to background here before running s6-rc, because if we're
# running from inside mdevd-coldplug trying to start another service
# will deadlock.
background {
  # Wait for the VM to be up.
  foreground { s6-rc -bu change ext-rc-init }
  if { s6-svwait -U /run/service/ext-netvm }

  ch-remote --api-socket /run/service/ext-netvm/env/cloud-hypervisor.sock
    add-device path=/sys${devpath}
}
debug log:

solving 7b282e7 ...
found 7b282e7 in https://spectrum-os.org/git/spectrum

Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).