Re: xen pci passthrough

2014-04-08 bef zés Kosa Attila
On Fri, Apr 04, 2014 at 02:19:42PM +0200, Kosa Attila wrote:
> Van egy jo kis gep, amin Wheezy van xen-nel (kinomban mar

Asus H87-Plus alaplap, Intel Core i7-4771-es procival. Lehetseges
lenne, hogy a H87 chipset nem tamogatja az Intel VT-d
technologiat? Itt mintha erre lenne utalas:
http://forums.anandtech.com/archive/index.php/t-2326402.html

-- 
Udvozlettel
Zsiga
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf.linux.rulez.org/mailman/listinfo/linux


Re: xen pci passthrough

2014-04-07 bef zés Kosa Attila
On Fri, Apr 04, 2014 at 08:36:39PM +0200, Szalontai, Zoltan wrote:
> On Fri, Apr 04, 2014 at 02:19:42PM +0200, Kosa Attila wrote:
> > 
> > # grep pci /etc/default/grub
> > #GRUB_CMDLINE_LINUX="ipv6.disable=1 
> > xen-pciback.hide=(:00:14.0)(:00:1d.0)"
> > GRUB_CMDLINE_LINUX="ipv6.disable=1 xen-pciback.hide=(00:14.0)(00:1d.0)"

A xen-pciback.hide reszeket kiszedtem, reboot, es utana neztem az
irq-kat.

> Én kvm-mel használom és 3.2.xx kernellel, de azt tapasztaltam, hogy az
> egy IRQ-n lévő összes eszközt át kell adni a pci-stub-nak.
> Azaz nálam:
> $ grep 20: /proc/interrupts
>  20:  62025  58372   IO-APIC-fasteoi   ehci_hcd:usb2, uhci_hcd:usb3, 
> uhci_hcd:usb6
> 
> Ha az usb2-t oda akarom adni a kvm-nek akkor az usb3-at és az usb6-ot
> is át kell adni a pci-stub-nak.

# cat /proc/interrupts
   CPU0
  1:  9  xen-pirq-ioapic-edge  i8042
  8:  0  xen-pirq-ioapic-edge  rtc0
  9:  3  xen-pirq-ioapic-level  acpi
 23: 37  xen-pirq-ioapic-level  ehci_hcd:usb1
 40:   3477  xen-percpu-virq  timer0
 41:   3450  xen-percpu-ipi   resched0
 42:430  xen-percpu-ipi   callfunc0
 43:  0  xen-percpu-virq  debug0
 44:392  xen-percpu-ipi   callfuncsingle0
 45:512  xen-percpu-ipi   irqwork0
 46:180   xen-dyn-event evtchn:xenstored
 47: 239576   xen-dyn-event evtchn:qemu-dm
 48:  83629   xen-dyn-event evtchn:qemu-dm
 49:   4918   xen-dyn-event blkif-backend
 50:   6153   xen-dyn-event blkif-backend
 51:  2   xen-dyn-event vif1.0
 64:   1579   xen-dyn-event xenbus
 65:  0  xen-percpu-virq  xen-pcpu
 68:  16445  xen-pirq-msi   ahci
 69: 13  xen-pirq-msi   mei_me
 70: 19  xen-pirq-msi   xhci_hcd
 72:  6  xen-pirq-msi   i915
 73: 94  xen-pirq-msi-x eth1-rx-0
 74: 53  xen-pirq-msi-x eth1-tx-0
 75:  2  xen-pirq-msi-x eth1
 76:888   xen-dyn-event evtchn:xenstored
 77:  0   xen-dyn-event evtchn:xenstored
NMI:  0   Non-maskable interrupts
LOC:  0   Local timer interrupts
SPU:  0   Spurious interrupts
PMI:  0   Performance monitoring interrupts
IWI:512   IRQ work interrupts
RTR:  0   APIC ICR read retries
RES:   3450   Rescheduling interrupts
CAL:822   Function call interrupts
TLB:  0   TLB shootdowns
TRM:  0   Thermal event interrupts
THR:  0   Threshold APIC interrupts
MCE:  0   Machine check exceptions
MCP:  1   Machine check polls
ERR:  0
MIS:  0

Az usb1 a 23-as irq-n van. A masik usb-nek a 70-es irq-n levo
xhci_hcd-t gondolnam, de nem vagyok biztos benne. Azonban azt nem
tudom, hogy a xen-pirq-ioapic-level-t es/vagy a xen-pirq-msi-t
hogyan adhatnam at a guest-nek...

-- 
Udvozlettel
Zsiga
_
linux lista  -  linux@mlf.linux.rulez.org
http://mlf.linux.rulez.org/mailman/listinfo/linux


Re: xen pci passthrough

2014-04-04 bef zés Szalontai, Zoltan
Szia!

On Fri, Apr 04, 2014 at 02:19:42PM +0200, Kosa Attila wrote:
> Hello!
> Van egy jo kis gep, amin Wheezy van xen-nel (kinomban mar
> backportos, 3.13-as kernellel).
> 
> # grep 'model name' /proc/cpuinfo 
> model name  : Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz
> 
> # lspci 
> 00:00.0 Host bridge: Intel Corporation Haswell DRAM Controller (rev 06)
> 00:01.0 PCI bridge: Intel Corporation Haswell PCI Express x16 Controller (rev 
> 06)
> 00:02.0 VGA compatible controller: Intel Corporation Haswell Integrated 
> Graphics Controller (rev 06)
> 00:03.0 Audio device: Intel Corporation Haswell HD Audio Controller (rev 06)
> 00:14.0 USB controller: Intel Corporation Lynx Point USB xHCI Host Controller 
> (rev 05)
> 00:16.0 Communication controller: Intel Corporation Lynx Point MEI Controller 
> #1 (rev 04)
> 00:1a.0 USB controller: Intel Corporation Lynx Point USB Enhanced Host 
> Controller #2 (rev 05)
> 00:1c.0 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #1 
> (rev d5)
> 00:1c.1 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #2 
> (rev d5)
> 00:1c.2 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #3 
> (rev d5)
> 00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d5)
> 00:1d.0 USB controller: Intel Corporation Lynx Point USB Enhanced Host 
> Controller #1 (rev 05)
> 00:1f.0 ISA bridge: Intel Corporation Lynx Point LPC Controller (rev 05)
> 00:1f.2 RAID bus controller: Intel Corporation 82801 SATA Controller [RAID 
> mode] (rev 05)
> 00:1f.3 SMBus: Intel Corporation Lynx Point SMBus Controller (rev 05)
> 03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network 
> Connection
> 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B 
> PCI Express Gigabit Ethernet controller (rev 0c)
> 05:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge 
> (rev 04)
> 
> Van rajta egy virtualis gep, aminek oda szeretnem adni az usb
> portokat. Mar egy csomo mindennel probalkoztam, de nem akar
> mukodni, a virtualis gep inditasakor mindig ezt kapom:
> # xm create /etc/xen/windows-xp.cfg 
> Using config file "/etc/xen/windows-xp.cfg".
> Error: (22, 'Invalid argument')
> 
> # grep iommu /etc/default/grub 
> GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M iommu=1"
> 
> Az iommu=1 helyett mar probaltam az "iommu=pass-through" es az
> "iommu=dom0-passthrough" opciokkal is, de ugy sem mukodott.
> 
> # grep pci /etc/default/grub
> #GRUB_CMDLINE_LINUX="ipv6.disable=1 
> xen-pciback.hide=(:00:14.0)(:00:1d.0)"
> GRUB_CMDLINE_LINUX="ipv6.disable=1 xen-pciback.hide=(00:14.0)(00:1d.0)"
> Mind a ket variacioval probalkoztam mar...
> 
> # cat /etc/modprobe.d/xen-pciback.conf 
> options xen-pciback passthrough=1
> 
> A xen-pciback es a pci-stub modulokkal is megprobaltam,
> termeszetesen kulon-kulon, reboot volt a probalkozasok kozott,
> hogy tuti "uresen" induljon minden...
> 
> # cat usb_hozzarendeles_xen-pciback.sh 
> #!/bin/bash
> 
> modprobe xen-pciback
> 
> echo ":00:14.0" > /sys/bus/pci/devices/\:00\:14.0/driver/unbind
> echo ":00:14.0" > /sys/bus/pci/drivers/pciback/new_slot
> echo ":00:14.0" > /sys/bus/pci/drivers/pciback/bind
> 
> echo ":00:1d.0" > /sys/bus/pci/devices/\:00\:1d.0/driver/unbind
> echo ":00:1d.0" > /sys/bus/pci/drivers/pciback/new_slot
> echo ":00:1d.0" > /sys/bus/pci/drivers/pciback/bind
> 
> # cat usb_hozzarendeles_pci-stub.sh 
> #!/bin/bash
> 
> modprobe pci_stub
> 
> echo "8086 8c31" > /sys/bus/pci/drivers/pci-stub/new_id
> echo ":00:14.0" > /sys/bus/pci/devices/\:00\:14.0/driver/unbind
> echo ":00:14.0" > /sys/bus/pci/drivers/pci-stub/bind
> 
> echo "8086 8c26" > /sys/bus/pci/drivers/pci-stub/new_id
> echo ":00:1d.0" > /sys/bus/pci/devices/\:00\:1d.0/driver/unbind
> echo ":00:1d.0" > /sys/bus/pci/drivers/pci-stub/bind
> 
> Barmelyik fenti szkriptet is futtatom, ezt kapom:
> # xm pci-list-assignable-devices
> :00:14.0
> :00:1d.0
> 
> # cat /etc/xen/windows-xp.cfg
> kernel = 'hvmloader'
> builder = 'hvm'
> vcpus = '2'
> memory = '3280'
> disk = [ 'phy:/dev/mapper/VG-xp,hda,w',
>  'phy:/dev/mapper/SSD-xp--data,hdb,w']
> name = 'windows-xp'
> vif = ['mac=00:00:00:00:00:11,bridge=br0,model=e1000']
> on_poweroff = 'destroy'
> on_reboot = 'restart'
> on_crash = 'restart'
> boot = 'c'
> acpi = '1'
> apic = '1'
> viridian = '1'
> xen_platform_pci = '1'
> vfb = [ 
> 'vnc=1,sdl=0,vncdisplay=1,vnclisten=127.0.0.1,display=1,vncpasswd=jelszo,keymap=hu']
> stdvga = '0'
> usb = '1'
> usbdevice = 'tablet'
> pci = [ '00:14.0' , '00:1d.0' ]
> 
> # lspci -vv | egrep -i --colour flreset
> ExtTag- RBE+ FLReset-
> ExtTag- RBE- FLReset+
> ExtTag- RBE+ FLReset-
> ExtTag- RBE+ FLReset-
> ExtTag- RBE+ FLReset-
> ExtTag- RBE+ FLReset-
> ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
>  

xen pci passthrough

2014-04-04 bef zés Kosa Attila
Hello!
Van egy jo kis gep, amin Wheezy van xen-nel (kinomban mar
backportos, 3.13-as kernellel).

# grep 'model name' /proc/cpuinfo 
model name  : Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz

# lspci 
00:00.0 Host bridge: Intel Corporation Haswell DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Haswell PCI Express x16 Controller (rev 
06)
00:02.0 VGA compatible controller: Intel Corporation Haswell Integrated 
Graphics Controller (rev 06)
00:03.0 Audio device: Intel Corporation Haswell HD Audio Controller (rev 06)
00:14.0 USB controller: Intel Corporation Lynx Point USB xHCI Host Controller 
(rev 05)
00:16.0 Communication controller: Intel Corporation Lynx Point MEI Controller 
#1 (rev 04)
00:1a.0 USB controller: Intel Corporation Lynx Point USB Enhanced Host 
Controller #2 (rev 05)
00:1c.0 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #1 (rev 
d5)
00:1c.1 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #2 (rev 
d5)
00:1c.2 PCI bridge: Intel Corporation Lynx Point PCI Express Root Port #3 (rev 
d5)
00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d5)
00:1d.0 USB controller: Intel Corporation Lynx Point USB Enhanced Host 
Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation Lynx Point LPC Controller (rev 05)
00:1f.2 RAID bus controller: Intel Corporation 82801 SATA Controller [RAID 
mode] (rev 05)
00:1f.3 SMBus: Intel Corporation Lynx Point SMBus Controller (rev 05)
03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI 
Express Gigabit Ethernet controller (rev 0c)
05:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge 
(rev 04)

