howto enable HBA port directly from kvm to windows server virual guest by using pci passtrough ?!

by iman

hi. this is mini howto, to enable HBA port directly from kvm to windows server virual guest by using pci passtrough. i tested it, on “HP DL380 G8 PRO” with no problem.

1. Enable the Intel VT-d extensions in the BIOS. (this option is enabled by default for dl380 g8 pro)
2. Enable SR-IOV in the BIOS. (this option is in “advanced options” of bios menu)
3. Activate Intel VT-d in the kernel by appending the intel_iommu=on in the /etc/default/grub file, like this:
GRUB_CMDLINE_LINUX_DEFAULT=”intel_iommu=on”
4. to identify device run:
#lspci  | grep HBA
0a:00.0 Fibre Channel: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA (rev 02)
search for 0a:00.0 in kvm list by running this:
]# virsh nodedev-list | grep pci
pci_0000_00_00_0
pci_0000_00_01_0
pci_0000_00_03_0
pci_0000_00_04_0

pci_0000_05_00_0
pci_0000_06_02_0
pci_0000_06_04_0
pci_0000_07_00_0
pci_0000_07_00_1
pci_0000_08_00_0
pci_0000_08_00_1
pci_0000_09_00_0
pci_0000_0a_00_0
pci_0000_0b_03_0

to get information of device run the following command:
# virsh nodedev-dumpxml pci_0000_0a_00_0
<device>
<name>pci_0000_0a_00_0</name>
<parent>pci_0000_00_09_0</parent>
<driver>
<name>mpt2sas</name>
</driver>
<capability type=’pci’>
<domain>0</domain>
<bus>10</bus>
<slot>0</slot>
<function>0</function>
<product id=’0x0072′>SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon]</product>
<vendor id=’0x1000′>LSI Logic / Symbios Logic</vendor>
</capability>
</device>

Above is the HBA card which we need to assign to the virtual host directly .
you can add xml outputs to vm by using ‘virsh edit VMNAME’ or just simply add it by using virt-manger. in information tab of virt-manager just add “pci hardware”,
and search for line which has “0a:00.0” code and add it to your vm’s hardware. now it’s ready to use your HBA in vm’s machine.