Using QEMU to emulate DOS with passthrough SCSI access?

0

I'd like to use QEMU to emulate an MS-DOS system that will run a very specific proprietary software that needs to talk to a SCSI tape device.

I see that QEMU offers passthrough access to the host SCSI bus, and it looks like it can also emulate a SCSI adapter that the guest OS can use. But I have very little experience setting up QEMU with SCSI, and the documentation is a bit dense/convoluted.

Here is my QEMU command line so far:

qemu-system-i386 -m 32 -drive file="dosdrive.img",format=raw \
-option-rom "8xx_64.ROM" \
-drive file=/dev/sg2,if=scsi,bus=0,unit=0,format=raw \
-device dc390

The emulated BIOS definitely sees the tape drive:

enter image description here

...and it looks like DOS successfully loads the ASPI driver. But then, when the software actually tries reading from the SCSI device, it hangs, and I see these errors coming from QEMU:

lsi_scsi: error: Unhandled writeb 0xbc = 0x0
lsi_scsi: error: IO mappings not implemented

Does this mean I'm out of luck, and QEMU can't work with a SCSI tape drive? Or do I have a problem in my configuration?

Dmitry Brant

Posted 2019-05-08T01:06:39.910

Reputation: 260

Answers

1

I can't help directly but:

  • try latest QEMU 4 and git development version - maybe its already fixed (i can't find any of the error msg string in current git except: "lsi_scsi: " with other messages) - according to https://wiki.qemu.org/ChangeLog/4.0#SCSI -> "Several bugfixes in the LSI53C8xxA and ESP/PCscsi parallel SCSI adapters."
  • does your software work without passthrough (using an image file)?
  • does the tape works in another msdos software (maybe fastape http://www.dcee.net/Files/Utils/)?

TIP: always post the exact Vendor/Name/Version of the used components:

  • qemu
  • 8xx_64.ROM (maybe older versions working for you and do not need this mapping implemented)
  • Tekram DC390(W,U,F..?) - PCI SCSI Controller add-on board with SCSI Prozessor SYM53C895A? using sym driver under linux https://github.com/torvalds/linux/blob/master/drivers/scsi/Kconfig#L907?
  • ASPI driver (LSI aspi8xx.sys?)
  • your Tape-Drive is an ULT3580-TD5?
  • your Host System x86/x64?
  • Distro, KVM support?

i've compiled qemu git under ubuntu 19.04 x64 to compare it with your qemu/rom version

./i386-softmmu/qemu-system-i386 --version
  QEMU emulator version 4.0.50 (v4.0.0-312-gdf06df4f41-dirty)

./i386-softmmu/qemu-system-i386 -nographic -device dc390 -option-rom "../lsi_bios/8xx_64.rom"
  SeaBIOS (version rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org)

  iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+07F912F0+07EF12F0 C980

  LSI Logic Corp. Symbios SDMS (TM) V4.0 PCI SCSI BIOS, PCI Rev. 2.0, 2.1
  Copyright 1995-2001 LSI Logic Corp.
  PCI-4.19.00                            

so i found a more up to date rom 4.16/4.19 i think :)

i've got the 8xx_64.rom from https://www.broadcom.com/site-search?q=lsi_bios.zip

so i think you should really upgrade you components, qemu git build is easy and dont' need installation so you can just give it a try

another check would be using current qemu/rom and linux inside qemu just to test if the SCSI communication works well (maybe its not only qemu but also the DOS driver the problem here)

i also saw your post on the qemu mailing list

maybe this helps: https://k1024.org/posts/2019/2019-02-22-qemu-scsi-tape-passthrough/

I would go this way:

  1. Host x64: Debian/Ubuntu - i would prefer using latest version of the distros to reduce dependencie problems with qemu 4 and other version conflicts, i've got a removable disk slot with a dedicated hard disk for tests like this

  2. check that the tape drive is perfectly running under linux (to reduce problems down to DOS as far a possible) maybe there is a wild test for tape access available (read/write benchmark for example, https://blog.devnu11.net/2009/11/benchmarking-tape-drives/ or using the mt tool http://fibrevillage.com/storage/121-linux-mt-control-magnetic-tape-drive-operation) ---> i would do strong checks if that gets used in production

  3. build qemu 4.0 (qemu-system-i386) from Source (or find a pre-build package)

  4. install 32bit Ubuntu/Debian (same version) Non-UI Minimal system (faster to install, just for the test) in qemu with (virt-?)scsi-path-through

  5. re-test like in Step 2 (but inside of qemu)

--> now its 100% clear that scsi-pass-through works without data fails/strange errors etc. and its easier to get help on the qemu mailing list up to this stage - its getting dirty when DOS comes into play :)

6 .do the DOS test again (with qemu 4, up to date components) if something fails here only the BIOS or DOS, ASPI is to blame

if would split up 6 into - does the tape access work (for example with https://winworldpc.com/product/pc-tools/9x -> Central Point Backup) and after that if your software works

llm

Posted 2019-05-08T01:06:39.910

Reputation: 11