public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU
@ 2009-03-26  9:02 Han, Weidong
  2009-03-26 12:00 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Han, Weidong @ 2009-03-26  9:02 UTC (permalink / raw)
  To: 'Avi Kivity'; +Cc: 'kvm@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

When user wants to assign device with IOMMU, but IOMMU is not
enabled, add warning messages to prompt user this situation, and
return error. Or device will be assigned but it cannot work.

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 qemu/hw/device-assignment.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
index b7f9fa6..cef7c8a 100644
--- a/qemu/hw/device-assignment.c
+++ b/qemu/hw/device-assignment.c
@@ -616,6 +616,11 @@ static int assign_device(AssignedDevInfo *adev)
     r = kvm_check_extension(kvm_context, KVM_CAP_IOMMU);
     if (r && !adev->disable_iommu)
 	assigned_dev_data.flags |= KVM_DEV_ASSIGN_ENABLE_IOMMU;
+    else if (!adev->disable_iommu && r == 0) {
+	fprintf(stderr, "IOMMU is not enabled. You cannot use "
+                "it to assign device!\n");
+	return -EINVAL;
+    }
 #endif
 
     r = kvm_assign_pci_device(kvm_context, &assigned_dev_data);
-- 
1.6.0.4

[-- Attachment #2: 0001-kvm-qemu-add-warning-message-when-assign-device-wi.patch --]
[-- Type: application/octet-stream, Size: 1223 bytes --]

From bd6db2f1a3946a2c85b1e1389be0919b0871ce76 Mon Sep 17 00:00:00 2001
From: Weidong Han <weidong.han@intel.com>
Date: Fri, 27 Mar 2009 00:47:08 +0800
Subject: [PATCH] kvm: qemu: add warning message when assign device without IOMMU

When user wants to assign device with IOMMU, but IOMMU is not
enabled, add warning messages to prompt user this situation, and
return error. Or device will be assigned but it cannot work.

Signed-off-by: Weidong Han <weidong.han@intel.com>
---
 qemu/hw/device-assignment.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c
index b7f9fa6..cef7c8a 100644
--- a/qemu/hw/device-assignment.c
+++ b/qemu/hw/device-assignment.c
@@ -616,6 +616,11 @@ static int assign_device(AssignedDevInfo *adev)
     r = kvm_check_extension(kvm_context, KVM_CAP_IOMMU);
     if (r && !adev->disable_iommu)
 	assigned_dev_data.flags |= KVM_DEV_ASSIGN_ENABLE_IOMMU;
+    else if (!adev->disable_iommu && r == 0) {
+	fprintf(stderr, "IOMMU is not enabled. You cannot use "
+                "it to assign device!\n");
+	return -EINVAL;
+    }
 #endif
 
     r = kvm_assign_pci_device(kvm_context, &assigned_dev_data);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU
  2009-03-26  9:02 [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU Han, Weidong
@ 2009-03-26 12:00 ` Avi Kivity
  2009-03-27  3:38   ` Han, Weidong
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2009-03-26 12:00 UTC (permalink / raw)
  To: Han, Weidong; +Cc: 'kvm@vger.kernel.org'

Han, Weidong wrote:
> When user wants to assign device with IOMMU, but IOMMU is not
> enabled, add warning messages to prompt user this situation, and
> return error. Or device will be assigned but it cannot work.
>   

If the device has does not do DMA (say a serial port) then it can be 
assigned.  Can we check the device for dma capability and allow this 
special case?


-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU
  2009-03-26 12:00 ` Avi Kivity
@ 2009-03-27  3:38   ` Han, Weidong
  0 siblings, 0 replies; 3+ messages in thread
From: Han, Weidong @ 2009-03-27  3:38 UTC (permalink / raw)
  To: 'Avi Kivity'; +Cc: 'kvm@vger.kernel.org'

Avi Kivity wrote:
> Han, Weidong wrote:
>> When user wants to assign device with IOMMU, but IOMMU is not
>> enabled, add warning messages to prompt user this situation, and
>> return error. Or device will be assigned but it cannot work.
>> 
> 
> If the device has does not do DMA (say a serial port) then it can be
> assigned.  Can we check the device for dma capability and allow this
> special case?

Do you have any hint to check it? This warning be triggered only when user wants to assign device with IOMMU. If user doesn't want to use IOMMU to assign device, he can use "-pcidevice host=xx:yy.z,dma=none". 

Regards,
Weidong


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-27  3:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26  9:02 [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU Han, Weidong
2009-03-26 12:00 ` Avi Kivity
2009-03-27  3:38   ` Han, Weidong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox