kdevops.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: fan.ni@gmx.us
To: mcgrof@kernel.org
Cc: nmtadam.samsung@gmail.com, fan.ni@samsung.com,
	kdevops@lists.linux.dev, jlayton@kernel.org,
	Fan Ni <fan.ni@gmx.us>
Subject: [PATCH 3/3] CXL: Add support to create a DC region for DCD
Date: Tue, 29 Aug 2023 13:36:34 -0700	[thread overview]
Message-ID: <20230829203634.29635-4-fan.ni@gmx.us> (raw)
In-Reply-To: <20230829203634.29635-1-fan.ni@gmx.us>

From: Fan Ni <fan.ni@gmx.us>

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 <fan.ni@gmx.us>
---
 .../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..c71e7a86 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.40.1


  parent reply	other threads:[~2023-08-29 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 20:36 [PATCH 0/3] CXL: Add dynamic capacity device test support in kdevops fan.ni
2023-08-29 20:36 ` [PATCH 1/3] CXL: Add a new topology to support DCD emulation fan.ni
2023-08-29 20:36 ` [PATCH 2/3] qemu: Add QMP connection option for QMP interface access fan.ni
2023-08-29 20:36 ` fan.ni [this message]
2023-08-29 20:48 ` [PATCH 0/3] CXL: Add dynamic capacity device test support in kdevops Fan Ni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829203634.29635-4-fan.ni@gmx.us \
    --to=fan.ni@gmx.us \
    --cc=fan.ni@samsung.com \
    --cc=jlayton@kernel.org \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    --cc=nmtadam.samsung@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).