From patchwork Fri Feb 19 02:03:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 12188261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B523EC433E0 for ; Fri, 19 Feb 2021 02:04:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 797E464ED2 for ; Fri, 19 Feb 2021 02:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbhBSCEa (ORCPT ); Thu, 18 Feb 2021 21:04:30 -0500 Received: from mga12.intel.com ([192.55.52.136]:50640 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbhBSCEa (ORCPT ); Thu, 18 Feb 2021 21:04:30 -0500 IronPort-SDR: 3OdMsMWtJxKvh64tJzrGj0+2fPGJdtHvpYYDtZpqsEYEdOPlq8WT/rrYBV/xC8UbDLxk1wKbCl wGLNATDWIR/g== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="162854685" X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="162854685" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 18:03:48 -0800 IronPort-SDR: icwyjkcBes/KDSQFVVPO65Z8ivBtF6STSuT3ljN7urYHfddxUrwgNiYLKfqgk3pVeAlMrYMbmu a78cPll0CPgw== X-IronPort-AV: E=Sophos;i="5.81,187,1610438400"; d="scan'208";a="513509615" Received: from jnavar1-mobl4.amr.corp.intel.com (HELO omniknight.intel.com) ([10.213.167.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2021 18:03:48 -0800 From: Vishal Verma To: Cc: , Ben Widawsky , Dan Williams , Vishal Verma Subject: [ndctl PATCH v2 00/13] Initial CXL support Date: Thu, 18 Feb 2021 19:03:18 -0700 Message-Id: <20210219020331.725687-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Changes since v1[1]: - Add 'firmware_version' retrieval for memdevs via sysfs attribute - Add private data storage and accessors for libcxl - Add a local copy of the UAPI header (cxl_mem.h) - Refactor 'Identify' command support into a single patch - Add libcxl APIs for get_lsa - Add libcxl APIs for get_health_info - Add libcxl APIs for firmware_status and out.size from cmd response - Refactor common test helpers to make them more generic - Add a hexdump helper in util/ - Add a new unit test, test/libcxl which tests: - Basic sanity tests - Module unload/load - identify device command - set_lsa (via RAW mode) command - get_lsa command - fuzzes command input/output payload sizes - Fix install location of cxl headers - Add section 3 man pages for libcxl API documentation (only two pages added so far). [1]: https://lore.kernel.org/linux-cxl/20210112003403.2944568-1-vishal.l.verma@intel.com/ --- Add a new utility and library to support CXL devices. This comprehends the kernel's sysfs layout for CXL devices, and implements a command submission harness for CXL mailbox commands via ioctl()s defined by the cxl_mem driver. A 'cxl-list' command is added which uses some of the libcxl APIs to display a listing of CXL devices that includes attributes obtained via sysfs. Additionally, a new unit test is added to test the library and kernel (ioctl) interfaces. This includes basic functionality tests for a subset of the mailbox commands, as well as some negative tests to validate graceful handling of malformed commands with unexpected buffer sizing for payloads. The unit tests are tied to the QEMU implementation[2] of CXL devices. The latest kernel patches can be found at [3]. An ndctl branch with these patches is also available at [4] [2]: https://lore.kernel.org/linux-cxl/20210202005948.241655-1-ben.widawsky@intel.com [3]: https://lore.kernel.org/linux-cxl/20210217040958.1354670-1-ben.widawsky@intel.com [4]: https://github.com/pmem/ndctl/tree/cxl-2.0v2 Vishal Verma (13): cxl: add a cxl utility and libcxl library cxl: add a local copy of the cxl_mem UAPI header libcxl: add support for command query and submission libcxl: add support for the 'Identify Device' command test: rename 'ndctl_test' to 'test_ctx' test: rename 'ndctl_test_*' helpers to 'test_*' test: introduce a libcxl unit test libcxl: add GET_HEALTH_INFO mailbox command and accessors libcxl: add support for the 'GET_LSA' command util/hexdump: Add a util helper to print a buffer in hex test/libcxl: add a test for {set, get}_lsa commands Documentation/cxl: add library API documentation test/libcxl: introduce a command size fuzzing test Documentation/cxl/cxl-list.txt | 65 ++ Documentation/cxl/cxl.txt | 34 ++ Documentation/cxl/human-option.txt | 8 + Documentation/cxl/lib/cxl_new.txt | 43 ++ Documentation/cxl/lib/libcxl.txt | 56 ++ Documentation/cxl/verbose-option.txt | 5 + configure.ac | 4 + Makefile.am | 10 +- Makefile.am.in | 5 + cxl/lib/private.h | 97 +++ cxl/lib/libcxl.c | 879 +++++++++++++++++++++++++++ cxl/builtin.h | 8 + cxl/cxl_mem.h | 181 ++++++ cxl/libcxl.h | 82 +++ test.h | 40 +- test/libcxl-expect.h | 13 + util/filter.h | 2 + util/hexdump.h | 8 + util/json.h | 3 + util/main.h | 3 + cxl/cxl.c | 95 +++ cxl/list.c | 113 ++++ ndctl/bat.c | 8 +- ndctl/test.c | 8 +- test/ack-shutdown-count-set.c | 16 +- test/blk_namespaces.c | 14 +- test/core.c | 32 +- test/dax-dev.c | 10 +- test/dax-pmd.c | 13 +- test/dax-poison.c | 6 +- test/daxdev-errors.c | 2 +- test/device-dax.c | 24 +- test/dpa-alloc.c | 14 +- test/dsm-fail.c | 14 +- test/libcxl.c | 514 ++++++++++++++++ test/libndctl.c | 84 +-- test/multi-pmem.c | 23 +- test/parent-uuid.c | 13 +- test/pmem_namespaces.c | 14 +- test/revoke-devmem.c | 12 +- util/filter.c | 20 + util/hexdump.c | 53 ++ util/json.c | 26 + .gitignore | 5 + Documentation/cxl/Makefile.am | 58 ++ Documentation/cxl/lib/Makefile.am | 58 ++ README.md | 2 +- cxl/Makefile.am | 21 + cxl/lib/Makefile.am | 32 + cxl/lib/libcxl.pc.in | 11 + cxl/lib/libcxl.sym | 57 ++ test/Makefile.am | 15 +- 52 files changed, 2754 insertions(+), 179 deletions(-) create mode 100644 Documentation/cxl/cxl-list.txt create mode 100644 Documentation/cxl/cxl.txt create mode 100644 Documentation/cxl/human-option.txt create mode 100644 Documentation/cxl/lib/cxl_new.txt create mode 100644 Documentation/cxl/lib/libcxl.txt create mode 100644 Documentation/cxl/verbose-option.txt create mode 100644 cxl/lib/private.h create mode 100644 cxl/lib/libcxl.c create mode 100644 cxl/builtin.h create mode 100644 cxl/cxl_mem.h create mode 100644 cxl/libcxl.h create mode 100644 test/libcxl-expect.h create mode 100644 util/hexdump.h create mode 100644 cxl/cxl.c create mode 100644 cxl/list.c create mode 100644 test/libcxl.c create mode 100644 util/hexdump.c create mode 100644 Documentation/cxl/Makefile.am create mode 100644 Documentation/cxl/lib/Makefile.am create mode 100644 cxl/Makefile.am create mode 100644 cxl/lib/Makefile.am create mode 100644 cxl/lib/libcxl.pc.in create mode 100644 cxl/lib/libcxl.sym