From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
akpm@linux-foundation.org, Greg KH <greg@kroah.com>,
muli@il.ibm.com, paulus@samba.org, kristen.c.accardi@intel.com
Subject: Re: [patch take 2][Intel-IOMMU] Fix for IOMMU early crash
Date: Fri, 05 Oct 2007 13:08:25 +1000 [thread overview]
Message-ID: <1191553705.28239.30.camel@pasglop> (raw)
In-Reply-To: <20071004192011.GA567@askeshav-devel.jf.intel.com>
> Subject: [Intel-IOMMU] Fix for IOMMU early crash
>
> pci_dev's->sysdata is highly overloaded and currently
> IOMMU is broken due to IOMMU code depending on this field.
>
> This patch introduces new field in pci_dev's dev.archdata struct to
> hold IOMMU specific per device IOMMU private data.
>
> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Looks good. Won't break powerpc.
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/pci/intel-iommu.c | 22 +++++++++++-----------
> include/asm-x86_64/device.h | 3 +++
> 2 files changed, 14 insertions(+), 11 deletions(-)
>
> Index: 2.6-mm/drivers/pci/intel-iommu.c
> ===================================================================
> --- 2.6-mm.orig/drivers/pci/intel-iommu.c 2007-10-04 11:35:09.000000000 -0700
> +++ 2.6-mm/drivers/pci/intel-iommu.c 2007-10-04 11:47:47.000000000 -0700
> @@ -1348,7 +1348,7 @@
> list_del(&info->link);
> list_del(&info->global);
> if (info->dev)
> - info->dev->sysdata = NULL;
> + info->dev->dev.archdata.iommu = NULL;
> spin_unlock_irqrestore(&device_domain_lock, flags);
>
> detach_domain_for_dev(info->domain, info->bus, info->devfn);
> @@ -1361,7 +1361,7 @@
>
> /*
> * find_domain
> - * Note: we use struct pci_dev->sysdata stores the info
> + * Note: we use struct pci_dev->dev.archdata.iommu stores the info
> */
> struct dmar_domain *
> find_domain(struct pci_dev *pdev)
> @@ -1369,7 +1369,7 @@
> struct device_domain_info *info;
>
> /* No lock here, assumes no domain exit in normal case */
> - info = pdev->sysdata;
> + info = pdev->dev.archdata.iommu;
> if (info)
> return info->domain;
> return NULL;
> @@ -1519,7 +1519,7 @@
> }
> list_add(&info->link, &domain->devices);
> list_add(&info->global, &device_domain_list);
> - pdev->sysdata = info;
> + pdev->dev.archdata.iommu = info;
> spin_unlock_irqrestore(&device_domain_lock, flags);
> return domain;
> error:
> @@ -1579,7 +1579,7 @@
> static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr,
> struct pci_dev *pdev)
> {
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO)
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO)
> return 0;
> return iommu_prepare_identity_map(pdev, rmrr->base_address,
> rmrr->end_address + 1);
> @@ -1595,7 +1595,7 @@
> int ret;
>
> for_each_pci_dev(pdev) {
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO ||
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO ||
> !IS_GFX_DEVICE(pdev))
> continue;
> printk(KERN_INFO "IOMMU: gfx device %s 1-1 mapping\n",
> @@ -1836,7 +1836,7 @@
> int prot = 0;
>
> BUG_ON(dir == DMA_NONE);
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO)
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO)
> return virt_to_bus(addr);
>
> domain = get_valid_domain_for_dev(pdev);
> @@ -1900,7 +1900,7 @@
> unsigned long start_addr;
> struct iova *iova;
>
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO)
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO)
> return;
> domain = find_domain(pdev);
> BUG_ON(!domain);
> @@ -1974,7 +1974,7 @@
> size_t size = 0;
> void *addr;
>
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO)
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO)
> return;
>
> domain = find_domain(pdev);
> @@ -2032,7 +2032,7 @@
> unsigned long start_addr;
>
> BUG_ON(dir == DMA_NONE);
> - if (pdev->sysdata == DUMMY_DEVICE_DOMAIN_INFO)
> + if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO)
> return intel_nontranslate_map_sg(hwdev, sg, nelems, dir);
>
> domain = get_valid_domain_for_dev(pdev);
> @@ -2234,7 +2234,7 @@
> for (i = 0; i < drhd->devices_cnt; i++) {
> if (!drhd->devices[i])
> continue;
> - drhd->devices[i]->sysdata = DUMMY_DEVICE_DOMAIN_INFO;
> + drhd->devices[i]->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
> }
> }
> }
> Index: 2.6-mm/include/asm-x86_64/device.h
> ===================================================================
> --- 2.6-mm.orig/include/asm-x86_64/device.h 2007-10-04 11:35:09.000000000 -0700
> +++ 2.6-mm/include/asm-x86_64/device.h 2007-10-04 11:49:44.000000000 -0700
> @@ -10,6 +10,9 @@
> #ifdef CONFIG_ACPI
> void *acpi_handle;
> #endif
> +#ifdef CONFIG_DMAR
> + void *iommu; /* hook for IOMMU specific extension */
> +#endif
> };
>
> #endif /* _ASM_X86_64_DEVICE_H */
prev parent reply other threads:[~2007-10-05 3:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-08 20:05 [RFC][Intel-IOMMU] Fix for IOMMU early crash Keshavamurthy, Anil S
2007-09-09 11:16 ` Muli Ben-Yehuda
2007-09-10 15:43 ` Keshavamurthy, Anil S
2007-09-09 17:51 ` Muli Ben-Yehuda
2007-09-11 17:22 ` Keshavamurthy, Anil S
2007-09-09 17:37 ` Paul Mackerras
2007-09-11 17:42 ` Keshavamurthy, Anil S
2007-09-10 20:25 ` Muli Ben-Yehuda
2007-09-11 20:43 ` Keshavamurthy, Anil S
2007-09-12 19:28 ` [patch][Intel-IOMMU] " Keshavamurthy, Anil S
2007-09-11 19:48 ` Paul Mackerras
2007-09-12 21:55 ` Keshavamurthy, Anil S
2007-09-11 22:05 ` [BUG:] forcedeth: MCP55 not allowing DHCP Casey Dahlin
2007-09-18 1:59 ` Casey Dahlin
2007-09-13 1:29 ` [patch][Intel-IOMMU] Fix for IOMMU early crash Keshavamurthy, Anil S
2007-09-14 16:30 ` Paul Mackerras
2007-09-25 17:07 ` Keshavamurthy, Anil S
2007-10-03 21:13 ` [patch take 2][Intel-IOMMU] " Keshavamurthy, Anil S
2007-10-04 1:19 ` Benjamin Herrenschmidt
2007-10-04 1:36 ` Keshavamurthy, Anil S
2007-10-04 3:39 ` Benjamin Herrenschmidt
2007-10-04 19:20 ` Keshavamurthy, Anil S
2007-10-05 3:08 ` Benjamin Herrenschmidt [this message]
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=1191553705.28239.30.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=greg@kroah.com \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=muli@il.ibm.com \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox