start up virtual machine with ivshmem device

1 execute ivshmem_server on host

./home/xzl/Nahanni+/Nahanni/nahanni-guest-code/ivshmem-server/ivshmem_server -m 256 /tmp/ivshmem_socket -n dynamo
-m :the size of shared memory
/tmp/ivshmem_socket : the path to initializing the socket for communicating with the ivshmem_device in virtual machine 

2 start virtual machine

sudo /etc/init.d/networking restart

sudo qemu-system-x86_64 -m 1204 -hda /home/xzl/virtual_machine/ubuntu-12.04-amd64-first.img -localtime -net nic,vlan=0,macaddr=52-54-00-12-34-0,model=virtio -net tap,vlan=0,ifname=tap0,script=no -boot c -smp 2 -chardev socket,path=/tmp/ivshmem_socket,id=foo -device ivshmem,chardev=foo,size=256


3 check  whether linux kernel probed the ivshmem_device or not (on guest)

lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 RAM memory: Red Hat, Inc Device 1110

 The last one 00:04.0(busID provided by linux kernel) is the ivshmem_device.

 

 Look the device for details

 

ls /sys/bus/pci/devices/0000\:00\:04.0
broken_parity_status  consistent_dma_mask_bits  enable         local_cpulist  msi_bus    remove    resource0  subsystem         uevent
class                 device                    firmware_node  local_cpus     numa_node  rescan    resource1  subsystem_device  vendor
config                dma_mask_bits             irq            modalias       power      resource  resource2  subsystem_vendor

device : the device ID

vendor the device vendor


3 Install ivhshmem_device drive uio_ivshmem

cd kernel_module/uio
sudo make
sudo make install

make : create kernel module  of  the driver

make install : equal to "cp uio_ivshmem.ko /lib/modules/$(shell uname -r)/kernel/drivers/uio/ "


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值