From patchwork Thu Nov 28 15:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 13888151 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 C1B0DD69115 for ; Thu, 28 Nov 2024 15:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=aG/3zTi82ryM+G7aYghs5ZU4z3cboKORjiUBk8lP6RY=; b=IM7PO0PtcgnmGmwliW3h0W7gsA AORPq8+wyscZIkP+lEq43caGkq4/Toa0Eq9VAt5GJitxHZDmBK8HWM6kjdayhgAowkR/qtADdKAvE i1h0iz9pSbo6yG4/NRi0/H7z1jfaBXzWzLIwdiT9Evqp2NWBp2jlBhCEanDcsGwmt6BWStBzhWt8k jozaToGZ5Wu5znzv0hNog86U4WLyfli5sYRiVL3kUnhnYKWMmI5JtODclZ6DpYXKbvON9FX1ZacHM oByIsz/PrqfryfZTwb6CG86B4ije6z0WUgmiQ330Z3GBbBKmPNRZWpHCM3n1cfjByl9fLuKl3ON0w C7kVwZmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGgFv-0000000Fr1H-1SPV; Thu, 28 Nov 2024 15:16:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tGgCS-0000000FqUV-27fE for linux-arm-kernel@lists.infradead.org; Thu, 28 Nov 2024 15:13:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 756E51474; Thu, 28 Nov 2024 07:13:29 -0800 (PST) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5F9E3F66E; Thu, 28 Nov 2024 07:12:57 -0800 (PST) From: Alexandru Elisei To: will@kernel.org, julien.thierry.kdev@gmail.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Cc: maz@kernel.org, oliver.upton@linux.dev, apatel@ventanamicro.com, andre.przywara@arm.com, suzuki.poulose@arm.com, s.abdollahi22@imperial.ac.uk Subject: [PATCH RESEND kvmtool 0/4] arm: Payload memory layout change Date: Thu, 28 Nov 2024 15:12:42 +0000 Message-ID: <20241128151246.10858-1-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241128_071300_587281_6774954B X-CRM114-Status: GOOD ( 12.44 ) 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 (resending because I accidently only sent the cover letter, sorry for that) The first 3 patches are fixes to kvm__arch_load_kernel_image(). I've CC'ed the riscv maintainer because it looks to me like riscv is similarly affected. Patch #4 ("arm64: Increase the payload memory region size to 512MB") might be controversial. Follows a bug report I received from Abdollahi Sina in private. Details in the commit message, but the gist of the patch is that the memory region where kernel + initrd + DTB are copied to are changed from 256MB to 512MB. As a result, the DTB and initrd are moved from below ram_start + 256MB to ram_start + 512MB to accomodate a larger initrd. If users rely on finding the DTB and initrd at the current addresses, then I'm not sure the patch is justified - after all, if someone really wants to use such a large initrd instead of a disk image with virtio, then replacing SZ_256M with SZ_512M locally doesn't look like a big ask. On the other hand, if there are no users that rely on the current payload layout, increasing the memory region size to 512MB to allow for more unusual use cases, while still maintaining compatibility with older kernels, doesn't seem unreasonable to me. Please comment, I don't feel strongly either way - I'll happy drop the last patch if there are objections. Alexandru Elisei (4): arm: Fix off-by-one errors when computing payload memory layout arm: Check return value for host_to_guest_flat() arm64: Use the kernel header image_size when loading into memory arm64: Increase the payload memory region size to 512MB arm/aarch32/include/kvm/kvm-arch.h | 5 +- arm/aarch64/include/kvm/kvm-arch.h | 7 ++- arm/aarch64/kvm.c | 88 +++++++++++++++++++++++------- arm/kvm.c | 35 +++++++++--- 4 files changed, 105 insertions(+), 30 deletions(-)