Lines Matching refs:topa

556 struct topa {  struct
570 ((PAGE_SIZE - sizeof(struct topa)) / sizeof(struct topa_entry)) argument
579 struct topa topa; member
582 static inline struct topa_page *topa_to_page(struct topa *topa) in topa_to_page() argument
584 return container_of(topa, struct topa_page, topa); in topa_to_page()
592 static inline phys_addr_t topa_pfn(struct topa *topa) in topa_pfn() argument
594 return PFN_DOWN(virt_to_phys(topa_to_page(topa))); in topa_pfn()
612 static struct topa *topa_alloc(int cpu, gfp_t gfp) in topa_alloc()
623 tp->topa.last = 0; in topa_alloc()
630 TOPA_ENTRY(&tp->topa, 1)->base = page_to_phys(p) >> TOPA_SHIFT; in topa_alloc()
631 TOPA_ENTRY(&tp->topa, 1)->end = 1; in topa_alloc()
634 return &tp->topa; in topa_alloc()
641 static void topa_free(struct topa *topa) in topa_free() argument
643 free_page((unsigned long)topa); in topa_free()
655 static void topa_insert_table(struct pt_buffer *buf, struct topa *topa) in topa_insert_table() argument
657 struct topa *last = buf->last; in topa_insert_table()
659 list_add_tail(&topa->list, &buf->tables); in topa_insert_table()
662 buf->first = buf->last = buf->cur = topa; in topa_insert_table()
666 topa->offset = last->offset + last->size; in topa_insert_table()
667 buf->last = topa; in topa_insert_table()
674 TOPA_ENTRY(last, -1)->base = topa_pfn(topa); in topa_insert_table()
682 static bool topa_table_full(struct topa *topa) in topa_table_full() argument
686 return !!topa->last; in topa_table_full()
688 return topa->last == TENTS_PER_PAGE - 1; in topa_table_full()
703 struct topa *topa = buf->last; in topa_insert_pages() local
711 if (topa_table_full(topa)) { in topa_insert_pages()
712 topa = topa_alloc(cpu, gfp); in topa_insert_pages()
713 if (!topa) in topa_insert_pages()
716 topa_insert_table(buf, topa); in topa_insert_pages()
719 if (topa->z_count == topa->last - 1) { in topa_insert_pages()
720 if (order == TOPA_ENTRY(topa, topa->last - 1)->size) in topa_insert_pages()
721 topa->z_count++; in topa_insert_pages()
724 TOPA_ENTRY(topa, -1)->base = page_to_phys(p) >> TOPA_SHIFT; in topa_insert_pages()
725 TOPA_ENTRY(topa, -1)->size = order; in topa_insert_pages()
728 TOPA_ENTRY(topa, -1)->intr = 1; in topa_insert_pages()
729 TOPA_ENTRY(topa, -1)->stop = 1; in topa_insert_pages()
732 topa->last++; in topa_insert_pages()
733 topa->size += sizes(order); in topa_insert_pages()
746 struct topa *topa; in pt_topa_dump() local
748 list_for_each_entry(topa, &buf->tables, list) { in pt_topa_dump()
749 struct topa_page *tp = topa_to_page(topa); in pt_topa_dump()
753 topa->offset, topa->size); in pt_topa_dump()
767 if (!i && topa->z_count) in pt_topa_dump()
768 i += topa->z_count; in pt_topa_dump()
788 buf->cur = list_entry(buf->cur->list.next, struct topa, in pt_buffer_advance()
911 buf->cur = &tp->topa; in pt_read_offset()
924 struct topa *topa; in pt_topa_entry_for_page() local
937 list_for_each_entry(topa, &buf->tables, list) { in pt_topa_entry_for_page()
938 if (topa->offset + topa->size > pg << PAGE_SHIFT) in pt_topa_entry_for_page()
954 if (WARN_ON_ONCE(topa->last == -1)) in pt_topa_entry_for_page()
957 tp = topa_to_page(topa); in pt_topa_entry_for_page()
958 cur_pg = PFN_DOWN(topa->offset); in pt_topa_entry_for_page()
959 if (topa->z_count) { in pt_topa_entry_for_page()
960 z_pg = TOPA_ENTRY_PAGES(topa, 0) * (topa->z_count + 1); in pt_topa_entry_for_page()
961 start_idx = topa->z_count + 1; in pt_topa_entry_for_page()
969 idx = (pg - cur_pg) / TOPA_ENTRY_PAGES(topa, 0); in pt_topa_entry_for_page()
976 for (idx = start_idx, cur_pg += z_pg; idx < topa->last; idx++) { in pt_topa_entry_for_page()
977 if (cur_pg + TOPA_ENTRY_PAGES(topa, idx) > pg) in pt_topa_entry_for_page()
980 cur_pg += TOPA_ENTRY_PAGES(topa, idx); in pt_topa_entry_for_page()
996 struct topa *topa; in pt_topa_prev_entry() local
1002 topa = &tp->topa; in pt_topa_prev_entry()
1003 if (topa == buf->first) in pt_topa_prev_entry()
1004 topa = buf->last; in pt_topa_prev_entry()
1006 topa = list_prev_entry(topa, list); in pt_topa_prev_entry()
1008 tp = topa_to_page(topa); in pt_topa_prev_entry()
1010 return &tp->table[topa->last - 1]; in pt_topa_prev_entry()
1118 buf->cur = &cur_tp->topa; in pt_buffer_reset_offsets()
1132 struct topa *topa, *iter; in pt_buffer_fini_topa() local
1134 list_for_each_entry_safe(topa, iter, &buf->tables, list) { in pt_buffer_fini_topa()
1139 topa_free(topa); in pt_buffer_fini_topa()
1152 struct topa *topa; in pt_buffer_init_topa() local
1155 topa = topa_alloc(cpu, gfp); in pt_buffer_init_topa()
1156 if (!topa) in pt_buffer_init_topa()
1159 topa_insert_table(buf, topa); in pt_buffer_init_topa()
1576 BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE); in pt_init()