Received: by 10.192.165.148 with SMTP id m20csp2539377imm; Sun, 22 Apr 2018 09:08:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/2IPkhE9Q+89m0BT09sZT9thk1c2CPnnng9gLgVnICGs+1fg2SQvS2yiSwE0IMZMyigVnz X-Received: by 10.98.16.142 with SMTP id 14mr16881552pfq.22.1524413301552; Sun, 22 Apr 2018 09:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413301; cv=none; d=google.com; s=arc-20160816; b=gZ3cmDu59eZQjwRtMxigEKAAqAVoNdVTwr13okHS7aprXXe0M6wfMf0ShY+7W6h7b+ WCCnSfzH0ouca1rXjPBz/ggIbY6NId8iFBaK65Cp8wY36hzQdAEeRd+B95+tQ1QfbEFx 8RTcNT+beJTGceo0JuwPM0/kN07h5w875/LENiQMgQneBzIF0/QpHxfKmZgd2y+O8QUS YRCl5TxWfHW5JBFG6Y69j7RDIOIgFLf7Natol/sPsnimV7iQt/buDe+nukE9vAybfK17 yOttri1Uc2VQrzZIchGoN7h6KuNuPjOz/qGojzdaCcDacfV6P3GL3PcBFgT6sdRPLnKZ nO1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=LB8SN6CG2e0YxE3TpvEAOPnOA93FSzpyjR/I8ZloOaY=; b=SKB5c0xj9NhaG2ZpUR4EuI50Lc9ihin+EIJt6y8Ny5TibcKa3ZnRvantbT/tVeZ8rs nOGBevVIWs68vbz1FwDXuG5X+lXnP0tGsKfLQG8ZQ3GCDXUATC5hUxnxpvOED1aq6lNb ibEnLHbJnpFE3iSh3+yjrGyr7WEQodHxbdqET4avWsKsa5vkbHjBu31GqtG2DQFBPVoU zsmYhrjoI3m2Msd3yjvejNAWZ/ba4fBRN5ve29A0yXmGHP9vnA47Kb/XgmTILvga+0Mb gHZOpYXNv+uF++G4m9pOsvidreTINzT4c/AGZcwCboV6QOqYSKzxsDbmCy9rAdjxH+gl jtaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r129si9690664pfc.202.2018.04.22.09.08.07; Sun, 22 Apr 2018 09:08:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753965AbeDVQGz (ORCPT + 99 others); Sun, 22 Apr 2018 12:06:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45576 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753929AbeDVN5K (ORCPT ); Sun, 22 Apr 2018 09:57:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 284E09CE; Sun, 22 Apr 2018 13:57:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Mackerras , Suraj Jitindar Singh , Michael Ellerman Subject: [PATCH 4.16 063/196] powerpc/64: Call H_REGISTER_PROC_TBL when running as a HPT guest on POWER9 Date: Sun, 22 Apr 2018 15:51:23 +0200 Message-Id: <20180422135107.505266885@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Mackerras commit dbfcf3cb9c681aa0c5d0bb46068f98d5b1823dd3 upstream. On POWER9, since commit cc3d2940133d ("powerpc/64: Enable use of radix MMU under hypervisor on POWER9", 2017-01-30), we set both the radix and HPT bits in the client-architecture-support (CAS) vector, which tells the hypervisor that we can do either radix or HPT. According to PAPR, if we use this combination we are promising to do a H_REGISTER_PROC_TBL hcall later on to let the hypervisor know whether we are doing radix or HPT. We currently do this call if we are doing radix but not if we are doing HPT. If the hypervisor is able to support both radix and HPT guests, it would be entitled to defer allocation of the HPT until the H_REGISTER_PROC_TBL call, and to fail any attempts to create HPTEs until the H_REGISTER_PROC_TBL call. Thus we need to do a H_REGISTER_PROC_TBL call when we are doing HPT; otherwise we may crash at boot time. This adds the code to call H_REGISTER_PROC_TBL in this case, before we attempt to create any HPT entries using H_ENTER. Fixes: cc3d2940133d ("powerpc/64: Enable use of radix MMU under hypervisor on POWER9") Cc: stable@vger.kernel.org # v4.11+ Signed-off-by: Paul Mackerras Reviewed-by: Suraj Jitindar Singh Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/hash_utils_64.c | 6 ++++++ arch/powerpc/platforms/pseries/lpar.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -875,6 +875,12 @@ static void __init htab_initialize(void) /* Using a hypervisor which owns the htab */ htab_address = NULL; _SDR1 = 0; + /* + * On POWER9, we need to do a H_REGISTER_PROC_TBL hcall + * to inform the hypervisor that we wish to use the HPT. + */ + if (cpu_has_feature(CPU_FTR_ARCH_300)) + register_process_table(0, 0, 0); #ifdef CONFIG_FA_DUMP /* * If firmware assisted dump is active firmware preserves --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -726,15 +726,18 @@ static int pseries_lpar_resize_hpt(unsig return 0; } -/* Actually only used for radix, so far */ static int pseries_lpar_register_process_table(unsigned long base, unsigned long page_size, unsigned long table_size) { long rc; - unsigned long flags = PROC_TABLE_NEW; + unsigned long flags = 0; + if (table_size) + flags |= PROC_TABLE_NEW; if (radix_enabled()) flags |= PROC_TABLE_RADIX | PROC_TABLE_GTSE; + else + flags |= PROC_TABLE_HPT_SLB; for (;;) { rc = plpar_hcall_norets(H_REGISTER_PROC_TBL, flags, base, page_size, table_size); @@ -760,6 +763,7 @@ void __init hpte_init_pseries(void) mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range; mmu_hash_ops.hpte_clear_all = pseries_hpte_clear_all; mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate; + register_process_table = pseries_lpar_register_process_table; if (firmware_has_feature(FW_FEATURE_HPT_RESIZE)) mmu_hash_ops.resize_hpt = pseries_lpar_resize_hpt;