Skip to contentSkip to conversation

ocxl: Move SPA and TL definitions

PATCH New christophe lombard 1 participant 3 messages Oct 16, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ocxl: Move SPA and TL definitions

This series moves the definition and the management of scheduled process area (SPA) and of the templates (Transaction Layer) for an ocxl card, using the OCAPI interface. The code is now located in the specific arch powerpc platform.
These patches will help for a futur implementation of the ocxl driver in QEMU.

The Open Coherently Attached Processor Interface (OCAPI) is used to allow an Attached Functional Unit (AFU) to connect to the Processor Chip's system bus in a high speed and cache coherent manner.

The Scheduled Processes Area and the configuration of the Transaction Layer are specific to the AFU and more generally to the Opencapi device. Running the ocxl module in a guest environment, and later in several guests in parallel, using the same Opencapi device and the same AFus, involves to have a common code handling the SPA. This explains why these parts of the ocxl driver will move to arch powerpc platform running on the host.

It builds on top of the existing ocxl driver.

It has been tested in a bare-metal environment using the memcpy and the AFP AFUs.

Changelog:
v2:
- patch 1: delete debug message as it no longer makes sense. (Fred) Rename pnv_ocxl_read_xsl_regs to pnv_ocxl_get_fault_state. (Fred) Rename pnv_ocxl_write_xsl_tfc to pnv_ocxl_handle_fault. (Fred) Call opal_npu_spa_clear_cache() internally without using external function. (Fred)
Remove pe_handle parameter from pnv_ocxl_update_pe() (Fred) Not possible to split this patch in 2 (one part for the SPA handling, the other for the translation fault interrupt). There are far too many dependencies with the SPA structure. (Fred) Switch the order of the pe_data allocation and the call to add the entry in the SPA. (Fred)

christophe lombard (2):
powerpc/powernv: ocxl move SPA definition
powerpc/powernv: ocxl move TL definition

 arch/powerpc/include/asm/pnv-ocxl.h   |  46 +--
 arch/powerpc/platforms/powernv/ocxl.c | 400 +++++++++++++++++++++++---
 drivers/misc/ocxl/afu_irq.c           |   1 -
 drivers/misc/ocxl/config.c            |  89 +-----
 drivers/misc/ocxl/link.c              | 383 ++++++------------------
 drivers/misc/ocxl/ocxl_internal.h     |  12 -
 drivers/misc/ocxl/trace.h             |  64 ++---
 7 files changed, 508 insertions(+), 487 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/2 powerpc/powernv: ocxl move SPA definition

The Scheduled Process Area, located in system momory, contains a list of Scheduled Processes (Structure of Process Element) to be serviced by the AFUs. The process elements contain the address context and other state information for the processes scheduled to run on the AFUs. Update, rename and create new few platform-specific calls which can be used by drivers.

The following elements have been moved to the specific arch powerpc platform location:
- Definition and allocation of the SPA.
- Rename pnv_ocxl_spa_* apis to pnv_ocxl_platform_*
- Translation fault interrupt.

No functional change.

---
 arch/powerpc/include/asm/pnv-ocxl.h   |  46 ++--
 arch/powerpc/platforms/powernv/ocxl.c | 297 +++++++++++++++++---
 drivers/misc/ocxl/afu_irq.c           |   1 -
 drivers/misc/ocxl/link.c              | 383 +++++++-------------------
 drivers/misc/ocxl/ocxl_internal.h     |  12 -
 drivers/misc/ocxl/trace.h             |  64 ++---
 6 files changed, 412 insertions(+), 391 deletions(-)
arch/powerpc/include/asm/pnv-ocxl.h +25 -21
index 7de82647e761..e53d2981ba2f 100644
@@ -9,28 +9,32 @@
 #define PNV_OCXL_TL_BITS_PER_RATE       4
 #define PNV_OCXL_TL_RATE_BUF_SIZE       ((PNV_OCXL_TL_MAX_TEMPLATE+1) * PNV_OCXL_TL_BITS_PER_RATE / 8)
 
-extern int pnv_ocxl_get_actag(struct pci_dev *dev, u16 *base, u16 *enabled,
-			u16 *supported);
-extern int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *count);
+int pnv_ocxl_get_actag(struct pci_dev *dev, u16 *base,
+		       u16 *enabled, u16 *supported);
+int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *count);
 
