예제 #1
0
파일: lpar.c 프로젝트: Naibasak/linux
/*
 * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie
 * lock.
 */
static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
{
    unsigned long vpn;
    unsigned long i, pix, rc;
    unsigned long flags = 0;
    struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
    int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
    unsigned long param[9];
    unsigned long hash, index, shift, hidx, slot;
    real_pte_t pte;
    int psize, ssize;

    if (lock_tlbie)
        spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);

    psize = batch->psize;
    ssize = batch->ssize;
    pix = 0;
    for (i = 0; i < number; i++) {
        vpn = batch->vpn[i];
        pte = batch->pte[i];
        pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) {
            hash = hpt_hash(vpn, shift, ssize);
            hidx = __rpte_to_hidx(pte, index);
            if (hidx & _PTEIDX_SECONDARY)
                hash = ~hash;
            slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
            slot += hidx & _PTEIDX_GROUP_IX;
            if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
                /*
                 * lpar doesn't use the passed actual page size
                 */
                pSeries_lpar_hpte_invalidate(slot, vpn, psize,
                                             0, ssize, local);
            } else {
                param[pix] = HBR_REQUEST | HBR_AVPN | slot;
                param[pix+1] = hpte_encode_avpn(vpn, psize,
                                                ssize);
                pix += 2;
                if (pix == 8) {
                    rc = plpar_hcall9(H_BULK_REMOVE, param,
                                      param[0], param[1], param[2],
                                      param[3], param[4], param[5],
                                      param[6], param[7]);
                    BUG_ON(rc != H_SUCCESS);
                    pix = 0;
                }
            }
        }
        pte_iterate_hashed_end();
    }
예제 #2
0
static void pSeries_lpar_hpte_removebolted(unsigned long ea,
					   int psize, int ssize)
{
	unsigned long vpn;
	unsigned long slot, vsid;

	vsid = get_kernel_vsid(ea, ssize);
	vpn = hpt_vpn(ea, vsid, ssize);

	slot = pSeries_lpar_hpte_find(vpn, psize, ssize);
	BUG_ON(slot == -1);
	/*
	 * lpar doesn't use the passed actual page size
	 */
	pSeries_lpar_hpte_invalidate(slot, vpn, psize, 0, ssize, 0);
}
예제 #3
0
파일: lpar.c 프로젝트: CCNITSilchar/linux
static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
					     unsigned long *vpn, int count,
					     int psize, int ssize)
{
	unsigned long param[PLPAR_HCALL9_BUFSIZE];
	int i = 0, pix = 0, rc;
	unsigned long flags = 0;
	int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);

	if (lock_tlbie)
		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);

	for (i = 0; i < count; i++) {

		if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
			pSeries_lpar_hpte_invalidate(slot[i], vpn[i], psize, 0,
						     ssize, 0);
		} else {
			param[pix] = HBR_REQUEST | HBR_AVPN | slot[i];
			param[pix+1] = hpte_encode_avpn(vpn[i], psize, ssize);
			pix += 2;
			if (pix == 8) {
				rc = plpar_hcall9(H_BULK_REMOVE, param,
						  param[0], param[1], param[2],
						  param[3], param[4], param[5],
						  param[6], param[7]);
				BUG_ON(rc != H_SUCCESS);
				pix = 0;
			}
		}
	}
	if (pix) {
		param[pix] = HBR_END;
		rc = plpar_hcall9(H_BULK_REMOVE, param, param[0], param[1],
				  param[2], param[3], param[4], param[5],
				  param[6], param[7]);
		BUG_ON(rc != H_SUCCESS);
	}

	if (lock_tlbie)
		spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
}