Received: by 10.223.176.46 with SMTP id f43csp3891958wra; Tue, 23 Jan 2018 00:29:58 -0800 (PST) X-Google-Smtp-Source: AH8x224Ptfb1gNe5uK04fmpEAib0MpTRzPd2FXexWufh2787/WuWlEJ54Y3mkapbEPiPc12NPiy7 X-Received: by 10.99.107.129 with SMTP id g123mr8152393pgc.356.1516696198685; Tue, 23 Jan 2018 00:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516696198; cv=none; d=google.com; s=arc-20160816; b=XGcAMXoqhEHLN6CaZpM8vhsrzfPkYigzJHtS5Zr8lDuWkzpZSqm3n3jbrm+5gKrXBh p1wukztDsbS2XHgxleW9DLFIaAU8ewcMwTNxA5xy1mMvz8tDaG5lQbX1hvZ6upQ4KAxJ ywcwl/q5MRaD9/Lpn6uggdpzKvMDFyfNaEApJLjWMfnw4LzQ/0uWH36c1omjvl/z7JbC BX06lXMR16u2shkDltvFJaZtwM6eDhHCZNdhPLlBa0tpiPqXvfVHLZQH8sChi6LjNNGm TpUnYpcoaOO/fBbI5GCUiQyMssHYat8FoiYgSqaQp0kNtlnTcHy7UDudgcKv//umDSJO mAJg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=B1Lci9k4x7kW3MN+E5WhwKy0feTGsWfi0p1FzOV1QuM=; b=0OxXdcnnBkh6RECGioZ8vITuwlDBhcVbW7COLHHGLZ94l3NouJjUss6efcMQxZIWS9 il23V5w4OkeREzwuaUK3AzGKmqrIyUgFlF/XSAAigvbYYdPJUQ1rsEKODciTNFWwnRlp amNGWxZcMpb7Y47HdIwnRRUAIUtsZBGOPABs7T3Ij4qE+BkzMcVvhlbY+8nVeVGz4w/c 09Ly1pC+GGTN5rM3DN00fXIlmg9kQcCtfDyTDJY4gDlJVxL+6kCa7FecYD9moJeKuqpJ +tEpabGI6e7mzzH/7I8KrZlAhA1tDNQw+lW6ZfLDXS9RdWQat15Gw6w5Q8lRWBOmCoQg a3Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si4366776plk.611.2018.01.23.00.29.43; Tue, 23 Jan 2018 00:29:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbeAWI3V (ORCPT + 99 others); Tue, 23 Jan 2018 03:29:21 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:44567 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751116AbeAWI3U (ORCPT ); Tue, 23 Jan 2018 03:29:20 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 190C6C05B6290; Tue, 23 Jan 2018 16:29:06 +0800 (CST) Received: from [127.0.0.1] (10.177.29.40) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Tue, 23 Jan 2018 16:29:03 +0800 Subject: Re: [PATCH v3 11/20] arm64: mm: Map entry trampoline into trampoline and kernel page tables To: Will Deacon , References: <1512563739-25239-1-git-send-email-will.deacon@arm.com> <1512563739-25239-12-git-send-email-will.deacon@arm.com> CC: , , , , , , , , , From: Yisheng Xie Message-ID: Date: Tue, 23 Jan 2018 16:28:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <1512563739-25239-12-git-send-email-will.deacon@arm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.40] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On 2017/12/6 20:35, Will Deacon wrote: > +#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 > +static int __init map_entry_trampoline(void) > +{ > + extern char __entry_tramp_text_start[]; > + > + pgprot_t prot = rodata_enabled ? PAGE_KERNEL_ROX : PAGE_KERNEL_EXEC; > + phys_addr_t pa_start = __pa_symbol(__entry_tramp_text_start); > + > + /* The trampoline is always mapped and can therefore be global */ > + pgprot_val(prot) &= ~PTE_NG; > + > + /* Map only the text into the trampoline page table */ > + memset(tramp_pg_dir, 0, PGD_SIZE); > + __create_pgd_mapping(tramp_pg_dir, pa_start, TRAMP_VALIAS, PAGE_SIZE, > + prot, pgd_pgtable_alloc, 0); How the tramp_pg_dir is used, should it be set to ttbr1 when exit kernel? Sorry for I do not find where it is used. Thanks Yisheng > + > + /* ...as well as the kernel page table */ > + __set_fixmap(FIX_ENTRY_TRAMP_TEXT, pa_start, prot); > + return 0; > +} > +core_initcall(map_entry_trampoline); > +#endif > + > /* > * Create fine-grained mappings for the kernel. > */ >