Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp675660pxa; Fri, 14 Aug 2020 14:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGmxoR0IqZhspm/4is//SlURxX8Xd3ycRxYR/sbC0LdZaRf1j8aFDzUkXlKp8ZY3Ac75U4 X-Received: by 2002:a17:906:359b:: with SMTP id o27mr4579141ejb.103.1597442388888; Fri, 14 Aug 2020 14:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597442388; cv=none; d=google.com; s=arc-20160816; b=Z27qvmXQQNOn4m4nok0jYJM8/f/J7DiaxXLByu08UQPJwSlUkcbauhQmB78UQeJjSw 3nXjvzhkEddXPnQFlL7g6hPls3uUziHvHeSOQ+atKWz/KNTYl+v9+47pvc1ExcSNorlO B/PynE60c1fAEljq+uubkYNtrot04Gt/4fov4fI6z9zCpO9vrDvE2zbIGPbOj4tK4rDs Puet9noifwAI9WMCY6WtU0EA+NKZwZgsf+4UTXK9hW9T9itgAF79YbNZQyM3EVyAGDgY URndGesOxgjlM9z2tYCIBHg/FbMn4yisWsZ73fecbLwLnOAmk40dERXmHL0ThUeoHh8V +rWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=jRnEl+oBkqgT6fDiI6zZmLmUyufDuL7nTZ5FeAyWMa8=; b=Em+NirD6oXbuv7nleuJgRSnBxmFa8zURXWKojfKwIoob78mOEhhHVJwj0HDfhh5psW EM9reOX7wUf+vnUZ/nOVcjO4BovhQovvHLC49CMJSZLm9Xk5NJEkih3RV7nd3VxO3rmE cesVPChxSEMM1YVQT8XO/4fA8eRQs2IEHv891+79sDIGbAkltnCEXj2l7VS/0rUfQ+hk 27yOz+8OooemzIco4D+1UvQGi85QXjlLzN/Kww99PEhJ8NKzOHknl+wSkuzKc2fVNEzz xj+9LE3LIeegAPFQwZ5xE3CBsvmSJjRNvBc1I6q9AqYpQJKdFbIJoSOJc/0LxV5Y92lP JREw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=SM0fwG7S; 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 x8si7740718edl.249.2020.08.14.14.59.25; Fri, 14 Aug 2020 14:59:48 -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=SM0fwG7S; 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 S1728557AbgHNVsh (ORCPT + 99 others); Fri, 14 Aug 2020 17:48:37 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:25018 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728481AbgHNVse (ORCPT ); Fri, 14 Aug 2020 17:48:34 -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=1597441714; x=1628977714; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UjeLYAGOcdXcIsgSttMVEHrk7RBdvzzoyHtETVrepjo=; b=SM0fwG7STXRMwyFzy9z3luTJL646RAlsWpvyf+B1nD5KDTJ7K5+1m9DA vER5azcK8Ff/KWfIEZnqVATgfwLEFW0Zd6fpRbYfSo9xudASpV8RecC74 qfsjc+n2LmcoMrxRhMOTg5m7MMGZRU71Do7BELYNKVeXKDQ617PvGS0K3 DprUAeUHlOH1XIywGtDJ+tOhp+dCnJdNV1o8SD60D6/kJLYUS2ZxCtJ40 T7tNxKECOqnY9RVmr7xxB+Bc4xrUxZuyXM3kIuKlSkgtjhS9DZOuOc1/S Zx4mYYxMw2++o4T3hiHi+A+mw5b9PLSNuoYDsSAQcdlrCGnBWbJa4FeqW A==; IronPort-SDR: DLj19ngf19Vk+atw2SpsBr+CYrdzK6VqONy493aVezvPekelR0lW41Vs41Mksf7ZjfoPM20cZ8 iQp8UJb2QGzN0g7vvtZbcWHeFMkd4gwf5IZp/MsShMmEanjWURCf957bRZhYc0GsM+LDGV4yMU sYuEhXzEgcJCLHfIyqQJPTb7MnS3bPEorVwlTTqbVUsxMMRDhmV3PgFskWb56N2qYtoF3Fv70G 5k9nk8/EqnND8+hv4vmL+e9KfWCXgMhiA1mJ5SMcFLEgHGnTaZ9IatrXghJgW6KDqfiEG4qfky oRM= X-IronPort-AV: E=Sophos;i="5.76,313,1592841600"; d="scan'208";a="146217658" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Aug 2020 05:48:33 +0800 IronPort-SDR: DvKPrsgP1fyL8qL/AulukhlyfDvn/gEfManoYtqBqqeTQjZJN4WVkcu9f4eXxufC5ltT6xYVwH Uu8JoZTyCqfQ== 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; 14 Aug 2020 14:35:37 -0700 IronPort-SDR: OiHQPqy3m8DvMgsYc0QMagm9siS9tQWyreMlyzSSKgLyP9TYhEfZkQosudZErrRfYErDIjVTC5 hyH3FpWbrN7Q== WDCIronportException: Internal Received: from cnf006060.ad.shared (HELO jedi-01.hgst.com) ([10.86.59.56]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Aug 2020 14:48:31 -0700 From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Greentime Hu , Albert Ou , Andrew Morton , Anshuman Khandual , Anup Patel , Arnd Bergmann , Catalin Marinas , Greg Kroah-Hartman , linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, Lorenzo Pieralisi , Mike Rapoport , Nick Hu , Palmer Dabbelt , Paul Walmsley , "Rafael J. Wysocki" , Rob Herring , Steven Price , Will Deacon , Zong Li , Ganapatrao Kulkarni , linux-arm-kernel@lists.infradead.org Subject: [RFC/RFT PATCH 5/6] riscv: Add support pte_protnone and pmd_protnone if CONFIG_NUMA_BALANCING Date: Fri, 14 Aug 2020 14:47:24 -0700 Message-Id: <20200814214725.28818-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200814214725.28818-1-atish.patra@wdc.com> References: <20200814214725.28818-1-atish.patra@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org 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.24.0