From patchwork Wed Jun 14 17:17:42 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: 108075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp133896vqr; Wed, 14 Jun 2023 11:04:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6aI8vF0174Qaf7cj7xcHw3EKVl/gc1ptXYLaPLW+3jGJdom79PXfP6+Qto6FT1DeRQYXGl X-Received: by 2002:a2e:9dca:0:b0:2a8:a651:8098 with SMTP id x10-20020a2e9dca000000b002a8a6518098mr7147240ljj.38.1686765852737; Wed, 14 Jun 2023 11:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686765852; cv=none; d=google.com; s=arc-20160816; b=GjkawQwvSmF2+zXDBw2hbNgx17Z0I8H8TlbirCIWCKHa1g2x8TgDeJaM9LM0Ia0oBe uejAucVj+uPWEHDsH72zVHUKfHqTdgIK1tVf6cpTtJbwEL6KVW090iuz0bN9vip/juYT WK/HR0COVaZ4qIhRIP9FtACoZbsJw4s+qAP7v/J4fo0YgYf1BSPd6A44LXaL/bKGQ+Hv tbgrgiTCNsdSp/QfedxRUuvNOiVUSg1gvHn8D1OFpIr4KxzJGQ0FgzHbfbWzavk986UO w/FMZyor6S0MIMsU5Z5BY5onSOEjYdRRwOLIbEWez+qHExtS4YfOAZLH9QadwRsNoXJs aW6A== 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=6mcSYmU0rhv38aPLfJ1oas0l5mCIcubmIxAziDMrocc=; b=VQc8DGsngRCqXst1KYP/p817DgEH+J1GZ9Zr5V/udWSq+mpgnYeiCRRl+Gjzre9OAb A5vhvFVTSNwXJrlz1udxWgGFXI20U7l6Gz6/sGkr7INBIoJR9/W62WlfFf8o1RWYzt+s JID6YuCOLJpjA3H4nV0bBvn6GLUrCiWSUFK6Alp7t+3vRMCF2nWCNIBmIKBiRAH3On7p Digqakabk0kwNSJsWvDKJCCe4ClKLPbDzcjp4EnpQ/jHD1AwJH2GnxFsMtxojY9sIZhK Bhvq/gcLIm4oggn46z168gZjVB3HBwkN29JMnAMT/wh3WxIfF+oMiZA0EDFXnHt0ww7L GCQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SYjXOEJZ; 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 m11-20020aa7c48b000000b00514b3a2009dsi9196093edq.178.2023.06.14.11.03.46; Wed, 14 Jun 2023 11:04:12 -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=SYjXOEJZ; 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 S237103AbjFNRSg (ORCPT + 99 others); Wed, 14 Jun 2023 13:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236756AbjFNRSP (ORCPT ); Wed, 14 Jun 2023 13:18:15 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77EF42711; Wed, 14 Jun 2023 10:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686763092; x=1718299092; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=KXze/yHtvX8i/7X5EL5m/NQ2O8y/9NNPJ8Ex4fgi0dY=; b=SYjXOEJZ3mNtMYrfxdgKdD47dZU9oTTd57WxTsL6c38W3vmEtzsxzLcW zpsWbMhWBnVZaGfOmo91g/xNhi6bBMZKFP0isVQ/XqKvtY2VpY1QYNGtA ku64g3KczwW3sY+hHnLpJz9wTHV2wxENclm+kXepdmXAvZvFHnXbOpbu9 JsGVu/aWqR4CpEOq3+j8qjFAxo0AvPdfpmap/zINn5eKRUfcv/Ga2ZoC1 3xUNC64+Dedf9B9g/6vw48HC5crXDr/OOMLWput2tr6egs3ezblrzKEXZ ChYi9J8BZ3Yt9rSF+AZkUJjbuR7LggVhWGSIWIYE+d7BilEGL8N3OFlcD A==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="362054380" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="362054380" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 10:18:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="662470742" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="662470742" Received: from mahbubu1-mobl.amr.corp.intel.com (HELO [192.168.1.200]) ([10.209.44.245]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 10:18:09 -0700 From: Vishal Verma Date: Wed, 14 Jun 2023 11:17:42 -0600 Subject: [PATCH v4 3/4] tools/testing/cxl: Use named effects for the Command Effect Log MIME-Version: 1.0 Message-Id: <20230602-vv-fw_update-v4-3-c6265bd7343b@intel.com> References: <20230602-vv-fw_update-v4-0-c6265bd7343b@intel.com> In-Reply-To: <20230602-vv-fw_update-v4-0-c6265bd7343b@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 , Jonathan Cameron X-Mailer: b4 0.13-dev-02a79 X-Developer-Signature: v=1; a=openpgp-sha256; l=2945; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=KXze/yHtvX8i/7X5EL5m/NQ2O8y/9NNPJ8Ex4fgi0dY=; b=owGbwMvMwCXGf25diOft7jLG02pJDCmd3/xb9q61P2gwZ0l10aL+g9tfz7v0qP78WkaZv2vkn s0Ib3b70VHKwiDGxSArpsjyd89HxmNy2/N5AhMcYeawMoEMYeDiFICJLJFn+Cu0/U2G9P5PrXI+ jTFKa8R9N3qanVyb8LRmf9DnSXpaqyIY/pek6em/v3unTuWQ1QWD8iVTzvGv3SkeNVHywh7fcwk 9/bwA 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_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768702191162784985?= X-GMAIL-MSGID: =?utf-8?q?1768702191162784985?= 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. Cc: Davidlohr Bueso Cc: Jonathan Cameron Cc: Russ Weight Cc: Alison Schofield Cc: Ira Weiny Cc: Dave Jiang Cc: Ben Widawsky Cc: Dan Williams Suggested-by: Jonathan Cameron Reviewed-by: Alison Schofield Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Signed-off-by: Vishal Verma --- 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)), }, };