From patchwork Mon May 30 02:14:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 9140143 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BBC9C60755 for ; Mon, 30 May 2016 02:17:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC0FF27BEF for ; Mon, 30 May 2016 02:17:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0AC928185; Mon, 30 May 2016 02:17:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2F43327BEF for ; Mon, 30 May 2016 02:17:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b7Cjs-0001XI-QJ; Mon, 30 May 2016 02:15:32 +0000 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b7CjV-00005Y-HL for linux-arm-kernel@lists.infradead.org; Mon, 30 May 2016 02:15:10 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01lp0246.outbound.protection.outlook.com [213.199.154.246]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-13-WeFKM3XkR9KyhFaOQsT_9g-1; Mon, 30 May 2016 03:14:48 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=/c5F4LY+sBjhrNG+/gVi1ohMkUo2O/PdHfVUVubMjyM=; b=X/iNu2QavKuquDytN2y3bAJsoNJFSQ380QcQJWSHR6zFje91n5BM7snZ0g0JqwLNF01QBRwsQCsTnZ4HEmHOUKXVIxljhbqi09juwrp2kZn4eRvFUxuIPjwuBMhqt1AA+Nc+nlj6fp0bNQSqLzKhRBc3XhllzpcqFniUjJQkIBY= Received: from DB5PR08CA0009.eurprd08.prod.outlook.com (10.163.102.147) by DB5PR08MB0518.eurprd08.prod.outlook.com (10.161.245.19) with Microsoft SMTP Server (TLS) id 15.1.506.9; Mon, 30 May 2016 02:14:47 +0000 Received: from AM1FFO11FD012.protection.gbl (2a01:111:f400:7e00::140) by DB5PR08CA0009.outlook.office365.com (2a01:111:e400:52c3::19) with Microsoft SMTP Server (TLS) id 15.1.506.9 via Frontend Transport; Mon, 30 May 2016 02:14:47 +0000 Received: from nebula.arm.com (217.140.96.140) by AM1FFO11FD012.mail.protection.outlook.com (10.174.65.101) with Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport; Mon, 30 May 2016 02:14:47 +0000 Received: from sha-win-210.asiapac.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.279.2; Mon, 30 May 2016 03:14:44 +0100 From: Huang Shijie To: Subject: [PATCH 3/3] arm64: add a new macro for the pgd table descriptor Date: Mon, 30 May 2016 10:14:28 +0800 Message-ID: <1464574468-22700-3-git-send-email-shijie.huang@arm.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464574468-22700-1-git-send-email-shijie.huang@arm.com> References: <1464574468-22700-1-git-send-email-shijie.huang@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(106466001)(2351001)(87936001)(5003940100001)(586003)(104016004)(5008740100001)(86362001)(11100500001)(229853001)(33646002)(47776003)(189998001)(19580395003)(19580405001)(110136002)(2906002)(5003600100002)(77096005)(6806005)(2950100001)(50226002)(76176999)(36756003)(50986999)(48376002)(4326007)(92566002)(8676002)(1220700001)(8936002)(450100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR08MB0518; H:nebula.arm.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD012; 1:8ZaV36vzxnCt10E8b98ME6LloQNBuJ+rN2dpaHEmJrS30lSStziFkX8Lu0UTJ7e1VFjY/qTRykyzlhmIhrUNhNFyDMt/QreNceNsINoC/zrqW+r100I5b9FFoXZxLhsoSpBZzAUjb4BUbksmK0PCGy0aNbhB9gUBRK8wO/qYDW+5Ry6Y+VzrCJ4Aqa0uNLZ+RMuYDgvaLcpI48fNhNRG/cP2tVj3erMHpzIeMMN5whEgBPgyfL4Z8QcSbgLS+hkDS7MicwhE4rT6Lqvh6Q8PryASycm/d2xlrIcLFCB+BnpYkqIpdx5iKl4cnIHcA0PSsvutlEsUNG4H46iEzyw968fhNVUzHZjLkgHnYImUzNQRl347h7rPzXpY20LgZvb3LJ4No39oKEuybN/d+nHFlbwJb0J7uTEXCMHmTMzVHeGhW8fwSsy8U8xdn9jBSIIkkwnO2Z3nUSJXu7hA3BYSz7sMELQSXVTi34eqvavxKODUaQDQYChDrUOcCa1e8RWqPEZPCrsaXJl/oS0jwZ1PUJ8T9Yl3HzOfoVsvcqV3kJA= X-MS-Office365-Filtering-Correlation-Id: 20038bdb-6483-45da-e116-08d388302c71 X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB0518; 2:82cnbisW31TEuIsH+FXgxX9PTkGWVz6jPffYpqgPMMiPSryMccz6DJsAZYJG8D5z2z7LJQG9u5Or11p1+LJT7KF9VMFLCeq066ShFtHzScnYoYLyZwTq2Te9tepBwUUpfkLZVem15NKkD5N7LIhIVN4qPU+XzjQgeWjW7c0WqByobwvFOJKMJJmQI7S+rYq0; 3:oj7QSFkpaXMG2+0kmh8P7SCcTaau8wkhMoGvZeU6bjcKeD/ceioraH6zN9kIXW8Ho2aef3lqmvvk5sptlkKiBi6EAZ7WdePAJxMHJlzd9xw40N7Vqhm7yha1z7gIMPtkq8VgnPheDKCIpXwBLMCZw3adfknV4NjiYoHVmEG9EW026X3EN/P8c3gmymomubA1N2RtM+b24r2jGjcZaA6m8yjebNWa/EywI4n1MT+uxTMNJiWZwrXE+hQm6WlzaFCalOxK7oD/zrBu1PuC28NLww== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:DB5PR08MB0518; X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB0518; 25:+ZHtHZUcwX3wcetu4SnBhOLQXm/745TZvX9Gq5DOB6quwmMGKOAsB9ORdO+EpQGylEeD0VJ39EEh86cKSMKhQO4mrn72nYTAnCu3IPqud/xlh/71IDq750YdUiLzb5+upqSp1+6Iqcil2rHWvHMuaOfwMp50qefs0hwUFm5r2zNmqBNfo5kGqNoIHjg+NMCXdR7VgUF6GdD4hUdxZ1RpU3B9oK+zdPudrH6JNLibBaizFOkTrnBhKNIYLkqB0/KRec69ez5n1M6Ia9XG0YJXUCjYsp0syRI6Xk/BfH5G02iahwUxzZKlBJ383Cu8oz3DDM2KX2Gk7+I98R5uLlEfDx3syYeR0p2zxVGov2/DHbaCEptcaffTJF56pfc38YIZ51oM5ZSb2E+L2Z+34eUKlg2rfU6ZLRJT0fhoxKCWmuYJRIEueqwhsfIcs01dbm+mkDM9KwQNPhI2Izf1SfP0o0z/+mGo/8y+qUOHjIKsf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tYPFGfIbLtPH776SWJEquIXhTPZSv0BYNF8qnGapsLarGKuyCyjk7OIDjbCCEtW4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(8121501046)(13020025)(5005006)(13013025)(13023025)(10201501046)(3002001)(6055026); SRVR:DB5PR08MB0518; BCL:0; PCL:0; RULEID:; SRVR:DB5PR08MB0518; X-Forefront-PRVS: 09583628E0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB5PR08MB0518; 23:YvA2VlHxb41aYgAWSwX3MtzNxAFB/H+JnJ93GMHdN?= =?us-ascii?Q?hQI65IdJ1JxNhu1tZKdkpXpjXR42DKyYadoqvDuZpzXI6cLOQPpcEJf7R5Re?= =?us-ascii?Q?u41iwRlFRMYBR3AB96IskGB/dvOSpKQ28Idbh+dBYSdNrT1R8j8XU/OqV+ws?= =?us-ascii?Q?AKYtjkfOJ+UC8+hAIJpKTF1C1OzTcPE7QvS9/rqL1TsnG5UXS6mezHQXs/4B?= =?us-ascii?Q?S2lSr8XOnnf8aAbH5spRO4MahnfGMOlxJDCEwf5Qe/tW94NmBFfTH8ZqzasZ?= =?us-ascii?Q?7a/jXSgvDgrjesfZcFy1euxrvCtJCxAqqLmtWRA4vdaEsk2wr3vJXOhNFQiP?= =?us-ascii?Q?p7Hqq8w/A1k9sMI4Lssdy6ikFfmWRBxAYvCWNjiFGN6NuYpdCrZFNYBgdfxy?= =?us-ascii?Q?QLXaZdAN8NExZS7hG19kMb0LZXkSYWsj6oMrh0bnrOL/1xthlvzlUV6LARz9?= =?us-ascii?Q?++9jb8XuZTlrUX+XHyi1PPZBYeiHfx9hyO8iKQ6waoyL82Rw+gjIlJu/Sm55?= =?us-ascii?Q?iamiI5lrRYQeirAwaZ5gDxHB8cAZ3UxUXEgg4sUycbKvrGxaxyZybFkLkP0/?= =?us-ascii?Q?dK0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0t5gyHPkuBywgHVklba1/8VCrUSRaw4Na2k0av7AahUBGRoNNnW1JUMJ0lHZ4sJuSTvfkRmH9ObrCr4jkbbvEOjm5dUgtNP++YbtOWpTs3HPTm07POlgz1DECi0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2016 02:14:47.2500 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB0518 X-MC-Unique: WeFKM3XkR9KyhFaOQsT_9g-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160529_191510_067070_5B3261FB X-CRM114-Status: GOOD ( 10.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, steve.capper@arm.com, will.deacon@arm.com, Huang Shijie , nd@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a new macro for the pgd table descriptor to define the "Table" type, and use it to replace the numerical constant in the pgd_bad(). This patch makes the code more legible. Signed-off-by: Huang Shijie --- arch/arm64/include/asm/pgtable-hwdef.h | 5 +++++ arch/arm64/include/asm/pgtable.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 54e2fbf..f648c28 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -113,6 +113,11 @@ /* * Hardware page table definitions. * + * Level 0 descriptor (PGD). + */ +#define PGD_TABLE_BIT (_AT(pgdval_t, 1) << 1) + +/* * Level 1 descriptor (PUD). */ #define PUD_TYPE_TABLE (_AT(pudval_t, 3) << 0) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 46472a9..bfa0092 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -453,7 +453,7 @@ static inline phys_addr_t pud_page_paddr(pud_t pud) #define pud_ERROR(pud) __pud_error(__FILE__, __LINE__, pud_val(pud)) #define pgd_none(pgd) (!pgd_val(pgd)) -#define pgd_bad(pgd) (!(pgd_val(pgd) & 2)) +#define pgd_bad(pgd) (!(pgd_val(pgd) & PGD_TABLE_BIT)) #define pgd_present(pgd) (pgd_val(pgd)) static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)