int patch_htabfix() { int i, res; uint64_t pte0, pte1; // process entire lv2 for (i = 0; i < 128; i++) { // read the old value pte0 = lv2peek(HTAB_BASE | (i << 7)); pte1 = lv2peek(HTAB_BASE | (i << 7) + 8); WriteLogInit(0,NULL,"APP: %d loop\n",i);; WriteLogInit(0,NULL,"APP: pte0: 0x%016llx\n", pte0);; WriteLogInit(0,NULL,"APP: pte1: 0x%016llx\n", pte1);; //verify entry is lv2 if ((pte1 >= HTAB_LV2_START) && (pte1 < HTAB_LV2_END)) { // patch proper htab settings res = lv1_write_htab_entry( 0, i << 3, pte0, (pte1 & 0xff0000) | 0x190 ); } } WriteLogInit(0,NULL,"APP: Htab parcheado OK!\n");; return res; }
void main(void) { for (int i = 0; i < 128; i++) { uint64_t pte0 = *(uint64_t *)(MKA(0xf000000 | (i<<7))); uint64_t pte1 = *(uint64_t *)(MKA(0xf000000 | ((i<<7)+8))); lv1_write_htab_entry(0, i << 3, pte0, (pte1 & 0xff0000) | 0x190); } }
static void ps3_hpte_clear(void) { unsigned long hpte_count = (1UL << ppc64_pft_size) >> 4; u64 i; for (i = 0; i < hpte_count; i++) lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, i, 0, 0); ps3_mm_shutdown(); ps3_mm_vas_destroy(); }
static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, unsigned long va, int psize, int ssize, int local) { int result; u64 hpte_v, want_v, hpte_rs; u64 hpte_v_array[4]; unsigned long flags; long ret; want_v = hpte_encode_v(va, psize, ssize); spin_lock_irqsave(&ps3_htab_lock, flags); result = lv1_read_htab_entries(PS3_LPAR_VAS_ID_CURRENT, slot & ~0x3UL, &hpte_v_array[0], &hpte_v_array[1], &hpte_v_array[2], &hpte_v_array[3], &hpte_rs); if (result) { pr_info("%s: res=%d read va=%lx slot=%lx psize=%d\n", __func__, result, va, slot, psize); BUG(); } hpte_v = hpte_v_array[slot % 4]; /* * As lv1_read_htab_entries() does not give us the RPN, we can * not synthesize the new hpte_r value here, and therefore can * not update the hpte with lv1_insert_htab_entry(), so we <<<<<<< HEAD * instead invalidate it and ask the caller to update it via ======= * insted invalidate it and ask the caller to update it via >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a * ps3_hpte_insert() by returning a -1 value. */ if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) { /* not found */ ret = -1; } else { /* entry found, just invalidate it */ result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); ret = -1; } spin_unlock_irqrestore(&ps3_htab_lock, flags); return ret; }
static void ps3_hpte_invalidate(unsigned long slot, unsigned long va, int psize, int ssize, int local) { unsigned long flags; int result; spin_lock_irqsave(&ps3_htab_lock, flags); result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); if (result) { pr_info("%s: res=%d va=%lx slot=%lx psize=%d\n", __func__, result, va, slot, psize); BUG(); } spin_unlock_irqrestore(&ps3_htab_lock, flags); }