From patchwork Wed Oct 21 22:04:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 318882 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp2541651ilg; Wed, 21 Oct 2020 15:04:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA3K0LsxypTffanodoDy8Xt7Hiv0kzks0ydRBVKOe0vx3gcS0doWU2UfWk+NZE0bCpVFGG X-Received: by 2002:a50:fb13:: with SMTP id d19mr5193464edq.215.1603317878793; Wed, 21 Oct 2020 15:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603317878; cv=none; d=google.com; s=arc-20160816; b=Bu7xL/TxFX2J5zFjHOuCbs9+H0f3lRaY5TgdIKRggH7h/gAYONcy8ZgEJc7skz/cHL 2gzHdwwyfmpT+UdFCtW6thNCJZt9zE8NUrmwN4fljRLscLycIyu+VeCV7KbmLJpwi4Gn LUtuH4+pwxoO5rL1v69fQ0Iz3ItZ59bVsOAE/KsN8TmcLlzjRT4A8l8w/WegVZnqskVB y59xXesF/E+QrL+uK73q3qLbuccFiWFcZj3feKDm3GsgreQkKzNVRDOLn3hHSIRETRI7 gJ+9D+7FafIDLBD1MJE17j3Tz+CsCUDoYU+qK5HI2YvaPH6kJDoUmHCb7U/pBHTfwH1N a5wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=yR3UjHs3W8rgyroT0PMUnwJEyMo4rTITvlf6Ze/7niA=; b=j93d/BZ7QkLHY1R95KIshTo4ZaOnGrNjRWtiPhEjl1zzBXis6SD33ICYtPjpS/iwRe flkHWpJHnf265gZyPvhc5n7Fago7VjcrbPGHY6eEDmfOZHyrYNH1Uj1B5fh8r/wdBfyM plyYO8b02hMWbgnxeuARVi7JPKbCVYY7NQJgq5C+pc06leic8fJLbm0K4Nfatfcs2p8p WB1nNjs5Kd6Ry2MqTfwOME5sjBKpQsnARzhkISk0KQhlciizCSsSTSkBy/Lu1wyFaWcA 9wK30jOMs9nkluDN9IlRwtv9Fs/n0bIz3YEly28SyH0ScPrPRJnvt/fsCn72vxmFgi4i VbxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NKqFlo7x; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id q9si2367717edn.539.2020.10.21.15.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NKqFlo7x; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01167823E5; Thu, 22 Oct 2020 00:04:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="NKqFlo7x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B4D182424; Thu, 22 Oct 2020 00:04:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 4ED67806C5 for ; Thu, 22 Oct 2020 00:04:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x52f.google.com with SMTP id dg9so4066760edb.12 for ; Wed, 21 Oct 2020 15:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yR3UjHs3W8rgyroT0PMUnwJEyMo4rTITvlf6Ze/7niA=; b=NKqFlo7xFnkqAYmM9wN0nxu2/hQgTr0Fd9ueJozIiItRnze/NPxVPI5wTjNJFevspz yDzH5MFpsEzWHtU0K9sndPJOfYoRwcEgCy6RDFQJqG7+ZXXLkSlGckI+Wsm4eLf+jOMp +FGSxdeiBxcxTxNYIKiZdEkYZtruaQkk1flSLW6WaoE82ZRVUmG8Sl1V4vsFr/oQ8QCL IFX4qZFMnhS2elTJhxtGJVz++KxM9HM5u7kGGhyknZerJxmisx3v5xU87elCkPI6E5rl OF9J53IC6kCgRb9on5kTHF/kpb8MxDsaxhuZxDV6ih1elbWplIlp9S+Z9RsqObjwkJIl FmpA== 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:mime-version :content-transfer-encoding; bh=yR3UjHs3W8rgyroT0PMUnwJEyMo4rTITvlf6Ze/7niA=; b=mb1B9CHlqj29rb4/gzumjiES7+IxW4z+Iid6kPWpcCfzxXhqJpKHNuFhK+5y/0WJlc 8ha9r3S/K5tQGuH/kX3vx0A00xm6lhMB5l8qVrbMPGKyfiaoyrathLr2fXHR4lmrGa69 RHO+ISzeVIwdxyB9IuL/7bEw4B5ATWKTsDt22B3fd+myrk28k9fSW6JszgPJKrVujpyW ziSpMnU8nHUsH92o3cABZkfk5M+f/XdfiYtajNg0AmMxkNeCahQ32dxqph+Xys2cPehg qLY0QHuz3X5HcG8DVnQCMKyXV9TOJQYU/00tYQL7Tp8xpgW4kYSKlhw29Cy3ncElE5dl qWEA== X-Gm-Message-State: AOAM531WS0bMQsPWx7y0ogJfNbof4WjONUNbLbUozV0puqYsKg5fSFAN wUT0684xafQ6xcwKL9a2nGolZcvKtlGK0Q== X-Received: by 2002:aa7:c3cf:: with SMTP id l15mr5195669edr.314.1603317865475; Wed, 21 Oct 2020 15:04:25 -0700 (PDT) Received: from apalos.home ([2a02:587:4615:c071:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id g3sm2586663eds.56.2020.10.21.15.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:04:24 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, xypron.glpk@gmx.de Cc: agraf@csgraf.de, Ilias Apalodimas Subject: [PATCH 1/2 v2] efi_loader: Sort header file ordering Date: Thu, 22 Oct 2020 01:04:20 +0300 Message-Id: <20201021220421.1926180-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Order header files according to https://www.denx.de/wiki/U-Boot/CodingStyle Signed-off-by: Ilias Apalodimas Suggested-by: Heinrich Schuchardt --- lib/efi_loader/efi_boottime.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.28.0 Reviewed-by: Heinrich Schuchardt diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index bf78176217c6..2896c3ea5aa8 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -6,18 +6,17 @@ */ #include +#include #include #include #include #include #include -#include -#include -#include -#include #include +#include #include #include +#include DECLARE_GLOBAL_DATA_PTR; From patchwork Wed Oct 21 22:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 318883 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp2541878ilg; Wed, 21 Oct 2020 15:05:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1GEMPA5uywp+zj8MHZ4baTAIEONMoaq5+RZIIYQ4BZnKtMOVPn6llFLaASyOwjTJLhPpY X-Received: by 2002:a17:906:e42:: with SMTP id q2mr2267180eji.261.1603317902395; Wed, 21 Oct 2020 15:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603317902; cv=none; d=google.com; s=arc-20160816; b=DDznPPBYLwf36VITTPNTKLsBBuyM9Tlje+tDApFKGDww1qc+F7SXvypn/eyLXYIQa/ I81EIFRZHq/2JXTU4ycuMlr36ySvaP4z2xnsl9R6LiaFMWalyMUcsWaeLsKS+sc/tDhV eEbf0jBM4pfGELrW4bfV43bzNOEZGxM+Tqc1xK6tjPSK6WBgUFBkUhoIb4WLHXwUSect 1vge72C5Vx8L0VB6idTnChyy3iCLixswvKeUcscXGi1KadPdIJ46zJ+OWL8b6cP975eI fXC/GUeQz6sHhE7OPXcxzwAvec1IcLI0Ra6Y7iVgT2fhTRaheiR1Mil1m/U8WjHeZQ3b 6AsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=uu7HxEIYTR4YnHXAF0haZ8++KKLp505mc93v5AHYjOk=; b=lwcynbj3dzY8DHfThikxaDh5DjerlnrVxpFhUWYumdASdshisC+ILBYrhheH95bCR8 OHm4hYVFsEOSLQlkV32pUpgaKLfAoppG/gMX5rWbfaxWSgnJ/atywJ2whD1m9wGuzwm8 l+KTtQE6eTNewCpIm35d6NNdYzTRqfohQjt5L1FWdT9sktyhtijD0ZXWWHPo/fNxwU0V qDhlcmWwaT9rYXPFsY9gRRYljBe8azl3yr4huJV7WPG8MGpb4KMOlc4gO/NtKKaRlsKX A8xt3n0HmCqdENaCK+O3TvGa58zJg5LB9Le4hH7dwQ2PfK/sGsW7updl49xKJwaVTg8c veiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F/o8ZktM"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id t27si2144164edt.158.2020.10.21.15.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:05:02 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F/o8ZktM"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 895A78243D; Thu, 22 Oct 2020 00:04:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="F/o8ZktM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20A4A82435; Thu, 22 Oct 2020 00:04:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,T_SPF_HELO_TEMPERROR,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (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 C1551823DD for ; Thu, 22 Oct 2020 00:04:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ed1-x542.google.com with SMTP id l16so4126763eds.3 for ; Wed, 21 Oct 2020 15:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uu7HxEIYTR4YnHXAF0haZ8++KKLp505mc93v5AHYjOk=; b=F/o8ZktMS6e7Q5RzhvQ873PBHY5B9A+oK6OMrS7Sxkgce04mQkA4C8CN4L1wiNyUXz giD1vKR0epn0q7MoS1Bxn7Ax04whqyjhGd3M9KBLgIm7QWEghqesy7KCpcLbsB0MOmtS 0nbzbIePR2VW+N6goTzHi5SK1C5KJJ61bYtVFESngZZGbpkTyk8Pshk4/WkwYy2cksOp 0m0MTRjKs7Te7RzKRMLXCRreHR1i7lZV+75+LqxyiO3sHHcrHsqHUfyEJTspqqcNS+Hv UIoC1JjOSc8nsaKkoT4Z2f9KaHzP5j5SnSOFK1aczGliTWlejMYMCqdCTtFijmpXWSWH 6Bow== 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:mime-version:content-transfer-encoding; bh=uu7HxEIYTR4YnHXAF0haZ8++KKLp505mc93v5AHYjOk=; b=o7OnNSuCrdIs2KBb5/dfh4V87uPm7qYjlkTLt7hLbSGayA9uif6uqPpwAclDZOI76y VGqsKqe8mUcEVqE8xrTGJjr5/yURO4C9uTgeu29/gnvzTRiohYDRmRm+W1MSRDVfL25z h/vaZC6yQdUU5TbU12ezPRWqdRWY6OmhLiEoBvYdoQv+kdcYO2M21MRY04SKVKF/M9SH r2R7VnIPLHbdn9hX/7avrP2Tvwx+9hDauoR3fLc5gwqCZjZk+HXkQ76cJrTGewsNDq0C 9XmBK6teQ8qhCcwRDifCoXEhskZqHAQxviWVEFDd0Jy/1fgS+WE7l5fkvLoKuuFNlmyt w0ig== X-Gm-Message-State: AOAM5305pUKU2xnstJHYgPtlRC24/tvNqi+9o+xILgJ+IcxGyRasva9f sOU665OwrMA/NhW+1dLCZiEdyd6h/W2qsg== X-Received: by 2002:a50:ab86:: with SMTP id u6mr5149735edc.158.1603317868087; Wed, 21 Oct 2020 15:04:28 -0700 (PDT) Received: from apalos.home ([2a02:587:4615:c071:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id g3sm2586663eds.56.2020.10.21.15.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:04:27 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de, xypron.glpk@gmx.de Cc: agraf@csgraf.de, Ilias Apalodimas Subject: [PATCH 2/2 v2] efi_loader: Disable devices before handing over control Date: Thu, 22 Oct 2020 01:04:21 +0300 Message-Id: <20201021220421.1926180-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021220421.1926180-1-ilias.apalodimas@linaro.org> References: <20201021220421.1926180-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean U-Boot Driver Model is supposed to remove devices with either DM_REMOVE_ACTIVE_DMA or DM_REMOVE_OS_PREPARE flags set, before exiting. Our bootm command does that by explicitly calling calling "dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);" and we also disable any USB devices. The EFI equivalent is doing none of those at the moment. As a result probing an fTPM driver now renders it unusable in Linux. During our (*probe) callback we open a session with OP-TEE, which is supposed to close with our (*remove) callback. Since the (*remove) is never called, once we boot into Linux and try to probe the device again we are getting a busy error response. Moreover all uclass (*preremove) functions won't run. So let's fix this by mimicking what bootm does and disconnect devices when efi_exit_boot_services() is called. Signed-off-by: Ilias Apalodimas --- changes since v1: - Add a patch sorting the .h files inclusions - Fix compilation errors for sandbox_spl_defconfig - TravisCI: https://travis-ci.com/github/apalos/u-boot/builds/191447335 lib/efi_loader/efi_boottime.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.28.0 Reviewed-by: Heinrich Schuchardt diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 2896c3ea5aa8..b26ac9fbfc79 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -15,6 +17,7 @@ #include #include #include +#include #include #include @@ -1993,7 +1996,10 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, list_del(&evt->link); } + if IS_ENABLED(CONFIG_USB_DEVICE) + udc_disconnect(); board_quiesce_devices(); + dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL); /* Patch out unsupported runtime function */ efi_runtime_detach();