From patchwork Thu Mar 28 11:56:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 13608430 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 AF981C54E64 for ; Thu, 28 Mar 2024 11:57:34 +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: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:In-Reply-To:References: List-Owner; bh=5uPlNEQvKH/KuAwvZ4NBQ0iqHw1ovKe7jeKgjXujOYY=; b=mfuHOBMMMVZkGC AaWHUwM6CFQHFs0xbL1TBXqX8hs7HATMfRjsQIcKP00kOojyrsfS+hNZLnn6oNgbzp82GcJBnXpKd 2d3O4IZTre18Y6GPT9YasAbDfrg6vTEKndDFlzKe5J74YBd5oQE6QEo9c0HQnaR8MZvM/T8BpcRzO C7/bpNCLy4ZVQoC+HHYKRIfPQTfLbmRh922nEOoUmaAh3d/i4owv4KE/X7Ah7ONE9pDObN2H0/AbQ L9zyZtYgb7jbbSApiGNbb4rG+I8qBPKzTfiePEU+huVUdd0xrH2VVE3ixrWEmPu+Lv6PbGz2AArrG 3bSYgXhn4pOxMAReAW3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpoNn-0000000Do89-2QAz; Thu, 28 Mar 2024 11:57:23 +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 1rpoNl-0000000Do7J-2FI8 for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2024 11:57:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711627039; 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; bh=Pb/XsGZm2aQBIUeRzaM3lVmiNRzN+M8eX2409yaKAss=; b=hPBTY4dFSYbdmBWe9j6NFOcDiFwfwQfMiZOniy0hRxnMk2Le3Srk6dnAFwX3AEvF2wT2fn 3uurRi+enskR42OutJNwfLuyun9G8EA22ZzUe5jGoYS1K4jiDHmkHBKJQMUgpfRpiFfdGY uc1YWL6NoJf6i6iH2/gBYVix0yRRpdk= 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-619-eyLJdqDTMXecffkfny2gqQ-1; Thu, 28 Mar 2024 07:57:14 -0400 X-MC-Unique: eyLJdqDTMXecffkfny2gqQ-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 6FC1F85179D; Thu, 28 Mar 2024 11:57:14 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id 329361C060D0; Thu, 28 Mar 2024 11:57:10 +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 0/4] arm64: kexec: translate relocate_kernel.S to C languange Date: Thu, 28 Mar 2024 19:56:50 +0800 Message-ID: <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_045721_670223_67BF9CD3 X-CRM114-Status: GOOD ( 12.23 ) 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 Translate relocate_kernel.S to C languange to make it more readable. The relocate_kernel.c is PIE, but I am not sure whether it should locate in kernel/pi, which runs check on the PIE code. (I can correct it in next version) 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 --- Pingfan Liu (4): arm64: relocate: Let __relocate_new_kernel_start align on SZ_4K arm64: mm: Provide prot param in trans_pgd_idmap_page()'s prototype arm64: kexec: Introduce d_size to carry cacheline size information arm64: kexec: Change relocate_kernel to C code arch/arm64/include/asm/kexec.h | 1 + arch/arm64/include/asm/trans_pgd.h | 2 +- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/asm-offsets.c | 10 -- arch/arm64/kernel/hibernate.c | 3 +- arch/arm64/kernel/machine_kexec.c | 16 ++- arch/arm64/kernel/relocate_kernel.S | 100 -------------- arch/arm64/kernel/relocate_kernel.c | 197 ++++++++++++++++++++++++++++ arch/arm64/kernel/vmlinux.lds.S | 3 +- arch/arm64/mm/trans_pgd.c | 4 +- 10 files changed, 218 insertions(+), 119 deletions(-) delete mode 100644 arch/arm64/kernel/relocate_kernel.S create mode 100644 arch/arm64/kernel/relocate_kernel.c