lkml.org 
[lkml]   [2011]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] EFI: Do not use __pa() to get the physical address of an ioremapped memory range
    From
    Date
    On Fri, 2011-09-02 at 13:12 +0800, huang ying wrote: 
    > On Thu, Sep 1, 2011 at 8:28 PM, Matt Fleming <matt@console-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.

    Zhang, I agree that calling __pa() on an ioremap()'d region is bogus,
    but I don't understand why no one is seeing this crash on x86-64. Is it
    something to do with the x86-64 memory map layout such that __pa() works
    on an ioremap()'d address?

    --
    Matt Fleming, Intel Open Source Technology Center



    \
     
     \ /
      Last update: 2011-09-12 16:55    [W:0.021 / U:1.596 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site