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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ECE45C38142 for ; Sat, 28 Jan 2023 22:03:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC98F85770; Sat, 28 Jan 2023 23:02:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BDdmEFHr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 035978574F; Sat, 28 Jan 2023 23:01:34 +0100 (CET) Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 491BE8575C for ; Sat, 28 Jan 2023 23:01:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x136.google.com with SMTP id f8so3754588ilj.5 for ; Sat, 28 Jan 2023 14:01:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=YSyu6bM3qJNIT/wgNdmE8ThZ+d6kDRaRZgia6uQu930=; b=BDdmEFHr35+VDHCX8SX6iVFVduHKB8GqAnm6vZjn4M4jCAoKQVARPJJy7jQU0ixxse ODYDU9RLAryiywyLkXYLAUPr6pCHR2I1fSSOdEIN5uKZhm+ttXX5Z5uvyTyccpFM6Hjx qwbRrkVrfNcPJvYjaNFwx8n5JW9GdQfXuagr4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=YSyu6bM3qJNIT/wgNdmE8ThZ+d6kDRaRZgia6uQu930=; b=x2wz6M8rjus0JwffoZm/MOOhgCa3l7vdY9t8ct8/MgAnYbqAs9+Qxjk+FlZFVuZNUI QuLVVHHB9Mt1bodnyIMw4mAhcxGQCIiM8AX/BemtA6Td+Cmk23T5a0fEMzaeTIWNh4F3 wgmDctMWfN5Wh0xjPgGbuIQlKrd4AklgUSACW1uTQtVGZFdDy7heSsNKFtW0ALBUb5Ft crL5u1R/8f1rkelX8dvTy5GcfIr6gVFJRQTS/vPk23G+97K1RSMOANQDDi5NL+77hFBS qZk74xCXQmA99iCbsfA1Rnph+WL4ALhssGjdVbNuW0nMyVy7jhX6jpFs+K+O3LFzYn3F w7mQ== X-Gm-Message-State: AO0yUKVd7U7V8gXmF4Vb84LhSHgi0WLS4lVv0criX2BFngrasH9vVO/T emECxk0WWwRThy/rYtjNT9NIU/CcjZM5wt+9 X-Google-Smtp-Source: AK7set+GH5o45y8ICoIbtR3MRFupHXzkuglU8kArG1yCXTdwYVxE82YlodoE4MSW27m6FB/J3CMqBA== X-Received: by 2002:a05:6e02:1bed:b0:310:b92b:704a with SMTP id y13-20020a056e021bed00b00310b92b704amr2792975ilv.8.1674943270105; Sat, 28 Jan 2023 14:01:10 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id f15-20020a056e0212af00b0030f1be2e051sm2525521ilr.39.2023.01.28.14.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 14:01:09 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Albert Aribaud , Ilias Apalodimas , Simon Glass , Bin Meng Subject: [PATCH 05/13] bootstd: Correct virtio block-device handling Date: Sat, 28 Jan 2023 15:00:20 -0700 Message-Id: <20230128220028.53575-6-sjg@chromium.org> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230128220028.53575-1-sjg@chromium.org> References: <20230128220028.53575-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean At present virtio tries to attach QEMU services to a bootdev device, which cannot work. Add a check for this. Also use bootdev_setup_sibling_blk() to create the bootdev device, since it allows the correct name to be used and bootdev_get_sibling_blk() to work as expected. The bootdev is not created on sandbox since it does have a real virtio device and it is not possible to read blocks. Signed-off-by: Simon Glass Fixes: a60f7a3e35b ("bootstd: Add a virtio bootdev") Reported-by: Ilias Apalodimas --- drivers/virtio/virtio-uclass.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index 91af412ec1d..de9bc90359c 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -247,8 +247,8 @@ static int virtio_uclass_post_probe(struct udevice *udev) } device_set_name_alloced(vdev); - if (uc_priv->device == VIRTIO_ID_BLOCK) { - ret = bootdev_setup_for_dev(udev, name); + if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) { + ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev"); if (ret) return log_msg_ret("bootdev", ret); } @@ -275,6 +275,10 @@ static int virtio_uclass_child_pre_probe(struct udevice *vdev) int i; int ret; + /* bootdevs are not virtio devices */ + if (device_get_uclass_id(vdev) == UCLASS_BOOTDEV) + return 0; + /* * Save the real virtio device (eg: virtio-net, virtio-blk) to * the transport (parent) device's uclass priv for future use. -- 2.39.1.456.gfc5497dd1b-goog