Van rajta egy virtualis gep, aminek oda szeretnem adni az usb
portokat. Mar egy csomo mindennel probalkoztam, de nem akar
mukodni, a virtualis gep inditasakor mindig ezt kapom:
# xm create /etc/xen/windows-xp.cfg 
Using config file "/etc/xen/windows-xp.cfg".
Error: (22, 'Invalid argument')

# grep iommu /etc/default/grub 
GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M iommu=1"

Az iommu=1 helyett mar probaltam az "iommu=pass-through" es az
"iommu=dom0-passthrough" opciokkal is, de ugy sem mukodott.

# grep pci /etc/default/grub
#GRUB_CMDLINE_LINUX="ipv6.disable=1 
xen-pciback.hide=(:00:14.0)(:00:1d.0)"
GRUB_CMDLINE_LINUX="ipv6.disable=1 xen-pciback.hide=(00:14.0)(00:1d.0)"
Mind a ket variacioval probalkoztam mar...

# cat /etc/modprobe.d/xen-pciback.conf 
options xen-pciback passthrough=1

A xen-pciback es a pci-stub modulokkal is megprobaltam,
termeszetesen kulon-kulon, reboot volt a probalkozasok kozott,
hogy tuti "uresen" induljon minden...

# cat usb_hozzarendeles_xen-pciback.sh 
#!/bin/bash

modprobe xen-pciback

echo ":00:14.0" > /sys/bus/pci/devices/\:00\:14.0/driver/unbind
echo ":00:14.0" > /sys/bus/pci/drivers/pciback/new_slot
echo ":00:14.0" > /sys/bus/pci/drivers/pciback/bind

echo ":00:1d.0" > /sys/bus/pci/devices/\:00\:1d.0/driver/unbind
echo ":00:1d.0" > /sys/bus/pci/drivers/pciback/new_slot
echo ":00:1d.0" > /sys/bus/pci/drivers/pciback/bind

# cat usb_hozzarendeles_pci-stub.sh 
#!/bin/bash

modprobe pci_stub

echo "8086 8c31" > /sys/bus/pci/drivers/pci-stub/new_id
echo ":00:14.0" > /sys/bus/pci/devices/\:00\:14.0/driver/unbind
echo ":00:14.0" > /sys/bus/pci/drivers/pci-stub/bind

echo "8086 8c26" > /sys/bus/pci/drivers/pci-stub/new_id
echo ":00:1d.0" > /sys/bus/pci/devices/\:00\:1d.0/driver/unbind
echo ":00:1d.0" > /sys/bus/pci/drivers/pci-stub/bind

Barmelyik fenti szkriptet is futtatom, ezt kapom:
# xm pci-list-assignable-devices
:00:14.0
:00:1d.0

# cat /etc/xen/windows-xp.cfg
kernel = 'hvmloader'
builder = 'hvm'
vcpus = '2'
memory = '3280'
disk = [ 'phy:/dev/mapper/VG-xp,hda,w',
 'phy:/dev/mapper/SSD-xp--data,hdb,w']
name = 'windows-xp'
vif = ['mac=00:00:00:00:00:11,bridge=br0,model=e1000']
on_poweroff = 'destroy'
on_reboot = 'restart'
on_crash = 'restart'
boot = 'c'
acpi = '1'
apic = '1'
viridian = '1'
xen_platform_pci = '1'
vfb = [ 
'vnc=1,sdl=0,vncdisplay=1,vnclisten=127.0.0.1,display=1,vncpasswd=jelszo,keymap=hu']
stdvga = '0'
usb = '1'
usbdevice = 'tablet'
pci = [ '00:14.0' , '00:1d.0' ]

# lspci -vv | egrep -i --colour flreset
ExtTag- RBE+ FLReset-
ExtTag- RBE- FLReset+
ExtTag- RBE+ FLReset-
ExtTag- RBE+ FLReset-
ExtTag- RBE+ FLReset-
ExtTag- RBE+ FLReset-
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-

Aminel FLReset+ van, az ez:
00:03.0 Audio device: Intel Corporation Haswell HD Audio Controller (rev 06)

Igy ne is varjam, hogy oda tudom adni az usb-t a virtualis
gepnek?

# xm dmesg | grep -i enable
(XEN) Intel VT-d Snoop Control not enabled.
(XEN) Intel VT-