From patchwork Thu Feb 22 23:16:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 205106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp276174dyb; Thu, 22 Feb 2024 15:18:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX7vhZLiWIsGo6Kcy6CUjwV32RQbn44AJcTZipiycC9wxZtPBzUgf/b97a1hn+/sr1GCPCBHpxhVP85dYpSYmjgh4i+hw== X-Google-Smtp-Source: AGHT+IHidtfTOusS2t9KvM+guzi7GRkijc3U193pS9x3spKlurs2BjpKDpMqU6ooosvPP2MAdYSJ X-Received: by 2002:a05:622a:1004:b0:42d:f128:eccf with SMTP id d4-20020a05622a100400b0042df128eccfmr842166qte.33.1708643906829; Thu, 22 Feb 2024 15:18:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708643906; cv=pass; d=google.com; s=arc-20160816; b=bUen69hEoEXfo+0kw+yKjK5Xg1ckLiIgHw1XELhUG7sM/pi08NJGxdJK3RtrZbpuBw f1xvtW2T5wOMeLdpaWOBQGqFnaBXg979xfxHb+2GkAU/BThh5aqS2N1H30SKlTCrKCFG 9q7k7050XYyw8thEbcUkSM9gh98gni/XJeTGQU4L/hRcTYF2QcgUqsFwJFahVkQS+dwE rYSt/OR1Hg1JoU2fWSN7Nxq4Rjds6Lby3xD9F+0leAJf//fDbggHlNZK7zlDMmARpH6c RZfbOQbUOpaT4qZrXws/mYN+ACq5M1yfS4xYE6F7BqbvTb8uF6Ql2xnayzWIt2ZvMw1e Npzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=BqFFNu68PPJsdW9psryeqdBWeZaEA8iJMtTYpGjEiRs=; fh=j53ffieBeHmuArQHAkiXDczYOIriM+Jf92hqYE3BW8U=; b=IeFV/bt/aoYvC/HP0ZyGxGsQHQt6LOlnrn07nqyK2U8CaaTawrRPUb1S+7UOqRfick 9PD0MQZ6OtiztElViomxTvQhYBWmurZx2V/d+PnYnDF4lJqCmoL0oSy4aA1behBTad4j FCuvEWPn23fS9tiGCYTs4bLvTozHC2nQ1jouFqtJpXBaFI+J58UpDuH0ttVuGh78eq4M qdCMX+Z1M+W9O40UGieL/wd2plNcr7fDuUyWylLwGsKu7W4kEuTF+B3RoFDOD0JQklqt x7+LBcOEFJCgKuyVyBwHZXq5hir8N0MZwlQ5ZQP5LsC/S423xppYqM6w/f9qgu+WZIMI jaxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Aex6mvf2; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-77497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77497-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e5-20020ac84905000000b0042c50465c78si13249887qtq.664.2024.02.22.15.18.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 15:18:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Aex6mvf2; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-77497-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77497-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9D5ED1C227E8 for ; Thu, 22 Feb 2024 23:18:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 808DD13BAD6; Thu, 22 Feb 2024 23:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Aex6mvf2" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CBE41C680; Thu, 22 Feb 2024 23:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643823; cv=none; b=qF748Xrn0f/pRiaFUoFwdvx426fTjL6SnRy/IyUB6BdKidLEKu0dD6sDm+ChtLF/js5qMEy6QRNZcPJmCPEoqiFBZasEYwVnaaYhQJ6J7dzHMv0g8Kev8AD/tciFb65CsV/Oq25RF680waXoXUPIMWPKEzGg72d/Fyo8Hh5zBeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643823; c=relaxed/simple; bh=Ka7yMpUBY0NWUH9927zVV6/k4CvFgSZ6vIK6Qbq74FY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ejij4vAOzVcZ3H5bZRFj6KQ+p3C9QV6CAvQuQgYI+hgBEdDE2AkaPqP2u0m/uq8WSmu3L0lIR79GLnZLpA5oNrg+N1zB0DGDyh3a7IxIhjtnt6iwFcI8rkxG6lC8zpXdixtdDLbZpQOtI6Qx/q6rS+UOv09YIm31TBQfHKwdZrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=Aex6mvf2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41MLSSYf024471; Thu, 22 Feb 2024 23:16:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=BqFFNu68PPJsdW9psryeqdBWeZaEA8iJMtTYpGjEiRs =; b=Aex6mvf2g3FnivTElXrRrrHWoO98H3rwWvOrmltuggNv3WUhHob6R/Efvf5 fth/r/0ebRdtGJN6hnNt00WxB+8pxKlu8y2Zjah3urXwGeZ2A8JIEuZNAzC80uvQ WlIeepmVse9WxaI/b//9J8xcsfewNrgxojbn1H3/NNwIMlcpN4bkj5HIqNF8ZUH7 RIuoI+MZZ6xj4SnJhmTgjSUiB7Us6pTFEBBECy0F6SLzOou0dnNdl49ruiqElAT2 F+J3iD96h5jsthaHd4CmCy/27vk8MDfgaFFPUXHpqcgipDVinxSZyXQCY0WIlNaK tnoNdc9MIJfm8YDvhpRbBPlK5Ig== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3we3231h1r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 23:16:39 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41MNGc3b025583 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 23:16:38 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 22 Feb 2024 15:16:37 -0800 From: Elliot Berman Date: Thu, 22 Feb 2024 15:16:42 -0800 Subject: [PATCH v17 19/35] arch/mm: Export direct {un,}map functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240222-gunyah-v17-19-1e9da6763d38@quicinc.com> References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> In-Reply-To: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> To: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" CC: , , , , , , Elliot Berman X-Mailer: b4 0.12.4 X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: MP-x340LqCsOeMxuGX6zrotY1v88l2Gs X-Proofpoint-GUID: MP-x340LqCsOeMxuGX6zrotY1v88l2Gs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 malwarescore=0 mlxlogscore=828 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402220178 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791642993186524545 X-GMAIL-MSGID: 1791642993186524545 Firmware and hypervisor drivers can donate system heap memory to their respective firmware/hypervisor entities. Those drivers should unmap the pages from the kernel's logical map before doing so. Export can_set_direct_map, set_direct_map_invalid_noflush, and set_direct_map_default_noflush. Signed-off-by: Elliot Berman --- arch/arm64/mm/pageattr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c index 924843f1f661b..a9bd84588c98a 100644 --- a/arch/arm64/mm/pageattr.c +++ b/arch/arm64/mm/pageattr.c @@ -32,6 +32,7 @@ bool can_set_direct_map(void) return rodata_full || debug_pagealloc_enabled() || arm64_kfence_can_set_direct_map(); } +EXPORT_SYMBOL_GPL(can_set_direct_map); static int change_page_range(pte_t *ptep, unsigned long addr, void *data) { @@ -176,6 +177,7 @@ int set_direct_map_invalid_noflush(struct page *page) (unsigned long)page_address(page), PAGE_SIZE, change_page_range, &data); } +EXPORT_SYMBOL_GPL(set_direct_map_invalid_noflush); int set_direct_map_default_noflush(struct page *page) { @@ -191,6 +193,7 @@ int set_direct_map_default_noflush(struct page *page) (unsigned long)page_address(page), PAGE_SIZE, change_page_range, &data); } +EXPORT_SYMBOL_GPL(set_direct_map_default_noflush); #ifdef CONFIG_DEBUG_PAGEALLOC void __kernel_map_pages(struct page *page, int numpages, int enable)