From patchwork Mon Jun 12 06:55:58 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: 106338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2446943vqr; Mon, 12 Jun 2023 02:02:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xtprKjbxEHHyaHrJAKPrjD2iph3mbvBzbLwx7p8ZMysa5zufL45LyUWaEpvCczddDGp4O X-Received: by 2002:a17:90b:4fc2:b0:23d:286:47d3 with SMTP id qa2-20020a17090b4fc200b0023d028647d3mr7365130pjb.40.1686560542490; Mon, 12 Jun 2023 02:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686560542; cv=none; d=google.com; s=arc-20160816; b=LEplcvS/mb9270s9RmRSN8JSNo/RWdiEFofD5kNgCsJjQDk2QP2QZOwO89kkkafMlV g6Bsmv0ZzCss2ej+BErT5jSF4R6I2yKuw8mt9FH7CepIx3gPuOzKSE7VMHty6dUUP2bm ul2c64llQCCsKSi4RZWpibR85QIVWJVfObfARBX3UHaKXSviXIeth7nCMFXz4oKB2TJq 1sWh93m97MTVK4KRDgYh/JC3GPDfnSz+a1ge2w487y1bVR3kJRH7mFOcmBKSx97tQlat oRXj5JzPrlq9E7Hw3oOskTZ89Rtyc+2PL4MmY/+Ewd7Gvv+t6DyRN5LEabWB5OCrRpZp XwZw== 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=alruqZwk3I/aUpswPHrxKCJAsfNuWqV+Vn0gOqv5ZMI=; b=mS6aEojertzPLza1x5UQEy1oODCCLHzekCkw0m8uZ9GOCzzeHGukq9JQaz+9S/X9Ii 7kWJ6BmrLM9UwB828GiFhdqoSmxSUmk6hBqGNeQvt0j19v2V3sVTJzJuPlfSTuwhvvtz r9nZh+TamRv+YREIClK/naYpgNLxZ3OyHbKBpTsxqOUDg9I/22kYBYBCkzfS3G3DDE17 rCEr4Nzf5nGPCTiLqjsOSrcH+hVHS3l/7MuoC/YUfh66PSIFJow989SyXsGEE6SqcB54 5eK+6bfJruVCh5Vf4cMZqmQUckrBDTbRRTTAreScgmUiwG+v0FEJlUwd2kzFXFFZlmm2 dtmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=R7m5X6l8; 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 2-20020a17090a018200b00256bc4aee2fsi3144597pjc.179.2023.06.12.02.02.09; Mon, 12 Jun 2023 02:02:22 -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=R7m5X6l8; 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 S233727AbjFLIwO (ORCPT + 99 others); Mon, 12 Jun 2023 04:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233345AbjFLIwA (ORCPT ); Mon, 12 Jun 2023 04:52:00 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AFBFF5; Mon, 12 Jun 2023 01:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686559919; x=1718095919; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=BBNfgqMFEu4CiWW3ME2sbOa4pebMX/L9DdT2Ta8fw7M=; b=R7m5X6l8xhRnhtAiBoIpO3j/TET9FiPUwaqt9rWG96aPZ3rT8ieJntfw eCOWiFHycj7XvYkuXTqwmgozJ+CmLTlZ0r2muzsiJdEUG60bxQxTZb/OI yxYVDKr3Gf2Dxw79hhZnNnghuM9WHzB0+HLnRk6+B49r+TIFIyH/OOKO3 tRcVI1OfL2E6wvhqLajd6cYQZJNBExQ6B3hyyjwbmqf+cAR1XOSviVZl1 InlljC/8kiy8/xUW/BKMCQh5rR3E6ixcHrG2bowJldG3msoZsHxNNlgHh 2yiKFAmFOdmwx4cx46yWWEl2IEe4K3e2KEehpwwy3vLsl/4Kaoei013mo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="347613312" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="347613312" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 23:56:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10738"; a="835365321" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="835365321" Received: from apeer-mobl.amr.corp.intel.com (HELO [192.168.1.200]) ([10.251.3.238]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2023 23:56:22 -0700 From: Vishal Verma Date: Mon, 12 Jun 2023 00:55:58 -0600 Subject: [PATCH v3 3/4] tools/testing/cxl: Use named effects for the Command Effect Log MIME-Version: 1.0 Message-Id: <20230602-vv-fw_update-v3-3-869f82069c95@intel.com> References: <20230602-vv-fw_update-v3-0-869f82069c95@intel.com> In-Reply-To: <20230602-vv-fw_update-v3-0-869f82069c95@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=2897; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=BBNfgqMFEu4CiWW3ME2sbOa4pebMX/L9DdT2Ta8fw7M=; b=owGbwMvMwCXGf25diOft7jLG02pJDCltB6dsaF86s+oyV9GEmSaL+F/b7lrn8+zKz0svP3pXi C1VzLCt7yhlYRDjYpAVU2T5u+cj4zG57fk8gQmOMHNYmUCGMHBxCsBEhJsY/gewfjq3gdFqxx6v 3j/SU15u81KffXDN9H+zw2beqrFPrXdkZJil9vCW99323duP+yztmrf6yT+5Wbk+BXoPvrqW/3t cHMQOAA== 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,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?1768486907485278360?= X-GMAIL-MSGID: =?utf-8?q?1768486907485278360?= 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 Signed-off-by: Vishal Verma Reviewed-by: Dave Jiang --- 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)), }, };