From patchwork Thu Mar 28 11:56:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 13608433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B386DC54E67 for ; Thu, 28 Mar 2024 11:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lj9TAICmDnQBXY9yv5z/cakTN4qTVeD4BsI22wIIaUo=; b=AXK20287Da7Ky7 UJjBhBxDkjT5uit2g4V/mm9sUlT6sF7+q7Vze9bohnMGTvHOmPOIFqhLBQV4c50sVWpKy8xrumEMp XgT4rMqJ6CKQcXaQiQolElwPeuDkY64Y8TlF7C8STcf7qIQN9foArQsbjN2/I6ka0K7zNzcuA7FZb DMxAOxvOGx6/TUN+nLuKKDgGY9yBF73cZxxQHuqVIB4nd8d4Dl9N3ytrUy4XePIWFuxZRlSdfMd6a V0/S7uCr810dU6K8SXkE3d8xo+nw8ZRZAWgm2TxXKxRGAH7BRsAzsO9Qbsc/IMgpdf/2VD0S40Drk N+UDSlY7wvfKELoNfgug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpoOD-0000000DoJx-38x4; Thu, 28 Mar 2024 11:57:49 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpoNu-0000000Do9I-395u for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2024 11:57:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711627049; 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=VNIOnzN2qDOQR695Gd5Wuuz8T045UOwrVbTKpSoFSq4=; b=adqfnpCoEnYQwzL0kAmlANTE4j3bt1tbFFDhDtGMQdgLY0e/odu64axBy+T08AnZ0xKINa cmmO7oOPhYQajwb9GRJk6Ve1cs6s5gQxdiUAyV9qQZSbo7JyfG87kjvtBc5+bfDx5tkCfr rO4otmXhfPrygWZJ42LHwMO2mc9LSks= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-355-bok5-ORDPPyQAPtwdSiTnA-1; Thu, 28 Mar 2024 07:57:26 -0400 X-MC-Unique: bok5-ORDPPyQAPtwdSiTnA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BC5D8007A3; Thu, 28 Mar 2024 11:57:25 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76C091C05E1C; Thu, 28 Mar 2024 11:57:22 +0000 (UTC) From: Pingfan Liu To: linux-arm-kernel@lists.infradead.org Cc: Pingfan Liu , Catalin Marinas , Will Deacon , Ard Biesheuvel , Kees Cook , Mark Rutland , Pasha Tatashin Subject: [PATCH 3/4] arm64: kexec: Introduce d_size to carry cacheline size information Date: Thu, 28 Mar 2024 19:56:53 +0800 Message-ID: <20240328115656.24090-4-piliu@redhat.com> In-Reply-To: <20240328115656.24090-1-piliu@redhat.com> References: <20240328115656.24090-1-piliu@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240328_045730_942198_AD0231ED X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introducing kimage_arch.d_size to carry the data cacheline size information, so that the relocate_kernel C routine can be implemented simpler. The cache size info will be used in the next patch Signed-off-by: Pingfan Liu Cc: Catalin Marinas Cc: Will Deacon Cc: Ard Biesheuvel Cc: Kees Cook Cc: Mark Rutland Cc: Pasha Tatashin To: linux-arm-kernel@lists.infradead.org --- arch/arm64/include/asm/kexec.h | 1 + arch/arm64/kernel/machine_kexec.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 9ac9572a3bbe..882d00786f92 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -116,6 +116,7 @@ struct kimage_arch { phys_addr_t zero_page; unsigned long phys_offset; unsigned long t0sz; + unsigned long d_size; }; #ifdef CONFIG_KEXEC_FILE diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index de4e9e0ad682..b4ae24dcac8c 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -146,6 +146,9 @@ int machine_kexec_post_load(struct kimage *kimage) if (rc) return rc; kimage->arch.phys_offset = virt_to_phys(kimage) - (long)kimage; + kimage->arch.d_size = 4 << cpuid_feature_extract_unsigned_field( + arm64_ftr_reg_ctrel0.sys_val, + CTR_EL0_DminLine_SHIFT); /* Flush the reloc_code in preparation for its execution. */ dcache_clean_inval_poc((unsigned long)reloc_code,