From patchwork Thu Dec 8 21:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 13068954 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 D0311C4332F for ; Thu, 8 Dec 2022 21:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbiLHV3r (ORCPT ); Thu, 8 Dec 2022 16:29:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbiLHV3q (ORCPT ); Thu, 8 Dec 2022 16:29:46 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9974BA5064 for ; Thu, 8 Dec 2022 13:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670534985; x=1702070985; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3OU1Zhr+kSFl/v9LDM+Jr3IzctANZ/iBrs+GWEVydZU=; b=V/yF1F2jgn2MYtbQMj+Itz3m0sH2T5jUCOiC4BCPO4PBHMVN2QscGQOW d4nUoSY6TCOhvJ/uWKQx60nmy6EJE6gGYSKgtN0GOfzQbjlOS8TfMBkMU wADfnAwGUgB3yluMxvYUuCTJpQJPLrB/JL2xqiLp06SPk70bVal/EMc9m Z5cL9Y4bMOaji333xZkbKAgO4pN5AfQJ12MAN2Ogg3R5Lh8Wwg+iyuswO dpq8pGGe4DGaEqV045RwcUCnHWVy3q/irf3kpLjJLcD4T4inZ/j/tLOBo LxejzlQBDoiJtdmymV1majVn18bdmN5JTTgbH20kSakKlBB5H15X+Zuys A==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="344343322" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="344343322" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 13:29:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="647170307" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="647170307" Received: from kputnam-mobl1.amr.corp.intel.com (HELO dwillia2-xfh.jf.intel.com) ([10.251.25.149]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 13:29:44 -0800 Subject: [ndctl PATCH v2 18/18] cxl/test: Test single-port host-bridge region creation From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Bobo WL , Jonathan Cameron , Alison Schofield , vishal.l.verma@intel.com, nvdimm@lists.linux.dev, vishal.l.verma@intel.com Date: Thu, 08 Dec 2022 13:29:44 -0800 Message-ID: <167053498406.582963.2052790353158387141.stgit@dwillia2-xfh.jf.intel.com> In-Reply-To: <167053487710.582963.17616889985000817682.stgit@dwillia2-xfh.jf.intel.com> References: <167053487710.582963.17616889985000817682.stgit@dwillia2-xfh.jf.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The original port decoder programming algorithm in the kernel failed to acommodate the corner case of a passthrough port connected to a fan-out port. Use the 5th cxl_test decoder to regression test this scenario. Reported-by: Bobo WL Reported-by: Jonathan Cameron Link: http://lore.kernel.org/r/20221010172057.00001559@huawei.com Tested-by: Alison Schofield Signed-off-by: Dan Williams --- test/cxl-create-region.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/cxl-create-region.sh b/test/cxl-create-region.sh index 82aad3a7285a..47aed44848ab 100644 --- a/test/cxl-create-region.sh +++ b/test/cxl-create-region.sh @@ -110,6 +110,34 @@ create_subregions() done } +create_single() +{ + # the 5th cxl_test decoder is expected to target a single-port + # host-bridge. Older cxl_test implementations may not define it, + # so skip the test in that case. + decoder=$($CXL list -b cxl_test -D -d root | + jq -r ".[4] | + select(.pmem_capable == true) | + select(.nr_targets == 1) | + .decoder") + + if [[ ! $decoder ]]; then + echo "no single-port host-bridge decoder found, skipping" + return + fi + + region=$($CXL create-region -d "$decoder" | jq -r ".region") + if [[ ! $region ]]; then + echo "failed to create single-port host-bridge region" + err "$LINENO" + fi + + destroy_regions "$region" +} + +# test region creation on devices behind a single-port host-bridge +create_single + # test reading labels directly through cxl-cli readarray -t mems < <("$CXL" list -b cxl_test -M | jq -r '.[].memdev')