From: Luming Yu <luming.yu@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: fenghua.yu@intel.com, dwmw2@infradead.org, tony.luck@intel.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [RFC patch] init default dma_ops to prepare intel_iommu_init failure
Date: Thu, 13 Aug 2009 15:03:20 +0800 [thread overview]
Message-ID: <3877989d0908130003i295cc7f2q343ad2446d0d51ff@mail.gmail.com> (raw)
In-Reply-To: <20090813155118P.fujita.tomonori@lab.ntt.co.jp>
Thanks for another workaround, we should be working on deleting wrong
assumption of"iommu_deteced == iommu working", Not just workaround. My
patch could break something.. but it is just a start towards right
goal..
On Thu, Aug 13, 2009 at 2:52 PM, FUJITA
Tomonori<fujita.tomonori@lab.ntt.co.jp> wrote:
> On Thu, 13 Aug 2009 13:48:45 +0800
> Luming Yu <luming.yu@gmail.com> wrote:
>
>> >>
>> >> This check can not be removed. Otherwise, swiotlb_dma_ops will always override
>> >> previous dma_ops value.
>> >
>> > Yeah.
>>
>> I think pci_swiotlb_init needs to be cleaned up for both x86_{32,64} and ia64.
>> it should be used to init default dma_ops, and the call site of it should be
>> as early as platform_dma_init in mem_init. SInce swiotlb_dma_ops is pitched as
>> default dma_ops for x86, ia64, we really don't need to let pci_swiotlb_init
>> know iommu_deteced, dmar_disabled or iommu_passthrough...and anything
>> like that..
>> Please note the major wrong assumption of the current implementation is
>> "iommu_deteced == iommu working" that I was trying to fix.
>
> How about this?
>
> You can work around that assumption, I guess.
>
>
> diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
> index f6b1ff0..48caafa 100644
> --- a/arch/ia64/kernel/pci-dma.c
> +++ b/arch/ia64/kernel/pci-dma.c
> @@ -20,6 +20,8 @@
>
> #include <asm/page.h>
>
> +extern int swiotlb_late_init_with_default_size (size_t size);
> +
> dma_addr_t bad_dma_address __read_mostly;
> EXPORT_SYMBOL(bad_dma_address);
>
> @@ -44,11 +46,25 @@ struct device fallback_dev = {
> };
>
> extern struct dma_map_ops intel_dma_ops;
> +extern struct dma_map_ops swiotlb_dma_ops;
>
> static int __init pci_iommu_init(void)
> {
> - if (iommu_detected)
> - intel_iommu_init();
> + int ret;
> +
> + if (iommu_detected) {
> + ret = intel_iommu_init();
> + if (ret) {
> +#ifdef CONFIG_IA64_GENERIC
> + dma_ops = &swiotlb_dma_ops;
> + if (swiotlb_late_init_with_default_size(64 * (1<<20)))
> + panic("failed to initialize swiotlb");
> + machvec_init("dig");
> +#else
> + panic("Unable to find Intel IOMMU");
> +#endif
> + }
> + }
>
> return 0;
> }
>
next prev parent reply other threads:[~2009-08-13 7:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 9:20 Luming Yu
2009-08-12 9:36 ` David Woodhouse
2009-08-12 18:17 ` Fenghua Yu
2009-08-12 18:20 ` David Woodhouse
2009-08-13 4:49 ` FUJITA Tomonori
2009-08-13 5:48 ` Luming Yu
2009-08-13 6:30 ` FUJITA Tomonori
2009-08-13 6:52 ` FUJITA Tomonori
2009-08-13 7:03 ` Luming Yu [this message]
2009-08-13 7:14 ` FUJITA Tomonori
2009-08-13 7:37 ` Luming Yu
2009-08-13 8:03 ` FUJITA Tomonori
2009-08-13 8:11 ` Luming Yu
2009-08-13 8:49 ` David Woodhouse
2009-08-13 9:00 ` FUJITA Tomonori
2009-08-13 9:00 ` Luming Yu
2009-08-13 17:08 ` David Woodhouse
2009-08-13 17:30 ` Yu, Fenghua
2009-08-14 5:44 ` Luming Yu
2009-08-13 2:11 ` FUJITA Tomonori
2009-08-13 2:24 ` Luming Yu
2009-08-13 3:15 ` FUJITA Tomonori
2009-08-13 3:18 ` FUJITA Tomonori
2009-08-13 8:26 ` David Woodhouse
2009-08-13 8:35 ` FUJITA Tomonori
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=3877989d0908130003i295cc7f2q343ad2446d0d51ff@mail.gmail.com \
--to=luming.yu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=fenghua.yu@intel.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/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
all inboxes | Powered by JetHome®