From patchwork Tue Feb 4 20:09:34 2025 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: 861845 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:11cb:b0:385:e875:8a9e with SMTP id i11csp490414wrx; Tue, 4 Feb 2025 12:12:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXkBeE0BMyEgOHMFCavEiYz1RMwLynzp0m5zI4QTExeL6ug4rf2pmuy7uyu9c0369w/t4S3bw==@linaro.org X-Google-Smtp-Source: AGHT+IEVBKcJfD2V56uiBtRxSV2FSHdjO6tQXJU36IPOiUokp/Zsh44iA7FfmZ6+MtNzh3UC772T X-Received: by 2002:a05:6214:4985:b0:6d8:8874:212a with SMTP id 6a1803df08f44-6e42fbde01emr1502766d6.17.1738699933059; Tue, 04 Feb 2025 12:12:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738699933; cv=none; d=google.com; s=arc-20240605; b=GkhQqDSGXO0rXtZb6s8y+ZaZ+TeeDUyMzx/xT+a9jlhBgj0i8jIV7s7kEqBfd8RYEa TQ9Kc1culg98sW8l+Qa35DTyEz5uvl1e/iVN5gQuHun4YwdZHWtSXH8OG8Hbgkp0sg3w NsUED7CNoZhctbAMKdDnJYZz7MC9N7dbEm7VbJxy+6n4DZIex70oRq7if78i6VwKG8uQ c+xcUKpeSkOVblilicS7SmmhBjC0493NF1Fj46SV59eD4IPA5jsZiUb6jT+RbNiY+p8L t4tmJhxTDOY/4GPiXMa6iFbB4tRQxx0KkrM/Sns4OA73LgkuP93DYrHtbI2mXL0EGY9i O4Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PhmA/maE+T+RrjSr6dpY30qil8BVZDc6N3XpaacESEk=; fh=MIRbudH41Un4YFW6NixOpRsaPhvTWB9E1+aH1Rbw9sY=; b=PQhmt9+d5XWFJ559BC3nxUHmK7aRdZzrXE8ToG6qYvQNZ77j6+cJBXqlmOKJRECIQJ +/odHe4THj7Jfa6LPALyJqPu98YRl1Oo//ZUZ0bOMMjL68XV3VjLRfOjS68fTNpAv2HI IFQvOtNqC2PSfz78/U1khQCtmHRpRux8uR+sdBB/4rOalaEBweNQyCbY9TyosPl8zHBH YI8MslLbmnSFxkLdRT7exfLEIhmp7DtiiwAFseOOIuns4FrIeSCaRrohBOo7I60KDdwk LAVBVydxdO9O5U5xFUxq0r/3LBJQJU3FjO752HCdkZ6jwcgPE2V0HSNJ1N+2/VGBPRJA xUNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XUNnyHcL; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e422813ba7si25767086d6.484.2025.02.04.12.12.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Feb 2025 12:12:13 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=XUNnyHcL; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tfPFY-0001Mr-6b; Tue, 04 Feb 2025 15:10:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tfPFS-0001Fv-Sf for qemu-devel@nongnu.org; Tue, 04 Feb 2025 15:10:18 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tfPFP-0006hO-Po for qemu-devel@nongnu.org; Tue, 04 Feb 2025 15:10:18 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4361815b96cso42161925e9.1 for ; Tue, 04 Feb 2025 12:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738699811; x=1739304611; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PhmA/maE+T+RrjSr6dpY30qil8BVZDc6N3XpaacESEk=; b=XUNnyHcLRkC15Z8nlDkP68umo1S+C9vJQMmUkyBaYFcBkRg01UHLmdT1siQWh2hSQl 5HcVkjzrKGS/RnagCl6qaEa5XY1coXb3zgm5UuAe8DKIPiJZ2QEkKZ8iIZnpqDkto9mB 6K+OYNTUCGorTtNoLgHcvTBu2fkP+BVIyKxFtklP7SgwADd9cGyySGesFwDofdzZ/KUd QjNnOA++6wqjyEUqV77jonv5AR17ZBLB4b2vhDZ+Co2fgWcFFOeuZYlZmgFNbGMI7wlr yxOK4+GZpM4CFQDqNToLifqisM7nbE26IO4O8HwIIUss+6f5k/YYGLcyoc6szHNPMcyG yQSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738699811; x=1739304611; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PhmA/maE+T+RrjSr6dpY30qil8BVZDc6N3XpaacESEk=; b=GZFqmNvEfSg6oYFxlLOpa7u5Z3VKVbs2sl1y7y7oAPtbw4iVHMGHrFhveV6egmkdBh ex6HoI+hqXr+wqPiIita/P3Kcux35zWcnqXFJEZnQinjA669mE2B8zHwW9Zp/ELMsMx2 MVFpXylH4fUYw5pFOyBkqoGCFS2iTA5PddWlae7Lm8LLq9mNShsTYnV4DPH+e7pnFv+x Pqc/ssTG+fB5lRtg4cEfhiENujuRM663g6tNGWmw5aucGtVmIF38ewQU9KOGHyeLcmJs UU8ZG3/P/Mo22Sy6IBbGsbQVWD4ahElFr8qPAZM6DANH7zo/JFo2+fq7q5uO6IOTKQUc /q9g== X-Gm-Message-State: AOJu0YwVF76clBrYU535IedmWeD3zOWa6XlBK+uwMA0+BPcLRRqMVGMy AmXypuqnMsC3C3HUaiJk6XRJi8xQRF3MCRQPAAgqMiuulO5VeeiisZw4jf6uQFjfN3FRB5WpTD9 2mGU= X-Gm-Gg: ASbGnctmvjUuj4F3rJ1tBM87wgx9eCT8/1GkAyt5yJknNM16U68/AaYVCM1s7jeVy+u 4Oj+IHlgi58v++OCRIK7Cypdf6uakdri6BO/9+AlwCrQc084GSxaN+9S1+uonHc9jpB4iVmp1B6 0KN7iexCCU5d8z814KotmmsLVoRrL9HJYnJwYFhAzMF7hYIO7IX/ejLPTuZmxcG+TwOVBei2Qoc xLgwfWsYAiPQrmEy/5fbemMNgn/qgbp8b8XtjOWGPRoH9LuJ32A1enn3L2PuaOrEYmLJFSIJGca 9q9fzI08fdfhbWcblFY3qObRr39zCfFb8Mag9YPoYe2tetNVU4WJzJyeUiYQpazlDA== X-Received: by 2002:a05:600c:5112:b0:436:fb02:e68 with SMTP id 5b1f17b1804b1-4390d42f7c5mr67025e9.2.1738699811044; Tue, 04 Feb 2025 12:10:11 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38da59470b2sm3255118f8f.40.2025.02.04.12.10.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Feb 2025 12:10:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH v4 7/7] hw/boards: Ensure machine setting auto_create_sdcard expose a SD Bus Date: Tue, 4 Feb 2025 21:09:34 +0100 Message-ID: <20250204200934.65279-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250204200934.65279-1-philmd@linaro.org> References: <20250204200934.65279-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Using the auto_create_sdcard feature without SD Bus is irrelevant. Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé --- system/vl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/system/vl.c b/system/vl.c index 5ff461ea4ca..a904687b57c 100644 --- a/system/vl.c +++ b/system/vl.c @@ -53,6 +53,7 @@ #include "hw/usb.h" #include "hw/isa/isa.h" #include "hw/scsi/scsi.h" +#include "hw/sd/sd.h" #include "hw/display/vga.h" #include "hw/firmware/smbios.h" #include "hw/acpi/acpi.h" @@ -2661,12 +2662,27 @@ static void qemu_init_displays(void) static void qemu_init_board(void) { + MachineClass *machine_class = MACHINE_GET_CLASS(current_machine); + /* process plugin before CPUs are created, but once -smp has been parsed */ qemu_plugin_load_list(&plugin_list, &error_fatal); /* From here on we enter MACHINE_PHASE_INITIALIZED. */ machine_run_board_init(current_machine, mem_path, &error_fatal); + if (machine_class->auto_create_sdcard) { + bool ambigous; + + /* Ensure there is a SD bus available to create SD card on */ + Object *obj = object_resolve_path_type("", TYPE_SD_BUS, &ambigous); + if (!obj && !ambigous) { + fprintf(stderr, "Can not create sd-card on '%s' machine" + " because it lacks a sd-bus\n", + machine_class->name); + abort(); + } + } + drive_check_orphaned(); realtime_init();