From patchwork Tue Jul 16 04:56:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 169026 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp325895ilk; Mon, 15 Jul 2019 21:57:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6wx5Bke2r8/lixIjv4JtOIfbN0VNyN0in2awdc7lRV84mnpFDUjFoWXf7/8mbiWS3Shj2 X-Received: by 2002:a50:f70c:: with SMTP id g12mr27542257edn.139.1563253021271; Mon, 15 Jul 2019 21:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563253021; cv=none; d=google.com; s=arc-20160816; b=lcteIIsZyLyXkeACfw2bVpfs1jhy54yvS4A69AKaWjKZ/DUTDcUvjBWFHYmRsM3kbX 8lY4jJ83gxGyqUrlhMJZZHS0umjfDhWlnpcoXBkFH5Sr+QKijHLUtuk2WkbMrt5y5d3N ThjCzCla+X/0R4G8XUJr64O+/F+R2XWht8b73NZB+C/Ozs1mmZZpCeLD37MUv0KaHpQa LLnazbVfgIegkb6UGCHVQNfY5M6OIFjiDpNTAIK/HvRmUSs42ADeCdRqr1pzsq00vqCX oEWO6KdLZ5F02jz7j9+4DsJ2BjAdK3OttH6/MtgnofrBb8Vh/UQwosh+4JlYY8ozlkjY Fltg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature; bh=84EdYxFDMFqQ8NYPswNkXpi54sRKOo94ARjpEEadd+w=; b=bgZ8XaurBVMVKdk7LoKrd3NQRd8Eb2wHbI4ew5ShoL3+DHJgCjlJvoZnOGBn63PpFI FqVqhfGgcvVsYzpk27+1BFM513mTvlmQhWud+4aaiO8y3s7iYVPWjJmx8QNsplsjBnp8 L0QnsXEQHN1vWve55hD9QirscQgCxiAr4Eg9cab4l0i+eQoE5swS5i+g6CVz/TkZ8aJk 8tGMQaqD+WmPmMjg2Nbv6oRjaGn0GQXn2f2InBjh1v6WsBC7E38akkiesiUePEV8eAPM pvey69GMCuMVN5dDFwypig547F5PVZsozgXa7HEK/ibvBRmg9PURf7Gydmeqbcrbavl4 pxmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="mWnCoy/j"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q10si10549147ejn.365.2019.07.15.21.57.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Jul 2019 21:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="mWnCoy/j"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:45332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnFWO-0003ms-6z for patch@linaro.org; Tue, 16 Jul 2019 00:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39208) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnFWG-0003j3-HR for qemu-devel@nongnu.org; Tue, 16 Jul 2019 00:56:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnFWE-0005wZ-HD for qemu-devel@nongnu.org; Tue, 16 Jul 2019 00:56:52 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:40606) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hnFWA-0005jT-Tp; Tue, 16 Jul 2019 00:56:47 -0400 Received: by mail-pg1-x544.google.com with SMTP id w10so8790358pgj.7; Mon, 15 Jul 2019 21:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=84EdYxFDMFqQ8NYPswNkXpi54sRKOo94ARjpEEadd+w=; b=mWnCoy/jcaqKDU/GC3iglKAt5tKeZuyLuU+wzOGz1RuSTiw3PJDKZ4tmAqY544PKNf bvyTelgxSyEwYQdeLKiTdjhoLNMGhpgt8xQ1VY0LWcK4EWAFsZ1HkdK2BJywSSZ5V1/H rO/HPQzu30DR2pPn34lPoSibOSlar42BDJhvAvQvMMAx+w3tHDis6KZgPKUXa6u39oHR /KQcjKRM+ECAQPsLsRhvizIwK6L3dvZV9/9YmNHp1zOJVkw16hdiwKckCZU32Hh8Bb6O lkqFlh8qjirBJ1nqvUDqOxaI8Gksp6gOisrroxTZJyWuMa8OFZDuUV1V4AOhKFYfKPXl ywfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=84EdYxFDMFqQ8NYPswNkXpi54sRKOo94ARjpEEadd+w=; b=LLi5arvFAoo+XEAki9kH0pxtCrME+9IxL53c6+Z5R0QtRfTxDMp33Y/oNHdgz60DgZ JtHAUVUviJYAi5bei5P/S+LtFY9c3PGofea4H5FKJR4kLirO+PsTI2Hg1YCGEbM8gp1V 5ajD0LA6OwDccpqhfL4TaHi4gYFX7Fd5vi5l09L4KrnBcghG97IYdmLDcvIqhKIFHZXA lOWgXQOjQMoBB2mbu8SUsrHj3rX0lKMWuoUZEp1SiezJWwSxowxWV1BhLt81XmS1Gr33 43frtliLcNe9OqbWWcx0qVGdff6CEXR52JuAVwy9EXTMIWaBBtK91Pr7f7+7X1AMYBkm gOQg== X-Gm-Message-State: APjAAAUt5ZLoc6QHm0xVcE4i0PpAU5OjYDg0XTjkBM8dD1p/K4PUC8yX xs7sBoKAAw103dexJOMxrwM= X-Received: by 2002:a17:90a:7d04:: with SMTP id g4mr33890745pjl.41.1563253002902; Mon, 15 Jul 2019 21:56:42 -0700 (PDT) Received: from voyager.ibm.com ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id o14sm39201167pfh.153.2019.07.15.21.56.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 15 Jul 2019 21:56:42 -0700 (PDT) From: Joel Stanley To: =?utf-8?q?C=C3=A9dric_Le_Goater?= , David Gibson Date: Tue, 16 Jul 2019 14:26:33 +0930 Message-Id: <20190716045633.15319-1-joel@jms.id.au> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH] ppc/pnv: Warn when using -initrd and low ram X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When booting with the default amount of RAM the powernv machine will load the initrd above the top of RAM and cause the Linux kernel to crash when it attempts to access the initrd: Linux/PowerPC load: Finalizing device tree... flat tree at 0x202770c0 [ 0.070476] nvram: Failed to find or create lnx,oops-log partition, err -28 [ 0.073270] nvram: Failed to initialize oops partition! [ 0.156302] BUG: Unable to handle kernel data access at 0xc000000060000000 [ 0.158009] Faulting instruction address: 0xc000000001002e5c cpu 0x0: Vector: 300 (Data Access) at [c00000003d1e3870] pc: c000000001002e5c: unpack_to_rootfs+0xdc/0x2f0 lr: c000000001002df4: unpack_to_rootfs+0x74/0x2f0 sp: c00000003d1e3b00 msr: 9000000002009033 dar: c000000060000000 dsisr: 40000000 current = 0xc00000003d1c0000 paca = 0xc000000001320000 irqmask: 0x03 irq_happened: 0x01 pid = 1, comm = swapper/0 Linux version 5.2.0-10292-g040e2e618374 (joel@voyager) (gcc version 8.3.0 (Debian 8.3.0-2)) #1 SMP Tue Jul 16 13:50:32 ACST 2019 enter ? for help [c00000003d1e3bb0] c000000001003c90 populate_rootfs+0x84/0x1dc [c00000003d1e3c40] c00000000000f494 do_one_initcall+0x88/0x1d0 [c00000003d1e3d10] c000000001000fc4 kernel_init_freeable+0x24c/0x250 [c00000003d1e3db0] c00000000000f7a0 kernel_init+0x1c/0x150 [c00000003d1e3e20] c00000000000b8a4 ret_from_kernel_thread+0x5c/0x78 Provide a helpful message for users so they don't go reporting bugs to kernel developers. Signed-off-by: Joel Stanley --- We could solve this in other ways, such as warn when loading the initrd outside of RAM, or load it within the known boundaries or RAM, but after hitting this myself I wanted to start the discussion. Signed-off-by: Joel Stanley --- hw/ppc/pnv.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.20.1 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index bd4531c82260..bbd596ab9eca 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -649,6 +649,13 @@ static void pnv_init(MachineState *machine) /* load initrd */ if (machine->initrd_filename) { + if (machine->ram_size <= (1.5 * GiB)) { + /* INITRD_LOAD_ADDR is at 1.5GB, so we require at least that much RAM + * when specifying the initrd on the command line */ + warn_report("initrd load requires > %ld MB of RAM", + INITRD_LOAD_ADDR / MiB); + } + pnv->initrd_base = INITRD_LOAD_ADDR; pnv->initrd_size = load_image_targphys(machine->initrd_filename, pnv->initrd_base, INITRD_MAX_SIZE);