[PATCH 0/6] x86: unify fixmap.h - Kernel

This is a discussion on [PATCH 0/6] x86: unify fixmap.h - Kernel ; This patches unify fixmap_32.h and fixmap_64.h into fixmap.h. Things that we can't merge now are using CONFIG_X86_{32,64} (e.g.:vsyscall and EFI) Signed-off-by: Gustavo F. Padovan Acked-by: Glauber Costa --- arch/x86/include/asm/fixmap.h | 156 +++++++++++++++++++++++++++++++++++++- arch/x86/include/asm/fixmap_32.h | 123 ------------------------------ arch/x86/include/asm/fixmap_64.h | 94 ----------------------- ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: [PATCH 0/6] x86: unify fixmap.h

  1. [PATCH 6/6] x86: Unify fixmap.h

    This patches unify fixmap_32.h and fixmap_64.h into fixmap.h.
    Things that we can't merge now are using CONFIG_X86_{32,64}
    (e.g.:vsyscall and EFI)

    Signed-off-by: Gustavo F. Padovan
    Acked-by: Glauber Costa
    ---
    arch/x86/include/asm/fixmap.h | 156 +++++++++++++++++++++++++++++++++++++-
    arch/x86/include/asm/fixmap_32.h | 123 ------------------------------
    arch/x86/include/asm/fixmap_64.h | 94 -----------------------
    3 files changed, 154 insertions(+), 219 deletions(-)
    delete mode 100644 arch/x86/include/asm/fixmap_32.h
    delete mode 100644 arch/x86/include/asm/fixmap_64.h

    diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
    index 8668a94..f400f3a 100644
    --- a/arch/x86/include/asm/fixmap.h
    +++ b/arch/x86/include/asm/fixmap.h
    @@ -1,11 +1,162 @@
    +/*
    + * fixmap.h: compile-time virtual memory allocation
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 1998 Ingo Molnar
    + *
    + * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
    + */
    +
    #ifndef _ASM_X86_FIXMAP_H
    #define _ASM_X86_FIXMAP_H

    +#ifndef __ASSEMBLY__
    +#include
    +#include
    +#include
    +#include
    +#ifdef CONFIG_HIGHMEM
    +#include
    +#include
    +#endif
    +#ifdef CONFIG_X86_64
    +#include
    +#ifdef CONFIG_EFI
    +#include
    +#endif
    +#endif
    +
    +/*
    + * We can't declare FIXADDR_TOP as variable for x86_64 because vsyscall
    + * uses fixmaps that relies on FIXADDR_TOP for proper address calculation.
    + * Because of this, FIXADDR_TOP x86 integration was left as later work.
    + */
    #ifdef CONFIG_X86_32
    -# include "fixmap_32.h"
    +/* used by vmalloc.c, vsyscall.lds.S.
    + *
    + * Leave one empty page between vmalloc'ed areas and
    + * the start of the fixmap.
    + */
    +extern unsigned long __FIXADDR_TOP;
    +#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
    +
    +#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
    +#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
    #else
    -# include "fixmap_64.h"
    +#define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE)
    +
    +/* Only covers 32bit vsyscalls currently. Need another set for 64bit. */
    +#define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL)
    +#define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE)
    +#endif
    +
    +
    +/*
    + * Here we define all the compile-time 'special' virtual
    + * addresses. The point is to have a constant address at
    + * compile time, but to set the physical address only
    + * in the boot process.
    + * for x86_32: We allocate these special addresses
    + * from the end of virtual memory (0xfffff000) backwards.
    + * Also this lets us do fail-safe vmalloc(), we
    + * can guarantee that these special addresses and
    + * vmalloc()-ed addresses never overlap.
    + *
    + * these 'compile-time allocated' memory buffers are
    + * fixed-size 4k pages. (or larger if used with an increment
    + * highger than 1) use fixmap_set(idx,phys) to associate
    + * physical memory with fixmap indices.
    + *
    + * TLB entries of such buffers will not be flushed across
    + * task switches.
    + */
    +
    +enum fixed_addresses {
    +#ifdef CONFIG_X86_32
    + FIX_HOLE,
    + FIX_VDSO,
    +#else
    + VSYSCALL_LAST_PAGE,
    + VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
    + + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
    + VSYSCALL_HPET,
    +#endif
    + FIX_DBGP_BASE,
    + FIX_EARLYCON_MEM_BASE,
    +#ifdef CONFIG_X86_LOCAL_APIC
    + FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
    #endif
    +#ifdef CONFIG_X86_IO_APIC
    + FIX_IO_APIC_BASE_0,
    + FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
    +#endif
    +#ifdef CONFIG_X86_64
    +#ifdef CONFIG_EFI
    + FIX_EFI_IO_MAP_LAST_PAGE,
    + FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE
    + + MAX_EFI_IO_PAGES - 1,
    +#endif
    +#endif
    +#ifdef CONFIG_X86_VISWS_APIC
    + FIX_CO_CPU, /* Cobalt timer */
    + FIX_CO_APIC, /* Cobalt APIC Redirection Table */
    + FIX_LI_PCIA, /* Lithium PCI Bridge A */
    + FIX_LI_PCIB, /* Lithium PCI Bridge B */
    +#endif
    +#ifdef CONFIG_X86_F00F_BUG
    + FIX_F00F_IDT, /* Virtual mapping for IDT */
    +#endif
    +#ifdef CONFIG_X86_CYCLONE_TIMER
    + FIX_CYCLONE_TIMER, /*cyclone timer register*/
    +#endif
    +#ifdef CONFIG_HIGHMEM
    + FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
    + FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
    +#endif
    +#ifdef CONFIG_X86_32
    +#ifdef CONFIG_PCI_MMCONFIG
    + FIX_PCIE_MCFG,
    +#endif
    +#endif
    +#ifdef CONFIG_PARAVIRT
    + FIX_PARAVIRT_BOOTMAP,
    +#endif
    + __end_of_permanent_fixed_addresses,
    +#ifdef CONFIG_ACPI
    + FIX_ACPI_BEGIN,
    + FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
    +#endif
    +#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
    + FIX_OHCI1394_BASE,
    +#endif
    + /*
    + * 256 temporary boot-time mappings, used by early_ioremap(),
    + * before ioremap() is functional.
    + *
    + * We round it up to the next 256 pages boundary so that we
    + * can have a single pgd entry and a single pte table:
    + */
    +#define NR_FIX_BTMAPS 64
    +#define FIX_BTMAPS_SLOTS 4
    + FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
    + (__end_of_permanent_fixed_addresses & 255),
    + FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
    +#ifdef CONFIG_X86_32
    + FIX_WP_TEST,
    +#endif
    + __end_of_fixed_addresses
    +};
    +
    +
    +extern void reserve_top_address(unsigned long reserve);
    +
    +#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
    +#define FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
    +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
    +#define FIXADDR_BOOT_START (FIXADDR_TOP - FIXADDR_BOOT_SIZE)

    extern int fixmaps_set;

    @@ -65,4 +216,5 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
    BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
    return __virt_to_fix(vaddr);
    }
    +#endif /* !__ASSEMBLY__ */
    #endif /* _ASM_X86_FIXMAP_H */
    diff --git a/arch/x86/include/asm/fixmap_32.h b/arch/x86/include/asm/fixmap_32.h
    deleted file mode 100644
    index 5d533f0..0000000
    --- a/arch/x86/include/asm/fixmap_32.h
    +++ /dev/null
    @@ -1,123 +0,0 @@
    -/*
    - * fixmap.h: compile-time virtual memory allocation
    - *
    - * This file is subject to the terms and conditions of the GNU General Public
    - * License. See the file "COPYING" in the main directory of this archive
    - * for more details.
    - *
    - * Copyright (C) 1998 Ingo Molnar
    - *
    - * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
    - */
    -
    -#ifndef _ASM_X86_FIXMAP_32_H
    -#define _ASM_X86_FIXMAP_32_H
    -
    -
    -/* used by vmalloc.c, vsyscall.lds.S.
    - *
    - * Leave one empty page between vmalloc'ed areas and
    - * the start of the fixmap.
    - */
    -extern unsigned long __FIXADDR_TOP;
    -#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
    -#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
    -
    -#ifndef __ASSEMBLY__
    -#include
    -#include
    -#include
    -#include
    -#ifdef CONFIG_HIGHMEM
    -#include
    -#include
    -#endif
    -
    -/*
    - * Here we define all the compile-time 'special' virtual
    - * addresses. The point is to have a constant address at
    - * compile time, but to set the physical address only
    - * in the boot process. We allocate these special addresses
    - * from the end of virtual memory (0xfffff000) backwards.
    - * Also this lets us do fail-safe vmalloc(), we
    - * can guarantee that these special addresses and
    - * vmalloc()-ed addresses never overlap.
    - *
    - * these 'compile-time allocated' memory buffers are
    - * fixed-size 4k pages. (or larger if used with an increment
    - * highger than 1) use fixmap_set(idx,phys) to associate
    - * physical memory with fixmap indices.
    - *
    - * TLB entries of such buffers will not be flushed across
    - * task switches.
    - */
    -enum fixed_addresses {
    - FIX_HOLE,
    - FIX_VDSO,
    - FIX_DBGP_BASE,
    - FIX_EARLYCON_MEM_BASE,
    -#ifdef CONFIG_X86_LOCAL_APIC
    - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
    -#endif
    -#ifdef CONFIG_X86_IO_APIC
    - FIX_IO_APIC_BASE_0,
    - FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
    -#endif
    -#ifdef CONFIG_X86_VISWS_APIC
    - FIX_CO_CPU, /* Cobalt timer */
    - FIX_CO_APIC, /* Cobalt APIC Redirection Table */
    - FIX_LI_PCIA, /* Lithium PCI Bridge A */
    - FIX_LI_PCIB, /* Lithium PCI Bridge B */
    -#endif
    -#ifdef CONFIG_X86_F00F_BUG
    - FIX_F00F_IDT, /* Virtual mapping for IDT */
    -#endif
    -#ifdef CONFIG_X86_CYCLONE_TIMER
    - FIX_CYCLONE_TIMER, /*cyclone timer register*/
    -#endif
    -#ifdef CONFIG_HIGHMEM
    - FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
    - FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
    -#endif
    -#ifdef CONFIG_PCI_MMCONFIG
    - FIX_PCIE_MCFG,
    -#endif
    -#ifdef CONFIG_PARAVIRT
    - FIX_PARAVIRT_BOOTMAP,
    -#endif
    - __end_of_permanent_fixed_addresses,
    - /*
    - * 256 temporary boot-time mappings, used by early_ioremap(),
    - * before ioremap() is functional.
    - *
    - * We round it up to the next 256 pages boundary so that we
    - * can have a single pgd entry and a single pte table:
    - */
    -#define NR_FIX_BTMAPS 64
    -#define FIX_BTMAPS_SLOTS 4
    - FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
    - (__end_of_permanent_fixed_addresses & 255),
    - FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
    - FIX_WP_TEST,
    -#ifdef CONFIG_ACPI
    - FIX_ACPI_BEGIN,
    - FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
    -#endif
    -#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
    - FIX_OHCI1394_BASE,
    -#endif
    - __end_of_fixed_addresses
    -};
    -
    -extern void reserve_top_address(unsigned long reserve);
    -
    -
    -#define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
    -
    -#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
    -#define FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
    -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
    -#define FIXADDR_BOOT_START (FIXADDR_TOP - FIXADDR_BOOT_SIZE)
    -
    -#endif /* !__ASSEMBLY__ */
    -#endif /* _ASM_X86_FIXMAP_32_H */
    diff --git a/arch/x86/include/asm/fixmap_64.h b/arch/x86/include/asm/fixmap_64.h
    deleted file mode 100644
    index 5dc7941..0000000
    --- a/arch/x86/include/asm/fixmap_64.h
    +++ /dev/null
    @@ -1,94 +0,0 @@
    -/*
    - * fixmap.h: compile-time virtual memory allocation
    - *
    - * This file is subject to the terms and conditions of the GNU General Public
    - * License. See the file "COPYING" in the main directory of this archive
    - * for more details.
    - *
    - * Copyright (C) 1998 Ingo Molnar
    - */
    -
    -#ifndef _ASM_X86_FIXMAP_64_H
    -#define _ASM_X86_FIXMAP_64_H
    -
    -#include
    -#include
    -#include
    -#include
    -#include
    -#include
    -
    -/*
    - * Here we define all the compile-time 'special' virtual
    - * addresses. The point is to have a constant address at
    - * compile time, but to set the physical address only
    - * in the boot process.
    - *
    - * These 'compile-time allocated' memory buffers are
    - * fixed-size 4k pages (or larger if used with an increment
    - * higher than 1). Use set_fixmap(idx,phys) to associate
    - * physical memory with fixmap indices.
    - *
    - * TLB entries of such buffers will not be flushed across
    - * task switches.
    - */
    -
    -enum fixed_addresses {
    - VSYSCALL_LAST_PAGE,
    - VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
    - + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
    - VSYSCALL_HPET,
    - FIX_DBGP_BASE,
    - FIX_EARLYCON_MEM_BASE,
    -#ifdef CONFIG_X86_LOCAL_APIC
    - FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
    -#endif
    -#ifdef CONFIG_X86_IO_APIC
    - FIX_IO_APIC_BASE_0,
    - FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS - 1,
    -#endif
    -#ifdef CONFIG_EFI
    - FIX_EFI_IO_MAP_LAST_PAGE,
    - FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE
    - + MAX_EFI_IO_PAGES - 1,
    -#endif
    -#ifdef CONFIG_PARAVIRT
    - FIX_PARAVIRT_BOOTMAP,
    -#endif
    - __end_of_permanent_fixed_addresses,
    -#ifdef CONFIG_ACPI
    - FIX_ACPI_BEGIN,
    - FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
    -#endif
    -#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
    - FIX_OHCI1394_BASE,
    -#endif
    - /*
    - * 256 temporary boot-time mappings, used by early_ioremap(),
    - * before ioremap() is functional.
    - *
    - * We round it up to the next 256 pages boundary so that we
    - * can have a single pgd entry and a single pte table:
    - */
    -#define NR_FIX_BTMAPS 64
    -#define FIX_BTMAPS_SLOTS 4
    - FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 -
    - (__end_of_permanent_fixed_addresses & 255),
    - FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1,
    - __end_of_fixed_addresses
    -};
    -
    -extern void reserve_top_address(unsigned long reserve);
    -
    -#define FIXADDR_TOP (VSYSCALL_END-PAGE_SIZE)
    -
    -#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
    -#define FIXADDR_BOOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
    -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
    -#define FIXADDR_BOOT_START (FIXADDR_TOP - FIXADDR_BOOT_SIZE)
    -
    -/* Only covers 32bit vsyscalls currently. Need another set for 64bit. */
    -#define FIXADDR_USER_START ((unsigned long)VSYSCALL32_VSYSCALL)
    -#define FIXADDR_USER_END (FIXADDR_USER_START + PAGE_SIZE)
    -
    -#endif /* _ASM_X86_FIXMAP_64_H */
    --
    1.5.6.4

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

  2. [PATCH 0/6] x86: unify fixmap.h

    Theses patches unify the fixmap_(32|64).h into fixmap.h
    Some things was left with '#ifdef CONFIG_X86_(32|64)' because first we
    need to integrate things like vsyscall, efi, pci_mmconfig, FIXADDR_TOP
    and FIX_WP_TEST.

    Signed-off-by: Gustavo F. Padovan
    Acked-by: Glauber Costa


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

  3. Re: [PATCH 1/6] x86: rename __FIXADDR_SIZE and __FIXADDR_BOOT_SIZE


    * Gustavo F. Padovan wrote:

    > Rename __FIXADDR_SIZE to FIXADDR_SIZE
    > and __FIXADDR_BOOT_SIZE to FIXADDR_BOOT_SIZE.
    >
    > Signed-off-by: Gustavo F. Padovan
    > Acked-by: Glauber Costa


    ok, the patches look nice. Could you please rework them against
    tip/master? We already have a commit in
    arch/x86/include/asm/fixmap_32.h (the DRM speedup patches) which cause
    rejects.

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

  4. Re: [PATCH 1/6] x86: rename __FIXADDR_SIZE and __FIXADDR_BOOT_SIZE

    On Mon, Nov 3, 2008 at 7:15 AM, Ingo Molnar wrote:
    >
    > * Gustavo F. Padovan wrote:
    >
    >> Rename __FIXADDR_SIZE to FIXADDR_SIZE
    >> and __FIXADDR_BOOT_SIZE to FIXADDR_BOOT_SIZE.
    >>
    >> Signed-off-by: Gustavo F. Padovan
    >> Acked-by: Glauber Costa

    >
    > ok, the patches look nice. Could you please rework them against
    > tip/master? We already have a commit in
    > arch/x86/include/asm/fixmap_32.h (the DRM speedup patches) which cause
    > rejects.


    That's ok.

    >
    > Ingo
    >




    --
    ----------------------------------------------
    Gustavo Fernando Padovan
    Engenharia de Computação 2006
    LAS - Laboratório de Administração e Segurança de Sistemas
    Instituto de Computação - UNICAMP

    gfpadovan@gmail.com
    ra061316@students.ic.unicamp.br
    pao@jabber.org
    -------------------------------------------

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

+ Reply to Thread