From patchwork Wed Dec 17 15:40:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 5507471 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 214A0BEEA8 for ; Wed, 17 Dec 2014 15:40:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41E7620A24 for ; Wed, 17 Dec 2014 15:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6ACFB20A26 for ; Wed, 17 Dec 2014 15:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751028AbaLQPko (ORCPT ); Wed, 17 Dec 2014 10:40:44 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:50532 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbaLQPko (ORCPT ); Wed, 17 Dec 2014 10:40:44 -0500 Received: from e106785-lin.cambridge.arm.com ([10.1.203.45]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id sBHFebwp003928; Wed, 17 Dec 2014 15:40:37 GMT From: Andre Przywara To: will.deacon@arm.com, penberg@kernel.org Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v3 1/5] kvmtool: ARM: fix initrd functionality Date: Wed, 17 Dec 2014 15:40:44 +0000 Message-Id: <1418830848-1463-2-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1418830848-1463-1-git-send-email-andre.przywara@arm.com> References: <1418830848-1463-1-git-send-email-andre.przywara@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP lkvm -i is currently broken on ARM/ARM64. We should not try to convert smaller-than-4GB addresses into 64-bit big endian and then stuff them into u32 variables if we expect to read anything other than 0 out of it. Adjust the type to u64 to write the proper address in BE format into the /chosen node (and also match the address size we formely posted) and let Linux thus read the right values. This fixes initrd functionality for ARM and ARM64 guests. Signed-off-by: Andre Przywara Acked-by: Marc Zyngier --- tools/kvm/arm/fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c index 5626931..4a33846 100644 --- a/tools/kvm/arm/fdt.c +++ b/tools/kvm/arm/fdt.c @@ -149,8 +149,8 @@ static int setup_fdt(struct kvm *kvm) /* Initrd */ if (kvm->arch.initrd_size != 0) { - u32 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start); - u32 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start + + u64 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start); + u64 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start + kvm->arch.initrd_size); _FDT(fdt_property(fdt, "linux,initrd-start",