From patchwork Fri Aug 19 08:50:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Ho X-Patchwork-Id: 12948542 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 876C1C25B0E for ; Fri, 19 Aug 2022 08:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347862AbiHSIun (ORCPT ); Fri, 19 Aug 2022 04:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347822AbiHSIuh (ORCPT ); Fri, 19 Aug 2022 04:50:37 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3662ECCE39 for ; Fri, 19 Aug 2022 01:50:35 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id h28so3746945pfq.11 for ; Fri, 19 Aug 2022 01:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=h5SgyCQK5Xj5sPgkZoZsPhACfc+94ZyRe6nxsjAQolo=; b=pLY7YxqUWonCRGizbUsG36+CMN0qW8s3v1fLgp0UG9A5W6zekKVh6LBajNQCN4VDcG q3mYBw7/UwyUprxnnExsXN3LECXfm65HpdqIfTbl/MI8f7dPA/8Bx7tcBjmwj+WVOLsv k+6zrwOVa7S3E8LW10S3DktTQQFvnVNigUxHHPGA29Lnx8Cu1aIw3uXn+fGNRAtL07eV ubNwn+EOYuss/PepnbCU4j1hxMHi6tCXFL4XAHy6mhrMSyhgvTR/69Y+xtJ9PD+aQPZ1 8P7eCf870+3cc7iiZkZ3Sdw3pJYuT5pX/C6ZrbPLtJq65V1TjDwpf48V7XDGf1pRsBYK zCRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=h5SgyCQK5Xj5sPgkZoZsPhACfc+94ZyRe6nxsjAQolo=; b=ktG0j4Euvn+3Enzdyo1U2l4ldYWdZdQ2oDLZRISQuwYIBwJtuecepZqdcYQJSoSJcK goE82nY1rjIUsh3RMnBpI4lOKehsNAsmHrSjdZ5orfc62j1NOjl8rMyCo2v1JpzekaoC KRumDnVwblQ1JLMEBOG3lVHAWHgbJ1NjIZXHR8kPuvy0Ijn5v2pfxRq4cxy3io2/9cPy R3z0vzZtdNMkziITaHhlpiB/gbiKUaFXjppQ7bzAwcQbqcnKazbmz0xbVTNUIwWbWT2F ud4IG0LG4sCewV48qXeuXI3YxjLeQGYB13Nj9ZgOUBNqvc122L6ChwKKYWdz7HURrqM2 ZZnw== X-Gm-Message-State: ACgBeo2/hRO+guIHH9T9cX5a0AFkTZACc51p9VAKmv18pN67n6MC5RBZ 4lWBfcVvFkg1TEv1PM0HT50/30e9rcY= X-Google-Smtp-Source: AA6agR4xKQHQdTQYy0gJF+PC8sfjwQdfmWqUT1LUq0YYWDV62j4XJnqIQrGFKEEe4zvI/NDRqVurtw== X-Received: by 2002:a05:6a00:4304:b0:532:3c0f:3597 with SMTP id cb4-20020a056a00430400b005323c0f3597mr6817025pfb.44.1660899034465; Fri, 19 Aug 2022 01:50:34 -0700 (PDT) Received: from localhost.localdomain (c-107-3-179-31.hsd1.ca.comcast.net. [107.3.179.31]) by smtp.gmail.com with ESMTPSA id c4-20020a170902b68400b0016eecdf8978sm2667489pls.106.2022.08.19.01.50.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 19 Aug 2022 01:50:33 -0700 (PDT) From: sunfishho12@gmail.com To: linux-cxl@vger.kernel.org Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com, dave@stgolabs.net, a.manzanares@samsung.com, Matthew Ho Subject: [ndctl PATCH 0/2] cxl: Add cxl list image, image-from-file subcommands Date: Fri, 19 Aug 2022 01:50:18 -0700 Message-Id: X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Matthew Ho cxl list outputs a json array containing the cxl hierarchy, which can be parsed to create an image of the cxl topology. Patch 1 adds a root port attribute in the cxl list output to switch ports and type 3 memory devices to allow determination of which devices hang off of which root ports. This preps for patch 2. Patch 2 adds a subcommand to output the cxl topology, using cxl list options. Acceptable output formats include .jpeg, .jpg, and .png. It also adds a subcommand to output the cxl topology given a text file generated by cxl list. This pair of patches applies on [1], a pending patch, applied on the tip of the create_region branch. The tip at the time of posting is: commit 8f0433abc2a4 ("cxl/decoder: add a max_available_extent attribute") [1] https://lore.kernel.org/linux-cxl/20220812221553.92278-1-sunfishho12@gmail.com/ Matthew Ho (2): cxl: Add root port attribute to cxl list output cxl: Add list image, image-from-file to CXL command Documentation/cxl/cxl-list.txt | 16 ++ cxl/filter.c | 279 ++++++++++++++++++++++++++++++++- cxl/filter.h | 7 + cxl/json.c | 16 +- cxl/lib/libcxl.c | 66 ++++++++ cxl/lib/libcxl.sym | 3 +- cxl/libcxl.h | 2 + cxl/list.c | 24 +++ cxl/meson.build | 1 + meson.build | 1 + 10 files changed, 412 insertions(+), 3 deletions(-)