All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Han, Weidong" <weidong.han@intel.com>
To: 'Avi Kivity' <avi@redhat.com>
Cc: "'kvm@vger.kernel.org'" <kvm@vger.kernel.org>
Subject: [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU
Date: Thu, 26 Mar 2009 17:02:47 +0800	[thread overview]
Message-ID: <715D42877B251141A38726ABF5CABF2C01A11B66ED@pdsmsx503.ccr.corp.intel.com> (raw)

[-- 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


             reply	other threads:[~2009-03-26  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26  9:02 Han, Weidong [this message]
2009-03-26 12:00 ` [PATCH 1/2] kvm: qemu: add warning message when assign device without IOMMU Avi Kivity
2009-03-27  3:38   ` Han, Weidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=715D42877B251141A38726ABF5CABF2C01A11B66ED@pdsmsx503.ccr.corp.intel.com \
    --to=weidong.han@intel.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.