Skip to contentSkip to conversation

Status of pci passthrough work?

DISCUSSION Thomas Fjellstrom 6 participants 20 messages Sep 27, 2008 – Dec 15, 2008 KVM

lore
Share & tools
lore
#0 lore raw

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Basically what I want to do is assign a two or three physical nics (100mb and GiB) to one vm, some tv tuner cards to another.

Also, I'm wondering if AMD's iommu in the SB750 southbridge is supported yet? Or if anyone is working on it?

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#1 lore raw

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Randy (Weidong)

Quoted 16 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Basically what I want to do is assign a two or three physical nics (100mb and GiB) to one vm, some tv tuner cards to another.

Also, I'm wondering if AMD's iommu in the SB750 southbridge is supported yet? Or if anyone is working on it?

--
Thomas Fjellstrom
[email protected]

#2 lore raw
Quoted 5 lines · Weidong

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Does that mean I need VT-d support in hardware? All I have to test with right now is an AMD Phenom X4 with a 780g+sb700 system. Don't think it has an iommu, and I'd find it odd if the intel VT-d code "just worked" on amd's hardware.

Quoted 24 lines

Randy (Weidong)

Quoted 10 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Basically what I want to do is assign a two or three physical nics (100mb and GiB) to one vm, some tv tuner cards to another.

Quoted 6 lines

Also, I'm wondering if AMD's iommu in the SB750 southbridge is supported yet? Or if anyone is working on it?

--
Thomas Fjellstrom
[email protected]

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#3 lore raw
Quoted 12 lines · Thomas Fjellstrom
Quoted 5 lines · Weidong

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Does that mean I need VT-d support in hardware? All I have to test with right now is an AMD Phenom X4 with a 780g+sb700 system. Don't think it has an iommu, and I'd find it odd if the intel VT-d code "just worked" on amd's hardware.

Yes, currently you need VT-d support in hardware to assign device.

Randy (Weidong)

Quoted 29 lines
Quoted 16 lines

Randy (Weidong)

Quoted 13 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Basically what I want to do is assign a two or three physical nics (100mb and GiB) to one vm, some tv tuner cards to another.

Also, I'm wondering if AMD's iommu in the SB750 southbridge is supported yet? Or if anyone is working on it?

Quoted 8 lines
Quoted 3 lines

--
Thomas Fjellstrom
[email protected]

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Thomas Fjellstrom
[email protected]

#4 lore raw
Quoted 8 lines · Weidong
Quoted 7 lines · Thomas Fjellstrom
Quoted 5 lines · Weidong

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Quoted 6 lines
Quoted 4 lines

Does that mean I need VT-d support in hardware? All I have to test with right now is an AMD Phenom X4 with a 780g+sb700 system. Don't think it has an iommu, and I'd find it odd if the intel VT-d code "just worked" on amd's hardware.

Yes, currently you need VT-d support in hardware to assign device.

So I take it the PV-DMA (or pv-dma doesn't do what I think it does...) or the other 1:1 device pass through work isn't working right now?

It's something I'd really like to use, but I don't have access to a platform with a hardware iommu. Though I might be able to pick up a replacement board for my new server with the SB750 southbridge which supposedly has AMD's new iommu hardware in it, but I haven't seen any evidence that kvm or linux supports it.

Quoted 30 lines

Randy (Weidong)

Quoted 28 lines
Quoted 16 lines

Randy (Weidong)

Quoted 13 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Basically what I want to do is assign a two or three physical nics (100mb and GiB) to one vm, some tv tuner cards to another.

Also, I'm wondering if AMD's iommu in the SB750 southbridge is supported yet? Or if anyone is working on it?

Quoted 8 lines
Quoted 3 lines

--
Thomas Fjellstrom
[email protected]

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Thomas Fjellstrom
[email protected]

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#5 lore raw
Quoted 14 lines · * On Saturday 27 Sep 2008 13:27:46 Thomas Fjellstrom wrote:
Quoted 13 lines · Weidong
Quoted 11 lines · Thomas Fjellstrom
Quoted 5 lines · Weidong

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Does that mean I need VT-d support in hardware? All I have to test with right now is an AMD Phenom X4 with a 780g+sb700 system. Don't think it has an iommu, and I'd find it odd if the intel VT-d code "just worked" on amd's hardware.

Quoted 4 lines
Quoted 1 line

Yes, currently you need VT-d support in hardware to assign device.

So I take it the PV-DMA (or pv-dma doesn't do what I think it does...) or the other 1:1 device pass through work isn't working right now?

pvdma does work, but the most recent patches aren't yet published (I should do that). It will work for simple devices.

1:1 will also work.

Quoted 5 lines

It's something I'd really like to use, but I don't have access to a platform with a hardware iommu. Though I might be able to pick up a replacement board for my new server with the SB750 southbridge which supposedly has AMD's new iommu hardware in it, but I haven't seen any evidence that kvm or linux supports it.

Linux 2.6.27 onwards supports AMD IOMMU. kvm (and device assignment) support for AMD IOMMU doesn't exist yet, but work is planned to start soon.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

The userspace patch is undergoing pre-merge revisions.

I'll send out an email once I get my git trees synced up to my working revisions.

In the meantime, you can use the patches from the list.

#6 lore raw
Quoted 17 lines · Amit Shah
Quoted 16 lines · * On Saturday 27 Sep 2008 13:27:46 Thomas Fjellstrom wrote:
Quoted 14 lines · Weidong
Quoted 11 lines · Thomas Fjellstrom
Quoted 5 lines · Weidong

Hi Thomas,

the patches of passthrough/VT-d on kvm.git are already checked in. With Amit's userspace patches, you can assign device to guest. You can have a try.

Does that mean I need VT-d support in hardware? All I have to test with right now is an AMD Phenom X4 with a 780g+sb700 system. Don't think it has an iommu, and I'd find it odd if the intel VT-d code "just worked" on amd's hardware.

Yes, currently you need VT-d support in hardware to assign device.

Quoted 7 lines
Quoted 2 lines

So I take it the PV-DMA (or pv-dma doesn't do what I think it does...) or the other 1:1 device pass through work isn't working right now?

pvdma does work, but the most recent patches aren't yet published (I should do that). It will work for simple devices.

1:1 will also work.

Once the trees are updated?

Quoted 8 lines
Quoted 5 lines

It's something I'd really like to use, but I don't have access to a platform with a hardware iommu. Though I might be able to pick up a replacement board for my new server with the SB750 southbridge which supposedly has AMD's new iommu hardware in it, but I haven't seen any evidence that kvm or linux supports it.

Linux 2.6.27 onwards supports AMD IOMMU. kvm (and device assignment) support for AMD IOMMU doesn't exist yet, but work is planned to start soon.

What does the kernel supporting it help a person wanting to use it to pass through devices to guests if kvm doesn't support it? Also, what would the kernel use it for in that case?

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · Thomas Fjellstrom

I'm very interested in being able to pass a few devices through to kvm guests. I'm wondering what exactly is working now, and how I can start testing it?

the latest kvm release doesn't seem to include any support for it in userspace, so I can't test it with that...

Quoted 6 lines

The userspace patch is undergoing pre-merge revisions.

I'll send out an email once I get my git trees synced up to my working revisions.

In the meantime, you can use the patches from the list.

Its rather hard to find the patches from before I joined the list, most archives don't keep attachments.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Thanks for the heads up, and all the work on this stuff :)

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#7 lore raw

Please keep me in the CC to get faster replies.

Quoted 11 lines · * On Monday 29 Sep 2008 06:39:26 Thomas Fjellstrom wrote:
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Yes, currently you need VT-d support in hardware to assign device.

So I take it the PV-DMA (or pv-dma doesn't do what I think it does...) or the other 1:1 device pass through work isn't working right now?

pvdma does work, but the most recent patches aren't yet published (I should do that). It will work for simple devices.

1:1 will also work.

Once the trees are updated?

pvdma, yes.

I don't have the 1:1 patches in my tree as of now. Andrea maintains those patches.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

It's something I'd really like to use, but I don't have access to a platform with a hardware iommu. Though I might be able to pick up a replacement board for my new server with the SB750 southbridge which supposedly has AMD's new iommu hardware in it, but I haven't seen any evidence that kvm or linux supports it.

Quoted 7 lines
Quoted 3 lines

Linux 2.6.27 onwards supports AMD IOMMU. kvm (and device assignment) support for AMD IOMMU doesn't exist yet, but work is planned to start soon.

What does the kernel supporting it help a person wanting to use it to pass through devices to guests if kvm doesn't support it? Also, what would the kernel use it for in that case?

That's right; that was just to give you an idea of how things are progressing.

Quoted 2 lines

Its rather hard to find the patches from before I joined the list, most archives don't keep attachments.

Sure; look for an update next week.

Quoted 1 line

Thanks for the heads up, and all the work on this stuff :)

You're welcome and it's always good to hear from users.

#8 lore raw

When can we expect pvdma updates? Is it ever going to be merged into mainline kvm?

#9 lore raw
In reply to Thomas Fjellstrom

Hi,

I have about the same problem, so excuse me for hijacking this thread.

My hardware consists of a 780g/SB700 Mainboard and a 4850e AMD CPU, and I'm interested in forwarding a DVB-C tuner card to the guest. Maybe some NICs later.

I tried and 'sort of' got it working with Amit's kernel and userspace tools.
First thing:
The dvb-c card has an interesting memory mapping, as reported by lspci -v:

        Memory at cfdff000 (32-bit, non-prefetchable) [size=512]

Size 512 doesn't fly with a check in kvm_main.c:
if (mem->memory_size & (PAGE_SIZE - 1))

                goto out;

So I patched the userspace utilities to use 4096 instead.

With that patch, the guest saw the card, the driver got loaded, and channel tuning works, but I get some i2c timeouts on the guest side, and the host side has errors like:

------------[ cut here ]------------
Sep 22 02:28:54 [kernel] WARNING: at kernel/irq/manage.c:180
enable_irq+0x3a/0x55()
Sep 22 02:28:54 [kernel] Unbalanced enable for IRQ 20
Sep 22 02:28:54 [kernel] Modules linked in: sha256_generic cbc dm_crypt

crypto_blkcipher kvm_amd kvm bridge stp llc stv0297 budget_core dvb_core saa7146 ttpci_eepr\
om ir_common k8temp i2c_core dm_snapshot dm_mirror dm_log scsi_wait_scan [last unloaded: budget_ci]

Sep 22 02:28:54 [kernel] Pid: 5283, comm: qemu-system-x86 Tainted: G
    W 2.6.27-rc5-11874-g19561b6 #11
Sep 22 02:28:54 [kernel] Call Trace:
Sep 22 02:28:54 [kernel]  [<ffffffff80238b04>] warn_slowpath+0xb4/0xdc
Sep 22 02:28:54 [kernel]  [<ffffffff8026b099>]
__alloc_pages_internal+0xde/0x419
Sep 22 02:28:54 [kernel]  [<ffffffff802758d0>] get_user_pages+0x401/0x4ae
Sep 22 02:28:54 [kernel]  [<ffffffff80349269>] __next_cpu+0x19/0x26
Sep 22 02:28:54 [kernel]  [<ffffffff80230ce2>]
find_busiest_group+0x315/0x7c3
Sep 22 02:28:54 [kernel]  [<ffffffffa005de31>] gfn_to_hva+0x9/0x5d [kvm]
                - Last output repeated twice -
Sep 22 02:28:54 [kernel]  [<ffffffffa005e01b>]
kvm_read_guest_page+0x34/0x46 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa005e06c>] kvm_read_guest+0x3f/0x7c
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa0068bfe>]
paging64_walk_addr+0xe0/0x2c1 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff80260d59>] enable_irq+0x3a/0x55
Sep 22 02:28:54 [kernel]  [<ffffffffa006df50>]
kvm_notify_acked_irq+0x17/0x30 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa00701c5>]
kvm_ioapic_update_eoi+0x2f/0x6e [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006f6da>]
apic_mmio_write+0x24a/0x546 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006498d>]
emulator_write_emulated_onepage+0xa1/0xf3 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802206f8>] paravirt_patch_call+0x13/0x2b
Sep 22 02:28:54 [kernel]  [<ffffffffa006c93e>]
x86_emulate_insn+0x366a/0x41de [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802206fa>] paravirt_patch_call+0x15/0x2b
Sep 22 02:28:54 [kernel]  [<ffffffffa005f90b>]
kvm_get_cs_db_l_bits+0x22/0x3a [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006167d>]
emulate_instruction+0x198/0x25c [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa0067dfe>]
kvm_mmu_page_fault+0x46/0x83 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa00636a9>]
kvm_arch_vcpu_ioctl_run+0x456/0x65c [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff8024d605>] hrtimer_start+0x111/0x133
Sep 22 02:28:54 [kernel]  [<ffffffffa005d451>] kvm_vcpu_ioctl+0xe0/0x459
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa005ee43>] kvm_vm_ioctl+0x203/0x21b
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802353b6>] finish_task_switch+0x2b/0xc4
Sep 22 02:28:54 [kernel]  [<ffffffff8029e3b5>] vfs_ioctl+0x21/0x6c
Sep 22 02:28:54 [kernel]  [<ffffffff8029e627>] do_vfs_ioctl+0x227/0x23d
Sep 22 02:28:54 [kernel]  [<ffffffff8029e67a>] sys_ioctl+0x3d/0x5f
Sep 22 02:28:54 [kernel]  [<ffffffff8020b45a>]
system_call_fastpath+0x16/0x1b
Sep 22 02:28:54 [kernel] ---[ end trace 7b8b990423985ddf ]---
Sep 22 02:28:54 [kernel] ------------[ cut here ]------------

Xen works with that card, but Xen has other problems, and kvm is much nicer :) So if you need a guinea pig with basic debugging knowledge, I'm your man.

Best regards,
Jan C. Bernauer

#10 lore raw
Quoted 90 lines · Jan C. Bernauer

Hi,

I have about the same problem, so excuse me for hijacking this thread.

My hardware consists of a 780g/SB700 Mainboard and a 4850e AMD CPU, and I'm interested in forwarding a DVB-C tuner card to the guest. Maybe some NICs later.

I tried and 'sort of' got it working with Amit's kernel and userspace tools.
First thing:
The dvb-c card has an interesting memory mapping, as reported by lspci -v:

        Memory at cfdff000 (32-bit, non-prefetchable) [size=512]

Size 512 doesn't fly with a check in kvm_main.c:
if (mem->memory_size & (PAGE_SIZE - 1))

                goto out;

So I patched the userspace utilities to use 4096 instead.

With that patch, the guest saw the card, the driver got loaded, and channel tuning works, but I get some i2c timeouts on the guest side, and the host side has errors like:

------------[ cut here ]------------
Sep 22 02:28:54 [kernel] WARNING: at kernel/irq/manage.c:180
enable_irq+0x3a/0x55()
Sep 22 02:28:54 [kernel] Unbalanced enable for IRQ 20
Sep 22 02:28:54 [kernel] Modules linked in: sha256_generic cbc dm_crypt

crypto_blkcipher kvm_amd kvm bridge stp llc stv0297 budget_core dvb_core saa7146 ttpci_eepr\
om ir_common k8temp i2c_core dm_snapshot dm_mirror dm_log scsi_wait_scan [last unloaded: budget_ci]

Sep 22 02:28:54 [kernel] Pid: 5283, comm: qemu-system-x86 Tainted: G
    W 2.6.27-rc5-11874-g19561b6 #11
Sep 22 02:28:54 [kernel] Call Trace:
Sep 22 02:28:54 [kernel]  [<ffffffff80238b04>] warn_slowpath+0xb4/0xdc
Sep 22 02:28:54 [kernel]  [<ffffffff8026b099>]
__alloc_pages_internal+0xde/0x419
Sep 22 02:28:54 [kernel]  [<ffffffff802758d0>] get_user_pages+0x401/0x4ae
Sep 22 02:28:54 [kernel]  [<ffffffff80349269>] __next_cpu+0x19/0x26
Sep 22 02:28:54 [kernel]  [<ffffffff80230ce2>]
find_busiest_group+0x315/0x7c3
Sep 22 02:28:54 [kernel]  [<ffffffffa005de31>] gfn_to_hva+0x9/0x5d [kvm]
                - Last output repeated twice -
Sep 22 02:28:54 [kernel]  [<ffffffffa005e01b>]
kvm_read_guest_page+0x34/0x46 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa005e06c>] kvm_read_guest+0x3f/0x7c
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa0068bfe>]
paging64_walk_addr+0xe0/0x2c1 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff80260d59>] enable_irq+0x3a/0x55
Sep 22 02:28:54 [kernel]  [<ffffffffa006df50>]
kvm_notify_acked_irq+0x17/0x30 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa00701c5>]
kvm_ioapic_update_eoi+0x2f/0x6e [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006f6da>]
apic_mmio_write+0x24a/0x546 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006498d>]
emulator_write_emulated_onepage+0xa1/0xf3 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802206f8>]
paravirt_patch_call+0x13/0x2b Sep 22 02:28:54 [kernel] 
[<ffffffffa006c93e>]
x86_emulate_insn+0x366a/0x41de [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802206fa>]
paravirt_patch_call+0x15/0x2b Sep 22 02:28:54 [kernel] 
[<ffffffffa005f90b>]
kvm_get_cs_db_l_bits+0x22/0x3a [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa006167d>]
emulate_instruction+0x198/0x25c [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa0067dfe>]
kvm_mmu_page_fault+0x46/0x83 [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa00636a9>]
kvm_arch_vcpu_ioctl_run+0x456/0x65c [kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff8024d605>] hrtimer_start+0x111/0x133
Sep 22 02:28:54 [kernel]  [<ffffffffa005d451>] kvm_vcpu_ioctl+0xe0/0x459
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffffa005ee43>] kvm_vm_ioctl+0x203/0x21b
[kvm]
Sep 22 02:28:54 [kernel]  [<ffffffff802353b6>] finish_task_switch+0x2b/0xc4
Sep 22 02:28:54 [kernel]  [<ffffffff8029e3b5>] vfs_ioctl+0x21/0x6c
Sep 22 02:28:54 [kernel]  [<ffffffff8029e627>] do_vfs_ioctl+0x227/0x23d
Sep 22 02:28:54 [kernel]  [<ffffffff8029e67a>] sys_ioctl+0x3d/0x5f
Sep 22 02:28:54 [kernel]  [<ffffffff8020b45a>]
system_call_fastpath+0x16/0x1b
Sep 22 02:28:54 [kernel] ---[ end trace 7b8b990423985ddf ]---
Sep 22 02:28:54 [kernel] ------------[ cut here ]------------
Quoted 3 lines

Xen works with that card, but Xen has other problems, and kvm is much nicer :) So if you need a guinea pig with basic debugging knowledge, I'm your man.

How did you manage to pull together those patches? They all seem so old, and won't likely apply cleanly to git head :(

Quoted 3 lines

Best regards,
Jan C. Bernauer

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#11 lore raw
Quoted 2 lines · Thomas Fjellstrom

How did you manage to pull together those patches? They all seem so

old, and

Quoted 2 lines

won't likely apply cleanly to git head :(

Which patches do you mean? The patches for kvm?
There is a nice repository managed by Amit Shah:
Linux source:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm.git;a=summary

kvm-userspace:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm-userspace.git;a=summary

I think this compiled without too much problems.

Best regards,
Jan

#12 lore raw
Quoted 12 lines · Jan C. Bernauer
Quoted 1 line · Thomas Fjellstrom

How did you manage to pull together those patches? They all seem so

old, and

Quoted 1 line

won't likely apply cleanly to git head :(

Which patches do you mean? The patches for kvm?
There is a nice repository managed by Amit Shah:
Linux source:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm.git;a=summary

Quoted 4 lines

kvm-userspace:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm-userspace.git;a=summary

I think this compiled without too much problems.

Ah, the pci branches in the main kvm.git tree seemed to be months old, and I assumed thats where the code was kept.

Quoted 3 lines

Best regards,
Jan

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#13 lore raw
Quoted 13 lines · Thomas Fjellstrom
Quoted 12 lines · Jan C. Bernauer
Quoted 1 line · Thomas Fjellstrom

How did you manage to pull together those patches? They all seem so

old, and

Quoted 1 line

won't likely apply cleanly to git head :(

Which patches do you mean? The patches for kvm?
There is a nice repository managed by Amit Shah:
Linux source:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm.git;a=summary

Quoted 11 lines
Quoted 5 lines

kvm-userspace:
http://git.kernel.org/?p=linux/kernel/git/amit/kvm-userspace.git;a=summar
y

I think this compiled without too much problems.

Ah, the pci branches in the main kvm.git tree seemed to be months old, and I assumed thats where the code was kept.

Quoted 2 lines

Best regards,
Jan

So I've checked out both of those trees and used head, and kvm-userspace is erroring out:

gcc -I. -I.. -I/root/kvm-amit-userspace/qemu/target-i386 -I/root/kvm-amit- userspace/qemu -MMD -MT qemu-kvm-x86.o -MP -DNEED_CPU_H -D_GNU_SOURCE - D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user= -I/root/kvm-amit- userspace/qemu/tcg -I/root/kvm-amit-userspace/qemu/tcg/x86_64 -I/root/kvm- amit-userspace/qemu/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/root/kvm-amit- userspace/qemu/slirp -I /root/kvm-amit-userspace/qemu/../libkvm -DCONFIG_X86 -Wall -O2 -g -fno-strict-aliasing -m64 -I /root/kvm-amit- userspace/kernel/include -c -o qemu-kvm-x86.o /root/kvm-amit- userspace/qemu/qemu-kvm-x86.c /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:522: error:
âKVM_FEATURE_CLOCKSOURCEâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:525: error:
âKVM_FEATURE_NOP_IO_DELAYâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:528: error: âKVM_FEATURE_MMU_OPâ undeclared here (not in a function)

So I'm a little stuck now.

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#14 lore raw
Quoted 20 lines · Thomas Fjellstrom

So I've checked out both of those trees and used head, and kvm-userspace is erroring out:

gcc -I. -I.. -I/root/kvm-amit-userspace/qemu/target-i386 -I/root/kvm-amit- userspace/qemu -MMD -MT qemu-kvm-x86.o -MP -DNEED_CPU_H -D_GNU_SOURCE - D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user= -I/root/kvm-amit- userspace/qemu/tcg -I/root/kvm-amit-userspace/qemu/tcg/x86_64 -I/root/kvm- amit-userspace/qemu/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/root/kvm-amit- userspace/qemu/slirp -I /root/kvm-amit-userspace/qemu/../libkvm -DCONFIG_X86 -Wall -O2 -g -fno-strict-aliasing -m64 -I /root/kvm-amit- userspace/kernel/include -c -o qemu-kvm-x86.o /root/kvm-amit- userspace/qemu/qemu-kvm-x86.c /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:522: error:
âKVM_FEATURE_CLOCKSOURCEâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:525: error:
âKVM_FEATURE_NOP_IO_DELAYâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:528: error: âKVM_FEATURE_MMU_OPâ undeclared here (not in a function)

Quoted 2 lines

So I'm a little stuck now.

Try running
make sync LINUX=/root/kvm-amit
(or whatever your kernel source dir is)
in the kernel sub directory of your kvm-amit-userspace dir. Those KVM_FEATURE_* should be defined somewhere in kvm_para.h, which is in there.

Best regards,
Jan

#15 lore raw
Quoted 21 lines · Jan C. Bernauer
Quoted 20 lines · Thomas Fjellstrom

So I've checked out both of those trees and used head, and kvm-userspace is erroring out:

gcc -I. -I.. -I/root/kvm-amit-userspace/qemu/target-i386

(quoted diff) +0 -4
-I/root/kvm-amit- userspace/qemu -MMD -MT qemu-kvm-x86.o -MP -DNEED_CPU_H
-D_GNU_SOURCE - D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D__user=
-I/root/kvm-amit- userspace/qemu/tcg
-I/root/kvm-amit-userspace/qemu/tcg/x86_64 -I/root/kvm-

amit-userspace/qemu/fpu -DHAS_AUDIO -DHAS_AUDIO_CHOICE -I/root/kvm-amit- userspace/qemu/slirp -I /root/kvm-amit-userspace/qemu/../libkvm -DCONFIG_X86 -Wall -O2 -g -fno-strict-aliasing -m64 -I /root/kvm-amit- userspace/kernel/include -c -o qemu-kvm-x86.o /root/kvm-amit- userspace/qemu/qemu-kvm-x86.c /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:522: error:
âKVM_FEATURE_CLOCKSOURCEâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:525: error:
âKVM_FEATURE_NOP_IO_DELAYâ undeclared here (not in a function) /root/kvm-amit-userspace/qemu/qemu-kvm-x86.c:528: error:
âKVM_FEATURE_MMU_OPâ undeclared here (not in a function)

Quoted 8 lines
Quoted 1 line

So I'm a little stuck now.

Try running
make sync LINUX=/root/kvm-amit
(or whatever your kernel source dir is)
in the kernel sub directory of your kvm-amit-userspace dir. Those KVM_FEATURE_* should be defined somewhere in kvm_para.h, which is in there.

that leaves me with:

/root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: âstruct kvm_msr_entryâ declared inside parameter list /root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: its scope is only this definition or declaration, which is probably not what you want

and a bunch more errors.

Quoted 9 lines

Best regards,
Jan

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#16 lore raw
Quoted 11 lines · Thomas Fjellstrom

