From patchwork Wed Dec 5 16:41:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 10714593 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 79DA8109C for ; Wed, 5 Dec 2018 16:41:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B18E2DDAC for ; Wed, 5 Dec 2018 16:41:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 694D02DE39; Wed, 5 Dec 2018 16:41:59 +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=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B56092DDAC for ; Wed, 5 Dec 2018 16:41:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B76AA6B754A; Wed, 5 Dec 2018 11:41:57 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B26806B754B; Wed, 5 Dec 2018 11:41:57 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3E566B754C; Wed, 5 Dec 2018 11:41:57 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) by kanga.kvack.org (Postfix) with ESMTP id 772E16B754A for ; Wed, 5 Dec 2018 11:41:57 -0500 (EST) Received: by mail-oi1-f200.google.com with SMTP id k76so12757748oih.13 for ; Wed, 05 Dec 2018 08:41:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=deoggW/S/f0gPcgW3JuerIndY+bDyi8XUS9CYJUajUI=; b=mSwBnlV/GCSSEIW8ubOuDfPTcaA4OEqq+u52ujFM+miR2X5N8NiQ6zthni56XR/LJW FF2KbkWP+Zq/dluNn/qydZSNurfNstnT+Yeadqj2GHA+GW+6f286fmCLteHHA9ALlxlO 6CDOpytcVVO0uF7lCljQrmtbYISpkngQUZCbsWv9SLiZ0knUNUWLrJQI3tSKEmMbVTyW keDHl1O88NwdRQ970HzKmrGPaoZiWSIcz1zblVB93IKnCfvXxULR/LS6b9rhDx68/fnK WFSGl/nCI3zq9SAo8JxzFqAZuOULZT6qeV2q9bgekycEmTuhOfm17/XAh8nTFeLg3C9z 5krg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of steve.capper@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steve.capper@arm.com X-Gm-Message-State: AA+aEWZaUI3qXiqmtNZ79JRmVBu6dTLGNwoA7UFtY35gtFtGXU8KXFtS oR4EkH4XWay2fmevI++3DxmnSJE467DqJwIyXNXJA7yQYvITMob3a43WNRL/BKWmPI5WcQkGTBH Ipt/ra7WnPj2THvB838QwfELoNk3uQt81ezpNHFOM4mZw3udIGoeR0d2ZE23gfde0NA== X-Received: by 2002:aca:e003:: with SMTP id x3mr16122105oig.39.1544028117218; Wed, 05 Dec 2018 08:41:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/WpJK8FdWK3Ud6+R6ec0XDZFXDiKLVKOml57d6tMaKZVLtRGsPWy8AqtFRIzoTbOlQ+HJgr X-Received: by 2002:aca:e003:: with SMTP id x3mr16122074oig.39.1544028116518; Wed, 05 Dec 2018 08:41:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544028116; cv=none; d=google.com; s=arc-20160816; b=x2p2SuJ3KUR2Fynkx2CeZJWPNLEVGc4U4a3ikk1DHLawMc/gtRTEs0IY8M4lojny1n YMVbKC+OHC1lKFCfCRC8xEE9LRZmQUb5FUTl1QbH3Fo3UsCetHYqCBFQAYGxedGFAfwM 1pYN5dC6xUap8kz3kzukGH0Ume5+94gLwN3VTbJ6AEXK5mAScvWHImD/yuJH2FMFnHT/ eQWqDnJPstqLIDBUenusl1uNA/NpZIi9OW5FE+kaloOL1wnwwlxfwNBmVTWbp/bhc6Rn 4JTyxu5CzmIEjyWQiX4mOjsrD1neeTGEcAqWWAbZesPeJEAsdP4OtOrPOLIrNwRar63b sf0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=deoggW/S/f0gPcgW3JuerIndY+bDyi8XUS9CYJUajUI=; b=nKRIcYoyqb31U8D1GfYwrxn4hrisBmDzcdOIavIEiH9Qt5yphztdfLh5FfKXo+du16 m7c0MiD5/yrR/tl5wL+3DhT53OR2AIFMbgLMTBbWTE8J3LKhpOBD9zSNnu6O09r8PbP8 sswctX/fCYdOhBKVfpOHtA66/BWXx0cHgqF2ktVIWY60FGNIgsZSKxAwii2kk8SX9zKh xrh511sonYGqU3mre+rIxqKlwEXJ7ZQPnvgvgJTIHcSO6qYiPsOGoF6KVtXEhjS9XQiC 78mT560CGeGuX2UgB4vfm8Uw1qOZZIUjjw6OMwRXOA7bh9YFT0RKUt4Sg3/iLxq2abFw Rnzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of steve.capper@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steve.capper@arm.com Received: from foss.arm.com (foss.arm.com. [217.140.101.70]) by mx.google.com with ESMTP id y8si9647963ota.237.2018.12.05.08.41.56 for ; Wed, 05 Dec 2018 08:41:56 -0800 (PST) Received-SPF: pass (google.com: domain of steve.capper@arm.com designates 217.140.101.70 as permitted sender) client-ip=217.140.101.70; Authentication-Results: mx.google.com; spf=pass (google.com: domain of steve.capper@arm.com designates 217.140.101.70 as permitted sender) smtp.mailfrom=steve.capper@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B34AFA78; Wed, 5 Dec 2018 08:41:55 -0800 (PST) Received: from capper-debian.emea.arm.com (C02R32KKFVH8.manchester.arm.com [10.32.102.139]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6ED983F5AF; Wed, 5 Dec 2018 08:41:54 -0800 (PST) From: Steve Capper To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will.deacon@arm.com, ard.biesheuvel@linaro.org, jcm@redhat.com, Steve Capper Subject: [PATCH V4 0/6] 52-bit userspace VAs Date: Wed, 5 Dec 2018 16:41:39 +0000 Message-Id: <20181205164145.24568-1-steve.capper@arm.com> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This patch series brings support for 52-bit userspace VAs to systems that have ARMv8.2-LVA and are running with a 48-bit VA_BITS and a 64KB PAGE_SIZE. If no hardware support is present, the kernel runs with a 48-bit VA space for userspace. Userspace can exploit this feature by providing an address hint to mmap where addr[51:48] != 0. Otherwise all the VA mappings will behave in the same way as a 48-bit VA system (this is to maintain compatibility with software that assumes the maximum VA size on arm64 is 48-bit). This patch series applies to 4.20-rc1. Testing was in a model with Trusted Firmware and UEFI for boot. Changed in V4, pgd_index changes dropped in favour of offsetting the ttbr1. This is performed in a new patch, #4. Changed in V3, COMPAT fixes added (and tested with 32-bit userspace code). Extra patch added to allow forcing all userspace allocations to come from 52-bits (to allow for debugging and testing). The major change to V2 of the series is that mm/mmap.c is altered in the first patch of the series (rather than copied over to arch/arm64). Steve Capper (6): mm: mmap: Allow for "high" userspace addresses arm64: mm: Introduce DEFAULT_MAP_WINDOW arm64: mm: Define arch_get_mmap_end, arch_get_mmap_base arm64: mm: Offset TTBR1 to allow 52-bit PTRS_PER_PGD arm64: mm: introduce 52-bit userspace support arm64: mm: Allow forcing all userspace addresses to 52-bit arch/arm64/Kconfig | 17 ++++++++++++ arch/arm64/include/asm/asm-uaccess.h | 4 +++ arch/arm64/include/asm/assembler.h | 30 ++++++++++++++++++--- arch/arm64/include/asm/elf.h | 4 +++ arch/arm64/include/asm/mmu_context.h | 3 +++ arch/arm64/include/asm/pgtable-hwdef.h | 9 +++++++ arch/arm64/include/asm/processor.h | 36 ++++++++++++++++++++----- arch/arm64/include/asm/uaccess.h | 4 +++ arch/arm64/kernel/head.S | 14 ++++++++++ arch/arm64/kernel/hibernate-asm.S | 1 + arch/arm64/mm/fault.c | 2 +- arch/arm64/mm/init.c | 2 +- arch/arm64/mm/mmu.c | 1 + arch/arm64/mm/proc.S | 14 +++++++++- drivers/firmware/efi/arm-runtime.c | 2 +- drivers/firmware/efi/libstub/arm-stub.c | 2 +- mm/mmap.c | 25 ++++++++++++----- 17 files changed, 148 insertions(+), 22 deletions(-)