From patchwork Tue Apr 11 17:42:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 749588 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w2Zf717hGz9sN6 for ; Wed, 12 Apr 2017 04:02:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b7xTWg8b"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w2Zf705XGzDq8V for ; Wed, 12 Apr 2017 04:02:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b7xTWg8b"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w2ZCW3x3RzDq7j for ; Wed, 12 Apr 2017 03:43:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b7xTWg8b"; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id c198so672788pfc.0 for ; Tue, 11 Apr 2017 10:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3QhkN/tpBt1I0Bga2DG0yLp0jkjS4A+OX3dEVPbtOq8=; b=b7xTWg8bqAY5/cVxnHkpWOyaNb43j8EuQVw0Lg4qy2nA+aunTeFbFpS/OxB6KjUnmb 6FAEYDASJqxbMTKug953ILVTz+w1BSiZ4Dgno/cDwDIkkjy5FRlMONCb13nVlT/FtUYD nV5xDZmzoom1PcwmRR2UVaF0kstMPgRV5eQGWAcxwz3QzYb85Vj3hL8wp5QMj3A1z2UJ JgbQkbt2eiVvR6OwkSwcEzmJkK2VxlBECJQRFwl971f9nqoHv9JhK1lwY5Noc4DrYZcz jfQznvtUQmUw1xIPS4cilm6ovo+14/CSI7xt5w2LUOxO15EFmE4Jinsu5XwbbsOEIr4i rMvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3QhkN/tpBt1I0Bga2DG0yLp0jkjS4A+OX3dEVPbtOq8=; b=b7kN5aAmpbTPNXDw3301uULiipSnjOG3NtXTQQU3LiNSXuSUx1SIxSPvdbJX99BB/T g6Y9tNn9AQM3xYTiw5tG28/bbDHlrTycAH37RlrQ3KgjR15fHJCqWdGka/kWAT96zQzj 9d/2+nD93Pk5gc/Za0v+j1eXYt7FZ1GiQoGCxkA0oezzn8ApzLKreJwIiYs4SxQgnS3M f2Xe59K3yXrlCRd6a8kyZOTVFEbSjHOJ8J3wZPRXLeOUWUXTpH84XVpK6O1Q6XgPAS1k eCMgaY6x9n0sxNaapHXq1Ag0r74djm6g+YYx8iN/ykYMZW+t0YDyHYojcUz7ZxoGy8FT Ov8w== X-Gm-Message-State: AN3rC/4lJZwoBjpXy0nGGlj9DCkrSB2tsWAYPYCF2+PRvXlfFRSzY28g8MHkGt1ZWCUIDA== X-Received: by 10.84.215.143 with SMTP id l15mr32775215pli.31.1491932597759; Tue, 11 Apr 2017 10:43:17 -0700 (PDT) Received: from localhost.localdomain ([103.57.0.128]) by smtp.gmail.com with ESMTPSA id r185sm20182582pfr.72.2017.04.11.10.43.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 10:43:17 -0700 (PDT) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 8/9] powerpc/mm: Wire up hpte_removebolted for powernv Date: Wed, 12 Apr 2017 03:42:32 +1000 Message-Id: <20170411174233.21902-9-oohall@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170411174233.21902-1-oohall@gmail.com> References: <20170411174233.21902-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org, arbab@linux.vnet.ibm.com, Oliver O'Halloran , Anton Blanchard , Rashmica Gupta Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Rashmica Gupta Adds support for removing bolted (i.e kernel linear mapping) mappings on powernv. This is needed to support memory hot unplug operations which are required for the teardown of DAX/PMEM devices. Cc: Rashmica Gupta Cc: Anton Blanchard Signed-off-by: Oliver O'Halloran Signed-off-by: Anton Blanchard --- Could the original author of this add their S-o-b? I pulled it out of Rashmica's memtrace patch, but I remember someone saying Anton wrote it originally. --- arch/powerpc/mm/hash_native_64.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index 65bb8f33b399..9ba91d4905a4 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c @@ -407,6 +407,36 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, tlbie(vpn, psize, psize, ssize, 0); } +/* + * Remove a bolted kernel entry. Memory hotplug uses this. + * + * No need to lock here because we should be the only user. + */ +static int native_hpte_removebolted(unsigned long ea, int psize, int ssize) +{ + unsigned long vpn; + unsigned long vsid; + long slot; + struct hash_pte *hptep; + + vsid = get_kernel_vsid(ea, ssize); + vpn = hpt_vpn(ea, vsid, ssize); + + slot = native_hpte_find(vpn, psize, ssize); + if (slot == -1) + return -ENOENT; + + hptep = htab_address + slot; + + /* Invalidate the hpte */ + hptep->v = 0; + + /* Invalidate the TLB */ + tlbie(vpn, psize, psize, ssize, 0); + return 0; +} + + static void native_hpte_invalidate(unsigned long slot, unsigned long vpn, int bpsize, int apsize, int ssize, int local) { @@ -725,6 +755,7 @@ void __init hpte_init_native(void) mmu_hash_ops.hpte_invalidate = native_hpte_invalidate; mmu_hash_ops.hpte_updatepp = native_hpte_updatepp; mmu_hash_ops.hpte_updateboltedpp = native_hpte_updateboltedpp; + mmu_hash_ops.hpte_removebolted = native_hpte_removebolted; mmu_hash_ops.hpte_insert = native_hpte_insert; mmu_hash_ops.hpte_remove = native_hpte_remove; mmu_hash_ops.hpte_clear_all = native_hpte_clear;