-extern int pnv_ocxl_get_tl_cap(struct pci_dev *dev, long *cap,
+int pnv_ocxl_get_tl_cap(struct pci_dev *dev, long *cap,
 			char *rate_buf, int rate_buf_size);
-extern int pnv_ocxl_set_tl_conf(struct pci_dev *dev, long cap,
-			uint64_t rate_buf_phys, int rate_buf_size);
-
-extern int pnv_ocxl_get_xsl_irq(struct pci_dev *dev, int *hwirq);
-extern void pnv_ocxl_unmap_xsl_regs(void __iomem *dsisr, void __iomem *dar,
-				void __iomem *tfc, void __iomem *pe_handle);
-extern int pnv_ocxl_map_xsl_regs(struct pci_dev *dev, void __iomem **dsisr,
-				void __iomem **dar, void __iomem **tfc,
-				void __iomem **pe_handle);
-
-extern int pnv_ocxl_spa_setup(struct pci_dev *dev, void *spa_mem, int PE_mask,
-			void **platform_data);
-extern void pnv_ocxl_spa_release(void *platform_data);
-extern int pnv_ocxl_spa_remove_pe_from_cache(void *platform_data, int pe_handle);
-
-extern int pnv_ocxl_alloc_xive_irq(u32 *irq, u64 *trigger_addr);
-extern void pnv_ocxl_free_xive_irq(u32 irq);
+int pnv_ocxl_set_tl_conf(struct pci_dev *dev, long cap,
+			 u64 rate_buf_phys,
+			 int rate_buf_size);
+
+int pnv_ocxl_platform_setup(struct pci_dev *dev,
+			    int PE_mask, int *hwirq,
+			    void **platform_data);
+void pnv_ocxl_platform_release(void *platform_data);
+
+void pnv_ocxl_get_fault_state(void *platform_data, u64 *dsisr,
+			      u64 *dar, u64 *pe, int *pid);
+void pnv_ocxl_handle_fault(void *platform_data, u64 tfc);
+
+int pnv_ocxl_alloc_xive_irq(u32 *irq, u64 *trigger_addr);
+void pnv_ocxl_free_xive_irq(u32 irq);
+
+int pnv_ocxl_set_pe(void *platform_data, int lpid, int pasid,
+		    u32 pidr, u32 tidr, u64 amr, int *pe_handle);
+int pnv_ocxl_update_pe(void *platform_data, int pasid, __u16 tid);
+int pnv_ocxl_remove_pe(void *platform_data, int pasid, u32 *pid,
+		       u32 *tid, int *pe_handle);
 
 #endif /* _ASM_PNV_OCXL_H */
arch/powerpc/platforms/powernv/ocxl.c +265 -32

365 lines not on this page · raw message

drivers/misc/ocxl/afu_irq.c +0 -1
index 70f8f1c3929d..b9150da0ea6b 100644
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 // Copyright 2017 IBM Corp.
 #include <linux/interrupt.h>
-#include <asm/pnv-ocxl.h>
 #include "ocxl_internal.h"
 #include "trace.h"
 
drivers/misc/ocxl/link.c +93 -290

609 lines not on this page · raw message

drivers/misc/ocxl/ocxl_internal.h +0 -12
index 97415afd79f3..6e1e9cd315c0 100644
@@ -82,18 +82,6 @@ struct ocxl_context {
 	u16 tidr; // Thread ID used for P9 wait implementation
 };
 
-struct ocxl_process_element {
-	__be64 config_state;
-	__be32 reserved1[11];
-	__be32 lpid;
-	__be32 tid;
-	__be32 pid;
-	__be32 reserved2[10];
-	__be64 amr;
-	__be32 reserved3[3];
-	__be32 software_state;
-};
-
 int ocxl_create_cdev(struct ocxl_afu *afu);
 void ocxl_destroy_cdev(struct ocxl_afu *afu);
 int ocxl_file_register_afu(struct ocxl_afu *afu);
drivers/misc/ocxl/trace.h +29 -35

136 lines not on this page · raw message

Signature · 1 line
2.21.0
#2 lore raw

PATCH v2 2/2 powerpc/powernv: ocxl move TL definition

In reply to christophe lombard

Specifies the templates in the Transaction Layer that the OpenCAPI device/host support when transmitting/receiving DL/DLX frames to or from the OpenCAPI device/host.
Update, rename and create new few platform-specific calls which can be used by drivers.

No functional change.

---
 arch/powerpc/include/asm/pnv-ocxl.h   |   6 +-
 arch/powerpc/platforms/powernv/ocxl.c | 103 ++++++++++++++++++++++++--
 drivers/misc/ocxl/config.c            |  89 +---------------------
 3 files changed, 99 insertions(+), 99 deletions(-)
arch/powerpc/include/asm/pnv-ocxl.h +1 -5
index e53d2981ba2f..e8d2b3aac558 100644
@@ -13,11 +13,7 @@ int pnv_ocxl_get_actag(struct pci_dev *dev, u16 *base,
 		       u16 *enabled, u16 *supported);
 int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *count);
 
-int pnv_ocxl_get_tl_cap(struct pci_dev *dev, long *cap,
-			char *rate_buf, int rate_buf_size);
-int pnv_ocxl_set_tl_conf(struct pci_dev *dev, long cap,
-			 u64 rate_buf_phys,
-			 int rate_buf_size);
+int pnv_ocxl_set_TL(struct pci_dev *dev, int tl_dvsec);
 
 int pnv_ocxl_platform_setup(struct pci_dev *dev,
 			    int PE_mask, int *hwirq,
arch/powerpc/platforms/powernv/ocxl.c +97 -6

122 lines not on this page · raw message

drivers/misc/ocxl/config.c +1 -88

101 lines not on this page · raw message

Signature · 1 line
2.21.0