Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ab063cf
powerpc: Add MSI operations to pci_controller_ops struct
daxtens Apr 14, 2015
4c22ddc
powerpc/powernv: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
8c0c018
powerpc/cell: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
8c93327
powerpc/pseries: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
c07e8f0
powerpc/fsl_msi: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
d72ded8
powerpc/ppc4xx_msi: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
a65a8ae
powerpc/ppc4xx_hsta_msi: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
bc83830
powerpc/pasemi: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
248d8b6
powerpc/mpic_u3msi: Move MSI-related ops to pci_controller_ops
daxtens Apr 14, 2015
9c186e0
powerpc: Remove MSI-related PCI controller ops from ppc_md
daxtens Apr 14, 2015
8220eeb
powerpc/powernv: Specialise pci_controller_ops for each controller type
daxtens Apr 28, 2015
2a5b688
powerpc/pci: add dma_set_mask to pci_controller_ops
daxtens Apr 28, 2015
25b36d0
powerpc/powernv: Move dma_set_mask() from pnv_phb to pci_controller_ops
daxtens Apr 28, 2015
4838158
cxl: Use call_rcu to reduce latency when releasing the afu fd
May 8, 2015
c3d5d91
powerpc/copro: Fix faulting kernel segments
mikey May 19, 2015
0972590
powerpc/pci: Export symbols for CXL
daxtens May 19, 2015
6405380
powerpc/pci: Add release_device() hook to phb ops
mikey May 19, 2015
814ec73
powerpc: Add cxl context to device archdata
mikey May 19, 2015
94645f2
cxl: Document external user of existing API
mikey May 19, 2015
7532aa0
cxl: Add shutdown hook
mikey May 19, 2015
9b83899
cxl: Re-order card init to check the VSEC earlier
mikey May 19, 2015
f4d2c43
cxl: Dump debug info on the AFU configuration record
mikey May 19, 2015
5e91ccb
cxl: Add cookie parameter to afu_release_irqs()
mikey May 19, 2015
5e8ecd9
cxl: Rework detach context functions
mikey May 19, 2015
67278e7
cxl: cxl_afu_reset() -> __cxl_afu_reset()
mikey May 19, 2015
c8ccf21
cxl: Export some symbols
mikey May 19, 2015
9843f03
cxl: Only check pid for userspace contexts
mikey May 19, 2015
680e78d
cxl: Split afu_register_irqs() function
mikey May 19, 2015
a083f06
cxl: Configure PSL for kernel contexts
mikey May 19, 2015
17e1c51
cxl: Cleanup Makefile
mikey May 19, 2015
5af30b1
cxl: Move include file cxl.h -> cxl-base.h
mikey May 19, 2015
ce3de26
cxl: Export file ops for use by API
mikey May 19, 2015
8013edc
cxl: Add AFU virtual PHB and kernel API
mikey May 19, 2015
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
22 changes: 22 additions & 0 deletions Documentation/ABI/testing/sysfs-class-cxl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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 +25,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 +50,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 +64,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 +101,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 +127,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 +139,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 +163,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 +180,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 +203,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
6 changes: 0 additions & 6 deletions arch/powerpc/include/asm/machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ struct machdep_calls {
/* To setup PHBs when using automatic OF platform driver for PCI */
int (*pci_setup_phb)(struct pci_controller *host);

#ifdef CONFIG_PCI_MSI
int (*setup_msi_irqs)(struct pci_dev *dev,
int nvec, int type);
void (*teardown_msi_irqs)(struct pci_dev *dev);
#endif

void (*restart)(char *cmd);
void (*halt)(void);
void (*panic)(char *str);
Expand Down
10 changes: 10 additions & 0 deletions arch/powerpc/include/asm/pci-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@ 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);

#ifdef CONFIG_PCI_MSI
int (*setup_msi_irqs)(struct pci_dev *dev,
int nvec, int type);
void (*teardown_msi_irqs)(struct pci_dev *dev);
#endif

int (*dma_set_mask)(struct pci_dev *dev, u64 dma_mask);
};

/*
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
8 changes: 8 additions & 0 deletions arch/powerpc/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
{
if (ppc_md.dma_set_mask)
return ppc_md.dma_set_mask(dev, dma_mask);

if (dev_is_pci(dev)) {
struct pci_dev *pdev = to_pci_dev(dev);
struct pci_controller *phb = pci_bus_to_host(pdev->bus);
if (phb->controller_ops.dma_set_mask)
return phb->controller_ops.dma_set_mask(pdev, dma_mask);
}

return __dma_set_mask(dev, dma_mask);
}
EXPORT_SYMBOL(dma_set_mask);
Expand Down
11 changes: 8 additions & 3 deletions arch/powerpc/kernel/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) {
struct pci_controller *phb = pci_bus_to_host(dev->bus);

if (!phb->controller_ops.setup_msi_irqs ||
!phb->controller_ops.teardown_msi_irqs) {
pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
return -ENOSYS;
}
Expand All @@ -24,10 +27,12 @@ int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
if (type == PCI_CAP_ID_MSI && nvec > 1)
return 1;

return ppc_md.setup_msi_irqs(dev, nvec, type);
return phb->controller_ops.setup_msi_irqs(dev, nvec, type);
}

void arch_teardown_msi_irqs(struct pci_dev *dev)
{
ppc_md.teardown_msi_irqs(dev);
struct pci_controller *phb = pci_bus_to_host(dev->bus);

phb->controller_ops.teardown_msi_irqs(dev);
}
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
Loading