SlideShare a Scribd company logo
QEMU AND DEVICE EMULATION
Yan Vugenfirer, yan@daynix.com
Daynix Computing LTD
Daynix Computing LTD
AGENDA
• Introduction to QEMU
• Development environment
• Examples of existing devices
• Adding a new device to
QEMU
Daynix Computing LTD
WHAT IS QEMU?
• Open source project (GPLv2.0+ license)
• Machine emulator
• Virtualizer
• Works together with KVM and Xen
Daynix Computing LTD
WHY SHOULDYOU CARE?
• Open source
• Easy to add additional devices
• Emulates different HW architectures
• Can be used for SW development long before
HW is ready
Daynix Computing LTD
GET IT NOW
• Project website: http://wiki.qemu.org/Main_Page
• Code repository: git clone git://git.qemu-
project.org/qemu.git
Daynix Computing LTD
PREPARING DEVELOPMENT
ENVIRONMENT
• Installing the packages on Ubuntu
• sudo apt-get update
• sudo apt-get install git
• sudo apt-get install build-essential
• sudo apt-get install pkg-config
• sudo apt-get install zlib zlib-dev
• sudo apt-get install zlib1g-dev zlib1g
• sudo apt-get install glib2.0
• sudo apt-get install libpixman-1-0
• sudo apt-get install libtool
• sudo apt-get install dh-autoreconf
• sudo apt-get install bridge-utils
Daynix Computing LTD
COMPILING QEMU
• git clone https://github.com/qemu/qemu.git
• cd qemu
• git submodule update --init pixman
• ./configure --disable-docs —target-list=x86_64-softmmu
• make -j 8
• Skip if development version only: make install
Daynix Computing LTD
NETWORK CONFIGURATION
Linux host
Virtual machine
QEMU process
NIC
Linux bridge
Physical NIC
Daynix Computing LTD
NETWORK CONFIGURATION
• On the host edit /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
#iface eth0 inet dhcp
iface eth0 inet manual
auto br0
iface br0 inet dhcp
bridge_ports eth0
Daynix Computing LTD
#!/bin/sh
switch=br0
/sbin/ifconfig $1 promisc 0.0.0.0
/sbin/brctl addif ${switch} $1
QEMU-IFUP SCRIPT
• Create qemu-ifup script with following content
Daynix Computing LTD
STORAGE
• Download Ubuntu server - http://
www.ubuntu.com/download/server
• CreateVM image
• qemu-img create -f qcow ubuntu.qcow 8G
Daynix Computing LTD
RUNNINGYOU FIRSTVIRTUAL
MACHINE
./qemu/x86_64-softmmu/qemu-system-x86_64 
-M pc -name Test_VM -smp 2 -m 512M 
-drive file=/home/qemu/images/ubuntu.qcow,if=ide 
-usbdevice tablet 
-boot order=cdn,once=c,menu=on 
-netdev tap,id=hostnet1,script=/home/qemu/dev/qemu-
ifup,ifname=testvm_nic 
-device e1000,netdev=hostnet1,mac=56:54:46:6b:64:22,bus=pci.
0,id=e1000_01 
-cdrom /ISO/ubuntu-14.04.1-server-amd64.iso 
-vnc :5
Daynix Computing LTD
CONNECTINGTOVM
• Use theVNC viewer of your choice
• ssh after you configured networking
Daynix Computing LTD
CODETREE
• cd qemu/HW
Daynix Computing LTD
QEMU DEVICE MODEL
• QDev device model abstraction
• Tree of devices connected by buses
• Represented by DeviceState and BusState
• Devices have common API
• Devices have properties
• Check include/hw/qdev-core.h for more info
Daynix Computing LTD
EXAMPLES OF EXISTING
DEVICES
• e1000
• qemu/hw/net/e1000.c
• virtio family -base code
• qemu/hw/virtio/virtio-pci.c, qemu/hw/virtio/virtio-rng.c
• virtio-net
• qemu/hw/net/virtio-net.c
• vmxnet3
• qemu/hw/net/vmxnet3.c
LET’S CODE!
Daynix Computing LTD
ADDING NEW DEVICE
• Basic source file for the device
• Enable the compilation of the device
• Command line options
• Step by step enhancement of the device
Daynix Computing LTD
ADDING NEW DEVICE
• In qemu/HW/net/ let’s create devix.c
• Add CONFIG_DEVIX_PCI option to default-configs/
pci.mak
• Add devix.o to hw/net/Makefile.objs
Daynix Computing LTD
COMPILATION
diff --git a/default-configs/pci.mak b/default-configs/
pci.mak
index 91b1e92..fcf2cf2 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -30,3 +30,4 @@ CONFIG_IPACK=y
CONFIG_WDT_IB6300ESB=y
CONFIG_PCI_TESTDEV=y
CONFIG_NVME_PCI=y
+CONFIG_DEVIX_PCI=y
Daynix Computing LTD
COMPILATION
diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
index ea93293..7800755 100644
--- a/hw/net/Makefile.objs
+++ b/hw/net/Makefile.objs
@@ -10,6 +10,7 @@ common-obj-$(CONFIG_E1000_PCI) += e1000.o
common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o
common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet_tx_pkt.o
vmxnet_rx_pkt.o
common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o
+common-obj-$(CONFIG_DEVIX_PCI) += devix.o
Daynix Computing LTD
REGISTERYOUR DEVICETYPE
static const TypeInfo devix_info = {
.name = TYPE_DEVIX,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(DEVIXState),
.class_init = devix_class_init,
.instance_init = devix_instance_init,
};
static void devix_register_types(void)
{
DVX_CBPRN("devix_register_types called...");
type_register_static(&devix_info);
}
type_init(devix_register_types)
Daynix Computing LTD
DEVICETYPE INITIALIZATION
static void devix_class_init(ObjectClass *class, void *data)
{
DeviceClass *dc = DEVICE_CLASS(class);
PCIDeviceClass *c = PCI_DEVICE_CLASS(class);
c->init = devix_pci_init;
c->exit = devix_pci_uninit;
c->vendor_id = PCI_VENDOR_ID_DAYNIX;
c->device_id = PCI_DEVICE_ID_DAYNIX_DEVIX;
c->revision = PCI_DEVICE_ID_DAYNIX_DEVIX_REVISION;
c->class_id = PCI_CLASS_NETWORK_ETHERNET;
c->subsystem_vendor_id = PCI_VENDOR_ID_DAYNIX;
c->subsystem_id = PCI_DEVICE_ID_DAYNIX_DEVIX;
c->config_write = devix_write_config;
c->config_read = devix_read_config;
dc->desc = "Daynix educational device v1";
dc->reset = devix_qdev_reset;
dc->vmsd = &vmstate_devix;
dc->props = devix_properties;
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
}
Daynix Computing LTD
PCI CONFIGURATION SPACE
ACCESS CALLBACKS
static void uint32_t devix_read_config(PCIDevice *pci_dev,
uint32_t address, int len)
{
return pci_default_read_config(pci_dev, address, len);
}
static void
devix_write_config(PCIDevice *pci_dev, uint32_t address, uint32_t val,
int len)
{
pci_default_write_config(pci_dev, address, val, len);
}
• At this point we have PCI device
• No BARs or Interrupts… yet
Daynix Computing LTD
VM POINT OFVIEW
00:04.0 Ethernet controller: Device 9696:1234
(rev 01)
Subsystem: Device 9696:1234
Physical Slot: 4
Control: I/O+ Mem+ BusMaster- SpecCycle-
MemWINV- VGASnoop- ParErr- Stepping- SERR+
FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr-
DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR-
<PERR- INTx-
• sudo lspci -vv
Daynix Computing LTD
• Register IO and memory space
• Configure interrupts
• Our own device initializations
PCI INITIALIZATION
Daynix Computing LTD
MEMORY REGIONS
typedef struct {
PCIDevice parent_obj;
MemoryRegion bar0;
MemoryRegion bar1;
} DEVIXState;
• Add placeholders for memory regions into device
state structure
Daynix Computing LTD
REGISTER MEMORY REGIONS
static int devix_pci_init(PCIDevice *pci_dev)
{
DeviceState *dev = DEVICE(pci_dev);
DEVIXState *s = DEVIX(pci_dev);
DVX_CBPRN("Starting init...");
memory_region_init_io(&s->bar0, OBJECT(s), &b0_ops, s,
"devix-b0", DEVIX_BAR0_SIZE);
pci_register_bar(pci_dev, DEVIX_BAR0_IDX,
PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0);
memory_region_init_io(&s->bar1, OBJECT(s), &b1_ops, s,
"devix-b1", DEVIX_BAR1_SIZE);
pci_register_bar(pci_dev, DEVIX_BAR1_IDX,
PCI_BASE_ADDRESS_SPACE_IO, &s->bar1);
devix_net_init(s);
return 0;
}
Daynix Computing LTD
ACCESS CALLBACKS
static const MemoryRegionOps b0_ops = {
.read = devix_io_bar0_read,
.write = devix_io_bar0_write,
.endianness = DEVICE_LITTLE_ENDIAN,
.impl = {
.min_access_size = 4,
.max_access_size = 4,
},
};
Daynix Computing LTD
ACCESS CALLBACKS - WRITE
static void
devix_io_bar0_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
DEVIXState *s = opaque;
DVX_WRPRN("BAR0 write [%" PRIx64 "] = %"
PRIx64 ", size %d",
(uint64_t) addr, val, size);
}
• Size
• Address
• Value
Daynix Computing LTD
ACCESS CALLBACKS - READ
static uint64_t
devix_io_bar0_read(void *opaque, hwaddr addr,
unsigned size)
{
DEVIXState *s = opaque;
uint64_t ret = 0;
DVX_CBPRN("Read BAR0 [%" PRIx64 "], size
%d",(uint64_t) addr, size);
return ret; /* Returns value of the read
register */
}
• Size
• Address
• Return the
value
Daynix Computing LTD
VM POINT OFVIEW
00:04.0 Ethernet controller: Device 9696:1234
(rev 01)
Subsystem: Device 9696:1234
Physical Slot: 4
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV-
VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr-
DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
INTx-
Region 0: Memory at febd2000 (32-bit, non-
prefetchable) [size=4K]
Region 1: I/O ports at c000 [size=512]
• sudo lspci -vv
Daynix Computing LTD
LEGACY INTERRUPTS
• Add interrupt line in pci_init
/* Interrupt pin A */
pci_dev->config[PCI_INTERRUPT_PIN] = 0x01;
Daynix Computing LTD
LEGACY INTERRUPTS
• Call to void pci_irq_assert(PCIDevice *pci_dev)
when you want to raise interrupt
• Call void pci_irq_deassert(PCIDevice *pci_dev) to
de-assert interrupt from one of your registers
callback depending on clear interrupt logic
Daynix Computing LTD
VM POINT OFVIEW
00:04.0 Ethernet controller: Device 9696:1234
(rev 01)
Subsystem: Device 9696:1234
Physical Slot: 4
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV-
VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr-
DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
INTx-
Interrupt: pin A routed to IRQ 11
Region 0: Memory at febd2000 (32-bit, non-
prefetchable) [size=4K]
Region 1: I/O ports at c000 [size=512]
• sudo lspci -vv
Daynix Computing LTD
“DMA”
• Actually guest memory access
• Synchronous
• void cpu_physical_memory_read(hwaddr addr, void *buf, int len)
• void cpu_physical_memory_write(hwaddr addr, const void *buf, int len)
• iov_xxx functions
• Check include/exec/cpu-common.h for more access functions
DEMO
Daynix Computing LTD
WHAT’S NEXT?
• Add network back end
• Add MSI and MSI-x support
• Littlebig endian
considerations
Q&A
Daynix Computing LTD
LINKS
• Project website: http://wiki.qemu.org/Main_Page
• Code repository: git clone git://git.qemu-project.org/
qemu.git
• QEMU new device model - http://www.linux-kvm.org/
wiki/images/f/fe/2010-forum-armbru-qdev.pdf
• Daynix - www.daynix.com
Ad

More Related Content

What's hot (20)

Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux Kernel
Adrian Huang
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
Linaro
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
Hands-on ethernet driver
Hands-on ethernet driverHands-on ethernet driver
Hands-on ethernet driver
SUSE Labs Taipei
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
Adrian Huang
 
Interrupt Affinityについて
Interrupt AffinityについてInterrupt Affinityについて
Interrupt Affinityについて
Takuya ASADA
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
Buland Singh
 
Memory Compaction in Linux Kernel.pdf
Memory Compaction in Linux Kernel.pdfMemory Compaction in Linux Kernel.pdf
Memory Compaction in Linux Kernel.pdf
Adrian Huang
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
National Cheng Kung University
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24
Varun Mahajan
 
Linux Kernel Crashdump
Linux Kernel CrashdumpLinux Kernel Crashdump
Linux Kernel Crashdump
Marian Marinov
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
Emertxe Information Technologies Pvt Ltd
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
Jiann-Fuh Liaw
 
Physical Memory Models.pdf
Physical Memory Models.pdfPhysical Memory Models.pdf
Physical Memory Models.pdf
Adrian Huang
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
Linaro
 
Kernel crashdump
Kernel crashdumpKernel crashdump
Kernel crashdump
Adrien Mahieux
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver Overview
RajKumar Rampelli
 
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Anne Nicolas
 
Slab Allocator in Linux Kernel
Slab Allocator in Linux KernelSlab Allocator in Linux Kernel
Slab Allocator in Linux Kernel
Adrian Huang
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
Houcheng Lin
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
Linaro
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
Adrian Huang
 
Interrupt Affinityについて
Interrupt AffinityについてInterrupt Affinityについて
Interrupt Affinityについて
Takuya ASADA
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
Buland Singh
 
Memory Compaction in Linux Kernel.pdf
Memory Compaction in Linux Kernel.pdfMemory Compaction in Linux Kernel.pdf
Memory Compaction in Linux Kernel.pdf
Adrian Huang
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24
Varun Mahajan
 
Linux Kernel Crashdump
Linux Kernel CrashdumpLinux Kernel Crashdump
Linux Kernel Crashdump
Marian Marinov
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
Jiann-Fuh Liaw
 
Physical Memory Models.pdf
Physical Memory Models.pdfPhysical Memory Models.pdf
Physical Memory Models.pdf
Adrian Huang
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
Linaro
 
Linux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver OverviewLinux Kernel MMC Storage driver Overview
Linux Kernel MMC Storage driver Overview
RajKumar Rampelli
 
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Anne Nicolas
 

Similar to Qemu device prototyping (20)

Rmll Virtualization As Is Tool 20090707 V1.0
Rmll Virtualization As Is Tool 20090707 V1.0Rmll Virtualization As Is Tool 20090707 V1.0
Rmll Virtualization As Is Tool 20090707 V1.0
guest72e8c1
 
RMLL / LSM 2009
RMLL / LSM 2009RMLL / LSM 2009
RMLL / LSM 2009
Franck_Villaume
 
NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)
Ryo ONODERA
 
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLESQuick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Jan Kalcic
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
Ajeet Singh Raina
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
Dmitry Vyukov
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
JayakumarS71
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
Hsi-Kai Wang
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
Anne Nicolas
 
