Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp203743imm; Wed, 30 May 2018 21:43:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLUGTS5p26J6l4l5rD3NwWGhKJH6m3YfPmDya8c68dZDCcqrpIrQpArY4g5lLKXAzRwzgRx X-Received: by 2002:a17:902:7c83:: with SMTP id y3-v6mr5512271pll.51.1527741833285; Wed, 30 May 2018 21:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527741833; cv=none; d=google.com; s=arc-20160816; b=EyJRttqyVWj5euaVNtgd0bXVDqKrOaFsOyMdxYDAdo70Vy8xJnJKBsH5FbSHbcNzVw 2oZHwjeaDDmWyYe64nI+K536JZxF1gjH+yjY4+SSXYjIH4DyF4pp5W4RFlPmPKz1c94K EJ6/TAhD86Vd6omt9bpRyuXCWHQ8oOHBH62qdDDHD5V2r1SUG7yPyNFlKphBXiy0FTM3 PYsUI2ZOT12LSOrNBN4Icx+GNIYAUftFohR7Iwlw+Ud5ReITFQKcTSkeVqleuDXcLufe mMYV5i2UuT+SW1sSTeLCh47IiLVm9ZYMxc6O2HME+HPKmcGFkei/w5E3C2bsDk0Eg0ui ug6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=6k1s982SE0R1+yTbcL27oT7omIRXxqR5HJUaH2GnHas=; b=cxVi3wmwRTwsxKv5ohmr0LRqCnWJNgoQhHXNlAy1OmKbyiz2K5veeIji8VAgWAEPeY h5etTwYZYrjG70E+9Gwr3yGra+lzcnuPFogzBgFUJcCWucVDsK4lyE4RJhxo1aK+mvEF za/igG1a1qYZ2rejVHg96BXeSM+z5HiTnE8Izc5s8+yFa5wf3hMcf980WHK/XrdziqDW JlCkFrNFDv4QPT+Esf8aFBDVQYyZYZ/fGEOJE1UMMyPfZkC5GL2UWqb20ulR2GPGxnNl Z4k8zUdPNFxAbkpE9OSJGiwoxZ2kdKlCvWzJacMURWVbEKh0mlHe0nKqZdOV2wIYUO97 49ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b59-v6si36395827plc.335.2018.05.30.21.43.39; Wed, 30 May 2018 21:43:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914AbeEaEmi (ORCPT + 99 others); Thu, 31 May 2018 00:42:38 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37688 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751890AbeEaEmg (ORCPT ); Thu, 31 May 2018 00:42:36 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4V4dEkU139147 for ; Thu, 31 May 2018 00:42:36 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ja4vbagbk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 31 May 2018 00:42:36 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 May 2018 05:42:34 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 31 May 2018 05:42:31 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4V4gUUC24445060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 31 May 2018 04:42:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9595AE045; Thu, 31 May 2018 05:31:35 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65535AE055; Thu, 31 May 2018 05:31:35 +0100 (BST) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 May 2018 05:31:35 +0100 (BST) Received: from [10.61.2.125] (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 90CA2A0222; Thu, 31 May 2018 14:42:28 +1000 (AEST) Subject: Re: [PATCH v5 5/7] ocxl: Expose the thread_id needed for wait on POWER9 To: "Alastair D'Silva" , linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, mikey@neuling.org, vaibhav@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, malat@debian.org, felix@linux.vnet.ibm.com, pombredanne@nexb.com, sukadev@linux.vnet.ibm.com, npiggin@gmail.com, gregkh@linuxfoundation.org, arnd@arndb.de, fbarrat@linux.vnet.ibm.com, corbet@lwn.net, "Alastair D'Silva" References: <20180511061303.10728-1-alastair@au1.ibm.com> <20180511061303.10728-6-alastair@au1.ibm.com> From: Andrew Donnellan Date: Thu, 31 May 2018 14:42:28 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180511061303.10728-6-alastair@au1.ibm.com> Content-Language: en-AU X-TM-AS-GCONF: 00 x-cbid: 18053104-0016-0000-0000-000001D63537 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18053104-0017-0000-0000-00003228ABD1 Message-Id: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-31_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805310051 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/18 16:13, Alastair D'Silva wrote: > From: Alastair D'Silva > > In order to successfully issue as_notify, an AFU needs to know the TID > to notify, which in turn means that this information should be > available in userspace so it can be communicated to the AFU. > > Signed-off-by: Alastair D'Silva Acked-by: Andrew Donnellan Comments below. > +#ifdef CONFIG_PPC64 > +static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx, > + struct ocxl_ioctl_p9_wait __user *uarg) > +{ > + struct ocxl_ioctl_p9_wait arg; > + > + memset(&arg, 0, sizeof(arg)); > + > + if (cpu_has_feature(CPU_FTR_P9_TIDR)) { > + enum ocxl_context_status status; > + > + // Locks both status & tidr > + mutex_lock(&ctx->status_mutex); > + if (!ctx->tidr) { > + if (set_thread_tidr(current)) > + return -ENOENT; > + > + ctx->tidr = current->thread.tidr; > + } > + > + status = ctx->status; > + mutex_unlock(&ctx->status_mutex); > + > + if (status == ATTACHED) { > + int rc; > + struct link *link = ctx->afu->fn->link; > + > + rc = ocxl_link_update_pe(link, ctx->pasid, ctx->tidr); > + if (rc) > + return rc; > + } > + > + arg.thread_id = ctx->tidr; > + } else > + return -ENOENT; I didn't pick this up before - please please please use braces on both sides of the if here. > + > + if (copy_to_user(uarg, &arg, sizeof(arg))) > + return -EFAULT; > + > + return 0; > +} > +#endif > diff --git a/include/misc/ocxl.h b/include/misc/ocxl.h > index 51ccf76db293..9ff6ddc28e22 100644 > --- a/include/misc/ocxl.h > +++ b/include/misc/ocxl.h > @@ -188,6 +188,15 @@ extern int ocxl_link_add_pe(void *link_handle, int pasid, u32 pidr, u32 tidr, > void (*xsl_err_cb)(void *data, u64 addr, u64 dsisr), > void *xsl_err_data); > > +/** > + * Update values within a Process Element > + * > + * link_handle: the link handle associated with the process element > + * pasid: the PASID for the AFU context > + * tid: the new thread id for the process element > + */ > +extern int ocxl_link_update_pe(void *link_handle, int pasid, __u16 tid); My earlier comment about __u16 vs u16 applies for this declaration (and the body declaration) as well -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnellan@au1.ibm.com IBM Australia Limited