forked from Minki/linux
powerpc fixes for 4.6 #3
- cxl: Keep IRQ mappings on context teardown from Michael Neuling - cxl: Poll for outstanding IRQs when detaching a context from Michael Neuling - Wire up preadv2 and pwritev2 syscalls from Rui Salvaterra -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJXI2HxAAoJEFHr6jzI4aWAfLgP/jxD+kfBtrK6KJXq5BVM+IWr aevVTVCgv3F8yOiI0ZPyOSh7B23dP8nBGYcejpTxyQcb8lox20WL6Q+om7H+BleC yrb9/sGzvJXIdazqMF77fzDjTHjjAMNizi9f82+8OzrghtQj8GJNogKwydIXe3QB +27kZcbkpXhdJZ/V0qmsWCAMV+sdaW0BW3DREQ0jFf0k08I0HMHiyN/zrqwadLjU Qx7af0iENdSRXtve1vGI41lflDPTaou39Y4NyUHfar1zGtt2rktrl5z16lmPC9nw gio6CsTIKwjsWRZugzrAlPXaToZKGgCGmW634RRfBMkjOnFoEGk0/GN2w0A+wjp4 +jYq8v+2jss74Ngq12/NmIbB+b8iFsKsN7b0UPZnf91PsAKlprB6iDbCw35KSHgi MLB8cOeEGBg+nm+ZSdrylyOa7RSJv3dK7cfEegtpXRAdxGwVAwCpjXvBqA+fdyUi dfg2ChHJ91GWs3+ljPd/ee+OTPq3jY+o6PL/lQBaGhC6XuxrFQTsm537pNzlH6wf sUZzF5duf1jpRvnpeGgzAMUqYHz7W/NbiHKVV8EC18jSDnc/7BANfVxENBk1Vk+o 2CdVWS26hDTUkRKdx+JbDRsStD1XxBgmBD37tEaDuD49VvbkqHB5yarjqAphM+zY Pf3WwyuXpfsB1ppjrzCM =4O+o -----END PGP SIGNATURE----- Merge tag 'powerpc-4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux Pull powerpc fixes from Michael Ellerman: "A few more powerpc fixes for 4.6: - cxl: Keep IRQ mappings on context teardown from Michael Neuling - cxl: Poll for outstanding IRQs when detaching a context from Michael Neuling - Wire up preadv2 and pwritev2 syscalls from Rui Salvaterra" * tag 'powerpc-4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc: wire up preadv2 and pwritev2 syscalls cxl: Poll for outstanding IRQs when detaching a context cxl: Keep IRQ mappings on context teardown
This commit is contained in:
commit
1b46bac627
@ -384,3 +384,5 @@ SYSCALL(ni_syscall)
|
||||
SYSCALL(ni_syscall)
|
||||
SYSCALL(mlock2)
|
||||
SYSCALL(copy_file_range)
|
||||
COMPAT_SYS_SPU(preadv2)
|
||||
COMPAT_SYS_SPU(pwritev2)
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <uapi/asm/unistd.h>
|
||||
|
||||
|
||||
#define NR_syscalls 380
|
||||
#define NR_syscalls 382
|
||||
|
||||
#define __NR__exit __NR_exit
|
||||
|
||||
|
@ -390,5 +390,7 @@
|
||||
#define __NR_membarrier 365
|
||||
#define __NR_mlock2 378
|
||||
#define __NR_copy_file_range 379
|
||||
#define __NR_preadv2 380
|
||||
#define __NR_pwritev2 381
|
||||
|
||||
#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
|
||||
|
@ -223,6 +223,13 @@ int __detach_context(struct cxl_context *ctx)
|
||||
cxl_ops->link_ok(ctx->afu->adapter, ctx->afu));
|
||||
flush_work(&ctx->fault_work); /* Only needed for dedicated process */
|
||||
|
||||
/*
|
||||
* Wait until no further interrupts are presented by the PSL
|
||||
* for this context.
|
||||
*/
|
||||
if (cxl_ops->irq_wait)
|
||||
cxl_ops->irq_wait(ctx);
|
||||
|
||||
/* release the reference to the group leader and mm handling pid */
|
||||
put_pid(ctx->pid);
|
||||
put_pid(ctx->glpid);
|
||||
|
@ -274,6 +274,7 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0};
|
||||
#define CXL_PSL_DSISR_An_PE (1ull << (63-4)) /* PSL Error (implementation specific) */
|
||||
#define CXL_PSL_DSISR_An_AE (1ull << (63-5)) /* AFU Error */
|
||||
#define CXL_PSL_DSISR_An_OC (1ull << (63-6)) /* OS Context Warning */
|
||||
#define CXL_PSL_DSISR_PENDING (CXL_PSL_DSISR_TRANS | CXL_PSL_DSISR_An_PE | CXL_PSL_DSISR_An_AE | CXL_PSL_DSISR_An_OC)
|
||||
/* NOTE: Bits 32:63 are undefined if DSISR[DS] = 1 */
|
||||
#define CXL_PSL_DSISR_An_M DSISR_NOHPTE /* PTE not found */
|
||||
#define CXL_PSL_DSISR_An_P DSISR_PROTFAULT /* Storage protection violation */
|
||||
@ -855,6 +856,7 @@ struct cxl_backend_ops {
|
||||
u64 dsisr, u64 errstat);
|
||||
irqreturn_t (*psl_interrupt)(int irq, void *data);
|
||||
int (*ack_irq)(struct cxl_context *ctx, u64 tfc, u64 psl_reset_mask);
|
||||
void (*irq_wait)(struct cxl_context *ctx);
|
||||
int (*attach_process)(struct cxl_context *ctx, bool kernel,
|
||||
u64 wed, u64 amr);
|
||||
int (*detach_process)(struct cxl_context *ctx);
|
||||
|
@ -203,7 +203,6 @@ unsigned int cxl_map_irq(struct cxl *adapter, irq_hw_number_t hwirq,
|
||||
void cxl_unmap_irq(unsigned int virq, void *cookie)
|
||||
{
|
||||
free_irq(virq, cookie);
|
||||
irq_dispose_mapping(virq);
|
||||
}
|
||||
|
||||
int cxl_register_one_irq(struct cxl *adapter,
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/delay.h>
|
||||
#include <asm/synch.h>
|
||||
#include <misc/cxl-base.h>
|
||||
|
||||
@ -797,6 +798,35 @@ static irqreturn_t native_irq_multiplexed(int irq, void *data)
|
||||
return fail_psl_irq(afu, &irq_info);
|
||||
}
|
||||
|
||||
void native_irq_wait(struct cxl_context *ctx)
|
||||
{
|
||||
u64 dsisr;
|
||||
int timeout = 1000;
|
||||
int ph;
|
||||
|
||||
/*
|
||||
* Wait until no further interrupts are presented by the PSL
|
||||
* for this context.
|
||||
*/
|
||||
while (timeout--) {
|
||||
ph = cxl_p2n_read(ctx->afu, CXL_PSL_PEHandle_An) & 0xffff;
|
||||
if (ph != ctx->pe)
|
||||
return;
|
||||
dsisr = cxl_p2n_read(ctx->afu, CXL_PSL_DSISR_An);
|
||||
if ((dsisr & CXL_PSL_DSISR_PENDING) == 0)
|
||||
return;
|
||||
/*
|
||||
* We are waiting for the workqueue to process our
|
||||
* irq, so need to let that run here.
|
||||
*/
|
||||
msleep(1);
|
||||
}
|
||||
|
||||
dev_warn(&ctx->afu->dev, "WARNING: waiting on DSI for PE %i"
|
||||
" DSISR %016llx!\n", ph, dsisr);
|
||||
return;
|
||||
}
|
||||
|
||||
static irqreturn_t native_slice_irq_err(int irq, void *data)
|
||||
{
|
||||
struct cxl_afu *afu = data;
|
||||
@ -1076,6 +1106,7 @@ const struct cxl_backend_ops cxl_native_ops = {
|
||||
.handle_psl_slice_error = native_handle_psl_slice_error,
|
||||
.psl_interrupt = NULL,
|
||||
.ack_irq = native_ack_irq,
|
||||
.irq_wait = native_irq_wait,
|
||||
.attach_process = native_attach_process,
|
||||
.detach_process = native_detach_process,
|
||||
.support_attributes = native_support_attributes,
|
||||
|
Loading…
Reference in New Issue
Block a user