この記事は、NetBSD Advent Calendar 2019の16日目の記事です。
はじめに
NetBSDなマシンにUSBマスストレージをつなげて使っていますが、USB Attached SCSI接続なマスストレージは持っておらず、
つないだことがありませんでした。
qemuでUSB Attached SCSI接続なマスストレージを仮想デバイスとして用意できることに気付いたので、
どう認識されるか試してみました。
NetBSD/amd64-currentを起動してみる
あらかじめ、GPT BIOSブートできるようなqcow2ディスクイメージを用意しておきました。
これで起動した仮想マシンに、新たに作った1 GBのディスクイメージをUSB Attached SCSI接続してみます。
qemuの文書 (qemu usb storage emulation)を参考にしてみます。
$ qemu-system-x86_64 -smp 2 -hda netbsd-10.qcow2 -drive if=none,id=stick,file=usb-attached-scsi.qcow2 \
-device nec-usb-xhci,id=xhci -device usb-storage,bus=xhci.0,drive=stick
以下はとりあえず無害のようですが、umass0
までは認識されてもsd(4)
までは進まないようです。
usbd_free_xfer: timeout_handle pending
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019 The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California. All rights reserved.
NetBSD 9.99.26 (GENERIC) #0: Tue Dec 17 19:12:50 UTC 2019
mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC
total memory = 127 MB
avail memory = 98568 KB
pool redzone disabled for 'buf4k'
pool redzone disabled for 'buf64k'
rnd: seeded with 256 bits
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
running cgd selftest aes-xts-256 aes-xts-512 done
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
QEMU Standard PC (i440FX + PIIX, 1996) (pc-i440fx-4.2)
mainbus0 (root)
ACPI: RSDP 0x00000000000F5870 000014 (v00 BOCHS )
ACPI: RSDT 0x0000000007FE15C9 000030 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
ACPI: FACP 0x0000000007FE149D 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
ACPI: DSDT 0x0000000007FE0040 00145D (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001)
ACPI: FACS 0x0000000007FE0000 000040
ACPI: APIC 0x0000000007FE1511 000080 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
ACPI: HPET 0x0000000007FE1591 000038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
ACPI: 1 ACPI AML tables successfully acquired and loaded
ioapic0 at mainbus0 apid 0: pa 0xfec00000, version 0x20, 24 pins
cpu0 at mainbus0 apid 0
cpu0: QEMU Virtual CPU version 2.5+, id 0x663
cpu0: package 0, core 0, smt 0
cpu1 at mainbus0 apid 1
cpu1: QEMU Virtual CPU version 2.5+, id 0x663
cpu1: package 1, core 0, smt 0
acpi0 at mainbus0: Intel ACPICA 20191213
acpi0: X/RSDT: OemId <BOCHS ,BXPCRSDT,00000001>, AslId <BXPC,00000001>
LNKS: ACPI: Found matching pin for 0.1.INTA at func 3: 9
LNKC: ACPI: Found matching pin for 0.3.INTA at func 0: 11
LNKD: ACPI: Found matching pin for 0.4.INTA at func 0: 11
acpi0: SCI interrupting at int 9
acpi0: fixed power button present
timecounter: Timecounter "ACPI-Safe" frequency 3579545 Hz quality 900
hpet0 at acpi0: high precision event timer (mem 0xfed00000-0xfed00400)
timecounter: Timecounter "hpet0" frequency 100000000 Hz quality 2000
pckbc1 at acpi0 (KBD, PNP0303) (kbd port): io 0x60,0x64 irq 1
pckbc2 at acpi0 (MOU, PNP0F13) (aux port): irq 12
FDC0 (PNP0700) at acpi0 not configured
LPT (PNP0400) at acpi0 not configured
COM1 (PNP0501) at acpi0 not configured
qemufwcfg0 at acpi0 (FWCF, QEMU0002): io 0x510-0x51b
qemufwcfg0: <QEMU<
ACPI: Enabled 2 GPEs in block 00 to 0F
pckbd0 at pckbc1 (kbd slot)
pckbc1: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pms0 at pckbc1 (aux slot)
pckbc1: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0: Intel 82441FX (PMC) PCI and Memory Controller (rev. 0x02)
pcib0 at pci0 dev 1 function 0: Intel 82371SB (PIIX3) PCI-ISA Bridge (rev. 0x00)
piixide0 at pci0 dev 1 function 1: Intel 82371SB IDE Interface (PIIX3) (rev. 0x00)
piixide0: bus-master DMA support present
piixide0: primary channel wired to compatibility mode
piixide0: primary channel interrupting at ioapic0 pin 14
atabus0 at piixide0 channel 0
piixide0: secondary channel wired to compatibility mode
piixide0: secondary channel interrupting at ioapic0 pin 15
atabus1 at piixide0 channel 1
piixpm0 at pci0 dev 1 function 3: Intel 82371AB (PIIX4) Power Management Controller (rev. 0x03)
timecounter: Timecounter "piixpm0" frequency 3579545 Hz quality 1000
piixpm0: 24-bit timer
piixpm0: interrupting at ioapic0 pin 9
iic0 at piixpm0 port 0: I2C bus
vga0 at pci0 dev 2 function 0: vendor 1234 product 1111 (rev. 0x02)
wsdisplay0 at vga0 kbdmux 1: console (80x25, vt100 emulation), using wskbd0
wsmux1: connecting to wsdisplay0
drm at vga0 not configured
wm0 at pci0 dev 3 function 0: Intel i82540EM 1000BASE-T Ethernet (rev. 0x03)
wm0: interrupting at ioapic0 pin 11
wm0: 32-bit 33MHz PCI bus
wm0: 64 words (6 address bits) MicroWire EEPROM
wm0: Ethernet address 52:54:00:12:34:56
wm0: 0x200402<LOCK_EECD,IOH_VALID,WOL>
makphy0 at wm0 phy 1: Marvell 88E1011 Gigabit PHY, rev. 0
makphy0: Failed to access EADR. Are you an emulator?
makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
xhci0 at pci0 dev 4 function 0: Red Hat product 000d (rev. 0x01)
xhci0: interrupting at msix0 vec 0
xhci0: xHCI version 1.0
usb0 at xhci0: USB revision 3.0
usb1 at xhci0: USB revision 2.0
isa0 at pcib0
lpt0 at isa0 port 0x378-0x37b irq 7
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
attimer0 at isa0 port 0x40-0x43
pcppi0 at isa0 port 0x61
spkr0 at pcppi0: PC Speaker
wsbell at spkr0 not configured
midi0 at pcppi0: PC speaker
sysbeep0 at pcppi0
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
attimer0: attached to pcppi0
acpicpu0 at cpu0: ACPI CPU
acpicpu0: C1: HLT, lat 0 us, pow 0 mW
acpicpu1 at cpu1: ACPI CPU
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
uhub0 at usb0: NetBSD (0000) xHCI root hub (0000), class 9/0, rev 3.00/1.00, addr 0
uhub0: 4 ports with 4 removable, self powered
uhub1 at usb1: NetBSD (0000) xHCI root hub (0000), class 9/0, rev 2.00/1.00, addr 0
uhub1: 4 ports with 4 removable, self powered
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
IPsec: Initialized Security Association Processing.
usbd_free_xfer: timeout_handle pending
xhci0: invalid mps 2^64 for SS ep0, using 512
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
usbd_free_xfer: timeout_handle pending
umass0 at uhub0 port 1 configuration 1 interface 0
umass0: QEMU (0x46f4) USB Attached SCSI HBA (0x03), rev 3.00/0.00, addr 1
wd0 at atabus0 drive 0
wd0: <QEMU HARDDISK>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 3072 MB, 6241 cyl, 16 head, 63 sec, 512 bytes/sect x 6291456 sectors
wd0: GPT GUID: cf250d44-cfa0-478f-9269-d68811369ada
dk0 at wd0: "6fb45348-e6e1-44f0-a5c8-86cbae8b162f", 5242813 blocks at 64, type: ffs
dk1 at wd0: "25fe867a-0636-4b4a-b261-85228808017a", 1048543 blocks at 5242880, type: swap
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(piixide0:0:0): using PIO mode 4, DMA mode 2 (using DMA)
boot device: wd0
root on dk0 dumps on dk1
root file system type: ffs
kern.module.path=/stand/amd64/9.99.26/modules
clock: unknown CMOS layout
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)
USB Attached SCSI接続のマスストレージと、
qemuの
xhci
をNetBSDでエラーなく動かせるようにするという課題が明らかになったと言うことで。