From patchwork Wed May 25 11:23:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 12861056 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 41E8CC433EF for ; Wed, 25 May 2022 11:28:35 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wdQ8BpxRUSBR1EV30NXi6Q/Anx+ddYiRBvvMRAoZgl8=; b=Sx35ckdWbm7HX6 sCKBVDPA07sKde2+qk9Q+qt6cigNnIJIrqVR2SQ4IDEXq445fVox0T0/x/pvfP75Ub7LLnQO+8Ycf bebFpTkeSqJSUXVTsRCtWG8eAAkGgRD3rnNM6zyNE1Z5N70BhjO2eEVLu5eqcjWsHcRqYr6ZXcWxZ SZW1jIgRk1z6URCwsXla7E5nlDgPUxZ7PmYCfqS0RG7A3AzhvrHIM8E8THnqPUj92ezmnwaSqB94V upKw3UY4Cm+ChkaWENqWfuQuudEyZepj6hoX5qi/zLZzvZNg57LIo/kX9lZ52rZFkw9Z3tEg+1Gxa yohyeeIhAi4sXs3cGfRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntpAe-00AuVY-Ry; Wed, 25 May 2022 11:27:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntp7S-00At6D-Mg for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 11:24:12 +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 8A04A1042; Wed, 25 May 2022 04:24:01 -0700 (PDT) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C28E43F70D; Wed, 25 May 2022 04:23:59 -0700 (PDT) From: Alexandru Elisei To: will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org, suzuki.poulose@arm.com, julien@xen.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, james.morse@arm.com, andre.przywara@arm.com Subject: [PATCH v3 kvmtool 12/13] Introduce kvm__arch_default_ram_address() Date: Wed, 25 May 2022 12:23:44 +0100 Message-Id: <20220525112345.121321-13-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525112345.121321-1-alexandru.elisei@arm.com> References: <20220525112345.121321-1-alexandru.elisei@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_042402_875635_740C3A6E X-CRM114-Status: GOOD ( 10.88 ) 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 Add a new function, kvm__arch_default_ram_address(), which returns the default address for guest RAM for each architecture. Signed-off-by: Alexandru Elisei Reviewed-by: Andre Przywara --- arm/aarch32/kvm.c | 5 +++++ arm/aarch64/kvm.c | 5 +++++ include/kvm/kvm.h | 1 + mips/kvm.c | 5 +++++ powerpc/kvm.c | 5 +++++ riscv/kvm.c | 5 +++++ x86/kvm.c | 5 +++++ 7 files changed, 31 insertions(+) diff --git a/arm/aarch32/kvm.c b/arm/aarch32/kvm.c index 9d68d7a15ee2..768a56bbb5b4 100644 --- a/arm/aarch32/kvm.c +++ b/arm/aarch32/kvm.c @@ -7,3 +7,8 @@ void kvm__arch_validate_cfg(struct kvm *kvm) kvm->cfg.ram_size, ARM_LOMAP_MAX_MEMORY); } } + +u64 kvm__arch_default_ram_address(void) +{ + return ARM_MEMORY_AREA; +} diff --git a/arm/aarch64/kvm.c b/arm/aarch64/kvm.c index 2134528bf7f2..357936844046 100644 --- a/arm/aarch64/kvm.c +++ b/arm/aarch64/kvm.c @@ -46,6 +46,11 @@ void kvm__arch_validate_cfg(struct kvm *kvm) } } +u64 kvm__arch_default_ram_address(void) +{ + return ARM_MEMORY_AREA; +} + /* * Return the TEXT_OFFSET value that the guest kernel expects. Note * that pre-3.17 kernels expose this value using the native endianness diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 640b76c095f9..360430b78b1e 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -190,6 +190,7 @@ void kvm__remove_socket(const char *name); void kvm__arch_validate_cfg(struct kvm *kvm); void kvm__arch_set_cmdline(char *cmdline, bool video); void kvm__arch_init(struct kvm *kvm); +u64 kvm__arch_default_ram_address(void); void kvm__arch_delete_ram(struct kvm *kvm); int kvm__arch_setup_firmware(struct kvm *kvm); int kvm__arch_free_firmware(struct kvm *kvm); diff --git a/mips/kvm.c b/mips/kvm.c index d8610cf81b94..4cbc9907731b 100644 --- a/mips/kvm.c +++ b/mips/kvm.c @@ -12,6 +12,11 @@ struct kvm_ext kvm_req_ext[] = { { 0, 0 } }; +u64 kvm__arch_default_ram_address(void) +{ + return 0; +} + void kvm__arch_validate_cfg(struct kvm *kvm) { } diff --git a/powerpc/kvm.c b/powerpc/kvm.c index d281b070fd0e..7b0d0669aff4 100644 --- a/powerpc/kvm.c +++ b/powerpc/kvm.c @@ -48,6 +48,11 @@ struct kvm_ext kvm_req_ext[] = { { 0, 0 } }; +u64 kvm__arch_default_ram_address(void) +{ + return 0; +} + void kvm__arch_validate_cfg(struct kvm *kvm) { } diff --git a/riscv/kvm.c b/riscv/kvm.c index c46660772aa0..4d6f5cb57ac8 100644 --- a/riscv/kvm.c +++ b/riscv/kvm.c @@ -13,6 +13,11 @@ struct kvm_ext kvm_req_ext[] = { { 0, 0 }, }; +u64 kvm__arch_default_ram_address(void) +{ + return RISCV_RAM; +} + void kvm__arch_validate_cfg(struct kvm *kvm) { } diff --git a/x86/kvm.c b/x86/kvm.c index 24b0305a1841..328fa7500596 100644 --- a/x86/kvm.c +++ b/x86/kvm.c @@ -35,6 +35,11 @@ struct kvm_ext kvm_req_ext[] = { { 0, 0 } }; +u64 kvm__arch_default_ram_address(void) +{ + return 0; +} + void kvm__arch_validate_cfg(struct kvm *kvm) { }