From patchwork Mon Jun 5 20:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 103484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2935704vqr; Mon, 5 Jun 2023 13:28:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40XLUvXZ1e4MxsQP+DfBl1VfRAHup91ABOlL/8o8eoC90IkCDKZJjsMdA3FAynZVon1cZS X-Received: by 2002:a05:6a00:1955:b0:65d:83d8:c3e3 with SMTP id s21-20020a056a00195500b0065d83d8c3e3mr911973pfk.32.1685996933964; Mon, 05 Jun 2023 13:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685996933; cv=none; d=google.com; s=arc-20160816; b=sQzenFsVbxihebIXmIrVn83dbkjnMLCpq1rmLgzD11heL5i6wocmCNNd05LRVVRij2 6GdRjL3zR9iXFZDWv9kTM8ESrD3V4jVCBZ5iqtv+Bg7oBuLyhc4UUIF/C/YXCg6AG+zG XZwJuus7NdRruxvRmZSc09Ip/WzxHHAI4v6o2aSvQdOJRtmWKzX2jEw0JAwpWPAp3vja CuE/ly7S8eU85/l+6/aFx3ruOHG9LBqUkeKGZQzrTFAji5n0ZwqZFrIjaYZcwJk6TO5o jmg/fB7IgNTYaxzCCcnil2iT/YQdv1YWEMZineXPlfzxCH0cvSptGlxeThhjXByzRBXL RjXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=fisRS1a/DBaAQkbo3QVfbJiKf9uTIoC+UJIQKR7tzx8=; b=WUH2qvT2f1RGVTXLNlHGOraFkvrri6GG4swYI1Sw69+H3gCVHaX0ir/fU35gpx/Gan AQpo2WUsnK965+O0aHWnaKoacj5YSQvEmFgP4C0Bf0sRoDxEXr/cfmxvi/WOty2mZvCF WnMwo3D7mtrDLchdzjCuRuJQfAsufut5pFHP+5t9T2aLRrVWZFteAx4LKZdxRmSaQCLP qB22X82iaaYs/6Ld3vk6BDg5Hr1M61nEPGj8/4dI2pHp4Vyk5cMxwqfsE6fCY7kKRxL/ GBRS3Han6Mdl7LrH3PPFIA25Y5rWGaZPS6lwR3a+v89hkREWcQXedZddmDf7dpvhoAyI RKow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kwHQBRei; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 76-20020a63004f000000b0053ef51d3fa8si5863679pga.401.2023.06.05.13.28.42; Mon, 05 Jun 2023 13:28:53 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=kwHQBRei; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233303AbjFEUVR (ORCPT + 99 others); Mon, 5 Jun 2023 16:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233223AbjFEUUz (ORCPT ); Mon, 5 Jun 2023 16:20:55 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5696CE49; Mon, 5 Jun 2023 13:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685996454; x=1717532454; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=n4j/XZl+PPPV6uJ0tCXctxrlIofbKWp/qosTAht8r6c=; b=kwHQBReiUL+Wr9yQ2+xfZvYAw9INB6qzi33aK9ylRJGkbdMQYIzMbHBL v7jETbkckZKW9I7mmJHawcO1tbRp/mQC6acwFMaCvZFjgryDi4Znsua1V s5m7TnWR4lKrhl7K0Z494E7lOlVUcCVdfvz1dulR/yGsMdeq9le6f9AYl 59GQimojyqm1zqWRBriIywYHYIe9GVQNCqtyD7eqxPDDE1qtTSc2HkMhm U4bE15wNSsQNhAO3GtquLEEbfhHt0eGuF6U4KBQuKpbBHZcj1fNyD9M8s VWpZMqcxekiD9QvtC6ISlx4LthSg/v2N/SZ4PONdW1n0ObngDBRyg/ThA A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="336093134" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="336093134" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 13:20:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="832934195" X-IronPort-AV: E=Sophos;i="6.00,218,1681196400"; d="scan'208";a="832934195" Received: from kmsalzbe-mobl1.amr.corp.intel.com (HELO [192.168.1.200]) ([10.209.52.9]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 13:20:51 -0700 From: Vishal Verma Date: Mon, 05 Jun 2023 14:20:24 -0600 Subject: [PATCH v2 3/4] tools/testing/cxl: Use named effects for the Command Effect Log MIME-Version: 1.0 Message-Id: <20230602-vv-fw_update-v2-3-e9e5cd5adb44@intel.com> References: <20230602-vv-fw_update-v2-0-e9e5cd5adb44@intel.com> In-Reply-To: <20230602-vv-fw_update-v2-0-e9e5cd5adb44@intel.com> To: Alison Schofield , Ira Weiny , Dave Jiang , Ben Widawsky , Dan Williams Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso , Jonathan Cameron , Russ Weight , Vishal Verma X-Mailer: b4 0.13-dev-02a79 X-Developer-Signature: v=1; a=openpgp-sha256; l=2776; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=n4j/XZl+PPPV6uJ0tCXctxrlIofbKWp/qosTAht8r6c=; b=owGbwMvMwCXGf25diOft7jLG02pJDCl1zoscGn/vLPDTf2389OtbgV06Auv+qBZxWW14Hb9x2 ZfmulknOkpZGMS4GGTFFFn+7vnIeExuez5PYIIjzBxWJpAhDFycAjCRosUM/+Nuf877wZs99fWf At2tE4RP/frH9/j9ye0G9Ysu832Tn3GQ4X/gx2Py6uqsuYffntt1ufihj2j2Bk2p6pq6NN3q0PL f/awA X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767895920902684379?= X-GMAIL-MSGID: =?utf-8?q?1767895920902684379?= As more emulated mailbox commands are added to cxl_test, it is a pain point to look up command effect numbers for each effect. Replace the bare numbers in the mock driver with an enum that lists all possible effects. Suggested-by: Jonathan Cameron 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 Reviewed-by: Alison Schofield Reviewed-by: Jonathan Cameron --- tools/testing/cxl/test/mem.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index 403cd3608772..68668d8df1cd 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -21,42 +21,56 @@ static unsigned int poison_inject_dev_max = MOCK_INJECT_DEV_MAX; +enum cxl_command_effects { + CONF_CHANGE_COLD_RESET = 0, + CONF_CHANGE_IMMEDIATE, + DATA_CHANGE_IMMEDIATE, + POLICY_CHANGE_IMMEDIATE, + LOG_CHANGE_IMMEDIATE, + SECURITY_CHANGE_IMMEDIATE, + BACKGROUND_OP, + SECONDARY_MBOX_SUPPORTED, +}; + +#define CXL_CMD_EFFECT_NONE cpu_to_le16(0) + static struct cxl_cel_entry mock_cel[] = { { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_SUPPORTED_LOGS), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_IDENTIFY), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_LSA), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_PARTITION_INFO), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_SET_LSA), - .effect = cpu_to_le16(EFFECT(1) | EFFECT(2)), + .effect = cpu_to_le16(EFFECT(CONF_CHANGE_IMMEDIATE) | + EFFECT(DATA_CHANGE_IMMEDIATE)), }, { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_HEALTH_INFO), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON), - .effect = cpu_to_le16(0), + .effect = CXL_CMD_EFFECT_NONE, }, { .opcode = cpu_to_le16(CXL_MBOX_OP_INJECT_POISON), - .effect = cpu_to_le16(EFFECT(2)), + .effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)), }, { .opcode = cpu_to_le16(CXL_MBOX_OP_CLEAR_POISON), - .effect = cpu_to_le16(EFFECT(2)), + .effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)), }, };