U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Simon Glass <sjg@chromium.org>, Shantur Rathore <i@shantur.com>,
	Eddie James <eajames@linux.ibm.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] usb: bootm: Drop old USB-device-removal code
Date: Tue, 30 Jul 2024 11:20:47 +0200	[thread overview]
Message-ID: <87zfpzp768.fsf@baylibre.com> (raw)
In-Reply-To: <20240726123609.57191-1-sjg@chromium.org>

Hi Simon,

Thank you for the patch.

On ven., juil. 26, 2024 at 06:36, Simon Glass <sjg@chromium.org> wrote:

> USB is stopped using driver model now, in dm_remove_devices_flags() in
> announce_and_cleanup() at the top of this file.
>
> The usb_stop() call actually unbinds devices.
>
> When a USB device is unbound, it causes any bootflows attached to it to
> be removed, via a call to bootdev_clear_bootflows() from
> bootdev_pre_unbind(). This obviously makes it impossible to boot the
> bootflow.
>
> However, when booting a bootflow that relies on USB, usb_stop() is
> called, which unbinds the device. At that point any information
> attached to the bootflow is dropped.
>
> This is quite risky since the contents of freed memory are not
> guaranteed to remain unchanged. Depending on what other options are
> done before boot, a hard-to-find bug may crop up.
>
> Drop the call to this old function.
>
> Leave the netconsole call there, since this needs conversion to
> driver model.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Suggested-by: Shantur Rathore <i@shantur.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
> The original patch was here:
> https://patchwork.ozlabs.org/project/uboot/patch/
> 20231119121144.v5.5.If206027372f73ce32480223e5626f4b944e281b7@changeid/
>
>  boot/bootm.c | 12 ------------
>  1 file changed, 12 deletions(-)
>
> diff --git a/boot/bootm.c b/boot/bootm.c
> index 376d63aafc9..480f8e6a0e6 100644
> --- a/boot/bootm.c
> +++ b/boot/bootm.c
> @@ -740,18 +740,6 @@ ulong bootm_disable_interrupts(void)
>  	eth_halt();
>  #endif
>  
> -#if defined(CONFIG_CMD_USB)
> -	/*
> -	 * turn off USB to prevent the host controller from writing to the
> -	 * SDRAM while Linux is booting. This could happen (at least for OHCI
> -	 * controller), because the HCCA (Host Controller Communication Area)
> -	 * lies within the SDRAM and the host controller writes continously to
> -	 * this area (as busmaster!). The HccaFrameNumber is for example
> -	 * updated every 1 ms within the HCCA structure in SDRAM! For more
> -	 * details see the OpenHCI specification.
> -	 */
> -	usb_stop();
> -#endif
>  	return iflag;
>  }
>  
> -- 
> 2.34.1

  reply	other threads:[~2024-07-30  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 12:36 [PATCH] usb: bootm: Drop old USB-device-removal code Simon Glass
2024-07-30  9:20 ` Mattijs Korpershoek [this message]
2024-07-31 19:38 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfpzp768.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=eajames@linux.ibm.com \
    --cc=i@shantur.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox