Changeset 46c20c8 in mainline for kernel/arch/sparc64/src/mm/sun4u


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
kernel/arch/sparc64/src/mm/sun4u
Files:
1 added
3 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/mm/sun4u/as.c

    rfb150d78 r46c20c8  
    4141
    4242#ifdef CONFIG_TSB
     43
    4344#include <arch/mm/tsb.h>
    4445#include <arch/memstr.h>
     
    4748#include <bitops.h>
    4849#include <macros.h>
     50
    4951#endif /* CONFIG_TSB */
    5052
     
    5860}
    5961
    60 int as_constructor_arch(as_t *as, int flags)
     62int as_constructor_arch(as_t *as, unsigned int flags)
    6163{
    6264#ifdef CONFIG_TSB
     
    6466         * The order must be calculated with respect to the emulated
    6567         * 16K page size.
    66          */
    67         int order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
     68         *
     69         */
     70        uint8_t order = fnzb32(((ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) *
    6871            sizeof(tsb_entry_t)) >> FRAME_WIDTH);
    69 
     72       
    7073        uintptr_t tsb = (uintptr_t) frame_alloc(order, flags | FRAME_KA);
    71 
     74       
    7275        if (!tsb)
    7376                return -1;
    74 
     77       
    7578        as->arch.itsb = (tsb_entry_t *) tsb;
    7679        as->arch.dtsb = (tsb_entry_t *) (tsb + ITSB_ENTRY_COUNT *
    7780            sizeof(tsb_entry_t));
    78 
     81       
    7982        memsetb(as->arch.itsb,
    8083            (ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT) * sizeof(tsb_entry_t), 0);
    8184#endif
     85       
    8286        return 0;
    8387}
     
    9397            sizeof(tsb_entry_t)) >> FRAME_WIDTH;
    9498        frame_free(KA2PA((uintptr_t) as->arch.itsb));
     99       
    95100        return cnt;
    96101#else
     
    99104}
    100105
    101 int as_create_arch(as_t *as, int flags)
     106int as_create_arch(as_t *as, unsigned int flags)
    102107{
    103108#ifdef CONFIG_TSB
    104109        tsb_invalidate(as, 0, (size_t) -1);
    105110#endif
     111       
    106112        return 0;
    107113}
     
    123129         *
    124130         * Moreover, the as->asid is protected by asidlock, which is being held.
     131         *
    125132         */
    126133       
     
    130137         * secondary context register from the TL=1 code just before switch to
    131138         * userspace.
     139         *
    132140         */
    133141        ctx.v = 0;
    134142        ctx.context = as->asid;
    135143        mmu_secondary_context_write(ctx.v);
    136 
    137 #ifdef CONFIG_TSB       
     144       
     145#ifdef CONFIG_TSB
    138146        uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
    139 
     147       
    140148        ASSERT(as->arch.itsb && as->arch.dtsb);
    141 
     149       
    142150        uintptr_t tsb = (uintptr_t) as->arch.itsb;
    143                
     151       
    144152        if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
    145153                /*
     
    147155                 * by the locked 4M kernel DTLB entry. We need
    148156                 * to map both TSBs explicitly.
     157                 *
    149158                 */
    150159                dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, tsb);
    151160                dtlb_insert_mapping(tsb, KA2PA(tsb), PAGESIZE_64K, true, true);
    152161        }
    153                
     162       
    154163        /*
    155164         * Setup TSB Base registers.
     165         *
    156166         */
    157167        tsb_base_reg_t tsb_base;
    158                
     168       
    159169        tsb_base.value = 0;
    160170        tsb_base.size = TSB_SIZE;
    161171        tsb_base.split = 0;
    162 
     172       
    163173        tsb_base.base = ((uintptr_t) as->arch.itsb) >> MMU_PAGE_WIDTH;
    164174        itsb_base_write(tsb_base.value);
     
    175185         * Clearing the extension registers will ensure that the value of the
    176186         * TSB Base register will be used as an address of TSB, making the code
    177          * compatible with the US port.
     187         * compatible with the US port.
     188         *
    178189         */
    179190        itsb_primary_extension_write(0);
     
    195206void as_deinstall_arch(as_t *as)
    196207{
    197 
    198208        /*
    199209         * Note that we don't and may not lock the address space. That's ok
     
    201211         *
    202212         * Moreover, the as->asid is protected by asidlock, which is being held.
    203          */
    204 
     213         *
     214         */
     215       
    205216#ifdef CONFIG_TSB
    206217        uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
    207 
     218       
    208219        ASSERT(as->arch.itsb && as->arch.dtsb);
    209 
     220       
    210221        uintptr_t tsb = (uintptr_t) as->arch.itsb;
    211                
     222       
    212223        if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
    213224                /*
  • kernel/arch/sparc64/src/mm/sun4u/tlb.c

    rfb150d78 r46c20c8  
    2727 */
    2828
    29 /** @addtogroup sparc64mm       
     29/** @addtogroup sparc64mm
    3030 * @{
    3131 */
     
    3737#include <mm/as.h>
    3838#include <mm/asid.h>
    39 #include <genarch/mm/page_ht.h>
    4039#include <arch/mm/frame.h>
    4140#include <arch/mm/page.h>
     
    4544#include <arch.h>
    4645#include <print.h>
    47 #include <arch/types.h>
     46#include <typedefs.h>
    4847#include <config.h>
    4948#include <arch/trap/trap.h>
     
    5150#include <panic.h>
    5251#include <arch/asm.h>
     52#include <genarch/mm/page_ht.h>
    5353
    5454#ifdef CONFIG_TSB
     
    5858static void dtlb_pte_copy(pte_t *, size_t, bool);
    5959static void itlb_pte_copy(pte_t *, size_t);
    60 static void do_fast_instruction_access_mmu_miss_fault(istate_t *, const char *);
     60static void do_fast_instruction_access_mmu_miss_fault(istate_t *, uintptr_t,
     61    const char *);
    6162static void do_fast_data_access_mmu_miss_fault(istate_t *, tlb_tag_access_reg_t,
    6263    const char *);
     
    6465    tlb_tag_access_reg_t, const char *);
    6566
    66 char *context_encoding[] = {
     67const char *context_encoding[] = {
    6768        "Primary",
    6869        "Secondary",
     
    222223                 * Forward the page fault to the address space page fault
    223224                 * handler.
    224                  */             
     225                 */
    225226                page_table_unlock(AS, true);
    226227                if (as_page_fault(page_16k, PF_ACCESS_EXEC, istate) ==
    227228                    AS_PF_FAULT) {
    228229                        do_fast_instruction_access_mmu_miss_fault(istate,
    229                             __func__);
     230                            istate->tpc, __func__);
    230231                }
    231232        }
     
    258259                        /* NULL access in kernel */
    259260                        do_fast_data_access_mmu_miss_fault(istate, tag,
    260                             __func__);
     261                            "Dereferencing NULL pointer.");
    261262                } else if (page_8k >= end_of_identity) {
    262263                        /*
     
    359360static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d)
    360361{
    361         printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, "
    362             "ie=%d, soft2=%#x, pfn=%#x, soft=%#x, l=%d, "
    363             "cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", i, t.vpn,
     362        printf("%u: vpn=%#" PRIx64 ", context=%u, v=%u, size=%u, nfo=%u, "
     363            "ie=%u, soft2=%#x, pfn=%#x, soft=%#x, l=%u, "
     364            "cp=%u, cv=%u, e=%u, p=%u, w=%u, g=%u\n", i, (uint64_t) t.vpn,
    364365            t.context, d.v, d.size, d.nfo, d.ie, d.soft2,
    365366            d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
     
    438439
    439440void do_fast_instruction_access_mmu_miss_fault(istate_t *istate,
    440     const char *str)
    441 {
    442         fault_if_from_uspace(istate, "%s.", str);
    443         dump_istate(istate);
    444         panic("%s.", str);
     441    uintptr_t va, const char *str)
     442{
     443        fault_if_from_uspace(istate, "%s, address=%p.", str, (void *) va);
     444        panic_memtrap(istate, PF_ACCESS_EXEC, va, str);
    445445}
    446446
     
    451451
    452452        va = tag.vpn << MMU_PAGE_WIDTH;
    453         if (tag.context) {
    454                 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va,
    455                     tag.context);
    456         }
    457         dump_istate(istate);
    458         printf("Faulting page: %p, ASID=%d.\n", va, tag.context);
    459         panic("%s.", str);
     453        fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
     454            (void *) va, tag.context);
     455        panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, str);
    460456}
    461457
     
    466462
    467463        va = tag.vpn << MMU_PAGE_WIDTH;
    468 
    469         if (tag.context) {
    470                 fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d).", str, va,
    471                     tag.context);
    472         }
    473         printf("Faulting page: %p, ASID=%d\n", va, tag.context);
    474         dump_istate(istate);
    475         panic("%s.", str);
    476 }
    477 
    478 void dump_sfsr_and_sfar(void)
     464        fault_if_from_uspace(istate, "%s, page=%p (asid=%u).", str,
     465            (void *) va, tag.context);
     466        panic_memtrap(istate, PF_ACCESS_WRITE, va, str);
     467}
     468
     469void describe_dmmu_fault(void)
    479470{
    480471        tlb_sfsr_reg_t sfsr;
     
    493484            sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
    494485#endif
     486       
     487        printf("DTLB SFAR: address=%p\n", (void *) sfar);
     488       
     489        dtlb_sfsr_write(0);
     490}
     491
     492void dump_sfsr_and_sfar(void)
     493{
     494        tlb_sfsr_reg_t sfsr;
     495        uintptr_t sfar;
     496
     497        sfsr.value = dtlb_sfsr_read();
     498        sfar = dtlb_sfar_read();
     499       
     500#if defined (US)
     501        printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, "
     502            "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
     503            sfsr.ow, sfsr.fv);
     504#elif defined (US3)
     505        printf("DTLB SFSR: nf=%d, asi=%#x, tm=%d, ft=%#x, e=%d, ct=%d, pr=%d, "
     506            "w=%d, ow=%d, fv=%d\n", sfsr.nf, sfsr.asi, sfsr.tm, sfsr.ft,
     507            sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
     508#endif
    495509           
    496         printf("DTLB SFAR: address=%p\n", sfar);
     510        printf("DTLB SFAR: address=%p\n", (void *) sfar);
    497511       
    498512        dtlb_sfsr_write(0);
  • kernel/arch/sparc64/src/mm/sun4u/tsb.c

    rfb150d78 r46c20c8  
    3838#include <arch/barrier.h>
    3939#include <mm/as.h>
    40 #include <arch/types.h>
     40#include <typedefs.h>
    4141#include <macros.h>
    4242#include <debug.h>
Note: See TracChangeset for help on using the changeset viewer.