LSA2 - 02 Namespaces
LSA2 - 02  NamespacesLSA2 - 02  Namespaces
LSA2 - 02 Namespaces
Marian Marinov
 
Razor, the Provisioning Toolbox - PuppetConf 2014
Razor, the Provisioning Toolbox - PuppetConf 2014Razor, the Provisioning Toolbox - PuppetConf 2014
Razor, the Provisioning Toolbox - PuppetConf 2014
Puppet
 
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdfStorage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
aaajjj4
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
ssuserb4d806
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
videos
 
Advanced Diagnostics 2
Advanced Diagnostics 2Advanced Diagnostics 2
Advanced Diagnostics 2
Aero Plane
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
DevOps.com
 
See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...
LinuxCon ContainerCon CloudOpen China
 
Known basic of NFV Features
Known basic of NFV FeaturesKnown basic of NFV Features
Known basic of NFV Features
Raul Leite
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
data://disrupted®
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
Ben Hall
 
Rmll Virtualization As Is Tool 20090707 V1.0
Rmll Virtualization As Is Tool 20090707 V1.0Rmll Virtualization As Is Tool 20090707 V1.0
Rmll Virtualization As Is Tool 20090707 V1.0
guest72e8c1
 
NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)NetBSD on Google Compute Engine (en)
NetBSD on Google Compute Engine (en)
Ryo ONODERA
 
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLESQuick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Quick-and-Easy Deployment of a Ceph Storage Cluster with SLES
Jan Kalcic
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
Ajeet Singh Raina
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
Dmitry Vyukov
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
JayakumarS71
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
Hsi-Kai Wang
 
Kernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysisKernel Recipes 2015 - Kernel dump analysis
Kernel Recipes 2015 - Kernel dump analysis
Anne Nicolas
 
Razor, the Provisioning Toolbox - PuppetConf 2014
Razor, the Provisioning Toolbox - PuppetConf 2014Razor, the Provisioning Toolbox - PuppetConf 2014
Razor, the Provisioning Toolbox - PuppetConf 2014
Puppet
 
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdfStorage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
Storage-Performance-Tuning-for-FAST-Virtual-Machines_Fam-Zheng.pdf
aaajjj4
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
ssuserb4d806
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
videos
 
Advanced Diagnostics 2
Advanced Diagnostics 2Advanced Diagnostics 2
Advanced Diagnostics 2
Aero Plane
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
DevOps.com
 
See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...
LinuxCon ContainerCon CloudOpen China
 
Known basic of NFV Features
Known basic of NFV FeaturesKnown basic of NFV Features
Known basic of NFV Features
Raul Leite
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
data://disrupted®
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
Ben Hall
 
Ad

More from Yan Vugenfirer (14)

HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
Yan Vugenfirer
 
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
Receive side scaling (RSS) with eBPF in QEMU and virtio-netReceive side scaling (RSS) with eBPF in QEMU and virtio-net
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
Yan Vugenfirer
 
Implementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationImplementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migration
Yan Vugenfirer
 
Windows network teaming
Windows network teamingWindows network teaming
Windows network teaming
Yan Vugenfirer
 
Rebuild presentation - IoT Israel MeetUp
Rebuild presentation - IoT Israel MeetUpRebuild presentation - IoT Israel MeetUp
Rebuild presentation - IoT Israel MeetUp
Yan Vugenfirer
 
Rebuild presentation during Docker's Birthday party
Rebuild presentation during Docker's Birthday partyRebuild presentation during Docker's Birthday party
Rebuild presentation during Docker's Birthday party
Yan Vugenfirer
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
Yan Vugenfirer
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Microsoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setupMicrosoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setup
Yan Vugenfirer
 
UsbDk at a Glance 
UsbDk at a Glance UsbDk at a Glance 
UsbDk at a Glance 
Yan Vugenfirer
 
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Yan Vugenfirer
 
Advanced NDISTest options
Advanced NDISTest optionsAdvanced NDISTest options
Advanced NDISTest options
Yan Vugenfirer
 
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
Yan Vugenfirer
 
Windows guest debugging presentation from KVM Forum 2012
Windows guest debugging presentation from KVM Forum 2012Windows guest debugging presentation from KVM Forum 2012
Windows guest debugging presentation from KVM Forum 2012
Yan Vugenfirer
 
HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
HCK-CI: Enabling CI for Windows Guest Paravirtualized Drivers - Kostiantyn Ko...
Yan Vugenfirer
 
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
Receive side scaling (RSS) with eBPF in QEMU and virtio-netReceive side scaling (RSS) with eBPF in QEMU and virtio-net
Receive side scaling (RSS) with eBPF in QEMU and virtio-net
Yan Vugenfirer
 
Implementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationImplementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migration
Yan Vugenfirer
 
Windows network teaming
Windows network teamingWindows network teaming
Windows network teaming
Yan Vugenfirer
 
Rebuild presentation - IoT Israel MeetUp
Rebuild presentation - IoT Israel MeetUpRebuild presentation - IoT Israel MeetUp
Rebuild presentation - IoT Israel MeetUp
Yan Vugenfirer
 
Rebuild presentation during Docker's Birthday party
Rebuild presentation during Docker's Birthday partyRebuild presentation during Docker's Birthday party
Rebuild presentation during Docker's Birthday party
Yan Vugenfirer
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
Yan Vugenfirer
 
Microsoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setupMicrosoft Hardware Certification Kit (HCK) setup
Microsoft Hardware Certification Kit (HCK) setup
Yan Vugenfirer
 
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
Yan Vugenfirer
 
Advanced NDISTest options
Advanced NDISTest optionsAdvanced NDISTest options
Advanced NDISTest options
Yan Vugenfirer
 
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
QEMU Development and Testing Automation Using MS HCK - Anton Nayshtut and Yan...
Yan Vugenfirer
 
Windows guest debugging presentation from KVM Forum 2012
Windows guest debugging presentation from KVM Forum 2012Windows guest debugging presentation from KVM Forum 2012
Windows guest debugging presentation from KVM Forum 2012
Yan Vugenfirer
 
Ad

Recently uploaded (20)

PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 

Qemu device prototyping

  • 1. QEMU AND DEVICE EMULATION Yan Vugenfirer, [email protected] Daynix Computing LTD
  • 2. Daynix Computing LTD AGENDA • Introduction to QEMU • Development environment • Examples of existing devices • Adding a new device to QEMU
  • 3. Daynix Computing LTD WHAT IS QEMU? • Open source project (GPLv2.0+ license) • Machine emulator • Virtualizer • Works together with KVM and Xen
  • 4. Daynix Computing LTD WHY SHOULDYOU CARE? • Open source • Easy to add additional devices • Emulates different HW architectures • Can be used for SW development long before HW is ready
  • 5. Daynix Computing LTD GET IT NOW • Project website: http://wiki.qemu.org/Main_Page • Code repository: git clone git://git.qemu- project.org/qemu.git
  • 6. Daynix Computing LTD PREPARING DEVELOPMENT ENVIRONMENT • Installing the packages on Ubuntu • sudo apt-get update • sudo apt-get install git • sudo apt-get install build-essential • sudo apt-get install pkg-config • sudo apt-get install zlib zlib-dev • sudo apt-get install zlib1g-dev zlib1g • sudo apt-get install glib2.0 • sudo apt-get install libpixman-1-0 • sudo apt-get install libtool • sudo apt-get install dh-autoreconf • sudo apt-get install bridge-utils
  • 7. Daynix Computing LTD COMPILING QEMU • git clone https://github.com/qemu/qemu.git • cd qemu • git submodule update --init pixman • ./configure --disable-docs —target-list=x86_64-softmmu • make -j 8 • Skip if development version only: make install
  • 8. Daynix Computing LTD NETWORK CONFIGURATION Linux host Virtual machine QEMU process NIC Linux bridge Physical NIC
  • 9. Daynix Computing LTD NETWORK CONFIGURATION • On the host edit /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface #auto eth0 #iface eth0 inet dhcp iface eth0 inet manual auto br0 iface br0 inet dhcp bridge_ports eth0
  • 10. Daynix Computing LTD #!/bin/sh switch=br0 /sbin/ifconfig $1 promisc 0.0.0.0 /sbin/brctl addif ${switch} $1 QEMU-IFUP SCRIPT • Create qemu-ifup script with following content
  • 11. Daynix Computing LTD STORAGE • Download Ubuntu server - http:// www.ubuntu.com/download/server • CreateVM image • qemu-img create -f qcow ubuntu.qcow 8G
  • 12. Daynix Computing LTD RUNNINGYOU FIRSTVIRTUAL MACHINE ./qemu/x86_64-softmmu/qemu-system-x86_64 -M pc -name Test_VM -smp 2 -m 512M -drive file=/home/qemu/images/ubuntu.qcow,if=ide -usbdevice tablet -boot order=cdn,once=c,menu=on -netdev tap,id=hostnet1,script=/home/qemu/dev/qemu- ifup,ifname=testvm_nic -device e1000,netdev=hostnet1,mac=56:54:46:6b:64:22,bus=pci. 0,id=e1000_01 -cdrom /ISO/ubuntu-14.04.1-server-amd64.iso -vnc :5
  • 13. Daynix Computing LTD CONNECTINGTOVM • Use theVNC viewer of your choice • ssh after you configured networking
  • 15. Daynix Computing LTD QEMU DEVICE MODEL • QDev device model abstraction • Tree of devices connected by buses • Represented by DeviceState and BusState • Devices have common API • Devices have properties • Check include/hw/qdev-core.h for more info
  • 16. Daynix Computing LTD EXAMPLES OF EXISTING DEVICES • e1000 • qemu/hw/net/e1000.c • virtio family -base code • qemu/hw/virtio/virtio-pci.c, qemu/hw/virtio/virtio-rng.c • virtio-net • qemu/hw/net/virtio-net.c • vmxnet3 • qemu/hw/net/vmxnet3.c
  • 18. Daynix Computing LTD ADDING NEW DEVICE • Basic source file for the device • Enable the compilation of the device • Command line options • Step by step enhancement of the device
  • 19. Daynix Computing LTD ADDING NEW DEVICE • In qemu/HW/net/ let’s create devix.c • Add CONFIG_DEVIX_PCI option to default-configs/ pci.mak • Add devix.o to hw/net/Makefile.objs
  • 20. Daynix Computing LTD COMPILATION diff --git a/default-configs/pci.mak b/default-configs/ pci.mak index 91b1e92..fcf2cf2 100644 --- a/default-configs/pci.mak +++ b/default-configs/pci.mak @@ -30,3 +30,4 @@ CONFIG_IPACK=y CONFIG_WDT_IB6300ESB=y CONFIG_PCI_TESTDEV=y CONFIG_NVME_PCI=y +CONFIG_DEVIX_PCI=y
  • 21. Daynix Computing LTD COMPILATION diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs index ea93293..7800755 100644 --- a/hw/net/Makefile.objs +++ b/hw/net/Makefile.objs @@ -10,6 +10,7 @@ common-obj-$(CONFIG_E1000_PCI) += e1000.o common-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet_tx_pkt.o vmxnet_rx_pkt.o common-obj-$(CONFIG_VMXNET3_PCI) += vmxnet3.o +common-obj-$(CONFIG_DEVIX_PCI) += devix.o
  • 22. Daynix Computing LTD REGISTERYOUR DEVICETYPE static const TypeInfo devix_info = { .name = TYPE_DEVIX, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(DEVIXState), .class_init = devix_class_init, .instance_init = devix_instance_init, }; static void devix_register_types(void) { DVX_CBPRN("devix_register_types called..."); type_register_static(&devix_info); } type_init(devix_register_types)
  • 23. Daynix Computing LTD DEVICETYPE INITIALIZATION static void devix_class_init(ObjectClass *class, void *data) { DeviceClass *dc = DEVICE_CLASS(class); PCIDeviceClass *c = PCI_DEVICE_CLASS(class); c->init = devix_pci_init; c->exit = devix_pci_uninit; c->vendor_id = PCI_VENDOR_ID_DAYNIX; c->device_id = PCI_DEVICE_ID_DAYNIX_DEVIX; c->revision = PCI_DEVICE_ID_DAYNIX_DEVIX_REVISION; c->class_id = PCI_CLASS_NETWORK_ETHERNET; c->subsystem_vendor_id = PCI_VENDOR_ID_DAYNIX; c->subsystem_id = PCI_DEVICE_ID_DAYNIX_DEVIX; c->config_write = devix_write_config; c->config_read = devix_read_config; dc->desc = "Daynix educational device v1"; dc->reset = devix_qdev_reset; dc->vmsd = &vmstate_devix; dc->props = devix_properties; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); }
  • 24. Daynix Computing LTD PCI CONFIGURATION SPACE ACCESS CALLBACKS static void uint32_t devix_read_config(PCIDevice *pci_dev, uint32_t address, int len) { return pci_default_read_config(pci_dev, address, len); } static void devix_write_config(PCIDevice *pci_dev, uint32_t address, uint32_t val, int len) { pci_default_write_config(pci_dev, address, val, len); }
  • 25. • At this point we have PCI device • No BARs or Interrupts… yet
  • 26. Daynix Computing LTD VM POINT OFVIEW 00:04.0 Ethernet controller: Device 9696:1234 (rev 01) Subsystem: Device 9696:1234 Physical Slot: 4 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- • sudo lspci -vv
  • 27. Daynix Computing LTD • Register IO and memory space • Configure interrupts • Our own device initializations PCI INITIALIZATION
  • 28. Daynix Computing LTD MEMORY REGIONS typedef struct { PCIDevice parent_obj; MemoryRegion bar0; MemoryRegion bar1; } DEVIXState; • Add placeholders for memory regions into device state structure
  • 29. Daynix Computing LTD REGISTER MEMORY REGIONS static int devix_pci_init(PCIDevice *pci_dev) { DeviceState *dev = DEVICE(pci_dev); DEVIXState *s = DEVIX(pci_dev); DVX_CBPRN("Starting init..."); memory_region_init_io(&s->bar0, OBJECT(s), &b0_ops, s, "devix-b0", DEVIX_BAR0_SIZE); pci_register_bar(pci_dev, DEVIX_BAR0_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar0); memory_region_init_io(&s->bar1, OBJECT(s), &b1_ops, s, "devix-b1", DEVIX_BAR1_SIZE); pci_register_bar(pci_dev, DEVIX_BAR1_IDX, PCI_BASE_ADDRESS_SPACE_IO, &s->bar1); devix_net_init(s); return 0; }
  • 30. Daynix Computing LTD ACCESS CALLBACKS static const MemoryRegionOps b0_ops = { .read = devix_io_bar0_read, .write = devix_io_bar0_write, .endianness = DEVICE_LITTLE_ENDIAN, .impl = { .min_access_size = 4, .max_access_size = 4, }, };
  • 31. Daynix Computing LTD ACCESS CALLBACKS - WRITE static void devix_io_bar0_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { DEVIXState *s = opaque; DVX_WRPRN("BAR0 write [%" PRIx64 "] = %" PRIx64 ", size %d", (uint64_t) addr, val, size); } • Size • Address • Value
  • 32. Daynix Computing LTD ACCESS CALLBACKS - READ static uint64_t devix_io_bar0_read(void *opaque, hwaddr addr, unsigned size) { DEVIXState *s = opaque; uint64_t ret = 0; DVX_CBPRN("Read BAR0 [%" PRIx64 "], size %d",(uint64_t) addr, size); return ret; /* Returns value of the read register */ } • Size • Address • Return the value
  • 33. Daynix Computing LTD VM POINT OFVIEW 00:04.0 Ethernet controller: Device 9696:1234 (rev 01) Subsystem: Device 9696:1234 Physical Slot: 4 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Region 0: Memory at febd2000 (32-bit, non- prefetchable) [size=4K] Region 1: I/O ports at c000 [size=512] • sudo lspci -vv
  • 34. Daynix Computing LTD LEGACY INTERRUPTS • Add interrupt line in pci_init /* Interrupt pin A */ pci_dev->config[PCI_INTERRUPT_PIN] = 0x01;
  • 35. Daynix Computing LTD LEGACY INTERRUPTS • Call to void pci_irq_assert(PCIDevice *pci_dev) when you want to raise interrupt • Call void pci_irq_deassert(PCIDevice *pci_dev) to de-assert interrupt from one of your registers callback depending on clear interrupt logic
  • 36. Daynix Computing LTD VM POINT OFVIEW 00:04.0 Ethernet controller: Device 9696:1234 (rev 01) Subsystem: Device 9696:1234 Physical Slot: 4 Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx- Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Interrupt: pin A routed to IRQ 11 Region 0: Memory at febd2000 (32-bit, non- prefetchable) [size=4K] Region 1: I/O ports at c000 [size=512] • sudo lspci -vv
  • 37. Daynix Computing LTD “DMA” • Actually guest memory access • Synchronous • void cpu_physical_memory_read(hwaddr addr, void *buf, int len) • void cpu_physical_memory_write(hwaddr addr, const void *buf, int len) • iov_xxx functions • Check include/exec/cpu-common.h for more access functions
  • 38. DEMO
  • 39. Daynix Computing LTD WHAT’S NEXT? • Add network back end • Add MSI and MSI-x support • Littlebig endian considerations
  • 40. Q&A
  • 41. Daynix Computing LTD LINKS • Project website: http://wiki.qemu.org/Main_Page • Code repository: git clone git://git.qemu-project.org/ qemu.git • QEMU new device model - http://www.linux-kvm.org/ wiki/images/f/fe/2010-forum-armbru-qdev.pdf • Daynix - www.daynix.com