I've passthrough the SATA controller on my server to a VM. I was able to see that the controller is passed through and that the disks are found. I was also able to paritition the disks. But I cannot mount the disks. So something is wrong. Here is what I did:
Following this guide:https://pve.proxmox.com/wiki/Pci_passthrough
*root@pve:~# pveversion
pve-manager/5.1-41/0b958203 (running kernel: 4.13.13-2-pve)
1.Identified the controller and verified it's a root node:
root@pve:~# lspci -knn | grep -A2 SATA
00:17.0 RAID bus controller [0104]: Intel Corporation SATA Controller [RAID mode] [8086:2822] (rev 31)
Subsystem: Dell SATA Controller [RAID mode] [1028:07c5]
Kernel driver in use: vfio-pci
Kernel modules: ahci
root@pve:~# lspci -t
-[0000:00]-+-00.0
+-01.0-[01]--
+-02.0
+-14.0
+-14.2
+-16.0
+-16.3
+-17.0
+-1b.0-[02]----00.0
+-1c.0-[03-04]----00.0-[04]--
+-1f.0
+-1f.2
+-1f.3
+-1f.4
\-1f.6
Note that it is currently using vfio-pci driver since I have made the changes and rebooted. Previously it was using achi driver. I don't know why kernel module is listed as ahci. Is that an issue?
2. edit and updated grub
host:
root@pve:~# cat /etc/default/grub | grep iommu
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
VM:
root@omv:/srv/dev-disk-by-label-data2# cat /etc/default/grub | grep iommu
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
3. Added vfio modules on host
root@pve:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
4. Verified IOMMU lines present and that they support interrupt remapping (e an a at the end of number after ecap)
root@pve:~# dmesg | grep -e DMAR -e IOMMU
[ 0.000000] ACPI: DMAR 0x000000008B912CE0 0000A8 (v01 INTEL SKL 00000001 INTL 00000001)
[ 0.000000] DMAR: IOMMU enabled
[ 0.034361] DMAR: Host address width 39
[ 0.034362] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034367] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[ 0.034370] DMAR: RMRR base: 0x0000008b762000 end: 0x0000008b781fff
[ 0.034371] DMAR: RMRR base: 0x0000008d800000 end: 0x0000008fffffff
[ 0.034372] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.034373] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[ 0.034373] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
[ 0.034374] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
[ 0.035766] DMAR-IR: Enabled IRQ remapping in xapic mode
[ 0.569868] DMAR: No ATSR found
[ 0.570180] DMAR: dmar0: Using Queued invalidation
[ 0.570183] DMAR: dmar1: Using Queued invalidation
[ 0.570379] DMAR: Setting RMRR:
[ 0.570400] DMAR: Setting identity map for device 0000:00:02.0 [0x8d800000 - 0x8fffffff]
[ 0.570418] DMAR: Setting identity map for device 0000:00:14.0 [0x8b762000 - 0x8b781fff]
[ 0.570422] DMAR: Prepare 0-16MiB unity mapping for LPC
[ 0.570435] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[ 0.570457] DMAR: Intel(R) Virtualization Technology for Directed I/O
root@pve:~# dmesg | grep ecap
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
5. Verified IOMMU processor support and isolation
root@pve:~# cat /proc/cpuinfo | grep Xeon
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
root@pve:~# find /sys/kernel/iommu_groups/ -type l
/sys/kernel/iommu_groups/7/devices/0000:00:1c.0
/sys/kernel/iommu_groups/5/devices/0000:00:17.0
/sys/kernel/iommu_groups/3/devices/0000:00:14.2
/sys/kernel/iommu_groups/3/devices/0000:00:14.0
/sys/kernel/iommu_groups/11/devices/0000:03:00.0
/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/8/devices/0000:00:1f.3
/sys/kernel/iommu_groups/8/devices/0000:00:1f.4
/sys/kernel/iommu_groups/8/devices/0000:00:1f.2
/sys/kernel/iommu_groups/8/devices/0000:00:1f.0
/sys/kernel/iommu_groups/6/devices/0000:00:1b.0
/sys/kernel/iommu_groups/4/devices/0000:00:16.3
/sys/kernel/iommu_groups/4/devices/0000:00:16.0
/sys/kernel/iommu_groups/2/devices/0000:00:02.0
/sys/kernel/iommu_groups/10/devices/0000:02:00.0
/sys/kernel/iommu_groups/0/devices/0000:00:00.0
/sys/kernel/iommu_groups/9/devices/0000:00:1f.6
6. VM config setting to pass pci
root@pve:~# cat /etc/pve/qemu-server/100.conf | grep hostpci
hostpci0: 00:17.0
7. Rebooted host
8. Verified the controller on VM
00:10.0 RAID bus controller [0104]: Intel Corporation SATA Controller [RAID mode] [8086:2822] (rev 31)
Subsystem: Dell SATA Controller [RAID mode] [1028:07c5]
Kernel driver in use: ahci
Kernel modules: ahci
Should it be using the vfio-pci driver?
9. Verified disks on VM
Disk /dev/sdd: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F24C7248-7C9E-4771-A9C1-22DA6FA8XXXX
Device Start End Sectors Size Type
/dev/sdd1 2048 5860533134 5860531087 2.7T Linux filesystem
Disk /dev/sdc: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 543E2DAD-B1CB-4CD9-9C3D-0B5ABD80XXXX
This is what they look like after I deleted the previous partitions and setup 1 ext4 parition. Previously, these drives were in linux software raid (md..). I used parted tool and it didn't give errors
10. Mounting drives failes:
root@omv:~# mount /dev/disk/by-label/data2 /srv/dev-disk-by-label-data2
mount: mount /dev/sdc1 on /srv/dev-disk-by-label-data2 failed: Structure needs cleaning
e2fsck returns errors and I tried lettting it fix them. But at the end I still got:
elocating group 22355's block bitmap to 732431878...
Relocating group 22355's inode bitmap to 732431879...
Relocating group 22355's inode table to 732431880...
Relocating group 22356's block bitmap to 732432392...
Relocating group 22356's inode bitmap to 732432393...
Relocating group 22356's inode table to 732432394...
Recreate journal? yes
Creating journal (262144 blocks): Block bitmap checksum does not match bitmap: while trying to create journal
Restarting e2fsck from the beginning...
ext2fs_open2: Bad magic number in super-block
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/disk/by-label/data2
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
So I am kind of stuck in that I got far enough to believe my controller passthrough worked. But accessing the drives is not working, so obviously something is not working. Anything I missed on the steps or any diagnostics I can run?
---PS. What is x2apic and do I need to enable it in the bios?
root@pve:~# dmesg | grep -e DMAR -e IOMMU
[ 0.000000] ACPI: DMAR 0x000000008B912CE0 0000A8 (v01 INTEL SKL 00000001 INTL 00000001)
[ 0.000000] DMAR: IOMMU enabled
[ 0.034361] DMAR: Host address width 39
[ 0.034362] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034367] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[ 0.034370] DMAR: RMRR base: 0x0000008b762000 end: 0x0000008b781fff
[ 0.034371] DMAR: RMRR base: 0x0000008d800000 end: 0x0000008fffffff
[ 0.034372] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.034373] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[ 0.034373] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
[ 0.034374] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
[ 0.035766] DMAR-IR: Enabled IRQ remapping in xapic mode
[ 0.569868] DMAR: No ATSR found
[ 0.570180] DMAR: dmar0: Using Queued invalidation
[ 0.570183] DMAR: dmar1: Using Queued invalidation
[ 0.570379] DMAR: Setting RMRR:
[ 0.570400] DMAR: Setting identity map for device 0000:00:02.0 [0x8d800000 - 0x8fffffff]
[ 0.570418] DMAR: Setting identity map for device 0000:00:14.0 [0x8b762000 - 0x8b781fff]
[ 0.570422] DMAR: Prepare 0-16MiB unity mapping for LPC
[ 0.570435] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[ 0.570457] DMAR: Intel(R) Virtualization Technology for Directed I/O
Following this guide:https://pve.proxmox.com/wiki/Pci_passthrough
*root@pve:~# pveversion
pve-manager/5.1-41/0b958203 (running kernel: 4.13.13-2-pve)
1.Identified the controller and verified it's a root node:
root@pve:~# lspci -knn | grep -A2 SATA
00:17.0 RAID bus controller [0104]: Intel Corporation SATA Controller [RAID mode] [8086:2822] (rev 31)
Subsystem: Dell SATA Controller [RAID mode] [1028:07c5]
Kernel driver in use: vfio-pci
Kernel modules: ahci
root@pve:~# lspci -t
-[0000:00]-+-00.0
+-01.0-[01]--
+-02.0
+-14.0
+-14.2
+-16.0
+-16.3
+-17.0
+-1b.0-[02]----00.0
+-1c.0-[03-04]----00.0-[04]--
+-1f.0
+-1f.2
+-1f.3
+-1f.4
\-1f.6
Note that it is currently using vfio-pci driver since I have made the changes and rebooted. Previously it was using achi driver. I don't know why kernel module is listed as ahci. Is that an issue?
2. edit and updated grub
host:
root@pve:~# cat /etc/default/grub | grep iommu
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
VM:
root@omv:/srv/dev-disk-by-label-data2# cat /etc/default/grub | grep iommu
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"
3. Added vfio modules on host
root@pve:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
4. Verified IOMMU lines present and that they support interrupt remapping (e an a at the end of number after ecap)
root@pve:~# dmesg | grep -e DMAR -e IOMMU
[ 0.000000] ACPI: DMAR 0x000000008B912CE0 0000A8 (v01 INTEL SKL 00000001 INTL 00000001)
[ 0.000000] DMAR: IOMMU enabled
[ 0.034361] DMAR: Host address width 39
[ 0.034362] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034367] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[ 0.034370] DMAR: RMRR base: 0x0000008b762000 end: 0x0000008b781fff
[ 0.034371] DMAR: RMRR base: 0x0000008d800000 end: 0x0000008fffffff
[ 0.034372] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.034373] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[ 0.034373] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
[ 0.034374] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
[ 0.035766] DMAR-IR: Enabled IRQ remapping in xapic mode
[ 0.569868] DMAR: No ATSR found
[ 0.570180] DMAR: dmar0: Using Queued invalidation
[ 0.570183] DMAR: dmar1: Using Queued invalidation
[ 0.570379] DMAR: Setting RMRR:
[ 0.570400] DMAR: Setting identity map for device 0000:00:02.0 [0x8d800000 - 0x8fffffff]
[ 0.570418] DMAR: Setting identity map for device 0000:00:14.0 [0x8b762000 - 0x8b781fff]
[ 0.570422] DMAR: Prepare 0-16MiB unity mapping for LPC
[ 0.570435] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[ 0.570457] DMAR: Intel(R) Virtualization Technology for Directed I/O
root@pve:~# dmesg | grep ecap
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
5. Verified IOMMU processor support and isolation
root@pve:~# cat /proc/cpuinfo | grep Xeon
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
model name : Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz
root@pve:~# find /sys/kernel/iommu_groups/ -type l
/sys/kernel/iommu_groups/7/devices/0000:00:1c.0
/sys/kernel/iommu_groups/5/devices/0000:00:17.0
/sys/kernel/iommu_groups/3/devices/0000:00:14.2
/sys/kernel/iommu_groups/3/devices/0000:00:14.0
/sys/kernel/iommu_groups/11/devices/0000:03:00.0
/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/8/devices/0000:00:1f.3
/sys/kernel/iommu_groups/8/devices/0000:00:1f.4
/sys/kernel/iommu_groups/8/devices/0000:00:1f.2
/sys/kernel/iommu_groups/8/devices/0000:00:1f.0
/sys/kernel/iommu_groups/6/devices/0000:00:1b.0
/sys/kernel/iommu_groups/4/devices/0000:00:16.3
/sys/kernel/iommu_groups/4/devices/0000:00:16.0
/sys/kernel/iommu_groups/2/devices/0000:00:02.0
/sys/kernel/iommu_groups/10/devices/0000:02:00.0
/sys/kernel/iommu_groups/0/devices/0000:00:00.0
/sys/kernel/iommu_groups/9/devices/0000:00:1f.6
6. VM config setting to pass pci
root@pve:~# cat /etc/pve/qemu-server/100.conf | grep hostpci
hostpci0: 00:17.0
7. Rebooted host
8. Verified the controller on VM
00:10.0 RAID bus controller [0104]: Intel Corporation SATA Controller [RAID mode] [8086:2822] (rev 31)
Subsystem: Dell SATA Controller [RAID mode] [1028:07c5]
Kernel driver in use: ahci
Kernel modules: ahci
Should it be using the vfio-pci driver?
9. Verified disks on VM
Disk /dev/sdd: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F24C7248-7C9E-4771-A9C1-22DA6FA8XXXX
Device Start End Sectors Size Type
/dev/sdd1 2048 5860533134 5860531087 2.7T Linux filesystem
Disk /dev/sdc: 2.7 TiB, 3000592982016 bytes, 5860533168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 543E2DAD-B1CB-4CD9-9C3D-0B5ABD80XXXX
This is what they look like after I deleted the previous partitions and setup 1 ext4 parition. Previously, these drives were in linux software raid (md..). I used parted tool and it didn't give errors
10. Mounting drives failes:
root@omv:~# mount /dev/disk/by-label/data2 /srv/dev-disk-by-label-data2
mount: mount /dev/sdc1 on /srv/dev-disk-by-label-data2 failed: Structure needs cleaning
e2fsck returns errors and I tried lettting it fix them. But at the end I still got:
elocating group 22355's block bitmap to 732431878...
Relocating group 22355's inode bitmap to 732431879...
Relocating group 22355's inode table to 732431880...
Relocating group 22356's block bitmap to 732432392...
Relocating group 22356's inode bitmap to 732432393...
Relocating group 22356's inode table to 732432394...
Recreate journal? yes
Creating journal (262144 blocks): Block bitmap checksum does not match bitmap: while trying to create journal
Restarting e2fsck from the beginning...
ext2fs_open2: Bad magic number in super-block
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/disk/by-label/data2
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
So I am kind of stuck in that I got far enough to believe my controller passthrough worked. But accessing the drives is not working, so obviously something is not working. Anything I missed on the steps or any diagnostics I can run?
---PS. What is x2apic and do I need to enable it in the bios?
root@pve:~# dmesg | grep -e DMAR -e IOMMU
[ 0.000000] ACPI: DMAR 0x000000008B912CE0 0000A8 (v01 INTEL SKL 00000001 INTL 00000001)
[ 0.000000] DMAR: IOMMU enabled
[ 0.034361] DMAR: Host address width 39
[ 0.034362] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
[ 0.034366] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap 1c0000c40660462 ecap 7e3ff0505e
[ 0.034367] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
[ 0.034370] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap d2008c40660462 ecap f050da
[ 0.034370] DMAR: RMRR base: 0x0000008b762000 end: 0x0000008b781fff
[ 0.034371] DMAR: RMRR base: 0x0000008d800000 end: 0x0000008fffffff
[ 0.034372] DMAR-IR: IOAPIC id 2 under DRHD base 0xfed91000 IOMMU 1
[ 0.034373] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
[ 0.034373] DMAR-IR: x2apic is disabled because BIOS sets x2apic opt out bit.
[ 0.034374] DMAR-IR: Use 'intremap=no_x2apic_optout' to override the BIOS setting.
[ 0.035766] DMAR-IR: Enabled IRQ remapping in xapic mode
[ 0.569868] DMAR: No ATSR found
[ 0.570180] DMAR: dmar0: Using Queued invalidation
[ 0.570183] DMAR: dmar1: Using Queued invalidation
[ 0.570379] DMAR: Setting RMRR:
[ 0.570400] DMAR: Setting identity map for device 0000:00:02.0 [0x8d800000 - 0x8fffffff]
[ 0.570418] DMAR: Setting identity map for device 0000:00:14.0 [0x8b762000 - 0x8b781fff]
[ 0.570422] DMAR: Prepare 0-16MiB unity mapping for LPC
[ 0.570435] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[ 0.570457] DMAR: Intel(R) Virtualization Technology for Directed I/O
Last edited: