Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp48735pxk; Mon, 5 Oct 2020 17:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIz7tXUoPEv4s6YZC+nLWjGrxL5YgT5oqJpOES8p3f0aRzeobWa/uge6lpq2or/OkyvMq0 X-Received: by 2002:aa7:d690:: with SMTP id d16mr2447234edr.301.1601943624575; Mon, 05 Oct 2020 17:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601943624; cv=none; d=google.com; s=arc-20160816; b=vGcA9NYLS+Pg3+/JgyMjeNAnedqI7CAsIox3QQ/HcCQvnZGdHhEUCgbsPfLiyr8h2N 82KwMg58lo50GECoyXEAk1JsT4FjCHOUcJz381tkQ1uwlQNI+XZkXDvmUft2YvVRAZCz btaCdZw5TjBVHrwi5Dz0pCS7mE/y0ExXuIiV0JsrfYEUCgis8l8BkGmye1r4NHIsfTkE vooamwqOcgcMC28aiQJlB4pBL766XK9JJ/5EjUb0c+keVDUTzMp98ftxrRbaQ9Rm9lOG QkOQR8wSd6++8hO/GgcmmxgMxTbBRk+wd5yDBAkF1AzLu/YwnNRMK5a/QL0zrqNQsx9W sWxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :wdcironportexception:ironport-sdr:ironport-sdr:ironport-sdr :dkim-signature; bh=ic/FNfTkSisgTg1pIz8bM2GvsWmjVzeOjhVoNaCcL2w=; b=qPJPqiy4YNJZ1keQUU4oi7o9j406Cr9duvwChoyV8yUFhuJ09jZzumFT52l+qQm2Xn I+mz9JP8Jqw3ntll3hBb/mJJbcDWv/k36OsqjtJempVfGGIFsiAlx7EMOvP6dSPF7nhC 6HoHYbwF8hiC8zkKnRyZHUlwufesfMAX3D1AV9kJ4QAcl9f8gnMj2qp7t/q2d5VVRy6O 9bjSQOwRRmCEAzS9iPdXcpS+bgugTdKSZJ0JriYhgMwHNVi3s/7pQYpnlCSwhDf5OTqb 3dWMJ6EF7FWx+QUvAXITOaHbcoMxCmaNgIIYnnGMS7AOag7WRwg3pHJQ+yVEvBxfyLIR UDow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="J86yf0k/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lf22si781779ejb.20.2020.10.05.17.20.02; Mon, 05 Oct 2020 17:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b="J86yf0k/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbgJFASK (ORCPT + 99 others); Mon, 5 Oct 2020 20:18:10 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:24250 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbgJFASB (ORCPT ); Mon, 5 Oct 2020 20:18:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1601943480; x=1633479480; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yFZiLxGXA9elMo70n32xkkNg4f+3DGRCZkaVt0joPmw=; b=J86yf0k/E6hJHvKLEpinBAxH6qiK5FvkKlPMWdF4KN+1M42AyGydpg+I wKA6N5lx3SX73+9VuCOqRPrWI7FNAfzTEsQ1q9Hjn5mkRUp1d/YeYSzbn 8FeqCKcZ2U7fxNH1/+DL65+FMmSsyY/iIsKkm46VInDY8X7GZ72K9J88u 6IaP64SxKd61ZggegJ29jWKFNL3DFi8cxCdqqEoGYkgzPGqkFQWRHIFjP Sjjdm4JkJDCx3H6g+w9gn5DuPoSXb9jN32pMajt8Q+TdAWJc4YlAENk8w VGsWWBt8EwN9cg7oEMZoYpyfsNuty8443J19dkyGJM7IaoZtyU2LiwWP0 Q==; IronPort-SDR: j32YP0tuNZnl6g0iZ+GigbcPf1+ILY8psAyCs+xW7rfrIxqiFP2a28JWx79COc6a+Qy/MgOFOR wEvdXk+QQ6QYmllssc4Lyu+WXPDP6UPh4QrtmcihEFlzQjwimr1VrX7AIKX5enyUPTGz6U1xA5 fLemaF5HNujnBhPDX+muzFFi3sKgY0HawoRvl6yfORDSJT//CsvUcBc7HyyCYTD1vZKZc1xzG/ DrtBa5SEWpB5/uaO60CGPO6pVG/e6kvSfT8TOnRa+u1kmomWxdsRXrYkjCPMVNtsYmUyRSPCHH ZM8= X-IronPort-AV: E=Sophos;i="5.77,341,1596470400"; d="scan'208";a="149023400" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Oct 2020 08:18:00 +0800 IronPort-SDR: 6lLPCKjbwkZsQ2MthiYO5QpBP4ucVVOp95pO0/w23caEsMwDIrXW2Fdo5iSVdTcL5bGHB+Gh0N 9Dr0urjQldRQ== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2020 17:03:52 -0700 IronPort-SDR: rD45YZG01rzAHCHeb+UWPggXpioB4z171xHwJ8hS9et3cvwetahVQCKI4OLiFEf7barKvGm8Kv 6Qg7IhGQ58+Q== WDCIronportException: Internal Received: from b9f8262.ad.shared (HELO jedi-01.hgst.com) ([10.86.59.253]) by uls-op-cesaip01.wdc.com with ESMTP; 05 Oct 2020 17:17:59 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Greentime Hu , Albert Ou , Andrew Morton , Anshuman Khandual , Anup Patel , Arnd Bergmann , Atish Patra , Catalin Marinas , David Hildenbrand , Greg Kroah-Hartman , Jia He , Jonathan Cameron , Kefeng Wang , linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, Mike Rapoport , Nicolas Saenz Julienne , Palmer Dabbelt , Paul Walmsley , "Rafael J. Wysocki" , Steven Price , Will Deacon , Zong Li , linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 4/5] riscv: Add support pte_protnone and pmd_protnone if CONFIG_NUMA_BALANCING Date: Mon, 5 Oct 2020 17:17:51 -0700 Message-Id: <20201006001752.248564-5-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006001752.248564-1-atish.patra@wdc.com> References: <20201006001752.248564-1-atish.patra@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greentime Hu These two functions are used to distinguish between PROT_NONENUMA protections and hinting fault protections. Signed-off-by: Greentime Hu --- arch/riscv/include/asm/pgtable.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 515b42f98d34..2751110675e6 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -183,6 +183,11 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) return (unsigned long)pfn_to_virt(pmd_val(pmd) >> _PAGE_PFN_SHIFT); } +static inline pte_t pmd_pte(pmd_t pmd) +{ + return __pte(pmd_val(pmd)); +} + /* Yields the page frame number (PFN) of a page table entry */ static inline unsigned long pte_pfn(pte_t pte) { @@ -286,6 +291,21 @@ static inline pte_t pte_mkhuge(pte_t pte) return pte; } +#ifdef CONFIG_NUMA_BALANCING +/* + * See the comment in include/asm-generic/pgtable.h + */ +static inline int pte_protnone(pte_t pte) +{ + return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)) == _PAGE_PROT_NONE; +} + +static inline int pmd_protnone(pmd_t pmd) +{ + return pte_protnone(pmd_pte(pmd)); +} +#endif + /* Modify page protection bits */ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { -- 2.25.1