Title: How to get the broadcom pci 1570 web cam working in Linux using qemu with OS X VM


Objective: Alright, I'll try to make this short and sweet ...ughhh I hope. Anwyays, this article will detail / outline the steps I performed to get the Broadcom PCIE 1570 web cam found in late 2013 MacBook Pro's (MBPr) to work in a Linux environment.

So first thing is first, the Broadcom PCIE 1570 web cam is only working / tested in a OS X (10.10 Yosemite) VM running qemu. Secondly, I am sure you read the article where I outline building SPICE support for qemu, if not you can check it out here. Third, as always your gonna need a lot patience. :-/

So, with that being said, let's get started. So you already have qemu installed (yay). As of writing this, I am presently running qemu 2.1.50 (I'll admit I haven't done a git pull in quite some time.) If you haven't set up your qemu / OS X VM environment yet I first suggest you read this. It's the #1 hit doing a google search for qemu os x so it's not exactly hard to find. After you have the qemu / OS X (10.10) you'll probably run into the same problem I blogged about earlier in the month. Well if you haven't read this, now is a good time to do so. ;) If your like most people and too lazy to read the article well run the below command in a root shell because I was unable to get sudo to work with the command.

echo 1 > /sys/module/kvm/parameters/ignore_msrs
Next, after you have everything setup ...this would be a good time to backup ;) is to modify the kernel boot flag if your running GRUB, (sorry I can't help you people running syslinux, as I have never ran it.) Add the below line to your grub.cfg
After that, your gonna want to enable to the following kernel modules, Next, find the broadcom 1570 device on your system with the below command,
lspci -v
Once you have those enabled, and you found your device it is time to find vfio group of the broadcom 1570 device / web cam. In my particular case I did the following.
readlink /sys/bus/pci/devices/0000\:04\:00.0/iommu_group
which should give you output like the following,
Normally this is where most people would tell you to unbind the driver, but since there isn't a driver for this device we need not worry about this step :)
Next, your gonna want to find the vendor ID / device ID for your web cam.
lspci -n -s 04:00.0
The above command should give you output such as the following,
04:00.0 0480: 14e4:1570
Almost there, ...bind vfio-pci
echo 14e4 1570 > /sys/bus/pci/drivers/vfio-pci/new_id
chown the device node so it is accessible by qemu,
chown $USER:users /dev/vfio/11
Last ...last thing is to allocate some memory for the device.
ulimit -l 2621440

Now it's time to test your new web cam with the below command,

sudo qemu-system-x86_64 -enable-kvm -m 4096 -cpu core2duo -machine q35 -usb -device usb-kbd -device usb-mouse -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" -kernel VM/chameleon_svn2570_boot -smbios type=2 -device ide-drive,bus=ide.2,drive=MacHDD -drive id=MacHDD,if=none,file=VM/osx-yosemite.img -netdev user,id=hub0port0 -device e1000-82545em,netdev=hub0port0,id=mac_vnet0 -monitor stdio -device qxl-vga -device vfio-pci,host=04:00.0

If all is well you should see something like the following,

Article id: 27

article.user_id = 1
current_user.id = article.meta_description = "How to get the broadcom pci 1570 web cam working in Linux using qemu with OS X VM"


Add a comment:

Back | Edit