lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAC=cRTO8LKSOq-Div=QeyqRvbbB6WFgM3vjYWesCS7OPk+PaZw@mail.gmail.com>
Date:	Thu, 15 Sep 2011 11:21:13 +0800
From:	huang ying <huang.ying.caritas@...il.com>
To:	Zhang Rui <rui.zhang@...el.com>
Cc:	Shaohua Li <shli@...nel.org>,
	Matt Fleming <matt@...sole-pimps.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Matthew Garrett <mjg59@...f.ucam.org>,
	"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH] EFI: Do not use __pa() to get the physical address of an
 ioremapped memory range

On Thu, Sep 15, 2011 at 9:52 AM, Zhang Rui <rui.zhang@...el.com> wrote:
> On Thu, 2011-09-15 at 09:22 +0800, Shaohua Li wrote:
>> 2011/9/12 Matt Fleming <matt@...sole-pimps.org>:
>> > On Fri, 2011-09-02 at 13:12 +0800, huang ying wrote:
>> >> On Thu, Sep 1, 2011 at 8:28 PM, Matt Fleming <matt@...sole-pimps.org> wrote:
>> >> >
>> >> > Hmm.. does anyone know why we ioremap_cache() the memory on
>> >> > CONFIG_X86_32 instead of ioremap_nocache()? In the case of
>> >> > EFI_MEMORY_MAPPED_IO the memory really needs to be uncached. Then if
>> >> > we've ioremap'd the memory we should skip set_memory_uc() altogether,
>> >> > no?
>> >>
>> >> Because whether the mapping should be cached is determined by md->attr
>> >> instead of md->type.  And besides UC, we may add WC, etc support.
>> >
>> > Confused.
>> >
>> > The CONFIG_X86_64 version of efi_ioremap() looks like this,
>> >
>> > void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
>> >                                 u32 type)
>> > {
>> >        unsigned long last_map_pfn;
>> >
>> >        if (type == EFI_MEMORY_MAPPED_IO)
>> >                return ioremap(phys_addr, size);
>> >
>> > Which uses md->type to figure out if we should call ioremap(), which on
>> > x86 is #define'd to ioremap_nocache(). CONFIG_X86_32 doesn't do this,
>> > but it looks to me like it should.
>> agree. mapping it wrong and fixing it later makes no sense. we should get
>> the mapping correct at the first.
>>
> So what kinds of memory regions need ioremap_nocache?
> should we make this decision based on the memory range type or attribute
> or even both of them?

I think the decision should be made based on attribute as follow:

- attribute & EFI_MEMORY_WB --> ioremap_cache
- attribute & EFI_MEMORY_WC --> ioremap_wc
- others -> ioremap_nocache

init_memory_mapping in efi_ioremap is used to make kexec support
possible.  But ioremap is used anyway, kexec support should be done in
another way.  So I think it is ok to just use ioremap_xxx in
efi_ioremap.  The efi_ioremap definition for 32bit need to be fixed
too.

Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