From patchwork Thu Jan 10 21:09:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khalid Aziz X-Patchwork-Id: 10756903 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 8352C159A for ; Thu, 10 Jan 2019 21:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CEBC29BC9 for ; Thu, 10 Jan 2019 21:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60A6929BC2; Thu, 10 Jan 2019 21:11:03 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 E481E29BAA for ; Thu, 10 Jan 2019 21:11:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17A348E000C; Thu, 10 Jan 2019 16:10:43 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 106018E0008; Thu, 10 Jan 2019 16:10:43 -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 EC0A58E000C; Thu, 10 Jan 2019 16:10:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id A32BB8E0008 for ; Thu, 10 Jan 2019 16:10:42 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id 82so8655909pfs.20 for ; Thu, 10 Jan 2019 13:10:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:in-reply-to:references; bh=7ze7ihNQNB91qQvcMs0AZsSJuj8aoWf893BJ5dPG2Tc=; b=slA9au1C4eE+3you2Dst4IgehAHnxmuqb+LXTScTjMm3RVK+nhVmd+vm7d7VSElM89 WKyvBZqxmlYl8HiURxIQGMdiawmRVRK6MIbXbJR1bPpN0x+P6Qrjmv8gzdMu9BUNa1sM 78bq/l/Y762viwX8pR3ZCRmslt+gDlPdw5odssp/dOrScugcPwi5F5YlbGtZvek5zrZF LOJklQVErWjSQeDoGBNiI0qT49JRrecYgx6iO3H9q/awBMiV0O5EsmRdJ6cjivuyBa/R UKH77woijuSoGVdtc5ejVXTqKf+RLBAZEHAahNw6D6E9xSbQ1MmVn0KYsEjyxYsYL5Ou yggQ== X-Gm-Message-State: AJcUukcLbrHhXRAFalZS5bb8+hdBbUjKCFa+868gbzewUBZs8f1rOXN2 w/OKT/Siva3t9HJnDSdVKml0HwoBr+3LWwQ/iFWCCC7ZIJg5g6OghGMIVX4sv4tqMs6fGxN9vTp eaR6HXY4uj+P3mwY38ydphdZXzabPIvV6+Ee1xIXjBJIAAWpANAcjchVRQoL+tDHN+g== X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr12191378plq.286.1547154642332; Thu, 10 Jan 2019 13:10:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN7JPcq/PAXxof9Qqam/K2dWmDu9pZJr1f1fVjI1uYVO5PQfONqv9ruNAolJ2PbV8sSYCCaW X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr12191349plq.286.1547154641626; Thu, 10 Jan 2019 13:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547154641; cv=none; d=google.com; s=arc-20160816; b=nh01G/y6Msu1fh1N6byTxWI0N6iarOs+IN1J+RkUWIl//aZOy0d7rLIEZ0nn5egyWv UXDqZSDtrWy9kA0Xkqx8LEpgUpuueDbxmR+TKvRz7XTbmW1MHD7zcnsUtZG+MTdrQ7aw rok6vCy6Zhvyb5VqVobR1Fz6OARwrixMZ4ZbB7lm0OANOwWKYpHciFFXJD6p509VuSFi Wo7n0TKCPyyAnYuy/Dw2bc+7DLryYLKDX7rO4BAyRyzu0U4cv4hKZCoJkL51mfm4PHnh grJt2JoTa2uvWNuIlHyWWPVmJnu7km+++X4XPQWOLdTb1/d0J3i2Yfgp/rCU+L+kqmBq Bj3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=7ze7ihNQNB91qQvcMs0AZsSJuj8aoWf893BJ5dPG2Tc=; b=SwnEzejBQiQOpZRnKOYGL4yGY6TvC/Jby82/Kf853VVCVjNX31V8WwJ/AmR3uTXiaT 2QQihZS6efDYpGFQOo4ep2Ydw5l0fXP808XLNHrncWMx4wFndlufdrhM+QB/fCsm4dwI r98Evri31uUUavEFbsjRyQ3dyA+u0GBtd2Z+GtpLIWEbYJSsh/oPMxXEJNsbCFagWrgj 2lisvISU5VIu9QsgvD4fSXhZlQMWGuj71hHsNPoBzoE16yygCpuPQ/bns+Asl1IMuLgV DrQdt9mEpkS55zdqdIYKBQkGnMRknZg4BjB/1vPlDH/Rei7inR4GiME42WUMB07ma7Nv stMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zQ6tEafk; spf=pass (google.com: domain of khalid.aziz@oracle.com designates 141.146.126.79 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2130.oracle.com (aserp2130.oracle.com. [141.146.126.79]) by mx.google.com with ESMTPS id e6si70558327pgk.201.2019.01.10.13.10.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 13:10:41 -0800 (PST) Received-SPF: pass (google.com: domain of khalid.aziz@oracle.com designates 141.146.126.79 as permitted sender) client-ip=141.146.126.79; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=zQ6tEafk; spf=pass (google.com: domain of khalid.aziz@oracle.com designates 141.146.126.79 as permitted sender) smtp.mailfrom=khalid.aziz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0AL8up0187070; Thu, 10 Jan 2019 21:10:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : in-reply-to : references; s=corp-2018-07-02; bh=7ze7ihNQNB91qQvcMs0AZsSJuj8aoWf893BJ5dPG2Tc=; b=zQ6tEafkYELketM9PQGIBhEggEtIFIzXE2AsxM/vjfAsKwijBbkklOA/wPl76KxUn5Er MVdeIHP/9T8pCzW9SZoZghIsrZOZNKKAoGszZc9Qr6DGVzSJOzz838a2YocF87jIomut IgACh2Uy1NML3PSo4anLaJ1jkIZukutMnbnYxOgiQzp74Yun3c8MmQMlRDscX5LdOkuD yx2o0t/4gZJlb9IkGWObtSKw/0X8YYv96FPadoHq+H/eQc4qy/uxbQrk9SCnvYbKScqz NibBrnvTaUIwc9u7cdJBxSwRG8l7RjGH1NC22eVgRnz0OLUbT7rrDDNQzRc5gx2BuKNd Wg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2ptj3e9tha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Jan 2019 21:10:33 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0ALARtm008956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Jan 2019 21:10:27 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0ALAQbd003774; Thu, 10 Jan 2019 21:10:26 GMT Received: from concerto.internal (/24.9.64.241) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Jan 2019 13:10:26 -0800 From: Khalid Aziz To: juergh@gmail.com, tycho@tycho.ws, jsteckli@amazon.de, ak@linux.intel.com, torvalds@linux-foundation.org, liran.alon@oracle.com, keescook@google.com, konrad.wilk@oracle.com Cc: Juerg Haefliger , deepa.srinivasan@oracle.com, chris.hyser@oracle.com, tyhicks@canonical.com, dwmw@amazon.co.uk, andrew.cooper3@citrix.com, jcm@redhat.com, boris.ostrovsky@oracle.com, kanth.ghatraju@oracle.com, joao.m.martins@oracle.com, jmattson@google.com, pradeep.vincent@oracle.com, john.haxby@oracle.com, tglx@linutronix.de, kirill.shutemov@linux.intel.com, hch@lst.de, steven.sistare@oracle.com, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tycho Andersen , Khalid Aziz Subject: [RFC PATCH v7 07/16] arm64/mm, xpfo: temporarily map dcache regions Date: Thu, 10 Jan 2019 14:09:39 -0700 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9132 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=682 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100164 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 From: Juerg Haefliger If the page is unmapped by XPFO, a data cache flush results in a fatal page fault, so let's temporarily map the region, flush the cache, and then unmap it. v6: actually flush in the face of xpfo, and temporarily map the underlying memory so it can be flushed correctly CC: linux-arm-kernel@lists.infradead.org Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- arch/arm64/mm/flush.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 30695a868107..f12f26b60319 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -28,9 +29,15 @@ void sync_icache_aliases(void *kaddr, unsigned long len) { unsigned long addr = (unsigned long)kaddr; + unsigned long num_pages = XPFO_NUM_PAGES(addr, len); + void *mapping[num_pages]; if (icache_is_aliasing()) { + xpfo_temp_map(kaddr, len, mapping, + sizeof(mapping[0]) * num_pages); __clean_dcache_area_pou(kaddr, len); + xpfo_temp_unmap(kaddr, len, mapping, + sizeof(mapping[0]) * num_pages); __flush_icache_all(); } else { flush_icache_range(addr, addr + len);