[{"id":1761469,"web_url":"http://patchwork.ozlabs.org/comment/1761469/","msgid":"<1504243603.4974.68.camel@kernel.crashing.org>","date":"2017-09-01T05:26:43","subject":"Re: [PATCH v3 1/8] powerpc/xive: introduce a common routine\n\txive_queue_page_alloc()","submitter":{"id":38,"url":"http://patchwork.ozlabs.org/api/people/38/","name":"Benjamin Herrenschmidt","email":"benh@kernel.crashing.org"},"content":"On Wed, 2017-08-30 at 21:46 +0200, Cédric Le Goater wrote:\n> This routine will be used in the spapr backend. Also introduce a short\n> xive_alloc_order() helper.\n> \n> Signed-off-by: Cédric Le Goater <clg@kaod.org>\n> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>\n\nAcked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>\n\n> ---\n>  arch/powerpc/sysdev/xive/common.c        | 16 ++++++++++++++++\n>  arch/powerpc/sysdev/xive/native.c        | 16 +++++-----------\n>  arch/powerpc/sysdev/xive/xive-internal.h |  6 ++++++\n>  3 files changed, 27 insertions(+), 11 deletions(-)\n> \n> diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c\n> index 6e0c9dee724f..26999ceae20e 100644\n> --- a/arch/powerpc/sysdev/xive/common.c\n> +++ b/arch/powerpc/sysdev/xive/common.c\n> @@ -1424,6 +1424,22 @@ bool xive_core_init(const struct xive_ops *ops, void __iomem *area, u32 offset,\n>  \treturn true;\n>  }\n>  \n> +__be32 *xive_queue_page_alloc(unsigned int cpu, u32 queue_shift)\n> +{\n> +\tunsigned int alloc_order;\n> +\tstruct page *pages;\n> +\t__be32 *qpage;\n> +\n> +\talloc_order = xive_alloc_order(queue_shift);\n> +\tpages = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, alloc_order);\n> +\tif (!pages)\n> +\t\treturn ERR_PTR(-ENOMEM);\n> +\tqpage = (__be32 *)page_address(pages);\n> +\tmemset(qpage, 0, 1 << queue_shift);\n> +\n> +\treturn qpage;\n> +}\n> +\n>  static int __init xive_off(char *arg)\n>  {\n>  \txive_cmdline_disabled = true;\n> diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c\n> index 0f95476b01f6..ef92a83090e1 100644\n> --- a/arch/powerpc/sysdev/xive/native.c\n> +++ b/arch/powerpc/sysdev/xive/native.c\n> @@ -202,17 +202,12 @@ EXPORT_SYMBOL_GPL(xive_native_disable_queue);\n>  static int xive_native_setup_queue(unsigned int cpu, struct xive_cpu *xc, u8 prio)\n>  {\n>  \tstruct xive_q *q = &xc->queue[prio];\n> -\tunsigned int alloc_order;\n> -\tstruct page *pages;\n>  \t__be32 *qpage;\n>  \n> -\talloc_order = (xive_queue_shift > PAGE_SHIFT) ?\n> -\t\t(xive_queue_shift - PAGE_SHIFT) : 0;\n> -\tpages = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL, alloc_order);\n> -\tif (!pages)\n> -\t\treturn -ENOMEM;\n> -\tqpage = (__be32 *)page_address(pages);\n> -\tmemset(qpage, 0, 1 << xive_queue_shift);\n> +\tqpage = xive_queue_page_alloc(cpu, xive_queue_shift);\n> +\tif (IS_ERR(qpage))\n> +\t\treturn PTR_ERR(qpage);\n> +\n>  \treturn xive_native_configure_queue(get_hard_smp_processor_id(cpu),\n>  \t\t\t\t\t   q, prio, qpage, xive_queue_shift, false);\n>  }\n> @@ -227,8 +222,7 @@ static void xive_native_cleanup_queue(unsigned int cpu, struct xive_cpu *xc, u8\n>  \t * from an IPI and iounmap isn't safe\n>  \t */\n>  \t__xive_native_disable_queue(get_hard_smp_processor_id(cpu), q, prio);\n> -\talloc_order = (xive_queue_shift > PAGE_SHIFT) ?\n> -\t\t(xive_queue_shift - PAGE_SHIFT) : 0;\n> +\talloc_order = xive_alloc_order(xive_queue_shift);\n>  \tfree_pages((unsigned long)q->qpage, alloc_order);\n>  \tq->qpage = NULL;\n>  }\n> diff --git a/arch/powerpc/sysdev/xive/xive-internal.h b/arch/powerpc/sysdev/xive/xive-internal.h\n> index d07ef2d29caf..dd1e2022cce4 100644\n> --- a/arch/powerpc/sysdev/xive/xive-internal.h\n> +++ b/arch/powerpc/sysdev/xive/xive-internal.h\n> @@ -56,6 +56,12 @@ struct xive_ops {\n>  \n>  bool xive_core_init(const struct xive_ops *ops, void __iomem *area, u32 offset,\n>  \t\t    u8 max_prio);\n> +__be32 *xive_queue_page_alloc(unsigned int cpu, u32 queue_shift);\n> +\n> +static inline u32 xive_alloc_order(u32 queue_shift)\n> +{\n> +\treturn (queue_shift > PAGE_SHIFT) ? (queue_shift - PAGE_SHIFT) : 0;\n> +}\n>  \n>  extern bool xive_cmdline_disabled;\n>","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"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\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 3xk77f46cLz9s83\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 15:28:30 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xk77f3D3JzDqpt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 15:28:30 +1000 (AEST)","from gate.crashing.org (gate.crashing.org [63.228.1.57])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xk76W2Bj6zDqY3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri,  1 Sep 2017 15:27:30 +1000 (AEST)","from localhost (localhost.localdomain [127.0.0.1])\n\tby gate.crashing.org (8.14.1/8.13.8) with ESMTP id v815QhgM012845;\n\tFri, 1 Sep 2017 00:26:47 -0500"],"Message-ID":"<1504243603.4974.68.camel@kernel.crashing.org>","Subject":"Re: [PATCH v3 1/8] powerpc/xive: introduce a common routine\n\txive_queue_page_alloc()","From":"Benjamin Herrenschmidt <benh@kernel.crashing.org>","To":"=?iso-8859-1?q?C=E9dric?= Le Goater <clg@kaod.org>,\n\tlinuxppc-dev@lists.ozlabs.org","Date":"Fri, 01 Sep 2017 15:26:43 +1000","In-Reply-To":"<20170830194617.26621-2-clg@kaod.org>","References":"<20170830194617.26621-1-clg@kaod.org>\n\t<20170830194617.26621-2-clg@kaod.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-Mailer":"Evolution 3.24.5 (3.24.5-1.fc26) ","Mime-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"Paul Mackerras <paulus@samba.org>,\n\tDavid Gibson <david@gibson.dropbear.id.au>","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":1764004,"web_url":"http://patchwork.ozlabs.org/comment/1764004/","msgid":"<3xnL8W4ZKZz9sCZ@ozlabs.org>","date":"2017-09-06T10:55:23","subject":"Re: [v3,\n\t1/8] powerpc/xive: introduce a common routine xive_queue_page_alloc()","submitter":{"id":69509,"url":"http://patchwork.ozlabs.org/api/people/69509/","name":"Michael Ellerman","email":"patch-notifications@ellerman.id.au"},"content":"On Wed, 2017-08-30 at 19:46:10 UTC, =?utf-8?q?C=C3=A9dric_Le_Goater?= wrote:\n> This routine will be used in the spapr backend. Also introduce a short\n> xive_alloc_order() helper.\n> \n> Signed-off-by: Cédric Le Goater <clg@kaod.org>\n> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>\n> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>\n\nSeries applied to powerpc next, thanks.\n\nhttps://git.kernel.org/powerpc/c/994ea2f41999113d84c317da3ec1e1\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"],"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 3xnL9w5Br2z9s0g\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  6 Sep 2017 20:56:36 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xnL9w4PbwzDrSt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  6 Sep 2017 20:56:36 +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 3xnL8W5BfHzDqY3\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed,  6 Sep 2017 20:55:23 +1000 (AEST)","by ozlabs.org (Postfix, from userid 1034)\n\tid 3xnL8W4ZKZz9sCZ; Wed,  6 Sep 2017 20:55:23 +1000 (AEST)"],"X-powerpc-patch-notification":"thanks","X-powerpc-patch-commit":"994ea2f41999113d84c317da3ec1e10aa6469b3f","In-Reply-To":"<20170830194617.26621-2-clg@kaod.org>","To":"=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@kaod.org>,\n\tlinuxppc-dev@lists.ozlabs.org","From":"Michael Ellerman <patch-notifications@ellerman.id.au>","Subject":"Re: [v3,\n\t1/8] powerpc/xive: introduce a common routine xive_queue_page_alloc()","Message-Id":"<3xnL8W4ZKZz9sCZ@ozlabs.org>","Date":"Wed,  6 Sep 2017 20:55:23 +1000 (AEST)","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":"Paul Mackerras <paulus@samba.org>, =?utf-8?q?C=C3=A9dric_Le_Goater?=\n\t<clg@kaod.org>,  David Gibson <david@gibson.dropbear.id.au>","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>"}}]