From mboxrd@z Thu Jan 1 00:00:00 1970 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 82320C433F5 for ; Tue, 15 Mar 2022 05:02:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C6834839AA; Tue, 15 Mar 2022 06:02:18 +0100 (CET) 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="duw7OAwL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C66A580F68; Tue, 15 Mar 2022 06:02:16 +0100 (CET) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (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 E080D80F68 for ; Tue, 15 Mar 2022 06:02:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x1032.google.com with SMTP id 15-20020a17090a098f00b001bef0376d5cso1380561pjo.5 for ; Mon, 14 Mar 2022 22:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=wRiAALgtSKEMKVQ5Ia580DJLDcCseM7j1bYL3SBDEhA=; b=duw7OAwLPAUGf1ILSVj9w2j4uEcBobKXwPsm5qkYc8EW1P5br9SJhNniQjGP+tqcrl RIQg12me0GEiv5xC+UftQjpHvjFQGACawsOTTInREbklPik/RfEY7lYzNDGQS4+ZK+q4 gtr8s+o4Q50/LhJoiWfht71qBfuK0guN9exMmZHbQAiWc0fWOfHowJ7TuztrkyMIm1OS GY7xUh8k3gLZs7gIzGdgmMZ1XNsZKbhlVCOYVrFM8PdH7ZrFVh1HXXGZoJOSiubGyqtZ foslne8x4Xkg6UtwDA7+aw2PFNCevb4eCuLB/VD3IZoAQ7vbP4fSKsviACVxrJVDEgH8 kubA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=wRiAALgtSKEMKVQ5Ia580DJLDcCseM7j1bYL3SBDEhA=; b=ywmjWrLY1PrxmnLIovXgRtHIGyCMDF53pkzHGXpJ1y+9b2vcQ2l9KdwNizSM2TD62U icM5VQctGzIVczYd7+AvjTPFQ3zxDV+evT2PhWpqBPjn/rPebw02bSeIUhKMA5Fk6p8w 8+8pkRwYnWoMS2yqbN5vogV//Zw6obxdgzMWxe8c1a4gFdaofX2YwEpXGegAYqvYSFWY wC7t3xhFHE464IgEvw6t7ivywPAd4Ldjd0BCnVuilfBMDBEpUA426TCEyuY0iXxpyZMr WA2LAoJzMQcsIYWAXMTO9y2VedIIQ2Aws5vZFswjDIdetkK5+z4eCQexKdjDubpCfwr+ v/FA== X-Gm-Message-State: AOAM532r8MnFlFukZsUPFcBWcvWeoHEeMhfiFkQ7Leo5o8GwD+SwMtH6 Kl0lKamMsedju90r+1MlxK4R1Q== X-Google-Smtp-Source: ABdhPJzPrbTy/KI+CM9RnOmX0FMLe7EH4W4a7S/BZy+TL2zJscCsYI+Km/FCevUcaGPnbwgvu9lqDg== X-Received: by 2002:a17:90a:d3d0:b0:1bb:f5b3:2fbf with SMTP id d16-20020a17090ad3d000b001bbf5b32fbfmr2585455pjw.87.1647320531080; Mon, 14 Mar 2022 22:02:11 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:28bf:1cf7:e86b:214c]) by smtp.gmail.com with ESMTPSA id t71-20020a63784a000000b00380a9f7367asm19041527pgc.77.2022.03.14.22.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 22:02:10 -0700 (PDT) Date: Tue, 15 Mar 2022 14:02:05 +0900 From: AKASHI Takahiro To: Masami Hiramatsu Cc: Simon Glass , Heinrich Schuchardt , Tom Rini , U-Boot Mailing List , Patrick Delaunay , Patrice Chotard , Alexander Graf , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: Re: [PATCH] test/py: efi_capsule: Handle expected reset after capsule on disk Message-ID: <20220315050205.GA52186@laputa> Mail-Followup-To: AKASHI Takahiro , Masami Hiramatsu , Simon Glass , Heinrich Schuchardt , Tom Rini , U-Boot Mailing List , Patrick Delaunay , Patrice Chotard , Alexander Graf , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Etienne Carriere , Sughosh Ganu , Paul Liu References: <20220219011550.GB6672@laputa> <20220314010813.GA37492@laputa> <20220314024258.GC37492@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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.5 at phobos.denx.de X-Virus-Status: Clean On Tue, Mar 15, 2022 at 09:40:34AM +0900, Masami Hiramatsu wrote: > Hi Simon, > > 2022年3月15日(火) 3:24 Simon Glass : > > > > > > OK, well 'reset by a user' presumably starts the board up and then > > > > runs some code to do the update in U-Boot? Is that right? If so, we > > > > just need to trigger that update from the test. We don't need to test > > > > the actual reset, at least not with sandbox. As I said, we need to > > > > write the code so that it is easy to test. > > > > > > Actually, we already have that command, "efidebug capsule disk-update" > > > which kicks the capsule update code even without the 'reset by a > > > user'. So we can just kick this command for checking whether the > > > U-Boot UEFI code correctly find the capsule file from ESP which > > > specified by UEFI vars. > > > > > > However, the 'capsule update on-disk' feature is also expected (and > > > defined in the spec?) to run when the UEFI subsystem is initialized. > > > This behavior will not be tested if we skip the 'reset by a user'. I > > > guess Takahiro's current test case tries to check it. > > > > The 'UEFI subsystem is intialised' is a problem, actually, since if it > > were better integrated into driver model, it would not have separate > > structures or they would be present and enabled when driver model is. > > I hope that it can be fixed and Takahiro's series is a start in that > > direction. > > OK. > > > But as to a test that an update is called when UEFI starts, that seems > > like a single line of code. Sure it is nice to test it, but it is much > > more important to test the installation of the update and the > > execution of the update. I suppose another way to test that is to > > shut down the UEFI subsystem and start it up? > > Yes, currently we call do_reset() after install the capsule file. > (This reset can be avoided if we replace it with > sysreset_walk_halt(SYSRESET_COLD) as you said, right?) > > Here is how I tested it on my machine; > > > usb start > > fatload usb 0 $kernel_addr_r test.cap > > fatwrite mmc 0 $fileaddr EFI/UpdateCapsule/test.cap $filesize > > efidebug capsule disk-update > (run install process and reboot the machine) > > So, if we can avoid the last reset, we can test the below without > reset on sandbox (depends on scenarios). > - confirm that the capsule update on disk can find the capsule file > from ESP specified by the BOOTXXXX EFI variable. > - confirm that the capsule update on disk writes the firmware > correctly to the storage which specified by DFU. > - confirm that the capsule update on disk success if the capsule image > type is supported. > - confirm that the capsule update on disk fails if the capsule image > type is not supported. > - confirm that the capsule update on disk will reboot after update > even if the update is failed. > > The only spec we can not test is > - confirm that the capsule update on disk is kicked when the UEFI is > initialized. It is important to verify this feature in system test like pytest. > > > > Anyway we should design subsystems so they are easy to test. Anyway we should design systems test so that they emulate operations in real world. -Takahiro Akashi > Here I guess you mean the unit test, not system test, am I correct? > > > > > > > > > > > Masami's patch (this series) fixes issues around those two resets > > > > > in pytest. > > > > > > > > Yes and that is the problem I have, at least on sandbox. > > > > > > So If I I call sysreset_walk_halt(SYSRESET_COLD) after capsule update, > > > it could help? > > > > Yes that can help, because sandbox can detect that and turn it into a nop. > > OK, let me submit a patch to update it. > > Thank you, > > > > > Regards, > > Simon > > [..] > > > > > > > > > > > > > > > > > > > > > > You should > > > > > > > > be able to run a command to make the update happen. How does the > > > > > > > > updata actually get triggered when you reset? > > > > > > > > > > > > > > It's not the purpose of this test. > > > > > > > > > > > > Then drop the reset and design the feature with testing in mind. > > > > > > > > > > So it's just beyond of my scope. > > > > > > > > > > -Takahiro Akashi > > > > > > > > > > > Regards, > > > > > > SImon > > > > -- > Masami Hiramatsu