Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDD5150255 for ; Tue, 28 Nov 2023 22:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RdDdjqb7" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so4716173a12.1 for ; Tue, 28 Nov 2023 14:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701211444; x=1701816244; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oXdPkvqfgqa1st3V0uPlk9oxmxd+0QnQcDv7fqikEVQ=; b=RdDdjqb7znGVMKV73/Wsc65SbQw+N+adbYR2IVFs71evHyPaeRSvg0DICt3Vy1jOZ7 odjLOE5tmfoYxjw0Y0FSsRW2W9xUCwfCN4v+RpmzOvRL/GyzEPaG600OREl13URe3z52 bx4ialPENugxeSMqucyXg1EQ6m0Re6meyAS1E4a2GkOwQu8FRzEZPCop7n5+O16mkT8v MAYKBdsLnewughMRYVL+18nRc5dfMzeGMib9uacP4x7h4TQIKEHT06jzCOjNP3he2tOc MWHofq8yklAMlessuFf1mT5fQf/waOtFcVm9Yj0dzfZeBtUwabgZwQ/i0JcU6xYWw0Ex o2Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701211444; x=1701816244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oXdPkvqfgqa1st3V0uPlk9oxmxd+0QnQcDv7fqikEVQ=; b=ISE7Loy6T3V+tt07acBGqnDWwZQpgkaKXnVO2YiZa6zD+TRGGxP1rp8KjV0wy6JeV/ eJguYAcQLZPZNV6gMYYrE+88SFuV8zV92OxqLbbr4iV9QjK4mVhee3/5nUUTJyY3M4yb eFkL5C+fIY9EaTIcxfjCcV62KBWN/7O2BisvoXoWundfv7LNSyPKh27fjI7mAsRyYmyU KuDboFEtsEfWIota3ts8TkFVW35EZXRQ+MZ30X1PKNlSle/F4zcSvi7eIjJ+TryCQtbR +AXlOkpvTyzcJcyrHoHnYVr9iAODQMeHX3wl01ye3Zu6qznsnbWzaIukRmPLj9REP7s5 9x8Q== X-Gm-Message-State: AOJu0YxhrJkM7MGuJ4H2HZfA2gIN1v79UxvzuM0bDpsbsU4bXMlKJLLZ f9+ix+ZXdlqSg2liw8a31Qlx3qL14xE= X-Google-Smtp-Source: AGHT+IEo0NUEa/p8542RQbmZkyYknq1DSeOCmkvBW4zktoAq2PLOv1KhDhRPmgFfpmIQpYYd6XDrdw== X-Received: by 2002:a05:6a21:6d98:b0:18c:376d:fbe8 with SMTP id wl24-20020a056a216d9800b0018c376dfbe8mr14862783pzb.41.1701211444131; Tue, 28 Nov 2023 14:44:04 -0800 (PST) Received: from DT.local (c-71-202-158-162.hsd1.ca.comcast.net. [71.202.158.162]) by smtp.gmail.com with ESMTPSA id s5-20020a17090a5d0500b00280469602bcsm9868120pji.2.2023.11.28.14.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 14:44:03 -0800 (PST) From: nifan.cxl@gmail.com To: mcgrof@kernel.org Cc: nmtadam.samsung@gmail.com, kdevops@lists.linux.dev, jlayton@kernel.org, a.manzanares@samsung.com, Fan Ni Subject: [PATCH 3/4] CXL: Add new make command to create DC region for DCD device Date: Tue, 28 Nov 2023 14:42:03 -0800 Message-ID: <20231128224331.324500-4-nifan.cxl@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231128224331.324500-1-nifan.cxl@gmail.com> References: <20231128224331.324500-1-nifan.cxl@gmail.com> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Fan Ni For a dynamic capacity device (DCD), before a dynamic capacity (DC) extent can be added and used by the system, a DC region needs to be created to cover the DC address range. This change add support to a new make command "cxl-create-dc-region" for creating a dc region. Signed-off-by: Fan Ni --- .../cxl/tasks/cxl-create-dc-region/main.yml | 27 +++++++++++++++++++ playbooks/roles/cxl/tasks/main.yml | 4 +++ workflows/cxl/Makefile | 6 +++++ 3 files changed, 37 insertions(+) create mode 100644 playbooks/roles/cxl/tasks/cxl-create-dc-region/main.yml diff --git a/playbooks/roles/cxl/tasks/cxl-create-dc-region/main.yml b/playbooks/roles/cxl/tasks/cxl-create-dc-region/main.yml new file mode 100644 index 00000000..daed8fa5 --- /dev/null +++ b/playbooks/roles/cxl/tasks/cxl-create-dc-region/main.yml @@ -0,0 +1,27 @@ +--- + +- name: Create a DC region before DC extents can be added + become: yes + become_method: sudo + shell: "rid=0; \ + region=$(cat /sys/bus/cxl/devices/decoder0.0/create_dc_region); \ + echo $region > /sys/bus/cxl/devices/decoder0.0/create_dc_region; \ + echo 256 > /sys/bus/cxl/devices/$region/interleave_granularity; \ + echo 1 > /sys/bus/cxl/devices/$region/interleave_ways; \ + echo dc$rid >/sys/bus/cxl/devices/decoder2.0/mode; \ + echo 0x40000000 >/sys/bus/cxl/devices/decoder2.0/dpa_size; \ + echo 0x40000000 > /sys/bus/cxl/devices/$region/size; \ + echo decoder2.0 > /sys/bus/cxl/devices/$region/target0; \ + echo 1 > /sys/bus/cxl/devices/$region/commit; \ + echo $region > /sys/bus/cxl/drivers/cxl_region/bind" + tags: [ 'cxl-create-dc-region' ] + +- name: Show the DC region created + become: no + shell: "cxl list -uR" + register: command_output + tags: [ 'cxl-create-dc-region' ] + +- debug: + var: command_output.stdout_lines + tags: [ 'cxl-create-dc-region' ] diff --git a/playbooks/roles/cxl/tasks/main.yml b/playbooks/roles/cxl/tasks/main.yml index a75c20a9..164bc2ad 100644 --- a/playbooks/roles/cxl/tasks/main.yml +++ b/playbooks/roles/cxl/tasks/main.yml @@ -57,6 +57,10 @@ include_tasks: cxl-mem-setup/main.yml tags: [ 'cxl-mem-setup' ] +- name: Create a dynamic capacity region for further dc extent add operations + include_tasks: cxl-create-dc-region/main.yml + tags: [ 'cxl-create-dc-region' ] + - name: Set the path to cxl workflow set_fact: cxl_workflow_target: "../workflows/cxl/" diff --git a/workflows/cxl/Makefile b/workflows/cxl/Makefile index 476ecc5e..86d17288 100644 --- a/workflows/cxl/Makefile +++ b/workflows/cxl/Makefile @@ -43,6 +43,11 @@ cxl-mem-setup: -f 30 -i hosts playbooks/cxl.yml \ --tags cxl-mem-setup $(LIMIT_HOSTS) +cxl-create-dc-region: + $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ + -f 30 -i hosts playbooks/cxl.yml \ + --tags cxl-create-dc-region $(LIMIT_HOSTS) + cxl-help-menu: @echo "cxl development:" @echo "cxl - Git clones ncdtl to compile and install the /usr/bin/cxl binary" @@ -50,6 +55,7 @@ cxl-help-menu: @echo "cxl-test-meson - Runs the ndctl meson unit tests for the CXL test suite" @echo "cxl-results - Get results for all tests runs" @echo "cxl-mem-setup - Convert cxl memory to cpu-less numa node" + @echo "cxl-create-dc-region - Create a DC region so DC extents can be added further" cxl-help-end: @echo "" -- 2.42.0