Linux IOMMU Development
 help / color / mirror / Atom feed
* Re: Intel-iommu panic on kernel v4.1-rc1
       [not found] ` <2015042715271977151914-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-04-27 21:18   ` Woodhouse, David
  0 siblings, 0 replies; only message in thread
From: Woodhouse, David @ 2015-04-27 21:18 UTC (permalink / raw)
  To: sl4ever-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org


[-- Attachment #1.1: Type: text/plain, Size: 2274 bytes --]

On Mon, 2015-04-27 at 15:27 +0800, sl4ever-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> commit 18436afdc11a00ac881990b454cfb2eae81d6003 iommu/vt-d: Allow 
> RMRR on graphics devices too
> 
> cause kernel panic with Z77+vt-d and kernel parameters: 
> intel_iommu=igfx_off iommu=pt
> the panic path is:
> dev_prepare_static_identity_mapping()
>   domain_add_dev_info()
>     dmar_insert_dev_info()
>       find_domain()
>         info = dev->archdata.iommu; 
>         if (info) 
> ->            return info->domain;
> 
> igfx_off cause <igfx@0:2.0>.archdata.iommu assigned to
>  DUMMY_DEVICE_DOMAIN_INFO. 
> Above patch cause iommu_should_identity_map() return 1, and attempt 
> to setup identity mapping for igfx.

Can you try this please?

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 68d43be..2ffe589 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -696,6 +696,11 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu
        return &context[devfn];
 }
 
+static int iommu_dummy(struct device *dev)
+{
+       return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
+}
+
 static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
 {
        struct dmar_drhd_unit *drhd = NULL;
@@ -705,6 +710,9 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
        u16 segment = 0;
        int i;
 
+       if (iommu_dummy(dev))
+               return NULL;
+
        if (dev_is_pci(dev)) {
                pdev = to_pci_dev(dev);
                segment = pci_domain_nr(pdev->bus);
@@ -2969,11 +2977,6 @@ static inline struct dmar_domain *get_valid_domain_for_dev(struct device *dev)
        return __get_valid_domain_for_dev(dev);
 }
 
-static int iommu_dummy(struct device *dev)
-{
-       return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
-}
-
 /* Check if the dev needs to go through non-identity map and unmap process.*/
 static int iommu_no_mapping(struct device *dev)
 {

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org                              Intel Corporation

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3437 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-27 21:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2015042715271977151914@gmail.com>
     [not found] ` <2015042715271977151914-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-27 21:18   ` Intel-iommu panic on kernel v4.1-rc1 Woodhouse, David

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