{"id":800590,"url":"http://patchwork.ozlabs.org/api/1.2/patches/800590/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170811142341.22715-2-clg@kaod.org/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.2/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170811142341.22715-2-clg@kaod.org>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170811142341.22715-2-clg@kaod.org/","date":"2017-08-11T14:23:34","name":"[v2,1/8] powerpc/xive: introduce a common routine xive_queue_page_alloc()","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"248042815db290ec367da5a497fd809986b8fc6e","submitter":{"id":68548,"url":"http://patchwork.ozlabs.org/api/1.2/people/68548/?format=json","name":"Cédric Le Goater","email":"clg@kaod.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170811142341.22715-2-clg@kaod.org/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/800590/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/800590/checks/","tags":{},"related":[],"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 3xTSBz53YPz9sRq\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 12 Aug 2017 00:32:27 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xTSBz4HRLzDr55\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 12 Aug 2017 00:32:27 +1000 (AEST)","from 1.mo4.mail-out.ovh.net (1.mo4.mail-out.ovh.net\n\t[178.33.248.196])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xTS9X3179zDr2M\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 12 Aug 2017 00:31:12 +1000 (AEST)","from player772.ha.ovh.net (b6.ovh.net [213.186.33.56])\n\tby mo4.mail-out.ovh.net (Postfix) with ESMTP id A77BF8C9A1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 11 Aug 2017 16:24:10 +0200 (CEST)","from zorba.kaod.org.com (LFbn-1-10652-153.w90-89.abo.wanadoo.fr\n\t[90.89.238.153]) (Authenticated sender: clg@kaod.org)\n\tby player772.ha.ovh.net (Postfix) with ESMTPSA id 87E4F740085;\n\tFri, 11 Aug 2017 16:24:04 +0200 (CEST)"],"X-Greylist":"delayed 418 seconds by postgrey-1.36 at bilbo;\n\tSat, 12 Aug 2017 00:31:12 AEST","From":"=?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@kaod.org>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH v2 1/8] powerpc/xive: introduce a common routine\n\txive_queue_page_alloc()","Date":"Fri, 11 Aug 2017 16:23:34 +0200","Message-Id":"<20170811142341.22715-2-clg@kaod.org>","X-Mailer":"git-send-email 2.13.4","In-Reply-To":"<20170811142341.22715-1-clg@kaod.org>","References":"<20170811142341.22715-1-clg@kaod.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Ovh-Tracer-Id":"13693757619432754109","X-VR-SPAMSTATE":"OK","X-VR-SPAMSCORE":"-100","X-VR-SPAMCAUSE":"gggruggvucftvghtrhhoucdtuddrfeelkedrkeelgdejiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd","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":"David Gibson <david@gibson.dropbear.id.au>,\n\tPaul Mackerras <paulus@samba.org>,\n\t=?UTF-8?q?C=C3=A9dric=20Le=20Goater?= <clg@kaod.org>","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>"},"content":"This routine will be used in the spapr backend. Also introduce a short\nxive_alloc_order() helper.\n\nSigned-off-by: Cédric Le Goater <clg@kaod.org>\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(-)","diff":"diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c\nindex 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;\ndiff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c\nindex 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 }\ndiff --git a/arch/powerpc/sysdev/xive/xive-internal.h b/arch/powerpc/sysdev/xive/xive-internal.h\nindex 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 \n","prefixes":["v2","1/8"]}