From patchwork Tue Jul 31 06:55:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 951436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fnK84Hq8z9ryn for ; Tue, 31 Jul 2018 16:56:12 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VyXm8FPn"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fnK828RwzF153 for ; Tue, 31 Jul 2018 16:56:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VyXm8FPn"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::443; helo=mail-pf1-x443.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VyXm8FPn"; dkim-atps=neutral Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fnJr5ppyzF14s for ; Tue, 31 Jul 2018 16:55:55 +1000 (AEST) Received: by mail-pf1-x443.google.com with SMTP id x17-v6so5689193pfh.5 for ; Mon, 30 Jul 2018 23:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=zsi7TadsHV2FTD7FS3bYsgwJTIABbQEYON+xieQ6DQY=; b=VyXm8FPn4OR4CWRL3c41+nWVnOKXizKl4mhhEPCV/iU+GTlg/jd9qPfNqTXi+8kwu8 OVOJaDiAs3q2+lnyiNTNfSJejrx7ZZi0o6mH+mPIsKyY7QIefho59P2TUikO+TDPpYJF HtB5RpD3z2iFKm+M7Lcry69V0vzkCvQR0EtvxWGTU9tgCAFq3kRuBg8xdUZr/ntk50Xt 0iP/kUIQAODtkz6ge6afnzAvUHDq/ryQjjBTmAq9ulhC2P/5F502NwfeMrbya6rr0dT3 mxmtlOywVIFHtOPRyHudgbovjYA3nRWZRmgTWt1NJN/uZSsrRcsUgBLehXF9B3IvSCjS MEWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zsi7TadsHV2FTD7FS3bYsgwJTIABbQEYON+xieQ6DQY=; b=tovLX9/GTmxyB+w+UFsUziNG7+SjY84CVrM55NsGsobSvCTWUeXqh//HRuq39roish U9Lkio+lOFTnlH+ETAWHZKI/Qva/LFrjdp317inIcydx7tNJE81nVucJy1ExUSIYuMQu vaYqxgVR0ELeCnSucpobHQ+oJOUVzozN+qxEzLx/mH6n2T3udxXGSHrpx6zGi5oepG9f zD7jUw10v7hk9KVmPnWSoL59NS9mZFY0bqDWMoAQeUWmQzCVYGF23h7qX4fpexA3e2mh UsAAWYLovuaFeR7u8o6XVsXCxfB/TCLIyILlVcpWEiGOhTpioMN/HHhIwSkSMulxf/BV R+eA== X-Gm-Message-State: AOUpUlE3nesjHs0sh5Oqfu/QD6Ljsp+CkKSUyH3jZS0Cnf0pvxFkMYpr Y5ytDhzE+/YD0REKFppP9GiL2cMK X-Google-Smtp-Source: AAOMgpe9AZTFEqKi9a0kJ7aYC2pmZoJKDWvmiZ8AcoiLJWO5wcfBjklNl/N8ibV3ThT5nEPX2fdlVg== X-Received: by 2002:a62:106:: with SMTP id 6-v6mr2061901pfb.168.1533020153039; Mon, 30 Jul 2018 23:55:53 -0700 (PDT) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id h69-v6sm36771227pfh.13.2018.07.30.23.55.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 23:55:52 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Tue, 31 Jul 2018 16:55:41 +1000 Message-Id: <20180731065541.14002-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 Subject: [Skiboot] [PATCH] hw/phb4: Use local_alloc for phb4 structures X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Grimm MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Struct phb4 is fairly heavyweight at 283664 bytes. On systems with 6x PHBs per socket this results in using 3.2MB of heap space the PHB structures alone. This is a fairly large chunk of our 12MB heap and on systems with particularly large PCIe topologies, or additional PHBs we can fail to boot because we cannot allocate space for the FDT blob. This patch switches to using local_alloc() for the PHB structures so they don't consume too large a portion of our 12MB heap space. Signed-off-by: Ryan Grimm Signed-off-by: Oliver O'Halloran --- hw/phb4.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index a95a4b3301a7..8c231a9d93e5 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -5341,7 +5341,7 @@ static u64 lane_eq_default[8] = { static void phb4_create(struct dt_node *np) { const struct dt_property *prop; - struct phb4 *p = zalloc(sizeof(struct phb4)); + struct phb4 *p; struct pci_slot *slot; size_t lane_eq_len, lane_eq_len_req; struct dt_node *iplp; @@ -5349,12 +5349,16 @@ static void phb4_create(struct dt_node *np) uint32_t irq_base, irq_flags; int i; struct proc_chip *chip; + int chip_id; + chip_id = dt_prop_get_u32(np, "ibm,chip-id"); + p = local_alloc(chip_id, sizeof(struct phb4), 8); assert(p); + memset(p, 0x0, sizeof(struct phb4)); /* Populate base stuff */ p->index = dt_prop_get_u32(np, "ibm,phb-index"); - p->chip_id = dt_prop_get_u32(np, "ibm,chip-id"); + p->chip_id = chip_id; chip = get_chip(p->chip_id); p->regs = (void *)dt_get_address(np, 0, NULL); p->int_mmio = (void *)dt_get_address(np, 1, NULL);