[{"id":1757266,"web_url":"http://patchwork.ozlabs.org/comment/1757266/","msgid":"<87shgfuda6.fsf@concordia.ellerman.id.au>","date":"2017-08-25T10:56:01","subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","submitter":{"id":46580,"url":"http://patchwork.ozlabs.org/api/people/46580/","name":"Michael Ellerman","email":"mpe@ellerman.id.au"},"content":"Hi Suka,\n\nA few more things ...\n\nSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:\n\n> diff --git a/arch/powerpc/platforms/powernv/copy-paste.h b/arch/powerpc/platforms/powernv/copy-paste.h\n> new file mode 100644\n> index 0000000..7783bb8\n> --- /dev/null\n> +++ b/arch/powerpc/platforms/powernv/copy-paste.h\n> @@ -0,0 +1,74 @@\n> +/*\n> + * Copyright 2016 IBM Corp.\n> + *\n> + * This program is free software; you can redistribute it and/or\n> + * modify it under the terms of the GNU General Public License\n> + * as published by the Free Software Foundation; either version\n> + * 2 of the License, or (at your option) any later version.\n> + */\n> +\n> +/*\n> + * Macros taken from tools/testing/selftests/powerpc/context_switch/cp_abort.c\n> + */\n\nThese are both out of date, they're changed in v3.0B.\n\n> +#define PASTE(RA, RB, L, RC) \\\n> +\t.long (0x7c00070c | (RA) << (31-15) | (RB) << (31-20) \\\n> +\t\t\t  | (L) << (31-10) | (RC) << (31-31))\n\nYou should define PPC_PASTE() in ppc-opcode.h\n\nWe already have PPC_INST_PASTE, so use that.\n\nL and RC are gone.\n\n> +\n> +#define COPY(RA, RB, L) \\\n> +\t.long (0x7c00060c | (RA) << (31-15) | (RB) << (31-20) \\\n> +\t\t\t  | (L) << (31-10))\n\nUse PPC_COPY().\n\n> +\n> +#define CR0_FXM\t\t\"0x80\"\n\nI don't think a #define for this helps readability.\n\n> +#define CR0_SHIFT\t28\n> +#define CR0_MASK\t0xF\n\nNot used.\n\n> +/*\n> + * Copy/paste instructions:\n> + *\n> + *\tcopy RA,RB,L\n> + *\t\tCopy contents of address (RA) + effective_address(RB)\n> + *\t\tto internal copy-buffer.\n> + *\n> + *\t\tL == 1 indicates this is the first copy.\n> + *\n> + *\t\tL == 0 indicates its a continuation of a prior first copy.\n> + *\n> + *\tpaste RA,RB,L\n> + *\t\tPaste contents of internal copy-buffer to the address\n> + *\t\t(RA) + effective_address(RB)\n> + *\n> + *\t\tL == 0 indicates its a continuation of a prior paste. i.e.\n> + *\t\tdon't wait for the completion or update status.\n> + *\n> + *\t\tL == 1 indicates this is the last paste in the group (i.e.\n> + *\t\twait for the group to complete and update status in CR0).\n> + *\n> + *\tFor Power9, the L bit must be 'true' in both copy and paste.\n> + */\n> +\n> +static inline int vas_copy(void *crb, int offset, int first)\n> +{\n> +\tWARN_ON_ONCE(!first);\n\nPlease change the API to not require unused parameters.\n\nSame for offset.\n\n> +\n> +\t__asm__ __volatile(stringify_in_c(COPY(%0, %1, %2))\";\"\n\nI've never seen __volatile before.\n\nJust use: asm volatile\n\n\n> +\t\t:\n> +\t\t: \"b\" (offset), \"b\" (crb), \"i\" (1)\n> +\t\t: \"memory\");\n> +\n> +\treturn 0;\n> +}\n> +\n> +static inline int vas_paste(void *paste_address, int offset, int last)\n> +{\n> +\tunsigned long long cr;\n\ncr is 32-bits actually.\n\n> +\tWARN_ON_ONCE(!last);\n> +\n> +\tcr = 0;\n> +\t__asm__ __volatile(stringify_in_c(PASTE(%1, %2, 1, 1))\";\"\n> +\t\t\"mfocrf %0,\" CR0_FXM \";\"\n> +\t\t: \"=r\" (cr)\n> +\t\t: \"b\" (paste_address), \"b\" (offset)\n> +\t\t: \"memory\");\n\nYou need cr0 in the clobbers.\n\n> +\n> +\treturn cr;\n\nI think it would be more natural if you just returned CR0, so if you did\nshift and mask with the CR0 constants you have above.\n\n\n> diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c\n> index 70762c3..73081b4 100644\n> --- a/arch/powerpc/platforms/powernv/vas-window.c\n> +++ b/arch/powerpc/platforms/powernv/vas-window.c\n> @@ -1040,6 +1041,57 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,\n>  }\n>  EXPORT_SYMBOL_GPL(vas_tx_win_open);\n>  \n> +int vas_copy_crb(void *crb, int offset, bool first)\n> +{\n> +\tif (!vas_initialized())\n> +\t\treturn -1;\n> +\n> +\treturn vas_copy(crb, offset, first);\n> +}\n> +EXPORT_SYMBOL_GPL(vas_copy_crb);\n> +\n> +#define RMA_LSMP_REPORT_ENABLE PPC_BIT(53)\n> +int vas_paste_crb(struct vas_window *txwin, int offset, bool last, bool re)\n> +{\n> +\tint rc;\n> +\tuint64_t val;\n> +\tvoid *addr;\n> +\n> +\tif (!vas_initialized())\n> +\t\treturn -1;\n\nThis is in the fast path, or at least the runtime path. So I don't think\nthese checks are wanted, how would we have got this far if vas wasn't\ninitialised?\n\n\n\ncheers","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xdymH3qnhz9sR9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 25 Aug 2017 20:57:19 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xdymH2sKxzDrWw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 25 Aug 2017 20:57:19 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xdykq2lhLzDrVk\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 25 Aug 2017 20:56:03 +1000 (AEST)","by ozlabs.org (Postfix)\n\tid 3xdykq1wX8z9sRm; Fri, 25 Aug 2017 20:56:03 +1000 (AEST)","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3xdykq0BFdz9sR9;\n\tFri, 25 Aug 2017 20:56:02 +1000 (AEST)"],"From":"Michael Ellerman <mpe@ellerman.id.au>","To":"Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>","Subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","In-Reply-To":"<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>","References":"<1503556688-15412-1-git-send-email-sukadev@linux.vnet.ibm.com>\n\t<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>","User-Agent":"Notmuch/0.21 (https://notmuchmail.org)","Date":"Fri, 25 Aug 2017 20:56:01 +1000","Message-ID":"<87shgfuda6.fsf@concordia.ellerman.id.au>","MIME-Version":"1.0","Content-Type":"text/plain","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"stewart@linux.vnet.ibm.com, mikey@neuling.org, linuxppc-dev@ozlabs.org, \n\tlinux-kernel@vger.kernel.org, apopple@au1.ibm.com, oohall@gmail.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1758372,"web_url":"http://patchwork.ozlabs.org/comment/1758372/","msgid":"<20170828052039.GG12907@us.ibm.com>","date":"2017-08-28T05:20:39","subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","submitter":{"id":984,"url":"http://patchwork.ozlabs.org/api/people/984/","name":"Sukadev Bhattiprolu","email":"sukadev@linux.vnet.ibm.com"},"content":"Michael Ellerman [mpe@ellerman.id.au] wrote:\n> Hi Suka,\n> \n> A few more things ...\n> \n> Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:\n> \n> > diff --git a/arch/powerpc/platforms/powernv/copy-paste.h b/arch/powerpc/platforms/powernv/copy-paste.h\n> > new file mode 100644\n> > index 0000000..7783bb8\n> > --- /dev/null\n> > +++ b/arch/powerpc/platforms/powernv/copy-paste.h\n> > @@ -0,0 +1,74 @@\n> > +/*\n> > + * Copyright 2016 IBM Corp.\n> > + *\n> > + * This program is free software; you can redistribute it and/or\n> > + * modify it under the terms of the GNU General Public License\n> > + * as published by the Free Software Foundation; either version\n> > + * 2 of the License, or (at your option) any later version.\n> > + */\n> > +\n> > +/*\n> > + * Macros taken from tools/testing/selftests/powerpc/context_switch/cp_abort.c\n> > + */\n> \n> These are both out of date, they're changed in v3.0B.\n> \n> > +#define PASTE(RA, RB, L, RC) \\\n> > +\t.long (0x7c00070c | (RA) << (31-15) | (RB) << (31-20) \\\n> > +\t\t\t  | (L) << (31-10) | (RC) << (31-31))\n> \n> You should define PPC_PASTE() in ppc-opcode.h\n> \n> We already have PPC_INST_PASTE, so use that.\n> \n> L and RC are gone.\n\nOk. I thought they would come back later, but of course we can update\nthese kernel-only calls then.\n\n> \n> > +\n> > +#define COPY(RA, RB, L) \\\n> > +\t.long (0x7c00060c | (RA) << (31-15) | (RB) << (31-20) \\\n> > +\t\t\t  | (L) << (31-10))\n> \n> Use PPC_COPY().\n> \n\nOk\n\n> > +\n> > +#define CR0_FXM\t\t\"0x80\"\n> \n> I don't think a #define for this helps readability.\n> \n> > +#define CR0_SHIFT\t28\n> > +#define CR0_MASK\t0xF\n> \n> Not used.\n\nWill need them now to return value in cr0?\n> \n> > +/*\n> > + * Copy/paste instructions:\n> > + *\n> > + *\tcopy RA,RB,L\n> > + *\t\tCopy contents of address (RA) + effective_address(RB)\n> > + *\t\tto internal copy-buffer.\n> > + *\n> > + *\t\tL == 1 indicates this is the first copy.\n> > + *\n> > + *\t\tL == 0 indicates its a continuation of a prior first copy.\n> > + *\n> > + *\tpaste RA,RB,L\n> > + *\t\tPaste contents of internal copy-buffer to the address\n> > + *\t\t(RA) + effective_address(RB)\n> > + *\n> > + *\t\tL == 0 indicates its a continuation of a prior paste. i.e.\n> > + *\t\tdon't wait for the completion or update status.\n> > + *\n> > + *\t\tL == 1 indicates this is the last paste in the group (i.e.\n> > + *\t\twait for the group to complete and update status in CR0).\n> > + *\n> > + *\tFor Power9, the L bit must be 'true' in both copy and paste.\n> > + */\n> > +\n> > +static inline int vas_copy(void *crb, int offset, int first)\n> > +{\n> > +\tWARN_ON_ONCE(!first);\n> \n> Please change the API to not require unused parameters.\n> \n> Same for offset.\n\nOk, Haren's NX patches will need to drop those parameters as well.\n\n> \n> > +\n> > +\t__asm__ __volatile(stringify_in_c(COPY(%0, %1, %2))\";\"\n> \n> I've never seen __volatile before.\n> \n> Just use: asm volatile\n\nok\n> \n> \n> > +\t\t:\n> > +\t\t: \"b\" (offset), \"b\" (crb), \"i\" (1)\n> > +\t\t: \"memory\");\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> > +static inline int vas_paste(void *paste_address, int offset, int last)\n> > +{\n> > +\tunsigned long long cr;\n> \n> cr is 32-bits actually.\n\nok\n> \n> > +\tWARN_ON_ONCE(!last);\n> > +\n> > +\tcr = 0;\n> > +\t__asm__ __volatile(stringify_in_c(PASTE(%1, %2, 1, 1))\";\"\n> > +\t\t\"mfocrf %0,\" CR0_FXM \";\"\n> > +\t\t: \"=r\" (cr)\n> > +\t\t: \"b\" (paste_address), \"b\" (offset)\n> > +\t\t: \"memory\");\n> \n> You need cr0 in the clobbers.\n\nok\n> \n> > +\n> > +\treturn cr;\n> \n> I think it would be more natural if you just returned CR0, so if you did\n> shift and mask with the CR0 constants you have above.\n> \nok\n\n> \n> > diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c\n> > index 70762c3..73081b4 100644\n> > --- a/arch/powerpc/platforms/powernv/vas-window.c\n> > +++ b/arch/powerpc/platforms/powernv/vas-window.c\n> > @@ -1040,6 +1041,57 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,\n> >  }\n> >  EXPORT_SYMBOL_GPL(vas_tx_win_open);\n> >  \n> > +int vas_copy_crb(void *crb, int offset, bool first)\n> > +{\n> > +\tif (!vas_initialized())\n> > +\t\treturn -1;\n> > +\n> > +\treturn vas_copy(crb, offset, first);\n> > +}\n> > +EXPORT_SYMBOL_GPL(vas_copy_crb);\n> > +\n> > +#define RMA_LSMP_REPORT_ENABLE PPC_BIT(53)\n> > +int vas_paste_crb(struct vas_window *txwin, int offset, bool last, bool re)\n> > +{\n> > +\tint rc;\n> > +\tuint64_t val;\n> > +\tvoid *addr;\n> > +\n> > +\tif (!vas_initialized())\n> > +\t\treturn -1;\n> \n> This is in the fast path, or at least the runtime path. So I don't think\n> these checks are wanted, how would we have got this far if vas wasn't\n> initialised?\n\nYes, I have dropped vas_initialized() now.\n> \n> \n> \n> cheers","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgg9x35Nmz9s9Y\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 15:21:57 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgg9x29lMzDqJ9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 15:21:57 +1000 (AEST)","from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgg8b22glzDqG1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 15:20:47 +1000 (AEST)","from ozlabs.org (bilbo.ozlabs.org [103.22.144.67])\n\tby bilbo.ozlabs.org (Postfix) with ESMTP id 3xgg8b1JNrz8t8p\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 15:20:47 +1000 (AEST)","by ozlabs.org (Postfix)\n\tid 3xgg8b0rzMz9sPt; Mon, 28 Aug 2017 15:20:47 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgg8Z50C4z9sP3\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 28 Aug 2017 15:20:46 +1000 (AEST)","from pps.filterd (m0098393.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7S5JMY5101179\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 28 Aug 2017 01:20:45 -0400","from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cm3uf1nm6-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@ozlabs.org>; Mon, 28 Aug 2017 01:20:44 -0400","from localhost\n\tby e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@ozlabs.org> from <sukadev@linux.vnet.ibm.com>;\n\tSun, 27 Aug 2017 23:20:44 -0600","from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18)\n\tby e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tSun, 27 Aug 2017 23:20:41 -0600","from b03ledav002.gho.boulder.ibm.com\n\t(b03ledav002.gho.boulder.ibm.com [9.17.130.233])\n\tby b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v7S5KfxG65208532; Sun, 27 Aug 2017 22:20:41 -0700","from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id F2127136043;\n\tSun, 27 Aug 2017 23:20:40 -0600 (MDT)","from suka-w540.localdomain (unknown [9.70.94.25])\n\tby b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP id\n\tB83C913603C; Sun, 27 Aug 2017 23:20:40 -0600 (MDT)","by suka-w540.localdomain (Postfix, from userid 1000)\n\tid 4943422528E; Sun, 27 Aug 2017 22:20:39 -0700 (PDT)"],"Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=sukadev@linux.vnet.ibm.com; receiver=<UNKNOWN>)","Date":"Sun, 27 Aug 2017 22:20:39 -0700","From":"Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>","To":"Michael Ellerman <mpe@ellerman.id.au>","Subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","References":"<1503556688-15412-1-git-send-email-sukadev@linux.vnet.ibm.com>\n\t<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>\n\t<87shgfuda6.fsf@concordia.ellerman.id.au>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<87shgfuda6.fsf@concordia.ellerman.id.au>","X-Operating-System":"Linux 2.0.32 on an i486","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-TM-AS-GCONF":"00","x-cbid":"17082805-0004-0000-0000-000012D5C361","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007625; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000225; SDB=6.00908660; UDB=6.00455622;\n\tIPR=6.00688901; \n\tBA=6.00005555; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016893;\n\tXFM=3.00000015; UTC=2017-08-28 05:20:43","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17082805-0005-0000-0000-000080E2C9A6","Message-Id":"<20170828052039.GG12907@us.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-28_02:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708280085","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"stewart@linux.vnet.ibm.com, mikey@neuling.org, linuxppc-dev@ozlabs.org, \n\tlinux-kernel@vger.kernel.org, apopple@au1.ibm.com, oohall@gmail.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1758523,"web_url":"http://patchwork.ozlabs.org/comment/1758523/","msgid":"<87a82jvrty.fsf@concordia.ellerman.id.au>","date":"2017-08-28T11:45:29","subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","submitter":{"id":46580,"url":"http://patchwork.ozlabs.org/api/people/46580/","name":"Michael Ellerman","email":"mpe@ellerman.id.au"},"content":"Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:\n\n> Michael Ellerman [mpe@ellerman.id.au] wrote:\n>> Hi Suka,\n>> \n>> A few more things ...\n>> \n>> Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> writes:\n>> \n>> > diff --git a/arch/powerpc/platforms/powernv/copy-paste.h b/arch/powerpc/platforms/powernv/copy-paste.h\n>> > new file mode 100644\n>> > index 0000000..7783bb8\n>> > --- /dev/null\n>> > +++ b/arch/powerpc/platforms/powernv/copy-paste.h\n>> > @@ -0,0 +1,74 @@\n>> > +/*\n>> > + * Copyright 2016 IBM Corp.\n>> > + *\n>> > + * This program is free software; you can redistribute it and/or\n>> > + * modify it under the terms of the GNU General Public License\n>> > + * as published by the Free Software Foundation; either version\n>> > + * 2 of the License, or (at your option) any later version.\n>> > + */\n>> > +\n>> > +/*\n>> > + * Macros taken from tools/testing/selftests/powerpc/context_switch/cp_abort.c\n>> > + */\n>> \n>> These are both out of date, they're changed in v3.0B.\n>> \n>> > +#define PASTE(RA, RB, L, RC) \\\n>> > +\t.long (0x7c00070c | (RA) << (31-15) | (RB) << (31-20) \\\n>> > +\t\t\t  | (L) << (31-10) | (RC) << (31-31))\n>> \n>> You should define PPC_PASTE() in ppc-opcode.h\n>> \n>> We already have PPC_INST_PASTE, so use that.\n>> \n>> L and RC are gone.\n>\n> Ok. I thought they would come back later, but of course we can update\n> these kernel-only calls then.\n\nPossible, but if they do we can update them then.\n\n>> > +#define CR0_SHIFT\t28\n>> > +#define CR0_MASK\t0xF\n>> \n>> Not used.\n>\n> Will need them now to return value in cr0?\n\nYes.\n\n>> > +/*\n>> > + * Copy/paste instructions:\n>> > + *\n>> > + *\tcopy RA,RB,L\n>> > + *\t\tCopy contents of address (RA) + effective_address(RB)\n>> > + *\t\tto internal copy-buffer.\n>> > + *\n>> > + *\t\tL == 1 indicates this is the first copy.\n>> > + *\n>> > + *\t\tL == 0 indicates its a continuation of a prior first copy.\n>> > + *\n>> > + *\tpaste RA,RB,L\n>> > + *\t\tPaste contents of internal copy-buffer to the address\n>> > + *\t\t(RA) + effective_address(RB)\n>> > + *\n>> > + *\t\tL == 0 indicates its a continuation of a prior paste. i.e.\n>> > + *\t\tdon't wait for the completion or update status.\n>> > + *\n>> > + *\t\tL == 1 indicates this is the last paste in the group (i.e.\n>> > + *\t\twait for the group to complete and update status in CR0).\n>> > + *\n>> > + *\tFor Power9, the L bit must be 'true' in both copy and paste.\n>> > + */\n>> > +\n>> > +static inline int vas_copy(void *crb, int offset, int first)\n>> > +{\n>> > +\tWARN_ON_ONCE(!first);\n>> \n>> Please change the API to not require unused parameters.\n>> \n>> Same for offset.\n>\n> Ok, Haren's NX patches will need to drop those parameters as well.\n\nThat's fine, I'm merging them all via my tree. I can fix that up.\n\ncheers","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xgqk64DS7z9sD9\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 21:46:54 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xgqk61tFjzDq7g\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 21:46:54 +1000 (AEST)","from ozlabs.org (bilbo.ozlabs.org [103.22.144.67])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xgqhV6rY3zDq66\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tMon, 28 Aug 2017 21:45:30 +1000 (AEST)","by ozlabs.org (Postfix)\n\tid 3xgqhV6H7Mz9sD9; Mon, 28 Aug 2017 21:45:30 +1000 (AEST)","from authenticated.ozlabs.org (localhost [127.0.0.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPSA id 3xgqhT5p6Rz9s7g;\n\tMon, 28 Aug 2017 21:45:29 +1000 (AEST)"],"From":"Michael Ellerman <mpe@ellerman.id.au>","To":"Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>","Subject":"Re: [PATCH v7 12/12] powerpc/vas: Define copy/paste interfaces","In-Reply-To":"<20170828052039.GG12907@us.ibm.com>","References":"<1503556688-15412-1-git-send-email-sukadev@linux.vnet.ibm.com>\n\t<1503556688-15412-13-git-send-email-sukadev@linux.vnet.ibm.com>\n\t<87shgfuda6.fsf@concordia.ellerman.id.au>\n\t<20170828052039.GG12907@us.ibm.com>","User-Agent":"Notmuch/0.21 (https://notmuchmail.org)","Date":"Mon, 28 Aug 2017 21:45:29 +1000","Message-ID":"<87a82jvrty.fsf@concordia.ellerman.id.au>","MIME-Version":"1.0","Content-Type":"text/plain","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"stewart@linux.vnet.ibm.com, mikey@neuling.org, linuxppc-dev@ozlabs.org, \n\tlinux-kernel@vger.kernel.org, apopple@au1.ibm.com, oohall@gmail.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}}]