Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions Documentation/ABI/testing/sysfs-class-cxl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ Example: The real path of the attribute /sys/class/cxl/afu0.0s/irqs_max is

Slave contexts (eg. /sys/class/cxl/afu0.0s):

What: /sys/class/cxl/<afu>/afu_err_buf
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
AFU Error Buffer contents. The contents of this file are
application specific and depends on the AFU being used.
Applications interacting with the AFU can use this attribute
to know about the current error condition and take appropriate
action like logging the event etc.


What: /sys/class/cxl/<afu>/irqs_max
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Expand All @@ -15,6 +26,7 @@ Description: read/write
that hardware can support (eg. 2037). Write values will limit
userspace applications to that many userspace interrupts. Must
be >= irqs_min.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/irqs_min
Date: September 2014
Expand All @@ -24,20 +36,23 @@ Description: read only
userspace must request on a CXL_START_WORK ioctl. Userspace may
omit the num_interrupts field in the START_WORK IOCTL to get
this minimum automatically.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/mmio_size
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the size of the MMIO space that may be mmaped
by userspace.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/modes_supported
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
List of the modes this AFU supports. One per line.
Valid entries are: "dedicated_process" and "afu_directed"
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/mode
Date: September 2014
Expand All @@ -46,6 +61,7 @@ Description: read/write
The current mode the AFU is using. Will be one of the modes
given in modes_supported. Writing will change the mode
provided that no user contexts are attached.
Users: https://github.com/ibm-capi/libcxl


What: /sys/class/cxl/<afu>/prefault_mode
Expand All @@ -59,26 +75,30 @@ Description: read/write
descriptor as an effective address and
prefault what it points to.
all: all segments process calling START_WORK maps.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/reset
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: write only
Writing 1 here will reset the AFU provided there are not
contexts active on the AFU.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/api_version
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the current version of the kernel/user API.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/api_version_compatible
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the the lowest version of the userspace API
this this kernel supports.
Users: https://github.com/ibm-capi/libcxl


AFU configuration records (eg. /sys/class/cxl/afu0.0/cr0):
Expand All @@ -92,20 +112,23 @@ Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Hexadecimal value of the vendor ID found in this AFU
configuration record.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/cr<config num>/device
Date: February 2015
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Hexadecimal value of the device ID found in this AFU
configuration record.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/cr<config num>/class
Date: February 2015
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Hexadecimal value of the class code found in this AFU
configuration record.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>/cr<config num>/config
Date: February 2015
Expand All @@ -115,6 +138,7 @@ Description: read only
record. The format is expected to match the either the standard
or extended configuration space defined by the PCIe
specification.
Users: https://github.com/ibm-capi/libcxl



Expand All @@ -126,18 +150,21 @@ Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the size of the MMIO space that may be mmaped
by userspace. This includes all slave contexts space also.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>m/pp_mmio_len
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the Per Process MMIO space length.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<afu>m/pp_mmio_off
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Decimal value of the Per Process MMIO space offset.
Users: https://github.com/ibm-capi/libcxl


Card info (eg. /sys/class/cxl/card0)
Expand All @@ -147,12 +174,14 @@ Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Identifies the CAIA Version the card implements.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<card>/psl_revision
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Identifies the revision level of the PSL.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<card>/base_image
Date: September 2014
Expand All @@ -162,13 +191,15 @@ Description: read only
that support loadable PSLs. For FPGAs this field identifies
the image contained in the on-adapter flash which is loaded
during the initial program load.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<card>/image_loaded
Date: September 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Will return "user" or "factory" depending on the image loaded
onto the card.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<card>/load_image_on_perst
Date: December 2014
Expand All @@ -183,10 +214,12 @@ Description: read/write
user or factory image to be loaded.
Default is to reload on PERST whichever image the card has
loaded.
Users: https://github.com/ibm-capi/libcxl

What: /sys/class/cxl/<card>/reset
Date: October 2014
Contact: linuxppc-dev@lists.ozlabs.org
Description: write only
Writing 1 will issue a PERST to card which may cause the card
to reload the FPGA depending on load_image_on_perst.
Users: https://github.com/ibm-capi/libcxl
4 changes: 4 additions & 0 deletions Documentation/powerpc/cxl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ User API
The following file operations are supported on both slave and
master devices.

A userspace library libcxl is avaliable here:
https://github.com/ibm-capi/libcxl
This provides a C interface to this kernel API.

open
----
Expand Down Expand Up @@ -366,6 +369,7 @@ Sysfs Class
enumeration and tuning of the accelerators. Its layout is
described in Documentation/ABI/testing/sysfs-class-cxl


Udev rules
==========

Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2946,7 +2946,7 @@ M: Michael Neuling <mikey@neuling.org>
L: linuxppc-dev@lists.ozlabs.org
S: Supported
F: drivers/misc/cxl/
F: include/misc/cxl.h
F: include/misc/cxl*
F: include/uapi/misc/cxl.h
F: Documentation/powerpc/cxl.txt
F: Documentation/powerpc/cxl.txt
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ struct dev_archdata {
#ifdef CONFIG_FAIL_IOMMU
int fail_iommu;
#endif
#ifdef CONFIG_CXL_BASE
struct cxl_context *cxl_ctx;
#endif
};

