Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbdGGNkG (ORCPT ); Fri, 7 Jul 2017 09:40:06 -0400 Received: from mail-by2nam01on0081.outbound.protection.outlook.com ([104.47.34.81]:24448 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751868AbdGGNj6 (ORCPT ); Fri, 7 Jul 2017 09:39:58 -0400 Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; From: Tom Lendacky Subject: [PATCH v9 09/38] x86/mm: Simplify p[g4um]d_page() macros To: linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, xen-devel@lists.xen.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org Cc: Brijesh Singh , Toshimitsu Kani , Radim =?utf-8?b?S3LEjW3DocWZ?= , Matt Fleming , Alexander Potapenko , "H. Peter Anvin" , Larry Woodman , Jonathan Corbet , Joerg Roedel , "Michael S. Tsirkin" , Ingo Molnar , Andrey Ryabinin , Dave Young , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Borislav Petkov , Andy Lutomirski , Boris Ostrovsky , Dmitry Vyukov , Juergen Gross , Thomas Gleixner , Paolo Bonzini Date: Fri, 07 Jul 2017 08:39:47 -0500 Message-ID: <20170707133947.29711.91675.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> References: <20170707133804.29711.1616.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR03CA0062.namprd03.prod.outlook.com (10.173.137.24) To BN6PR12MB1137.namprd12.prod.outlook.com (10.168.226.139) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 745f6479-8dde-4471-4956-08d4c53da53a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BN6PR12MB1137; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1137;3:776o/xN+z4Aw4R6oR24qIVd1wuobw4aDKUGc1JLnfTOdPl6/Ls6s4Bds31GOrk0aUrEeGSboDjgK6QR5moXLJeCSo0NeQdy5xeRscFoPYDQVGs2MrUKJwaBG4eC1XuoNvU75u+ZbyzoAXzYT8kO+WqmolcZxHByDzuQrH/XqQ0cuxdyey1V3I+hGBx1dOLl8IhBqkWJKfMZStO0Qfx0QJ5GpfSX3ulKNyrNJgT/fWb17dYMZQwjiZNMJmWUnCe8jfJxSDLoDMQjJAeVi/xafJt/7a+pZ+V+u5Y91VH6Wufimu6KUIOI5GXYGdsLj+xT3hb26ZFZnA+SuEShrPgbDdITcF4NbqDhz1QbxXnhXkhjH/gBTavYnm5BqKMYDBctsfXc+Vbb7FV9FhcAPAnO7i87sBd6Dlo+ODV/lkEGLO2z0ApWUHRtRLXJS1ZQVyJs+FWXo1nJLpQTIleY1LDh3ApivBZkuRUKk3oKlMs9btf6x4feVk0Vt+6boNBzdmHXceRrMGnP721yQds86yQT6FbOLqJ5tQpeH7zhJNTdaPvtWusuuv4NLgALVJjl/j3qpf+o8340RQuWONu9nBnYsvAyX4V0zWtW+hnLYz3DJh6xRyrfIZvMExpc4MTW3Smfp5ykzBes0gT9v+VDqWwMVMHndLdyKoxEwv1SN829IEKu3GPVX6kw4iqOUpPAJ5TRKYayOXstoa+p5e7lbnKnt6Ert03I5za8mI40TvL/gJeZIovlwIULQddMbE197XcqhyjGbI855T+lhFSh/LcGBqQ== X-MS-TrafficTypeDiagnostic: BN6PR12MB1137: X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1137;25:obxbAa8S53Yc+LwiigQWvuigtvnlGxpHNBVfo/VQ9N5+DREM58B1L7ElB7BLkgiRJOwsf85EzFRzKBnUg4kY29hpBbfbA7wykFmHw2auIO9tgBIi2dM2XJpW5MOISm1o1561Go1ohNl5IkNRP2kOELst30lp7U7Q45+7IejhrrBlOJ+r/3owbxMNlYqhXqBLQbPmmHg9f4j3kXsXShwodP7Q5s89nPSUXACKSWVIqzjpPksNbuAQ4z9C9O9BmKRk3ZF7Z3j05+YcYuBRzAgki7msufANVIaN2DX9vxAQAmwojrq4U2/xbOLDWipCYo9BL1gS7OLX8EnEEqpH2KUrDzkaVkN2pPmqqlnd1M8nezPwrbh5EOvBLJv9sY0kPDugaOGFR+/3zgwCKGeXU1sgdEYHYmz3n67mQPpCiTRmq5FNwtTBYqdtinP+SIaDrxlfjF7nZkGO4iQ/1CbuuyCb/auSy3krZp3kld4+O8eqGWZePO0Q95Uo1u38S3LTiyFJBHEf/9HSLnCg23SV3vo2wK7G7vi91ODNQWnyOes7mKFWfjTk4iv8aJxeC46H9BaX+Q3Jk09vBTYgX0z6z7rMsoHBYuHlMvbMS3yFH/GdJ5Gc7CTL242cL6rtmpan/T0DUzVT5LSGroR3TKCKW20FG97hqBFIeHotRTPXgdeuql7lZOGYWIHaZUfvreRoFyoKThJtJP3HoXQgvqLwqoEaTFMQVf4RC/j+173R8PcTOx7tqtI/7hSHHian4Ai9Jy68zyIHXjRlcJZF13QR+GDmPLzwjkV3VwxfYUqYQaKk7XHqjDxl9gb9lkPQ+bwInMYujycRp9icGQwTz7uqebt3+9RVgoLM0BQH8Y1/GQq6qa+fjw99NWAJAhNIbDf3hqjRn4EvWMJEwywzwq7uz9SxX1LIsPIL3UTyDKfSyNtMIZY= X-Microsoft-Exchange-Diagnostics: 1;BN6PR12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Z2InZTtq0ATkztHNLg3f2oCyoxil1RT1bfRdC4jsgEFpqVLWwXV0iJ4Bs2yxI7VOcr/wM5AWlIoyYdY9ziSppV1msdi8f2yd3DNiFVBOvlyC+vRzkOEd2EQKNn8+94SY628FRVbnD5KXGh+gHr26jrwche X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236129657087228)(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(2017060910064)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(3002001)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN6PR12MB1137;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN6PR12MB1137; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM3OzQ6WjBUdmNXQWh6Z0FQQkI0YUZxbHNPclVOMUZZ?= =?utf-8?B?UE95TmZBRThhNHBuZHZaNkkrR05xRHBXVEJENjJjdmk2TmRMWWgxV0FuYmRE?= =?utf-8?B?VHJyQkJIUjlEUEk2WlVBV2hOa0ZiNnY4TUhLVzdWdG5EN1c3bzNJSUFrRTJC?= =?utf-8?B?OUU1UGVPRmhYNmluK0FvS3VFUTZRTUljZFhUMzl6MUdic0o4RFhSWGo4ZmlD?= =?utf-8?B?MVVITzg4NnVvYTNINVhUak5MZTlPbXBkYWg1MGU3Rkc0UHllZnFiaTVnYVoz?= =?utf-8?B?aXA0Vi92bFVzRldKK2I0TGFzbnhTbEh3YUR4UWVvOFZlSzVJSW5kaC9pR0ND?= =?utf-8?B?QzJVcGlGMGhuS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HT0NFdEZBVFpoME13K2dkbXR5L1BkL0g1WWV1eWdNTms1VDlTNzdUd05a?= =?utf-8?B?L1lweU1ZM3V1elJWZEo0S2x5VGlrQktLb2dIMGRPdFh5Z3ZnOFMzazdabVJu?= =?utf-8?B?SjZ2WU40S0YxTUM0WHliWHUvVlpnR0FKSzB1NFZIRk9LbC9sVllFSjdqazlS?= =?utf-8?B?dWtjdFRscytYSlFFWDJ1OUdEZkRhSlpJTnNuL3h3c2VWSjAyN1VnOHM1MHZR?= =?utf-8?B?Y1Vmc2lpY05sdjZCVWVoVTRuN3RIMnZFTTZjS2VPcityWVMwc2NwNHhsZDFz?= =?utf-8?B?cFluaTlLc0h1Y2FFYjFINWhPNEhWaWQvNkdqK2p3TGpGaVdjUTQ0aGhRdW83?= =?utf-8?B?dCtzQzBxSFI2aVlVb3preWpWNDJSTVVzbk5VYk5acXY5bWg5WHEwanlrMGJt?= =?utf-8?Q?SGOZ8xJ7buyxMfFIo4xLfdM6DU8sIxYvEBr8Ut?= X-Forefront-PRVS: 0361212EA8 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(39860400002)(39450400003)(39840400002)(39410400002)(39400400002)(39850400002)(2906002)(97746001)(66066001)(7736002)(47776003)(81166006)(8676002)(103116003)(86362001)(50466002)(189998001)(42186005)(4326008)(53936002)(2950100002)(55016002)(6666003)(9686003)(38730400002)(110136004)(23676002)(53416004)(33646002)(6506006)(54906002)(25786009)(6116002)(7406005)(478600001)(72206003)(3846002)(230700001)(54356999)(1076002)(305945005)(76176999)(83506001)(50986999)(7416002)(5660300001)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1137;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxMTM3OzIzOkRVenoxV2ZvL0hXMkhSdkU2UENjY3QxUFA3?= =?utf-8?B?eHQxQ0gwK2N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glyQyfgVSF3lQbaxIUv5nLa0y1prrtUZekEzma9GXbjC8gpHvUhxcAydrVAnSBXo/tVTWpkih72wUz5B8Cre/4av+SAfmRsy2ebmLEZ3EfxybS43Smf4IaiPSMlTnK X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2017 13:39:50.7132 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1137 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2664 Lines: 65 Create a pgd_pfn() macro similar to the p[4um]d_pfn() macros and then use the p[g4um]d_pfn() macros in the p[g4um]d_page() macros instead of duplicating the code. Reviewed-by: Borislav Petkov Signed-off-by: Tom Lendacky --- arch/x86/include/asm/pgtable.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 77037b6..b64ea52 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -195,6 +195,11 @@ static inline unsigned long p4d_pfn(p4d_t p4d) return (p4d_val(p4d) & p4d_pfn_mask(p4d)) >> PAGE_SHIFT; } +static inline unsigned long pgd_pfn(pgd_t pgd) +{ + return (pgd_val(pgd) & PTE_PFN_MASK) >> PAGE_SHIFT; +} + static inline int p4d_large(p4d_t p4d) { /* No 512 GiB pages yet */ @@ -704,8 +709,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pmd_page(pmd) \ - pfn_to_page((pmd_val(pmd) & pmd_pfn_mask(pmd)) >> PAGE_SHIFT) +#define pmd_page(pmd) pfn_to_page(pmd_pfn(pmd)) /* * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] @@ -773,8 +777,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud) * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pud_page(pud) \ - pfn_to_page((pud_val(pud) & pud_pfn_mask(pud)) >> PAGE_SHIFT) +#define pud_page(pud) pfn_to_page(pud_pfn(pud)) /* Find an entry in the second-level page table.. */ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address) @@ -824,8 +827,7 @@ static inline unsigned long p4d_page_vaddr(p4d_t p4d) * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define p4d_page(p4d) \ - pfn_to_page((p4d_val(p4d) & p4d_pfn_mask(p4d)) >> PAGE_SHIFT) +#define p4d_page(p4d) pfn_to_page(p4d_pfn(p4d)) /* Find an entry in the third-level page table.. */ static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address) @@ -859,7 +861,7 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd) * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT) +#define pgd_page(pgd) pfn_to_page(pgd_pfn(pgd)) /* to find an entry in a page-table-directory. */ static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)