10d17de03SHaren Myneni // SPDX-License-Identifier: GPL-2.0+ 20d17de03SHaren Myneni /* 30d17de03SHaren Myneni * VAS Fault handling. 40d17de03SHaren Myneni * Copyright 2019, IBM Corporation 50d17de03SHaren Myneni */ 60d17de03SHaren Myneni 70d17de03SHaren Myneni #define pr_fmt(fmt) "vas: " fmt 80d17de03SHaren Myneni 90d17de03SHaren Myneni #include <linux/kernel.h> 100d17de03SHaren Myneni #include <linux/types.h> 110d17de03SHaren Myneni #include <linux/slab.h> 120d17de03SHaren Myneni #include <linux/uaccess.h> 130d17de03SHaren Myneni #include <linux/kthread.h> 14c96c4436SHaren Myneni #include <linux/sched/signal.h> 159774628aSHaren Myneni #include <linux/mmu_context.h> 160d17de03SHaren Myneni #include <asm/icswx.h> 170d17de03SHaren Myneni 180d17de03SHaren Myneni #include "vas.h" 190d17de03SHaren Myneni 200d17de03SHaren Myneni /* 210d17de03SHaren Myneni * The maximum FIFO size for fault window can be 8MB 220d17de03SHaren Myneni * (VAS_RX_FIFO_SIZE_MAX). Using 4MB FIFO since each VAS 230d17de03SHaren Myneni * instance will be having fault window. 240d17de03SHaren Myneni * 8MB FIFO can be used if expects more faults for each VAS 250d17de03SHaren Myneni * instance. 260d17de03SHaren Myneni */ 270d17de03SHaren Myneni #define VAS_FAULT_WIN_FIFO_SIZE (4 << 20) 280d17de03SHaren Myneni 29cf33e1e9SHaren Myneni static void dump_crb(struct coprocessor_request_block *crb) 30cf33e1e9SHaren Myneni { 31cf33e1e9SHaren Myneni struct data_descriptor_entry *dde; 32cf33e1e9SHaren Myneni struct nx_fault_stamp *nx; 33cf33e1e9SHaren Myneni 34cf33e1e9SHaren Myneni dde = &crb->source; 35cf33e1e9SHaren Myneni pr_devel("SrcDDE: addr 0x%llx, len %d, count %d, idx %d, flags %d\n", 36cf33e1e9SHaren Myneni be64_to_cpu(dde->address), be32_to_cpu(dde->length), 37cf33e1e9SHaren Myneni dde->count, dde->index, dde->flags); 38cf33e1e9SHaren Myneni 39cf33e1e9SHaren Myneni dde = &crb->target; 40cf33e1e9SHaren Myneni pr_devel("TgtDDE: addr 0x%llx, len %d, count %d, idx %d, flags %d\n", 41cf33e1e9SHaren Myneni be64_to_cpu(dde->address), be32_to_cpu(dde->length), 42cf33e1e9SHaren Myneni dde->count, dde->index, dde->flags); 43cf33e1e9SHaren Myneni 44cf33e1e9SHaren Myneni nx = &crb->stamp.nx; 45cf33e1e9SHaren Myneni pr_devel("NX Stamp: PSWID 0x%x, FSA 0x%llx, flags 0x%x, FS 0x%x\n", 46cf33e1e9SHaren Myneni be32_to_cpu(nx->pswid), 47cf33e1e9SHaren Myneni be64_to_cpu(crb->stamp.nx.fault_storage_addr), 48cf33e1e9SHaren Myneni nx->flags, nx->fault_status); 49cf33e1e9SHaren Myneni } 50cf33e1e9SHaren Myneni 510d17de03SHaren Myneni /* 52c96c4436SHaren Myneni * Update the CSB to indicate a translation error. 53c96c4436SHaren Myneni * 54c96c4436SHaren Myneni * User space will be polling on CSB after the request is issued. 55c96c4436SHaren Myneni * If NX can handle the request without any issues, it updates CSB. 56c96c4436SHaren Myneni * Whereas if NX encounters page fault, the kernel will handle the 57c96c4436SHaren Myneni * fault and update CSB with translation error. 58c96c4436SHaren Myneni * 59c96c4436SHaren Myneni * If we are unable to update the CSB means copy_to_user failed due to 60c96c4436SHaren Myneni * invalid csb_addr, send a signal to the process. 61c96c4436SHaren Myneni */ 62c96c4436SHaren Myneni static void update_csb(struct vas_window *window, 63c96c4436SHaren Myneni struct coprocessor_request_block *crb) 64c96c4436SHaren Myneni { 65c96c4436SHaren Myneni struct coprocessor_status_block csb; 66c96c4436SHaren Myneni struct kernel_siginfo info; 67c96c4436SHaren Myneni struct task_struct *tsk; 68c96c4436SHaren Myneni void __user *csb_addr; 69c96c4436SHaren Myneni struct pid *pid; 70c96c4436SHaren Myneni int rc; 71c96c4436SHaren Myneni 72c96c4436SHaren Myneni /* 73c96c4436SHaren Myneni * NX user space windows can not be opened for task->mm=NULL 74c96c4436SHaren Myneni * and faults will not be generated for kernel requests. 75c96c4436SHaren Myneni */ 76c96c4436SHaren Myneni if (WARN_ON_ONCE(!window->mm || !window->user_win)) 77c96c4436SHaren Myneni return; 78c96c4436SHaren Myneni 79c96c4436SHaren Myneni csb_addr = (void __user *)be64_to_cpu(crb->csb_addr); 80c96c4436SHaren Myneni 81c96c4436SHaren Myneni memset(&csb, 0, sizeof(csb)); 82c96c4436SHaren Myneni csb.cc = CSB_CC_TRANSLATION; 83c96c4436SHaren Myneni csb.ce = CSB_CE_TERMINATION; 84c96c4436SHaren Myneni csb.cs = 0; 85c96c4436SHaren Myneni csb.count = 0; 86c96c4436SHaren Myneni 87c96c4436SHaren Myneni /* 88c96c4436SHaren Myneni * NX operates and returns in BE format as defined CRB struct. 89c96c4436SHaren Myneni * So saves fault_storage_addr in BE as NX pastes in FIFO and 90c96c4436SHaren Myneni * expects user space to convert to CPU format. 91c96c4436SHaren Myneni */ 92c96c4436SHaren Myneni csb.address = crb->stamp.nx.fault_storage_addr; 93c96c4436SHaren Myneni csb.flags = 0; 94c96c4436SHaren Myneni 95c96c4436SHaren Myneni pid = window->pid; 96c96c4436SHaren Myneni tsk = get_pid_task(pid, PIDTYPE_PID); 97c96c4436SHaren Myneni /* 98c96c4436SHaren Myneni * Process closes send window after all pending NX requests are 99c96c4436SHaren Myneni * completed. In multi-thread applications, a child thread can 100c96c4436SHaren Myneni * open a window and can exit without closing it. May be some 101c96c4436SHaren Myneni * requests are pending or this window can be used by other 102c96c4436SHaren Myneni * threads later. We should handle faults if NX encounters 103c96c4436SHaren Myneni * pages faults on these requests. Update CSB with translation 104c96c4436SHaren Myneni * error and fault address. If csb_addr passed by user space is 105c96c4436SHaren Myneni * invalid, send SEGV signal to pid saved in window. If the 106c96c4436SHaren Myneni * child thread is not running, send the signal to tgid. 107c96c4436SHaren Myneni * Parent thread (tgid) will close this window upon its exit. 108c96c4436SHaren Myneni * 109c96c4436SHaren Myneni * pid and mm references are taken when window is opened by 110c96c4436SHaren Myneni * process (pid). So tgid is used only when child thread opens 111c96c4436SHaren Myneni * a window and exits without closing it. 112c96c4436SHaren Myneni */ 113c96c4436SHaren Myneni if (!tsk) { 114c96c4436SHaren Myneni pid = window->tgid; 115c96c4436SHaren Myneni tsk = get_pid_task(pid, PIDTYPE_PID); 116c96c4436SHaren Myneni /* 117c96c4436SHaren Myneni * Parent thread (tgid) will be closing window when it 118c96c4436SHaren Myneni * exits. So should not get here. 119c96c4436SHaren Myneni */ 120c96c4436SHaren Myneni if (WARN_ON_ONCE(!tsk)) 121c96c4436SHaren Myneni return; 122c96c4436SHaren Myneni } 123c96c4436SHaren Myneni 124c96c4436SHaren Myneni /* Return if the task is exiting. */ 125c96c4436SHaren Myneni if (tsk->flags & PF_EXITING) { 126c96c4436SHaren Myneni put_task_struct(tsk); 127c96c4436SHaren Myneni return; 128c96c4436SHaren Myneni } 129c96c4436SHaren Myneni 130c96c4436SHaren Myneni use_mm(window->mm); 131c96c4436SHaren Myneni rc = copy_to_user(csb_addr, &csb, sizeof(csb)); 132c96c4436SHaren Myneni /* 133c96c4436SHaren Myneni * User space polls on csb.flags (first byte). So add barrier 134c96c4436SHaren Myneni * then copy first byte with csb flags update. 135c96c4436SHaren Myneni */ 136c96c4436SHaren Myneni if (!rc) { 137c96c4436SHaren Myneni csb.flags = CSB_V; 138c96c4436SHaren Myneni /* Make sure update to csb.flags is visible now */ 139c96c4436SHaren Myneni smp_mb(); 140c96c4436SHaren Myneni rc = copy_to_user(csb_addr, &csb, sizeof(u8)); 141c96c4436SHaren Myneni } 142c96c4436SHaren Myneni unuse_mm(window->mm); 143c96c4436SHaren Myneni put_task_struct(tsk); 144c96c4436SHaren Myneni 145c96c4436SHaren Myneni /* Success */ 146c96c4436SHaren Myneni if (!rc) 147c96c4436SHaren Myneni return; 148c96c4436SHaren Myneni 149c96c4436SHaren Myneni pr_debug("Invalid CSB address 0x%p signalling pid(%d)\n", 150c96c4436SHaren Myneni csb_addr, pid_vnr(pid)); 151c96c4436SHaren Myneni 152c96c4436SHaren Myneni clear_siginfo(&info); 153c96c4436SHaren Myneni info.si_signo = SIGSEGV; 154c96c4436SHaren Myneni info.si_errno = EFAULT; 155c96c4436SHaren Myneni info.si_code = SEGV_MAPERR; 156c96c4436SHaren Myneni info.si_addr = csb_addr; 157c96c4436SHaren Myneni 158c96c4436SHaren Myneni /* 159c96c4436SHaren Myneni * process will be polling on csb.flags after request is sent to 160c96c4436SHaren Myneni * NX. So generally CSB update should not fail except when an 161c96c4436SHaren Myneni * application passes invalid csb_addr. So an error message will 162c96c4436SHaren Myneni * be displayed and leave it to user space whether to ignore or 163c96c4436SHaren Myneni * handle this signal. 164c96c4436SHaren Myneni */ 165c96c4436SHaren Myneni rcu_read_lock(); 166c96c4436SHaren Myneni rc = kill_pid_info(SIGSEGV, &info, pid); 167c96c4436SHaren Myneni rcu_read_unlock(); 168c96c4436SHaren Myneni 169c96c4436SHaren Myneni pr_devel("%s(): pid %d kill_proc_info() rc %d\n", __func__, 170c96c4436SHaren Myneni pid_vnr(pid), rc); 171c96c4436SHaren Myneni } 172c96c4436SHaren Myneni 173cf33e1e9SHaren Myneni static void dump_fifo(struct vas_instance *vinst, void *entry) 174cf33e1e9SHaren Myneni { 175cf33e1e9SHaren Myneni unsigned long *end = vinst->fault_fifo + vinst->fault_fifo_size; 176cf33e1e9SHaren Myneni unsigned long *fifo = entry; 177cf33e1e9SHaren Myneni int i; 178cf33e1e9SHaren Myneni 179cf33e1e9SHaren Myneni pr_err("Fault fifo size %d, Max crbs %d\n", vinst->fault_fifo_size, 180cf33e1e9SHaren Myneni vinst->fault_fifo_size / CRB_SIZE); 181cf33e1e9SHaren Myneni 182cf33e1e9SHaren Myneni /* Dump 10 CRB entries or until end of FIFO */ 183cf33e1e9SHaren Myneni pr_err("Fault FIFO Dump:\n"); 184cf33e1e9SHaren Myneni for (i = 0; i < 10*(CRB_SIZE/8) && fifo < end; i += 4, fifo += 4) { 185cf33e1e9SHaren Myneni pr_err("[%.3d, %p]: 0x%.16lx 0x%.16lx 0x%.16lx 0x%.16lx\n", 186cf33e1e9SHaren Myneni i, fifo, *fifo, *(fifo+1), *(fifo+2), *(fifo+3)); 187cf33e1e9SHaren Myneni } 188cf33e1e9SHaren Myneni } 189cf33e1e9SHaren Myneni 190c96c4436SHaren Myneni /* 1919774628aSHaren Myneni * Process valid CRBs in fault FIFO. 1929774628aSHaren Myneni * NX process user space requests, return credit and update the status 1939774628aSHaren Myneni * in CRB. If it encounters transalation error when accessing CRB or 1949774628aSHaren Myneni * request buffers, raises interrupt on the CPU to handle the fault. 1959774628aSHaren Myneni * It takes credit on fault window, updates nx_fault_stamp in CRB with 1969774628aSHaren Myneni * the following information and pastes CRB in fault FIFO. 1979774628aSHaren Myneni * 1989774628aSHaren Myneni * pswid - window ID of the window on which the request is sent. 1999774628aSHaren Myneni * fault_storage_addr - fault address 2009774628aSHaren Myneni * 2019774628aSHaren Myneni * It can raise a single interrupt for multiple faults. Expects OS to 2029774628aSHaren Myneni * process all valid faults and return credit for each fault on user 2039774628aSHaren Myneni * space and fault windows. This fault FIFO control will be done with 2049774628aSHaren Myneni * credit mechanism. NX can continuously paste CRBs until credits are not 2059774628aSHaren Myneni * available on fault window. Otherwise, returns with RMA_reject. 2069774628aSHaren Myneni * 2079774628aSHaren Myneni * Total credits available on fault window: FIFO_SIZE(4MB)/CRBS_SIZE(128) 2089774628aSHaren Myneni * 2099774628aSHaren Myneni */ 2109774628aSHaren Myneni irqreturn_t vas_fault_thread_fn(int irq, void *data) 2119774628aSHaren Myneni { 2129774628aSHaren Myneni struct vas_instance *vinst = data; 2139774628aSHaren Myneni struct coprocessor_request_block *crb, *entry; 2149774628aSHaren Myneni struct coprocessor_request_block buf; 2159774628aSHaren Myneni struct vas_window *window; 2169774628aSHaren Myneni unsigned long flags; 2179774628aSHaren Myneni void *fifo; 2189774628aSHaren Myneni 2199774628aSHaren Myneni crb = &buf; 2209774628aSHaren Myneni 2219774628aSHaren Myneni /* 2229774628aSHaren Myneni * VAS can interrupt with multiple page faults. So process all 2239774628aSHaren Myneni * valid CRBs within fault FIFO until reaches invalid CRB. 2249774628aSHaren Myneni * We use CCW[0] and pswid to validate validate CRBs: 2259774628aSHaren Myneni * 2269774628aSHaren Myneni * CCW[0] Reserved bit. When NX pastes CRB, CCW[0]=0 2279774628aSHaren Myneni * OS sets this bit to 1 after reading CRB. 2289774628aSHaren Myneni * pswid NX assigns window ID. Set pswid to -1 after 2299774628aSHaren Myneni * reading CRB from fault FIFO. 2309774628aSHaren Myneni * 2319774628aSHaren Myneni * We exit this function if no valid CRBs are available to process. 2329774628aSHaren Myneni * So acquire fault_lock and reset fifo_in_progress to 0 before 2339774628aSHaren Myneni * exit. 2349774628aSHaren Myneni * In case kernel receives another interrupt with different page 2359774628aSHaren Myneni * fault, interrupt handler returns with IRQ_HANDLED if 2369774628aSHaren Myneni * fifo_in_progress is set. Means these new faults will be 2379774628aSHaren Myneni * handled by the current thread. Otherwise set fifo_in_progress 2389774628aSHaren Myneni * and return IRQ_WAKE_THREAD to wake up thread. 2399774628aSHaren Myneni */ 2409774628aSHaren Myneni while (true) { 2419774628aSHaren Myneni spin_lock_irqsave(&vinst->fault_lock, flags); 2429774628aSHaren Myneni /* 2439774628aSHaren Myneni * Advance the fault fifo pointer to next CRB. 2449774628aSHaren Myneni * Use CRB_SIZE rather than sizeof(*crb) since the latter is 2459774628aSHaren Myneni * aligned to CRB_ALIGN (256) but the CRB written to by VAS is 2469774628aSHaren Myneni * only CRB_SIZE in len. 2479774628aSHaren Myneni */ 2489774628aSHaren Myneni fifo = vinst->fault_fifo + (vinst->fault_crbs * CRB_SIZE); 2499774628aSHaren Myneni entry = fifo; 2509774628aSHaren Myneni 2519774628aSHaren Myneni if ((entry->stamp.nx.pswid == cpu_to_be32(FIFO_INVALID_ENTRY)) 2529774628aSHaren Myneni || (entry->ccw & cpu_to_be32(CCW0_INVALID))) { 2539774628aSHaren Myneni vinst->fifo_in_progress = 0; 2549774628aSHaren Myneni spin_unlock_irqrestore(&vinst->fault_lock, flags); 2559774628aSHaren Myneni return IRQ_HANDLED; 2569774628aSHaren Myneni } 2579774628aSHaren Myneni 2589774628aSHaren Myneni spin_unlock_irqrestore(&vinst->fault_lock, flags); 2599774628aSHaren Myneni vinst->fault_crbs++; 2609774628aSHaren Myneni if (vinst->fault_crbs == (vinst->fault_fifo_size / CRB_SIZE)) 2619774628aSHaren Myneni vinst->fault_crbs = 0; 2629774628aSHaren Myneni 2639774628aSHaren Myneni memcpy(crb, fifo, CRB_SIZE); 2649774628aSHaren Myneni entry->stamp.nx.pswid = cpu_to_be32(FIFO_INVALID_ENTRY); 2659774628aSHaren Myneni entry->ccw |= cpu_to_be32(CCW0_INVALID); 266461862efSHaren Myneni /* 267461862efSHaren Myneni * Return credit for the fault window. 268461862efSHaren Myneni */ 269461862efSHaren Myneni vas_return_credit(vinst->fault_win, false); 2709774628aSHaren Myneni 2719774628aSHaren Myneni pr_devel("VAS[%d] fault_fifo %p, fifo %p, fault_crbs %d\n", 2729774628aSHaren Myneni vinst->vas_id, vinst->fault_fifo, fifo, 2739774628aSHaren Myneni vinst->fault_crbs); 2749774628aSHaren Myneni 275cf33e1e9SHaren Myneni dump_crb(crb); 2769774628aSHaren Myneni window = vas_pswid_to_window(vinst, 2779774628aSHaren Myneni be32_to_cpu(crb->stamp.nx.pswid)); 2789774628aSHaren Myneni 2799774628aSHaren Myneni if (IS_ERR(window)) { 2809774628aSHaren Myneni /* 2819774628aSHaren Myneni * We got an interrupt about a specific send 2829774628aSHaren Myneni * window but we can't find that window and we can't 2839774628aSHaren Myneni * even clean it up (return credit on user space 2849774628aSHaren Myneni * window). 2859774628aSHaren Myneni * But we should not get here. 2869774628aSHaren Myneni * TODO: Disable IRQ. 2879774628aSHaren Myneni */ 288cf33e1e9SHaren Myneni dump_fifo(vinst, (void *)entry); 2899774628aSHaren Myneni pr_err("VAS[%d] fault_fifo %p, fifo %p, pswid 0x%x, fault_crbs %d bad CRB?\n", 2909774628aSHaren Myneni vinst->vas_id, vinst->fault_fifo, fifo, 2919774628aSHaren Myneni be32_to_cpu(crb->stamp.nx.pswid), 2929774628aSHaren Myneni vinst->fault_crbs); 2939774628aSHaren Myneni 2949774628aSHaren Myneni WARN_ON_ONCE(1); 295c96c4436SHaren Myneni } else { 296c96c4436SHaren Myneni update_csb(window, crb); 297461862efSHaren Myneni /* 298461862efSHaren Myneni * Return credit for send window after processing 299461862efSHaren Myneni * fault CRB. 300461862efSHaren Myneni */ 301461862efSHaren Myneni vas_return_credit(window, true); 3029774628aSHaren Myneni } 3039774628aSHaren Myneni } 3049774628aSHaren Myneni } 3059774628aSHaren Myneni 3069774628aSHaren Myneni irqreturn_t vas_fault_handler(int irq, void *dev_id) 3079774628aSHaren Myneni { 3089774628aSHaren Myneni struct vas_instance *vinst = dev_id; 3099774628aSHaren Myneni irqreturn_t ret = IRQ_WAKE_THREAD; 3109774628aSHaren Myneni unsigned long flags; 3119774628aSHaren Myneni 3129774628aSHaren Myneni /* 3139774628aSHaren Myneni * NX can generate an interrupt for multiple faults. So the 3149774628aSHaren Myneni * fault handler thread process all CRBs until finds invalid 3159774628aSHaren Myneni * entry. In case if NX sees continuous faults, it is possible 3169774628aSHaren Myneni * that the thread function entered with the first interrupt 3179774628aSHaren Myneni * can execute and process all valid CRBs. 3189774628aSHaren Myneni * So wake up thread only if the fault thread is not in progress. 3199774628aSHaren Myneni */ 3209774628aSHaren Myneni spin_lock_irqsave(&vinst->fault_lock, flags); 3219774628aSHaren Myneni 3229774628aSHaren Myneni if (vinst->fifo_in_progress) 3239774628aSHaren Myneni ret = IRQ_HANDLED; 3249774628aSHaren Myneni else 3259774628aSHaren Myneni vinst->fifo_in_progress = 1; 3269774628aSHaren Myneni 3279774628aSHaren Myneni spin_unlock_irqrestore(&vinst->fault_lock, flags); 3289774628aSHaren Myneni 3299774628aSHaren Myneni return ret; 3309774628aSHaren Myneni } 3319774628aSHaren Myneni 3329774628aSHaren Myneni /* 3330d17de03SHaren Myneni * Fault window is opened per VAS instance. NX pastes fault CRB in fault 3340d17de03SHaren Myneni * FIFO upon page faults. 3350d17de03SHaren Myneni */ 3360d17de03SHaren Myneni int vas_setup_fault_window(struct vas_instance *vinst) 3370d17de03SHaren Myneni { 3380d17de03SHaren Myneni struct vas_rx_win_attr attr; 3390d17de03SHaren Myneni 3400d17de03SHaren Myneni vinst->fault_fifo_size = VAS_FAULT_WIN_FIFO_SIZE; 3410d17de03SHaren Myneni vinst->fault_fifo = kzalloc(vinst->fault_fifo_size, GFP_KERNEL); 3420d17de03SHaren Myneni if (!vinst->fault_fifo) { 3430d17de03SHaren Myneni pr_err("Unable to alloc %d bytes for fault_fifo\n", 3440d17de03SHaren Myneni vinst->fault_fifo_size); 3450d17de03SHaren Myneni return -ENOMEM; 3460d17de03SHaren Myneni } 3470d17de03SHaren Myneni 3480d17de03SHaren Myneni /* 3490d17de03SHaren Myneni * Invalidate all CRB entries. NX pastes valid entry for each fault. 3500d17de03SHaren Myneni */ 3510d17de03SHaren Myneni memset(vinst->fault_fifo, FIFO_INVALID_ENTRY, vinst->fault_fifo_size); 3520d17de03SHaren Myneni vas_init_rx_win_attr(&attr, VAS_COP_TYPE_FAULT); 3530d17de03SHaren Myneni 3540d17de03SHaren Myneni attr.rx_fifo_size = vinst->fault_fifo_size; 3550d17de03SHaren Myneni attr.rx_fifo = vinst->fault_fifo; 3560d17de03SHaren Myneni 3570d17de03SHaren Myneni /* 3580d17de03SHaren Myneni * Max creds is based on number of CRBs can fit in the FIFO. 3590d17de03SHaren Myneni * (fault_fifo_size/CRB_SIZE). If 8MB FIFO is used, max creds 3600d17de03SHaren Myneni * will be 0xffff since the receive creds field is 16bits wide. 3610d17de03SHaren Myneni */ 3620d17de03SHaren Myneni attr.wcreds_max = vinst->fault_fifo_size / CRB_SIZE; 3630d17de03SHaren Myneni attr.lnotify_lpid = 0; 3640d17de03SHaren Myneni attr.lnotify_pid = mfspr(SPRN_PID); 3650d17de03SHaren Myneni attr.lnotify_tid = mfspr(SPRN_PID); 3660d17de03SHaren Myneni 3670d17de03SHaren Myneni vinst->fault_win = vas_rx_win_open(vinst->vas_id, VAS_COP_TYPE_FAULT, 3680d17de03SHaren Myneni &attr); 3690d17de03SHaren Myneni 3700d17de03SHaren Myneni if (IS_ERR(vinst->fault_win)) { 3710d17de03SHaren Myneni pr_err("VAS: Error %ld opening FaultWin\n", 3720d17de03SHaren Myneni PTR_ERR(vinst->fault_win)); 3730d17de03SHaren Myneni kfree(vinst->fault_fifo); 3740d17de03SHaren Myneni return PTR_ERR(vinst->fault_win); 3750d17de03SHaren Myneni } 3760d17de03SHaren Myneni 3770d17de03SHaren Myneni pr_devel("VAS: Created FaultWin %d, LPID/PID/TID [%d/%d/%d]\n", 3780d17de03SHaren Myneni vinst->fault_win->winid, attr.lnotify_lpid, 3790d17de03SHaren Myneni attr.lnotify_pid, attr.lnotify_tid); 3800d17de03SHaren Myneni 3810d17de03SHaren Myneni return 0; 3820d17de03SHaren Myneni } 383