that leaves me with:

/root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: âstruct kvm_msr_entryâ declared inside parameter list /root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: its scope is only this definition or declaration, which is probably not what you want

and a bunch more errors.

Well, these are warning, and I might have ignored them :) What are the errors?

Anyway, I'll be off now, so I won't respond till tomorrow.

Best regards,
Jan

#17 lore raw
Quoted 9 lines · Jan C. Bernauer
Quoted 8 lines · Thomas Fjellstrom

that leaves me with:

/root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: âstruct kvm_msr_entryâ declared inside parameter list /root/kvm-amit-userspace/qemu/../libkvm/libkvm.h:28: warning: its scope is only this definition or declaration, which is probably not what you want

Quoted 6 lines
Quoted 1 line

and a bunch more errors.

Well, these are warning, and I might have ignored them :) What are the errors?

Anyway, I'll be off now, so I won't respond till tomorrow.

libkvm.h:404: error: expected '=', ',' ';', 'asm' or '__attribute__' before 'kvm_get_cr8'
libkvm.c:145: error: expected declaration specifiers or '...' before '__u32'

and quite a few more after that.

Quoted 2 lines

Best regards,
Jan

Signature · 2 lines
Thomas Fjellstrom
[email protected]
#18 lore raw
In reply to Jan C. Bernauer
Quoted 21 lines · Jan C. Bernauer

Hi,

I have about the same problem, so excuse me for hijacking this thread.

My hardware consists of a 780g/SB700 Mainboard and a 4850e AMD CPU, and I'm interested in forwarding a DVB-C tuner card to the guest. Maybe some NICs later.

I tried and 'sort of' got it working with Amit's kernel and userspace tools.
First thing:
The dvb-c card has an interesting memory mapping, as reported by lspci -v:

        Memory at cfdff000 (32-bit, non-prefetchable) [size=512]

Size 512 doesn't fly with a check in kvm_main.c:
if (mem->memory_size & (PAGE_SIZE - 1))

                goto out;

So I patched the userspace utilities to use 4096 instead.

Quoted 9 lines

With that patch, the guest saw the card, the driver got loaded, and channel tuning works, but I get some i2c timeouts on the guest side, and the host side has errors like:

------------[ cut here ]------------
Sep 22 02:28:54 [kernel] WARNING: at kernel/irq/manage.c:180
enable_irq+0x3a/0x55()
Sep 22 02:28:54 [kernel] Unbalanced enable for IRQ 20

That looks due to bad error handling, due to the failures you had before.

Try rebooting the host and starting again with the patched userspace.

Amit, can you take a look at the error handling paths?

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#19 lore raw
Quoted 31 lines · * On Sunday 28 Sep 2008 10:09:13 Avi Kivity wrote:
Quoted 21 lines · Jan C. Bernauer

Hi,

I have about the same problem, so excuse me for hijacking this thread.

My hardware consists of a 780g/SB700 Mainboard and a 4850e AMD CPU, and I'm interested in forwarding a DVB-C tuner card to the guest. Maybe some NICs later.

I tried and 'sort of' got it working with Amit's kernel and userspace tools.
First thing:
The dvb-c card has an interesting memory mapping, as reported by lspci -v:

        Memory at cfdff000 (32-bit, non-prefetchable) [size=512]

Size 512 doesn't fly with a check in kvm_main.c:
if (mem->memory_size & (PAGE_SIZE - 1))

                goto out;

So I patched the userspace utilities to use 4096 instead.

Quoted 8 lines

With that patch, the guest saw the card, the driver got loaded, and channel tuning works, but I get some i2c timeouts on the guest side, and the host side has errors like:

------------[ cut here ]------------
Sep 22 02:28:54 [kernel] WARNING: at kernel/irq/manage.c:180
enable_irq+0x3a/0x55()
Sep 22 02:28:54 [kernel] Unbalanced enable for IRQ 20
Quoted 5 lines

That looks due to bad error handling, due to the failures you had before.

Try rebooting the host and starting again with the patched userspace.

Amit, can you take a look at the error handling paths?

I suspect this is so because Jan's using very old trees. The 'master' branch used to hold the device assignment patches, They're now upstream.

The patches in the 'vtd' branch are also upstream.

The 'pvdma' branch is the one I should be updating. Currently, it's based on an older upstream kvm.git. I'll refresh it and drop a note.

Amit