From nobody Sat Feb 7 04:47:31 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E15411991CD for ; Sat, 23 Nov 2024 11:42:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362161; cv=none; b=MRJd1Cb98cK4QhSEos50eqMPLFsUY6LHT0MxK/V0Q8b1xcQCLvyUUK4ca/Gg42sGPMl9BVgnr54/9B1qM9VVfZC75eP65EGuhDDw2OZj9h+ocd70Hi/8arpQcirKKMULfVM20bN6SGJs5+1DpCgzhCAyink6UYaXFIvBd/euPS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362161; c=relaxed/simple; bh=G3swD89QHBnyzx01W3vlbAk/XxQvcjBt0CJORcbm3VA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=cVrv6c/uExa3VLOU7PeGQv6DS9xSaBaWsUlp27/KDWZDoi/B3gCRHvbT3VjNXF0odEumzOLkpe3YhUtJQOj4talAmFhSyJdKW7IH0v808/3RomaBg7I4vXbQF8mH+QN2L4h+2ER+zWUqr5EbLRCVUpIbKwcEi4Ur1usPEw9p5uI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=jHw2rtZK; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jHw2rtZK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732362158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QmyYa2oCHPzw0Id7SpWheJapKne0y94rnLOSTdXdXFM=; b=jHw2rtZKmXSZGRQPCCBwDEBN0jbgKHSVIMtStfM9X11ZX/z9oWtDzUmFUxE2xDpnusj0mf SKi7U8ECFnnEzjoH8Jwpk4aXxgBlOoiaKK39d8pZgLjewGdP+Z92lGoVXDKpc0NIvZIkKP QcnJOfhcaarVh4NCSf5CblyxwZGngAc= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-92-Zkr-myXKOhudvE7e7Bz1CQ-1; Sat, 23 Nov 2024 06:42:35 -0500 X-MC-Unique: Zkr-myXKOhudvE7e7Bz1CQ-1 X-Mimecast-MFC-AGG-ID: Zkr-myXKOhudvE7e7Bz1CQ Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E11141955EE7; Sat, 23 Nov 2024 11:42:33 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.113.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7C8DE30000DF; Sat, 23 Nov 2024 11:42:30 +0000 (UTC) From: Baoquan He To: mingo@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, linux-kernel@vger.kernel.org Cc: x86@kernel.org, Baoquan He Subject: [PATCH v3 1/3] x86/ioremap: introduce helper to implement xxx_is_setup_data() Date: Sat, 23 Nov 2024 19:42:19 +0800 Message-ID: <20241123114221.149383-2-bhe@redhat.com> In-Reply-To: <20241123114221.149383-1-bhe@redhat.com> References: <20241123114221.149383-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" Functions memremap_is_setup_data() and early_memremap_is_setup_data() share completely the same process and handling, except of the different memremap/unmap invocations. So add helper __memremap_is_setup_data() to extract the common part, parameter 'early' is used to decide what kind of memremap/unmap APIs are called. This simplifies codes a lot by removing the duplicated codes, and also removes the similar code comment above them. And '__ref' is added to __memremap_is_setup_data() to suppress below section mismatch warning: ARNING: modpost: vmlinux: section mismatch in reference: __memremap_is_setu= p_data+0x5f (section: .text) -> early_memunmap (section: .init.text) Signed-off-by: Baoquan He --- arch/x86/mm/ioremap.c | 104 ++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 69 deletions(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 8d29163568a7..aaf40a712b04 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -632,8 +632,8 @@ static bool memremap_is_efi_data(resource_size_t phys_a= ddr, * Examine the physical address to determine if it is boot data by checking * it against the boot params setup_data chain. */ -static bool memremap_is_setup_data(resource_size_t phys_addr, - unsigned long size) +static bool __ref __memremap_is_setup_data(resource_size_t phys_addr, + bool early) { struct setup_indirect *indirect; struct setup_data *data; @@ -641,31 +641,45 @@ static bool memremap_is_setup_data(resource_size_t ph= ys_addr, =20 paddr =3D boot_params.hdr.setup_data; while (paddr) { - unsigned int len; + unsigned int len, size; =20 if (phys_addr =3D=3D paddr) return true; =20 - data =3D memremap(paddr, sizeof(*data), - MEMREMAP_WB | MEMREMAP_DEC); + if (early) + data =3D early_memremap_decrypted(paddr, sizeof(*data)); + else + data =3D memremap(paddr, sizeof(*data), + MEMREMAP_WB | MEMREMAP_DEC); if (!data) { pr_warn("failed to memremap setup_data entry\n"); return false; } =20 + size =3D sizeof(*data); + paddr_next =3D data->next; len =3D data->len; =20 if ((phys_addr > paddr) && - (phys_addr < (paddr + sizeof(struct setup_data) + len))) { - memunmap(data); + (phys_addr < (paddr + sizeof(*data) + len))) { + if (early) + early_memunmap(data, sizeof(*data)); + else + memunmap(data); return true; } =20 if (data->type =3D=3D SETUP_INDIRECT) { - memunmap(data); - data =3D memremap(paddr, sizeof(*data) + len, - MEMREMAP_WB | MEMREMAP_DEC); + size +=3D len; + if (early) { + early_memunmap(data, sizeof(*data)); + data =3D early_memremap_decrypted(paddr, size); + } else { + memunmap(data); + data =3D memremap(paddr, size, + MEMREMAP_WB | MEMREMAP_DEC); + } if (!data) { pr_warn("failed to memremap indirect setup_data\n"); return false; @@ -679,7 +693,10 @@ static bool memremap_is_setup_data(resource_size_t phy= s_addr, } } =20 - memunmap(data); + if (early) + early_memunmap(data, size); + else + memunmap(data); =20 if ((phys_addr > paddr) && (phys_addr < (paddr + len))) return true; @@ -690,67 +707,16 @@ static bool memremap_is_setup_data(resource_size_t ph= ys_addr, return false; } =20 -/* - * Examine the physical address to determine if it is boot data by checking - * it against the boot params setup_data chain (early boot version). - */ +static bool memremap_is_setup_data(resource_size_t phys_addr, + unsigned long size) +{ + return __memremap_is_setup_data(phys_addr, false); +} + static bool __init early_memremap_is_setup_data(resource_size_t phys_addr, unsigned long size) { - struct setup_indirect *indirect; - struct setup_data *data; - u64 paddr, paddr_next; - - paddr =3D boot_params.hdr.setup_data; - while (paddr) { - unsigned int len, size; - - if (phys_addr =3D=3D paddr) - return true; - - data =3D early_memremap_decrypted(paddr, sizeof(*data)); - if (!data) { - pr_warn("failed to early memremap setup_data entry\n"); - return false; - } - - size =3D sizeof(*data); - - paddr_next =3D data->next; - len =3D data->len; - - if ((phys_addr > paddr) && - (phys_addr < (paddr + sizeof(struct setup_data) + len))) { - early_memunmap(data, sizeof(*data)); - return true; - } - - if (data->type =3D=3D SETUP_INDIRECT) { - size +=3D len; - early_memunmap(data, sizeof(*data)); - data =3D early_memremap_decrypted(paddr, size); - if (!data) { - pr_warn("failed to early memremap indirect setup_data\n"); - return false; - } - - indirect =3D (struct setup_indirect *)data->data; - - if (indirect->type !=3D SETUP_INDIRECT) { - paddr =3D indirect->addr; - len =3D indirect->len; - } - } - - early_memunmap(data, size); - - if ((phys_addr > paddr) && (phys_addr < (paddr + len))) - return true; - - paddr =3D paddr_next; - } - - return false; + return __memremap_is_setup_data(phys_addr, true); } =20 /* --=20 2.41.0 From nobody Sat Feb 7 04:47:31 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 5BFBB19D062 for ; Sat, 23 Nov 2024 11:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362166; cv=none; b=p0DyIKkNYtwHN/H5+DK/Ai8M3rDd1F9OqU5dbu6XHPhm64jhfXjJDpI+vB4Ag1wzzEe9L/TN/GptGPUIUryNdOjVkksGeC/LQiZuDvLZ5W+HVBUyOZISvaFrrwR3NiEsVQv2ET1/FkUExonA/an/lO9cbJTapU/VDaBSu8fNaug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362166; c=relaxed/simple; bh=dKRraXEvvBIiELg1KVw+pNKsQ+dISM0Y2Qkzpj0lXyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=X7jvl7Sm+VUJe0yWQWMm1M1gAwCBENrcMvcSZhAZPdMTS6hy63DWyGjmqHoFcQ0CZlba88Rg8ZpL5fvbwfTQSCsJ5k3AgGXxGAa9pPfcL9FggVRMP+gzFtZ6wjkTeXifhxcWiIfj5R5K+Rfzi4yZWXcM1ATdJt5UBI8MwNVptu8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XZYTAjyQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XZYTAjyQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732362163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BkUrFTWxTUqZBwu2Upg8aNpuqaNWXe8OYfpatQKY0cI=; b=XZYTAjyQhWwEY60hSQ5AiVDxcf6uASjkZyvKguDniXJ7xS99R6uFpu3Vs3bzGZVnFhsF9Z ARuylcjR4ra6bPfsGUQZmAYEsop23vmWw3z9+6zxQrYYhd6YgrylREb+llg8DhIZ+sOUqL vwHClyNbkIgwQzunZhstbwpnQL4Gug8= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-280-GIE6mWTtMF-ooV23Sg5D5Q-1; Sat, 23 Nov 2024 06:42:39 -0500 X-MC-Unique: GIE6mWTtMF-ooV23Sg5D5Q-1 X-Mimecast-MFC-AGG-ID: GIE6mWTtMF-ooV23Sg5D5Q Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 67A7119560B4; Sat, 23 Nov 2024 11:42:38 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.113.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BDF6C30000DF; Sat, 23 Nov 2024 11:42:34 +0000 (UTC) From: Baoquan He To: mingo@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, linux-kernel@vger.kernel.org Cc: x86@kernel.org, Baoquan He Subject: [PATCH v3 2/3] x86/ioremap: Clean up size calculations in xxx_is_setup_data() Date: Sat, 23 Nov 2024 19:42:20 +0800 Message-ID: <20241123114221.149383-3-bhe@redhat.com> In-Reply-To: <20241123114221.149383-1-bhe@redhat.com> References: <20241123114221.149383-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" while *normally* we'd use the 'sizeof(*data)' pattern, this particular size repeats a number of times and not all contexts are obvious - so abstracting it out into a trivial define SD_SIZE looks like the proper cleanup. Signed-off-by: Baoquan He --- arch/x86/mm/ioremap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index aaf40a712b04..76be3d664e09 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -628,6 +628,7 @@ static bool memremap_is_efi_data(resource_size_t phys_a= ddr, return false; } =20 +#define SD_SIZE sizeof(struct setup_data) /* * Examine the physical address to determine if it is boot data by checking * it against the boot params setup_data chain. @@ -647,24 +648,24 @@ static bool __ref __memremap_is_setup_data(resource_s= ize_t phys_addr, return true; =20 if (early) - data =3D early_memremap_decrypted(paddr, sizeof(*data)); + data =3D early_memremap_decrypted(paddr, SD_SIZE); else - data =3D memremap(paddr, sizeof(*data), + data =3D memremap(paddr, SD_SIZE, MEMREMAP_WB | MEMREMAP_DEC); if (!data) { pr_warn("failed to memremap setup_data entry\n"); return false; } =20 - size =3D sizeof(*data); + size =3D SD_SIZE; =20 paddr_next =3D data->next; len =3D data->len; =20 if ((phys_addr > paddr) && - (phys_addr < (paddr + sizeof(*data) + len))) { + (phys_addr < (paddr + SD_SIZE + len))) { if (early) - early_memunmap(data, sizeof(*data)); + early_memunmap(data, SD_SIZE); else memunmap(data); return true; @@ -673,7 +674,7 @@ static bool __ref __memremap_is_setup_data(resource_siz= e_t phys_addr, if (data->type =3D=3D SETUP_INDIRECT) { size +=3D len; if (early) { - early_memunmap(data, sizeof(*data)); + early_memunmap(data, SD_SIZE); data =3D early_memremap_decrypted(paddr, size); } else { memunmap(data); @@ -706,6 +707,7 @@ static bool __ref __memremap_is_setup_data(resource_siz= e_t phys_addr, =20 return false; } +#undef SD_SIZE =20 static bool memremap_is_setup_data(resource_size_t phys_addr, unsigned long size) --=20 2.41.0 From nobody Sat Feb 7 04:47:31 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 EF8FD19F132 for ; Sat, 23 Nov 2024 11:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362170; cv=none; b=SmIuA136RqSJWMFscgiyEtHhPn8h/wxWlBeBGwVmqyIOwrOnlh1V4QZGvVz2biDYoiNpVNJF3ZhOPgTcKM52HcTfExhYoUu9w/YpAO20Hi3kktq/vtXWpvOf5NLH3xs+3AnM+R9s6ANOFLro6PIIwOsmda3qSlP8+Hsxk5twBxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732362170; c=relaxed/simple; bh=uECwqsF+UkX8OwEsyxyIkz4yOVeW9YjoPdbUuywnYm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=gEDWHXZKrylw8jdJvCQfA1JWsWQWO5599QCnwttYnIUXNSL90+IdZzhAJ9r/RlN2pGg3UKhdH+t8dG9HNrZA9eC32M6xpcVAn4vi9YP5PxTpYTsGCSxB7LGfy33VVKPUWNwTSC04Lis92EN/cEaSaDgAHQ+qYXLmdNYZnnv+twc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=WMJKtkKM; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WMJKtkKM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732362168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NoH0Y2WcxRDLIytNosGD2VXHqriS8fyOCwsa9auaVRQ=; b=WMJKtkKMRvJMRa6o+rfW7X72CsrZHTIqfWZMfRjPijuRgWAut8fvfSp+2PLyqm15DroDNN tP1VBI+3l52m5nxxe2KbKTRj8Z574aGLKlt8wdFGYcFNb0wroh5WZzX5/f9A0BR/OWv/bp HPBxx8K4SlsCbkc9j9dTLhH+NcqUnAc= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-777IVqaFM2OHh_EBYHwBeA-1; Sat, 23 Nov 2024 06:42:44 -0500 X-MC-Unique: 777IVqaFM2OHh_EBYHwBeA-1 X-Mimecast-MFC-AGG-ID: 777IVqaFM2OHh_EBYHwBeA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CB65E19560AA; Sat, 23 Nov 2024 11:42:42 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.113.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4881A30000DF; Sat, 23 Nov 2024 11:42:38 +0000 (UTC) From: Baoquan He To: mingo@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, linux-kernel@vger.kernel.org Cc: x86@kernel.org, Baoquan He Subject: [PATCH v3 3/3] x86/mm: clean up unused parameters of functions Date: Sat, 23 Nov 2024 19:42:21 +0800 Message-ID: <20241123114221.149383-4-bhe@redhat.com> In-Reply-To: <20241123114221.149383-1-bhe@redhat.com> References: <20241123114221.149383-1-bhe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Content-Type: text/plain; charset="utf-8" For functions memremap_is_efi_data(), memremap_is_setup_data and early_memremap_is_setup_data(), their parameter 'size' is not used and sometime cause confusion. Remove it now. Signed-off-by: Baoquan He --- arch/x86/mm/ioremap.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 76be3d664e09..a11890692e4d 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -593,8 +593,7 @@ static bool memremap_should_map_decrypted(resource_size= _t phys_addr, * Examine the physical address to determine if it is EFI data. Check * it against the boot params structure and EFI tables and memory types. */ -static bool memremap_is_efi_data(resource_size_t phys_addr, - unsigned long size) +static bool memremap_is_efi_data(resource_size_t phys_addr) { u64 paddr; =20 @@ -709,14 +708,12 @@ static bool __ref __memremap_is_setup_data(resource_s= ize_t phys_addr, } #undef SD_SIZE =20 -static bool memremap_is_setup_data(resource_size_t phys_addr, - unsigned long size) +static bool memremap_is_setup_data(resource_size_t phys_addr) { return __memremap_is_setup_data(phys_addr, false); } =20 -static bool __init early_memremap_is_setup_data(resource_size_t phys_addr, - unsigned long size) +static bool __init early_memremap_is_setup_data(resource_size_t phys_addr) { return __memremap_is_setup_data(phys_addr, true); } @@ -739,8 +736,8 @@ bool arch_memremap_can_ram_remap(resource_size_t phys_a= ddr, unsigned long size, return false; =20 if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) { - if (memremap_is_setup_data(phys_addr, size) || - memremap_is_efi_data(phys_addr, size)) + if (memremap_is_setup_data(phys_addr) || + memremap_is_efi_data(phys_addr)) return false; } =20 @@ -765,8 +762,8 @@ pgprot_t __init early_memremap_pgprot_adjust(resource_s= ize_t phys_addr, encrypted_prot =3D true; =20 if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) { - if (early_memremap_is_setup_data(phys_addr, size) || - memremap_is_efi_data(phys_addr, size)) + if (early_memremap_is_setup_data(phys_addr) || + memremap_is_efi_data(phys_addr)) encrypted_prot =3D false; } =20 --=20 2.41.0