Re: [PATCH 2/3] powperc/mm: read TLB Block Invalidate Characteristics

From: Laurent Dufour
Date: Fri Sep 13 2019 - 05:10:46 EST


Le 13/09/2019 Ã 04:00, Aneesh Kumar K.V a ÃcritÂ:
On 9/13/19 12:56 AM, Laurent Dufour wrote:
Le 12/09/2019 Ã 16:44, Aneesh Kumar K.V a ÃcritÂ:
Laurent Dufour <ldufour@xxxxxxxxxxxxx> writes:

+
+ÂÂÂ idx = 2;
+ÂÂÂ while (idx < len) {
+ÂÂÂÂÂÂÂ unsigned int block_size = local_buffer[idx++];
+ÂÂÂÂÂÂÂ unsigned int npsize;
+
+ÂÂÂÂÂÂÂ if (!block_size)
+ÂÂÂÂÂÂÂÂÂÂÂ break;
+
+ÂÂÂÂÂÂÂ block_size = 1 << block_size;
+ÂÂÂÂÂÂÂ if (block_size != 8)
+ÂÂÂÂÂÂÂÂÂÂÂ /* We only support 8 bytes size TLB invalidate buffer */
+ÂÂÂÂÂÂÂÂÂÂÂ pr_warn("Unsupported H_BLOCK_REMOVE block size : %d\n",
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ block_size);

Should we skip setting block size if we find block_size != 8? Also can
we avoid doing that pr_warn in loop and only warn if we don't find
block_size 8 in the invalidate characteristics array?

My idea here is to fully read and process the data returned by the hcall, and to put the limitation to 8 when checking before calling H_BLOCK_REMOVE.
The warning is there because I want it to be displayed once at boot.



Can we have two block size reported for the same base page size/actual page size combination? If so we will overwrite the hblk[actual_psize] ?

In check_lp_set_hblk() I'm only keeping the bigger one.



+
+ÂÂÂÂÂÂÂ for (npsize = local_buffer[idx++];Â npsize > 0; npsize--)
+ÂÂÂÂÂÂÂÂÂÂÂ check_lp_set_hblk((unsigned int) local_buffer[idx++],
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ block_size);
+ÂÂÂ }
+
+ÂÂÂ for (bpsize = 0; bpsize < MMU_PAGE_COUNT; bpsize++)
+ÂÂÂÂÂÂÂ for (idx = 0; idx < MMU_PAGE_COUNT; idx++)
+ÂÂÂÂÂÂÂÂÂÂÂ if (mmu_psize_defs[bpsize].hblk[idx])
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ pr_info("H_BLOCK_REMOVE supports base psize:%d psize:%d block size:%d",
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ bpsize, idx,
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ mmu_psize_defs[bpsize].hblk[idx]);
+
+ÂÂÂ return 0;
+}
+machine_arch_initcall(pseries, read_tlbbi_characteristics);
+
 /*
ÂÂ * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie
ÂÂ * lock.

-aneesh