Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp198161rdb; Mon, 15 Jan 2024 18:21:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ9eAtWzeXBZh5W4WOPwa2BR8K1EAf/NfJWCspyLBlRjiLRRmxGw/XqzWPhDJYjdTVaM6v X-Received: by 2002:a17:907:3108:b0:a26:98a1:9e89 with SMTP id wl8-20020a170907310800b00a2698a19e89mr2877457ejb.41.1705371670044; Mon, 15 Jan 2024 18:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705371670; cv=none; d=google.com; s=arc-20160816; b=vyWJ/rVEvtSpRhkPHCebv3FRsZdR6cAaPjGxW5UjLlHpnk7BrlNkv/7Mz0jTwM/Yhh dYGbRv5e5S9dea788NuWlXxJSIPOpSOcGBls6eK1PesuiMG9XtYxBru9AKxd8/zJCwGI fRVHTUYL0Ls3eUizNec+vx0O/ePKtr67IxInN6Fe5QY/5E58SfAzb/5C5AN+pi9NoQen nhWUI4Wd4+0TMojF5PPkRWHWGrxCpT2zlaDzL9ddcOYEE8j2kGEgKWhi8g82Pw7o4pGb /x+/MCMplsR5RnrCh3PP22OLCnPLLnyFncsUL2Saf3HkVeFD3t/kCxkKiud9U0Y1L5DN a4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:reply-to:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=c4vfRMdoaViI6HxDtxXy2GwJGspyIYSCzcn+j2z7kh4=; fh=NIsPzUZjaJ3tPkVc3BtGzQZbr06zzzUFoB+mXYLA6CI=; b=K1wJ+EZLrmQD55vzf0DoBJa7MH2JXb1VbSV6DFR4wZq+nJVk4L1qSv4EF+b29H+i8w cj3I20fX1m/yHnVTVlA4Ydre1RxmkJQhKDqpsRAntdJgyOjzWMn2YbccHM2FvfM3WZVB 6KCloE+yKB1dbd4pPt0xqd/juNOnbd5IMu0eEzjyhXzhiMaelKFhQkrhFbKryC9iToaR xLVG8XFH1rwxu7MEhMZeRHZb72Dt2oDQMs7vYkfcr1OV6fknDuUvr2WFzLTq9jSLNWRz hK0ODAVsw4zGL1REME8eioREoqvP1LFbqW+W7EuuqJngVsSOBdBCTHMilapwyr0r8P2h IwUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k4uDZkcN; spf=pass (google.com: domain of linux-kernel+bounces-26925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e19-20020a170906c01300b00a28f6ebcd2asi4313288ejz.1012.2024.01.15.18.21.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 18:21:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k4uDZkcN; spf=pass (google.com: domain of linux-kernel+bounces-26925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id C05721F228BC for ; Tue, 16 Jan 2024 02:21:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C63679EA; Tue, 16 Jan 2024 02:20:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k4uDZkcN" Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D319567D; Tue, 16 Jan 2024 02:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d3f2985425so44576845ad.3; Mon, 15 Jan 2024 18:20:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705371631; x=1705976431; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c4vfRMdoaViI6HxDtxXy2GwJGspyIYSCzcn+j2z7kh4=; b=k4uDZkcNwgelhv8HFf9nmioP4dIoTWC45t1pAGzvsA86QqktpEMy/9NuCURb1aVa8/ /xCB41ND7GEQS6+nUf7LGkJHTVI38zj/Uw5PSpRD+tSJotap4UAVEuQ57CiQW5GzTkr/ 4uxlT7Fa1f0zG3pMe95oYcptBOeaVIpXwBfWuXs+4BVbzO7bht9HpF9Va9P+psKU4y7X 3aRuSvdQX7tJr49cT+YTzg8wwq3ktGk2DEZYg2zUf1dni54HwAHSs9Zb8DOf+qdT6SuJ fLWhlqhq4EANvg4naXgm749CNKg0GMpXAVeonJNd2Zp4m/uBUriyF2okaWKujl6aKIkh dsEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705371631; x=1705976431; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=c4vfRMdoaViI6HxDtxXy2GwJGspyIYSCzcn+j2z7kh4=; b=G/E76C2tHyt30lzTNBH0IIxfNRyaXxtmTIYajazC/TMZmgO/GC7izy2belKKynlPRh uXydUuuhQ1rkQwP5pIHGon9NETy+lAfr9xPDbyWoIo2y/ON8DF/85YLKlmRAIOVIZ8mD VON8rSLjv06P6mY7JQROdWTLxVbxoY3riuVLRJk80v1TC/vspi09Mu6uT63rQ8LanyV4 ziwPPCLUhwlJE+23gIQOq0p51gHH4IDIOsLypDYFjBlFM4Omp5Yyaq2giBidtEQuamGE ItTUbgZ8ShEvquscjSq3Lqeu0cOpOlvHDES29tceQ1c8+XwmLKf1s+G/nup/Is1SM6hf tHHw== X-Gm-Message-State: AOJu0YyX5nhevSBR0bmCXtluJqPhY4V3frs7GNt7bVsB0SteWlO0zBw+ 9AETX1ds/OpzWPE4aw91YQI= X-Received: by 2002:a17:902:cec8:b0:1d5:c558:164d with SMTP id d8-20020a170902cec800b001d5c558164dmr1779308plg.74.1705371631546; Mon, 15 Jan 2024 18:20:31 -0800 (PST) Received: from localhost.localdomain (c-73-254-87-52.hsd1.wa.comcast.net. [73.254.87.52]) by smtp.gmail.com with ESMTPSA id kn14-20020a170903078e00b001d1d1ef8be5sm8193379plb.173.2024.01.15.18.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 18:20:31 -0800 (PST) From: mhkelley58@gmail.com X-Google-Original-From: mhklinux@outlook.com To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kirill.shutemov@linux.intel.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, luto@kernel.org, peterz@infradead.org, akpm@linux-foundation.org, urezki@gmail.com, hch@infradead.org, lstoakes@gmail.com, thomas.lendacky@amd.com, ardb@kernel.org, jroedel@suse.de, seanjc@google.com, rick.p.edgecombe@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 2/3] x86/mm: Regularize set_memory_p() parameters and make non-static Date: Mon, 15 Jan 2024 18:20:07 -0800 Message-Id: <20240116022008.1023398-3-mhklinux@outlook.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240116022008.1023398-1-mhklinux@outlook.com> References: <20240116022008.1023398-1-mhklinux@outlook.com> Reply-To: mhklinux@outlook.com Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Michael Kelley set_memory_p() is currently static. It has parameters that don't match set_memory_p() under arch/powerpc and that aren't congruent with the other set_memory_* functions. There's no good reason for the difference. Fix this by making the parameters consistent, and update the one existing call site. Make the function non-static and add it to include/asm/set_memory.h so that it is completely parallel to set_memory_np() and is usable in other modules. No functional change. Signed-off-by: Michael Kelley Reviewed-by: Rick Edgecombe Acked-by: Kirill A. Shutemov --- arch/x86/include/asm/set_memory.h | 1 + arch/x86/mm/pat/set_memory.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h index a5e89641bd2d..9aee31862b4a 100644 --- a/arch/x86/include/asm/set_memory.h +++ b/arch/x86/include/asm/set_memory.h @@ -47,6 +47,7 @@ int set_memory_uc(unsigned long addr, int numpages); int set_memory_wc(unsigned long addr, int numpages); int set_memory_wb(unsigned long addr, int numpages); int set_memory_np(unsigned long addr, int numpages); +int set_memory_p(unsigned long addr, int numpages); int set_memory_4k(unsigned long addr, int numpages); int set_memory_encrypted(unsigned long addr, int numpages); int set_memory_decrypted(unsigned long addr, int numpages); diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index e76ac64b516e..164d32029424 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -2045,17 +2045,12 @@ int set_mce_nospec(unsigned long pfn) return rc; } -static int set_memory_p(unsigned long *addr, int numpages) -{ - return change_page_attr_set(addr, numpages, __pgprot(_PAGE_PRESENT), 0); -} - /* Restore full speculative operation to the pfn. */ int clear_mce_nospec(unsigned long pfn) { unsigned long addr = (unsigned long) pfn_to_kaddr(pfn); - return set_memory_p(&addr, 1); + return set_memory_p(addr, 1); } EXPORT_SYMBOL_GPL(clear_mce_nospec); #endif /* CONFIG_X86_64 */ @@ -2108,6 +2103,11 @@ int set_memory_np_noalias(unsigned long addr, int numpages) CPA_NO_CHECK_ALIAS, NULL); } +int set_memory_p(unsigned long addr, int numpages) +{ + return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_PRESENT), 0); +} + int set_memory_4k(unsigned long addr, int numpages) { return change_page_attr_set_clr(&addr, numpages, __pgprot(0), -- 2.25.1