Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b3cfdbf6
Commit
b3cfdbf6
authored
Oct 31, 2023
by
Dan Williams
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-6.7/cxl-commited' into cxl/next
Add the committed decoder sysfs attribute for v6.7.
parents
de5512b2
05e37b21
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
6 deletions
+55
-6
Documentation/ABI/testing/sysfs-bus-cxl
Documentation/ABI/testing/sysfs-bus-cxl
+15
-0
drivers/cxl/core/hdm.c
drivers/cxl/core/hdm.c
+4
-3
drivers/cxl/core/mbox.c
drivers/cxl/core/mbox.c
+1
-1
drivers/cxl/core/memdev.c
drivers/cxl/core/memdev.c
+2
-2
drivers/cxl/core/port.c
drivers/cxl/core/port.c
+32
-0
drivers/cxl/cxl.h
drivers/cxl/cxl.h
+1
-0
No files found.
Documentation/ABI/testing/sysfs-bus-cxl
View file @
b3cfdbf6
...
@@ -178,6 +178,21 @@ Description:
...
@@ -178,6 +178,21 @@ Description:
hardware decoder target list.
hardware decoder target list.
What: /sys/bus/cxl/devices/portX/decoders_committed
Date: October, 2023
KernelVersion: v6.7
Contact: linux-cxl@vger.kernel.org
Description:
(RO) A memory device is considered active when any of its
decoders are in the "committed" state (See CXL 3.0 8.2.4.19.7
CXL HDM Decoder n Control Register). Hotplug and destructive
operations like "sanitize" are blocked while device is actively
decoding a Host Physical Address range. Note that this number
may be elevated without any regionX objects active or even
enumerated, as this may be due to decoders established by
platform firwmare or a previous kernel (kexec).
What: /sys/bus/cxl/devices/decoderX.Y
What: /sys/bus/cxl/devices/decoderX.Y
Date: June, 2021
Date: June, 2021
KernelVersion: v5.14
KernelVersion: v5.14
...
...
drivers/cxl/core/hdm.c
View file @
b3cfdbf6
...
@@ -633,10 +633,11 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
...
@@ -633,10 +633,11 @@ static int cxl_decoder_commit(struct cxl_decoder *cxld)
if
(
cxld
->
flags
&
CXL_DECODER_F_ENABLE
)
if
(
cxld
->
flags
&
CXL_DECODER_F_ENABLE
)
return
0
;
return
0
;
if
(
port
->
commit_end
+
1
!=
id
)
{
if
(
cxl_num_decoders_committed
(
port
)
!=
id
)
{
dev_dbg
(
&
port
->
dev
,
dev_dbg
(
&
port
->
dev
,
"%s: out of order commit, expected decoder%d.%d
\n
"
,
"%s: out of order commit, expected decoder%d.%d
\n
"
,
dev_name
(
&
cxld
->
dev
),
port
->
id
,
port
->
commit_end
+
1
);
dev_name
(
&
cxld
->
dev
),
port
->
id
,
cxl_num_decoders_committed
(
port
));
return
-
EBUSY
;
return
-
EBUSY
;
}
}
...
@@ -853,7 +854,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
...
@@ -853,7 +854,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
cxld
->
target_type
=
CXL_DECODER_HOSTONLYMEM
;
cxld
->
target_type
=
CXL_DECODER_HOSTONLYMEM
;
else
else
cxld
->
target_type
=
CXL_DECODER_DEVMEM
;
cxld
->
target_type
=
CXL_DECODER_DEVMEM
;
if
(
cxld
->
id
!=
port
->
commit_end
+
1
)
{
if
(
cxld
->
id
!=
cxl_num_decoders_committed
(
port
)
)
{
dev_warn
(
&
port
->
dev
,
dev_warn
(
&
port
->
dev
,
"decoder%d.%d: Committed out of order
\n
"
,
"decoder%d.%d: Committed out of order
\n
"
,
port
->
id
,
cxld
->
id
);
port
->
id
,
cxld
->
id
);
...
...
drivers/cxl/core/mbox.c
View file @
b3cfdbf6
...
@@ -1200,7 +1200,7 @@ int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd)
...
@@ -1200,7 +1200,7 @@ int cxl_mem_sanitize(struct cxl_memdev *cxlmd, u16 cmd)
* Require an endpoint to be safe otherwise the driver can not
* Require an endpoint to be safe otherwise the driver can not
* be sure that the device is unmapped.
* be sure that the device is unmapped.
*/
*/
if
(
endpoint
&&
endpoint
->
commit_end
==
-
1
)
if
(
endpoint
&&
cxl_num_decoders_committed
(
endpoint
)
==
0
)
rc
=
__cxl_mem_sanitize
(
mds
,
cmd
);
rc
=
__cxl_mem_sanitize
(
mds
,
cmd
);
else
else
rc
=
-
EBUSY
;
rc
=
-
EBUSY
;
...
...
drivers/cxl/core/memdev.c
View file @
b3cfdbf6
...
@@ -231,7 +231,7 @@ int cxl_trigger_poison_list(struct cxl_memdev *cxlmd)
...
@@ -231,7 +231,7 @@ int cxl_trigger_poison_list(struct cxl_memdev *cxlmd)
if
(
rc
)
if
(
rc
)
return
rc
;
return
rc
;
if
(
port
->
commit_end
==
-
1
)
{
if
(
cxl_num_decoders_committed
(
port
)
==
0
)
{
/* No regions mapped to this memdev */
/* No regions mapped to this memdev */
rc
=
cxl_get_poison_by_memdev
(
cxlmd
);
rc
=
cxl_get_poison_by_memdev
(
cxlmd
);
}
else
{
}
else
{
...
@@ -282,7 +282,7 @@ static struct cxl_region *cxl_dpa_to_region(struct cxl_memdev *cxlmd, u64 dpa)
...
@@ -282,7 +282,7 @@ static struct cxl_region *cxl_dpa_to_region(struct cxl_memdev *cxlmd, u64 dpa)
.
dpa
=
dpa
,
.
dpa
=
dpa
,
};
};
port
=
cxlmd
->
endpoint
;
port
=
cxlmd
->
endpoint
;
if
(
port
&&
is_cxl_endpoint
(
port
)
&&
port
->
commit_end
!=
-
1
)
if
(
port
&&
is_cxl_endpoint
(
port
)
&&
cxl_num_decoders_committed
(
port
)
)
device_for_each_child
(
&
port
->
dev
,
&
ctx
,
__cxl_dpa_to_region
);
device_for_each_child
(
&
port
->
dev
,
&
ctx
,
__cxl_dpa_to_region
);
return
ctx
.
cxlr
;
return
ctx
.
cxlr
;
...
...
drivers/cxl/core/port.c
View file @
b3cfdbf6
...
@@ -37,6 +37,13 @@ DECLARE_RWSEM(cxl_region_rwsem);
...
@@ -37,6 +37,13 @@ DECLARE_RWSEM(cxl_region_rwsem);
static
DEFINE_IDA
(
cxl_port_ida
);
static
DEFINE_IDA
(
cxl_port_ida
);
static
DEFINE_XARRAY
(
cxl_root_buses
);
static
DEFINE_XARRAY
(
cxl_root_buses
);
int
cxl_num_decoders_committed
(
struct
cxl_port
*
port
)
{
lockdep_assert_held
(
&
cxl_region_rwsem
);
return
port
->
commit_end
+
1
;
}
static
ssize_t
devtype_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
static
ssize_t
devtype_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
char
*
buf
)
{
{
...
@@ -537,8 +544,33 @@ static void cxl_port_release(struct device *dev)
...
@@ -537,8 +544,33 @@ static void cxl_port_release(struct device *dev)
kfree
(
port
);
kfree
(
port
);
}
}
static
ssize_t
decoders_committed_show
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
struct
cxl_port
*
port
=
to_cxl_port
(
dev
);
int
rc
;
down_read
(
&
cxl_region_rwsem
);
rc
=
sysfs_emit
(
buf
,
"%d
\n
"
,
cxl_num_decoders_committed
(
port
));
up_read
(
&
cxl_region_rwsem
);
return
rc
;
}
static
DEVICE_ATTR_RO
(
decoders_committed
);
static
struct
attribute
*
cxl_port_attrs
[]
=
{
&
dev_attr_decoders_committed
.
attr
,
NULL
,
};
static
struct
attribute_group
cxl_port_attribute_group
=
{
.
attrs
=
cxl_port_attrs
,
};
static
const
struct
attribute_group
*
cxl_port_attribute_groups
[]
=
{
static
const
struct
attribute_group
*
cxl_port_attribute_groups
[]
=
{
&
cxl_base_attribute_group
,
&
cxl_base_attribute_group
,
&
cxl_port_attribute_group
,
NULL
,
NULL
,
};
};
...
...
drivers/cxl/cxl.h
View file @
b3cfdbf6
...
@@ -689,6 +689,7 @@ static inline bool is_cxl_root(struct cxl_port *port)
...
@@ -689,6 +689,7 @@ static inline bool is_cxl_root(struct cxl_port *port)
return
port
->
uport_dev
==
port
->
dev
.
parent
;
return
port
->
uport_dev
==
port
->
dev
.
parent
;
}
}
int
cxl_num_decoders_committed
(
struct
cxl_port
*
port
);
bool
is_cxl_port
(
const
struct
device
*
dev
);
bool
is_cxl_port
(
const
struct
device
*
dev
);
struct
cxl_port
*
to_cxl_port
(
const
struct
device
*
dev
);
struct
cxl_port
*
to_cxl_port
(
const
struct
device
*
dev
);
struct
pci_bus
;
struct
pci_bus
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment