Skip to content

Commit 497a079

Browse files
philippe56mpe
authored andcommitted
cxl: Report the tunneled operations status
Failure to synchronize the tunneled operations does not prevent the initialization of the cxl card. This patch reports the tunneled operations status via /sys. Signed-off-by: Philippe Bergheaud <felix@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 401dca8 commit 497a079

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

Documentation/ABI/testing/sysfs-class-cxl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,11 @@ Description: read only
244244
Returns 1 if the psl timebase register is synchronized
245245
with the core timebase register, 0 otherwise.
246246
Users: https://github.com/ibm-capi/libcxl
247+
248+
What: /sys/class/cxl/<card>/tunneled_ops_supported
249+
Date: May 2018
250+
Contact: linuxppc-dev@lists.ozlabs.org
251+
Description: read only
252+
Returns 1 if tunneled operations are supported in capi mode,
253+
0 otherwise.
254+
Users: https://github.com/ibm-capi/libcxl

drivers/misc/cxl/cxl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ struct cxl {
717717
bool perst_select_user;
718718
bool perst_same_image;
719719
bool psl_timebase_synced;
720+
bool tunneled_ops_supported;
720721

721722
/*
722723
* number of contexts mapped on to this card. Possible values are:

drivers/misc/cxl/pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,9 +1742,14 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
17421742
/* Required for devices using CAPP DMA mode, harmless for others */
17431743
pci_set_master(dev);
17441744

1745-
if (cxl_is_power9())
1745+
adapter->tunneled_ops_supported = false;
1746+
1747+
if (cxl_is_power9()) {
17461748
if (pnv_pci_set_tunnel_bar(dev, 0x00020000E0000000ull, 1))
17471749
dev_info(&dev->dev, "Tunneled operations unsupported\n");
1750+
else
1751+
adapter->tunneled_ops_supported = true;
1752+
}
17481753

17491754
if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode)))
17501755
goto err;

drivers/misc/cxl/sysfs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ static ssize_t psl_timebase_synced_show(struct device *device,
7878
return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
7979
}
8080

81+
static ssize_t tunneled_ops_supported_show(struct device *device,
82+
struct device_attribute *attr,
83+
char *buf)
84+
{
85+
struct cxl *adapter = to_cxl_adapter(device);
86+
87+
return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->tunneled_ops_supported);
88+
}
89+
8190
static ssize_t reset_adapter_store(struct device *device,
8291
struct device_attribute *attr,
8392
const char *buf, size_t count)
@@ -183,6 +192,7 @@ static struct device_attribute adapter_attrs[] = {
183192
__ATTR_RO(base_image),
184193
__ATTR_RO(image_loaded),
185194
__ATTR_RO(psl_timebase_synced),
195+
__ATTR_RO(tunneled_ops_supported),
186196
__ATTR_RW(load_image_on_perst),
187197
__ATTR_RW(perst_reloads_same_image),
188198
__ATTR(reset, S_IWUSR, NULL, reset_adapter_store),

0 commit comments

Comments
 (0)