Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455189 > unrolled thread

[PATCH v12 6/8] vfio/type1: check doorbell safety

Started byEric Auger <eric.auger@redhat.com>
First post2016-08-02 19:50 +0200
Last post2016-08-03 08:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v12 6/8] vfio/type1: check doorbell safety Eric Auger <eric.auger@redhat.com> - 2016-08-02 19:50 +0200
    Re: [PATCH v12 6/8] vfio/type1: check doorbell safety kbuild test robot <lkp@intel.com> - 2016-08-03 08:40 +0200

#1455189 — [PATCH v12 6/8] vfio/type1: check doorbell safety

FromEric Auger <eric.auger@redhat.com>
Date2016-08-02 19:50 +0200
Subject[PATCH v12 6/8] vfio/type1: check doorbell safety
Message-ID<s1LZg-7Ht-17@gated-at.bofh.it>
On x86 IRQ remapping is abstracted by the IOMMU. On ARM this is abstracted
by the msi controller.

Since we currently have no way to detect whether the MSI controller is
upstream or downstream to the IOMMU we rely on the MSI doorbell information
registered by the interrupt controllers. In case at least one doorbell
does not implement proper isolation, we state the assignment is unsafe
with regard to interrupts. This is a coase assessment but should allow to
wait for a better system description.

At this point ARM sMMU still advertises IOMMU_CAP_INTR_REMAP. This is
removed in next patch.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

v9 -> v10:
- coarse safety assessment based on MSI doorbell info

v3 -> v4:
- rename vfio_msi_parent_irq_remapping_capable into vfio_safe_irq_domain
  and irq_remapping into safe_irq_domains

v2 -> v3:
- protect vfio_msi_parent_irq_remapping_capable with
  CONFIG_GENERIC_MSI_IRQ_DOMAIN
---
 drivers/vfio/vfio_iommu_type1.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 14dc9ef..7daab53 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -37,6 +37,7 @@
 #include <linux/vfio.h>
 #include <linux/workqueue.h>
 #include <linux/msi-iommu.h>
+#include <linux/msi-doorbell.h>
 
 #define DRIVER_VERSION  "0.2"
 #define DRIVER_AUTHOR   "Alex Williamson <alex.williamson@redhat.com>"
@@ -922,8 +923,14 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
 	INIT_LIST_HEAD(&domain->group_list);
 	list_add(&group->next, &domain->group_list);
 
+	/*
+	 * to advertise safe interrupts either the IOMMU or the MSI controllers
+	 * must support IRQ remapping (aka. interrupt translation), property
+	 * exposed by their registered doorbells
+	 */
 	if (!allow_unsafe_interrupts &&
-	    !iommu_capable(bus, IOMMU_CAP_INTR_REMAP)) {
+	    (!iommu_capable(bus, IOMMU_CAP_INTR_REMAP) &&
+	     !msi_doorbell_safe())) {
 		pr_warn("%s: No interrupt remapping support.  Use the module param \"allow_unsafe_interrupts\" to enable VFIO IOMMU support on this platform\n",
 		       __func__);
 		ret = -EPERM;
-- 
1.9.1

[toc] | [next] | [standalone]


#1455644

Fromkbuild test robot <lkp@intel.com>
Date2016-08-03 08:40 +0200
Message-ID<s1Y0p-7dj-7@gated-at.bofh.it>
In reply to#1455189

[Multipart message — attachments visible in raw view] — view raw

Hi Eric,

[auto build test ERROR on vfio/next]
[also build test ERROR on v4.7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Eric-Auger/KVM-PCIe-MSI-passthrough-on-ARM-ARM64-kernel-part-3-3-vfio-changes/20160803-122924
base:   https://github.com/awilliam/linux-vfio.git next
config: x86_64-randconfig-s1-08031247 (attached as .config)
compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/vfio/vfio_iommu_type1.c:39:29: error: linux/msi-iommu.h: No such file or directory
>> drivers/vfio/vfio_iommu_type1.c:40:32: error: linux/msi-doorbell.h: No such file or directory
   drivers/vfio/vfio_iommu_type1.c: In function 'vfio_set_msi_aperture':
   drivers/vfio/vfio_iommu_type1.c:453: error: implicit declaration of function 'iommu_msi_set_aperture'
   drivers/vfio/vfio_iommu_type1.c: In function 'vfio_iommu_type1_attach_group':
>> drivers/vfio/vfio_iommu_type1.c:933: error: implicit declaration of function 'msi_doorbell_safe'
   At top level:
   cc1: warning: unrecognized command line option "-Wno-maybe-uninitialized"

vim +40 drivers/vfio/vfio_iommu_type1.c

    33	#include <linux/rbtree.h>
    34	#include <linux/sched.h>
    35	#include <linux/slab.h>
    36	#include <linux/uaccess.h>
    37	#include <linux/vfio.h>
    38	#include <linux/workqueue.h>
  > 39	#include <linux/msi-iommu.h>
  > 40	#include <linux/msi-doorbell.h>
    41	
    42	#define DRIVER_VERSION  "0.2"
    43	#define DRIVER_AUTHOR   "Alex Williamson <alex.williamson@redhat.com>"

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web