From patchwork Sat Oct 19 23:47:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1179918 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Y4fvp0ZV"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46wfpQ11dGz9sP6 for ; Sun, 20 Oct 2019 10:52:30 +1100 (AEDT) Received: from localhost ([::1]:42158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLyWJ-0006Dr-L2 for incoming@patchwork.ozlabs.org; Sat, 19 Oct 2019 19:52:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34642) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLyRf-0000Ps-MR for qemu-devel@nongnu.org; Sat, 19 Oct 2019 19:47:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLyRe-0005dx-En for qemu-devel@nongnu.org; Sat, 19 Oct 2019 19:47:39 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:36825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLyRe-0005d7-8r; Sat, 19 Oct 2019 19:47:38 -0400 Received: by mail-wr1-x442.google.com with SMTP id w18so9316345wrt.3; Sat, 19 Oct 2019 16:47:38 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=d2Dhv4ozB6GokdikOHsEv99K2NKwEzUmYJOH6ccwUU4=; b=Y4fvp0ZVBCGgfybaHWMB1TTb1Rjfsdk1SyLXdJt8eM8cA/pQU38fz6wp5BVjFlg5/h jvVsDVG7hxLu30aeGgKCEIaMx9rMRXa0KH/h0ithiBLNuXCrX7Md7cytwViNJEg478tX nXJi5vUl+x0EWzgxp2tyCFrnAhXgV6TqojlYoXGkU+cSHuvdPIhpeZrwWgzxTIZ5u7C9 UmUETJBKZ3P07iD7g7YwqNl+6lV41z1WllK4RDEoT5ySRW7Zq3nLFh5CYWXeL3fItA0r zSE+AWFmAnRNHqNSpPRd1cDwtNypOzGqxH+FxoiWg10/4ofsT9Ybw5I/GsU58W0ADXCu w40g== 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 :in-reply-to:references:mime-version:content-transfer-encoding; bh=d2Dhv4ozB6GokdikOHsEv99K2NKwEzUmYJOH6ccwUU4=; b=PetSwJivUhRNi3pYbV2FbbIL/eULYhQB4kqyCRk32ZECQIbNfRU9jMtYfJfU89wGuC BXHf39WcFVmyVte/7S3w5Bux9boFXCFD9xn9xxoGeGdUdjP/dmNUV7Kg2eYFRL1qOQaV 6CM0nFgpxhYMuQ7hLsiGy+tCjDTYqv8+dOoKVbXG0Hz54r2SiiBTe1HXikE07H34Z7i0 n8jic5rQt89vV0l2isfAK7Y/fWGLtmGHIC0W0G/gECNsVcUp/kSruUSAYP0CUdS8i8Uo RLP2v1lENn6rw6ya4CMNIrkx8XGavH1umCnz/fEzGeRSM9rQ29f6QMLYjnms6XnQY0FO U4kw== X-Gm-Message-State: APjAAAXERBznTH309zyBF7krXOklPyKPBikCiCtdcT76YcOe8wHJXSa6 GjGSwqiJ1BUZtBkeJvZpb/iY3X9y X-Google-Smtp-Source: APXvYqwhARONlB9dru7D5rkLvLJ+U10xdpgYyYJQjnMOqcyzF73zX2vre0cfe0bo5j8VwMr/B1MuRg== X-Received: by 2002:adf:e74c:: with SMTP id c12mr7419657wrn.133.1571528857127; Sat, 19 Oct 2019 16:47:37 -0700 (PDT) Received: from x1w.redhat.com (14.red-88-21-201.staticip.rima-tde.net. [88.21.201.14]) by smtp.gmail.com with ESMTPSA id u1sm10433763wrp.56.2019.10.19.16.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 16:47:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v3 11/16] hw/arm/raspi: Use -smp cores= option to restrict enabled cores Date: Sun, 20 Oct 2019 01:47:10 +0200 Message-Id: <20191019234715.25750-12-f4bug@amsat.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191019234715.25750-1-f4bug@amsat.org> References: <20191019234715.25750-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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: Peter Maydell , Matthias Brugger , Rob Herring , Alistair Francis , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , "Emilio G . Cota" , Clement Deschamps , qemu-arm@nongnu.org, Cleber Rosa , Laurent Bonnans , Cheng Xiang , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pekka Enberg , Pete Batard Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The abstract TYPE_BCM283X device provides a 'enabled-cpus' property to restrict the number of cores powered on reset. This because on real hardware the GPU is responsible of starting the cores and keep them spinning until the Linux kernel is ready to use them. When using the -kernel paramenter, QEMU does this by installing the 'raspi_smpboot' code when arm_boot_info::write_board_setup() is called. This is a special feature to help the Linux kernel, and can only be used with a Linux kernel. Even if loaded with the -kernel option, U-boot is not Linux, thus is not recognized as it and the raspi_smpboot code is not installed. Upon introduction of this machine in commit 1df7d1f9303, the -smp option allowd to limit the number of cores powered on reset. Unfortunately later commit 72649619341 added a check which made this feature unusable: $ qemu-system-aarch64 -M raspi3 -smp 1 qemu-system-aarch64: Invalid SMP CPUs 1. The min CPUs supported by machine 'raspi3' is 4 Fortunately, the -smp option allow various kind of CPU topology: -smp [cpus=]n[,maxcpus=cpus][,cores=cores][,threads=threads][,dies=dies][,sockets=sockets] set the number of CPUs to 'n' [default=1] maxcpus= maximum number of total cpus, including offline CPUs for hotplug, etc cores= number of CPU cores on one socket (for PC, it's on one die) threads= number of threads on one CPU core dies= number of CPU dies on one socket (for PC only) sockets= number of discrete sockets in the system Let's use the 'cores' argument to specify the number of cores powered at reset to restore this feature, and allow to boot U-boot. We can now run U-boot using: $ qemu-system-aarch64 -M raspi3 -smp 4,cores=1 ... Reported-by: Laurent Bonnans Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 569d85c11a..45d3f91f95 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -190,8 +190,8 @@ static void raspi_init(MachineState *machine, int version) /* Setup the SOC */ object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), &error_abort); - object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-cpus", - &error_abort); + object_property_set_int(OBJECT(&s->soc), machine->smp.cores, + "enabled-cpus", &error_abort); int board_rev = version == 3 ? 0xa02082 : 0xa21041; object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", &error_abort);