struct pdev_archdata {
Expand Down
2 changes: 2 additions & 0 deletions arch/powerpc/include/asm/pci-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct pci_controller_ops {
* allow assignment/enabling of the device. */
bool (*enable_device_hook)(struct pci_dev *);

void (*release_device)(struct pci_dev *);

/* Called during PCI resource reassignment */
resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
void (*reset_secondary_bus)(struct pci_dev *dev);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/pnv-pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define _ASM_PNV_PCI_H

#include <linux/pci.h>
#include <misc/cxl.h>
#include <misc/cxl-base.h>

int pnv_phb_to_cxl_mode(struct pci_dev *dev, uint64_t mode);
int pnv_cxl_ioda_msi_setup(struct pci_dev *dev, unsigned int hwirq,
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
#endif
return phb;
}
EXPORT_SYMBOL_GPL(pcibios_alloc_controller);

void pcibios_free_controller(struct pci_controller *phb)
{
Expand Down Expand Up @@ -1447,6 +1448,7 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
list_for_each_entry(child_bus, &bus->children, node)
pcibios_claim_one_bus(child_bus);
}
EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);


/* pcibios_finish_adding_to_bus
Expand Down Expand Up @@ -1680,6 +1682,7 @@ void pcibios_scan_phb(struct pci_controller *hose)
pcie_bus_configure_settings(child);
}
}
EXPORT_SYMBOL_GPL(pcibios_scan_phb);

static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
{
Expand Down
5 changes: 5 additions & 0 deletions arch/powerpc/kernel/pci-hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
*/
void pcibios_release_device(struct pci_dev *dev)
{
struct pci_controller *phb = pci_bus_to_host(dev->bus);

eeh_remove_device(dev);

if (phb->controller_ops.release_device)
phb->controller_ops.release_device(dev);
}

/**
Expand Down
9 changes: 6 additions & 3 deletions arch/powerpc/mm/copro_fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <asm/reg.h>
#include <asm/copro.h>
#include <asm/spu.h>
#include <misc/cxl.h>
#include <misc/cxl-base.h>

/*
* This ought to be kept in sync with the powerpc specific do_page_fault
Expand Down Expand Up @@ -100,7 +100,7 @@ EXPORT_SYMBOL_GPL(copro_handle_mm_fault);

int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
{
u64 vsid;
u64 vsid, vsidkey;
int psize, ssize;

switch (REGION_ID(ea)) {
Expand All @@ -109,6 +109,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
psize = get_slice_psize(mm, ea);
ssize = user_segment_size(ea);
vsid = get_vsid(mm->context.id, ea, ssize);
vsidkey = SLB_VSID_USER;
break;
case VMALLOC_REGION_ID:
pr_devel("%s: 0x%llx -- VMALLOC_REGION_ID\n", __func__, ea);
Expand All @@ -118,19 +119,21 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb)
psize = mmu_io_psize;
ssize = mmu_kernel_ssize;
vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
vsidkey = SLB_VSID_KERNEL;
break;
case KERNEL_REGION_ID:
pr_devel("%s: 0x%llx -- KERNEL_REGION_ID\n", __func__, ea);
psize = mmu_linear_psize;
ssize = mmu_kernel_ssize;
vsid = get_kernel_vsid(ea, mmu_kernel_ssize);
vsidkey = SLB_VSID_KERNEL;
break;
default:
pr_debug("%s: invalid region access at %016llx\n", __func__, ea);
return 1;
}

vsid = (vsid << slb_vsid_shift(ssize)) | SLB_VSID_USER;
vsid = (vsid << slb_vsid_shift(ssize)) | vsidkey;

vsid |= mmu_psize_defs[psize].sllp |
((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/mm/hash_native_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <asm/kexec.h>
#include <asm/ppc-opcode.h>

#include <misc/cxl.h>
#include <misc/cxl-base.h>

#ifdef DEBUG_LOW
#define DBG_LOW(fmt...) udbg_printf(fmt)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powernv/pci-ioda.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <asm/firmware.h>
#include <asm/pnv-pci.h>

#include <misc/cxl.h>
#include <misc/cxl-base.h>

#include "powernv.h"
#include "pci.h"
Expand Down
4 changes: 3 additions & 1 deletion drivers/misc/cxl/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cxl-y += main.o file.o irq.o fault.o native.o context.o sysfs.o debugfs.o pci.o trace.o
cxl-y += main.o file.o irq.o fault.o native.o
cxl-y += context.o sysfs.o debugfs.o pci.o trace.o
cxl-y += vphb.o api.o
obj-$(CONFIG_CXL) += cxl.o
obj-$(CONFIG_CXL_BASE) += base.o

Expand Down
Loading