Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp822309rwd; Thu, 8 Jun 2023 08:11:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45xw/u46YakrPYAd09NL9v8y4mYYS3+n+5FG+Qt1sMMUGCPhmH1YBGy5YKX1jUR0VRfWto X-Received: by 2002:a17:90a:f297:b0:253:3975:7a37 with SMTP id fs23-20020a17090af29700b0025339757a37mr2974845pjb.9.1686237090701; Thu, 08 Jun 2023 08:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686237090; cv=none; d=google.com; s=arc-20160816; b=Jmpvcqq3+0QsbyiWILi+gN5QbGqN0UZRUXKo0rYsELbVylHfMMKsbsKAZEWEQQu7Hj ZiopxOq7Vkn69AmCE4zmAIDIQDsKTTp5ImPQgy22gvNrqEg8PKJ2Eu3uF7pr75eQqe20 SQjHwetA2H/KgFb9nI9izLgK0qoSjBMvb+ChXPjFAfc45Fn9vtmPOzHE9PJgwuC+N7eF u8qUr/HnCJ2PkRN4RK4wHACj2P4LE5KLQTK7RwHt3gIoIlz8Gql0nHn4Q4FVl+3Fea3J 1m85Xd34pqDkQtBfLDflu79KbuFUyT7poTvDPh5TeLg3mwqpTwRy3Sg6zlfSJKzyFOQI 58sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=NoR8TXua2PTViHNm+/DQG39M4TXIln5CjDEodqDpV1c=; b=w5eUINcw6S8vuORdlqLS4Az2gOgOERwJvo9oror/HDGGxbp1sWPIPjQNnzcUUFYicT W61YWm4Z72+iVX3jB4+r5bhxPtIPFR8xqMDckssYXbCTaDbXGotRLWEG6l+Kdv+cXxq3 JaFIopQE/B/0QZmo6zjQd0i5nl3CDlvZahWcv7p8XhBFoOnus39mxC08VED4HNjtNevs XkB+w0P34/ZgqpjNBC/4O65AkSxrP+ZfSH4bv9vWEh1ROX1UhGQvkIlcTD7ixXOjgHAV WTLXvTLqM83eYId64LJ9gUHdueIzPH8C6RK5N9mgLUWNag4vyFwWknfCMhNiPkCaThhd G1kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a17090a670600b002528157a968si2885921pjj.2.2023.06.08.08.11.15; Thu, 08 Jun 2023 08:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236358AbjFHOym (ORCPT + 99 others); Thu, 8 Jun 2023 10:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235886AbjFHOyl (ORCPT ); Thu, 8 Jun 2023 10:54:41 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C909F273A; Thu, 8 Jun 2023 07:54:39 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QcRyT2NYBz67SFB; Thu, 8 Jun 2023 22:52:33 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 8 Jun 2023 15:54:37 +0100 Date: Thu, 8 Jun 2023 15:54:36 +0100 From: Jonathan Cameron To: Vishal Verma CC: Alison Schofield , Ira Weiny , Dave Jiang , Ben Widawsky , Dan Williams , , , Davidlohr Bueso , Russ Weight Subject: Re: [PATCH v2 4/4] tools/testing/cxl: add firmware update emulation to CXL memdevs Message-ID: <20230608155436.00006087@Huawei.com> In-Reply-To: <20230602-vv-fw_update-v2-4-e9e5cd5adb44@intel.com> References: <20230602-vv-fw_update-v2-0-e9e5cd5adb44@intel.com> <20230602-vv-fw_update-v2-4-e9e5cd5adb44@intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500005.china.huawei.com (7.191.163.240) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 05 Jun 2023 14:20:25 -0600 Vishal Verma wrote: > Add emulation for the 'Get FW Info', 'Transfer FW', and 'Activate FW' > CXL mailbox commands to the cxl_test emulated memdevs to enable > end-to-end unit testing of a firmware update flow. For now, only > advertise an 'offline activation' capability as that is all the CXL > memdev driver currently implements. > > Add some canned values for the serial number fields, and create a > platform device sysfs knob to calculate the sha256sum of the firmware > image that was received, so a unit test can compare it with the original > file that was uploaded. > > Cc: Davidlohr Bueso > Cc: Jonathan Cameron > Cc: Russ Weight > Cc: Alison Schofield > Cc: Ira Weiny > Cc: Dave Jiang > Cc: Ben Widawsky > Cc: Dan Williams > Signed-off-by: Vishal Verma One trivial comment inline. I've somewhat lost track of the test utils, so less comfortable on reviewing them than the kernel code. With that in mind this looks good to me. Reviewed-by: Jonathan Cameron > --- > tools/testing/cxl/test/mem.c | 162 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 162 insertions(+) > > +static int mock_activate_fw(struct cxl_dev_state *cxlds, > + struct cxl_mbox_cmd *cmd) > +{ > + struct cxl_mbox_activate_fw *activate = cmd->payload_in; > + struct cxl_mockmem_data *mdata = dev_get_drvdata(cxlds->dev); > + > + if (activate->slot == 0 || activate->slot > FW_SLOTS) > + return -EINVAL; > + > + switch (activate->action) { > + case CXL_FW_ACTIVATE_ONLINE: > + mdata->fw_slot = activate->slot; > + mdata->fw_staged = 0; > + break; > + case CXL_FW_ACTIVATE_OFFLINE: > + mdata->fw_staged = activate->slot; > + break; > + default: > + return -EINVAL; > + } > + > + return 0; Might as well push the return 0 up to the cases instead of breaking out. >