From patchwork Mon Oct 15 09:20:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 983995 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="sn5wdCuR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42YXtx5WDLz9s7W for ; Mon, 15 Oct 2018 20:19:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7F532C21E57; Mon, 15 Oct 2018 09:18:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 03633C21E3B; Mon, 15 Oct 2018 09:16:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DC3E6C21DA1; Mon, 15 Oct 2018 09:16:41 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by lists.denx.de (Postfix) with ESMTPS id A6540C21D83 for ; Mon, 15 Oct 2018 09:16:36 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id f18-v6so8883640pgv.3 for ; Mon, 15 Oct 2018 02:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EfwDRIslbEKKIGqb50z6OU8kxjjfRJ7YJ67jbE+1TpA=; b=sn5wdCuRzYhAFBSb0bCm5PEUQo/93GO1VqK7jP5pdcy6sxlPe6vWVeZjLNrzeH3nlT 9AHblNb3dUTPKyruLAbT/cfqEtVi7ZFJL0+efP3Vh0G6OFgaL+fEk8APv6TDsaXLSJEu VhlrWuOGG9ONyHMIUeGGJFEfyx+MWYYuRri3ZbK3WPMQ4KQlkwqThlOZzsohvOb6XT7f tss62REeUH2B34KedjabuJ4BLJYqXuKrtJeWpUfI9/UlUzTjsUF3ozPQdnw8LiuRBFO7 YruKE08mKRSJj0XcpO5xH0uq3FRlVGoV6URJY5USKCoIS9s50F7wJoiXYl69MrCXNYC4 zLIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EfwDRIslbEKKIGqb50z6OU8kxjjfRJ7YJ67jbE+1TpA=; b=BKSxs6iHfIRtjVz+9otdyjI7zFYujjzl5RgM4uGyV0YK2HKUiiWhVCrBBmzcwepfTe sEYMRNIcCNCQuawanD4sDE1hGZLKtTdalcVJWKxhSP0LDrgtUm/+0CPka6IbE9NY6W4L L4T4c/yfDiE5B5BI0swzOZ6OSXoQH30lh7nvxB7bP0rglhaHKr3w1+cGiFVsPM5SaYdh LEmyLy0CnEGGpuSQ4xzd1QLIj+gsEyA+wa6xwPJnmCt7+Y8/g72c+ogBmwnjJDisVq5z rxzDBYiB4r4qAQXbM7D4TNELQidD6Y9rzE87oNLR/+5VYWivTwCbLAe7E2g1q5F1ucRo F7Fw== X-Gm-Message-State: ABuFfojJirxFbrkkZhh9pO0HUvIzcCju09RwxAjeXJnMqqHqrgrcSz7T rnA6Pffn9c8I2IjEGEqFBkI= X-Google-Smtp-Source: ACcGV63thbtAcb8vMkT28RLqWQFU/3/zal4FeZSTEi5wpVZlAn5N88cfag4iE8/J51DwlI/1Yy4PLw== X-Received: by 2002:a63:7156:: with SMTP id b22-v6mr15166913pgn.342.1539594995297; Mon, 15 Oct 2018 02:16:35 -0700 (PDT) Received: from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com. [147.11.156.139]) by smtp.gmail.com with ESMTPSA id a11-v6sm10798256pgw.54.2018.10.15.02.16.34 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 02:16:34 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Mon, 15 Oct 2018 02:20:59 -0700 Message-Id: <1539595287-31378-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1539595287-31378-1-git-send-email-bmeng.cn@gmail.com> References: <1539595287-31378-1-git-send-email-bmeng.cn@gmail.com> Subject: [U-Boot] [PATCH v3 03/31] riscv: bootm: Add dm_remove_devices_flags() call to do_bootm_linux() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This adds a call to dm_remove_devices_flags() to do_bootm_linux() so that drivers that have one of the removal flags set (e.g. DM_FLAG_ACTIVE_DMA_REMOVE) in their driver struct, may do some last-stage cleanup before the OS is started. arm and x86 already did such, and we should do the same for riscv. Signed-off-by: Bin Meng Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- Changes in v3: None Changes in v2: - new patch to add dm_remove_devices_flags() call to do_bootm_linux() for riscv bootm arch/riscv/lib/bootm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index a7a9fb9..2b5ccce 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -9,9 +9,11 @@ #include #include #include -#include #include #include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -57,6 +59,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) /* we assume that the kernel is in place */ printf("\nStarting kernel ...\n\n"); + /* + * Call remove function of all devices with a removal flag set. + * This may be useful for last-stage operations, like cancelling + * of DMA operation or releasing device internal buffers. + */ + dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); + cleanup_before_linux(); if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)