From patchwork Tue Sep 3 17:04:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 1157187 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46NDMy04S1z9sBF for ; Wed, 4 Sep 2019 03:24:30 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46NDMx58hnzDqmX for ; Wed, 4 Sep 2019 03:24:29 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=kaod.org (client-ip=46.105.56.132; helo=17.mo5.mail-out.ovh.net; envelope-from=clg@kaod.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kaod.org X-Greylist: delayed 594 seconds by postgrey-1.36 at bilbo; Wed, 04 Sep 2019 03:23:40 AEST Received: from 17.mo5.mail-out.ovh.net (17.mo5.mail-out.ovh.net [46.105.56.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46NDM04VqVzDqlR for ; Wed, 4 Sep 2019 03:23:39 +1000 (AEST) Received: from player779.ha.ovh.net (unknown [10.109.160.39]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 686D524C189 for ; Tue, 3 Sep 2019 19:05:01 +0200 (CEST) Received: from kaod.org (lfbn-1-2240-157.w90-76.abo.wanadoo.fr [90.76.60.157]) (Authenticated sender: clg@kaod.org) by player779.ha.ovh.net (Postfix) with ESMTPSA id DE78094D016D; Tue, 3 Sep 2019 17:04:57 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: skiboot@lists.ozlabs.org Date: Tue, 3 Sep 2019 19:04:02 +0200 Message-Id: <20190903170413.4373-12-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903170413.4373-1-clg@kaod.org> References: <20190903170413.4373-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 11330212239782218713 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudejfedgjeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Subject: [Skiboot] [PATCH 11/22] xive/p9: fix EQ bitmap assignment when allocation fails X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Wehn allocating a EQ set for a VP, the EQ base index bit is marked as allocated even if allocation fails, due to a lack of available pages. Move bit assignment at the end of xive_alloc_eq_set(). Signed-off-by: Cédric Le Goater --- hw/xive-p9.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/xive-p9.c b/hw/xive-p9.c index 2232220babd6..b5c437fec8b1 100644 --- a/hw/xive-p9.c +++ b/hw/xive-p9.c @@ -849,6 +849,7 @@ static uint32_t xive_alloc_eq_set(struct xive *x, bool alloc_indirect) { uint32_t ind_idx; int idx; + int eq_base_idx; xive_vdbg(x, "Allocating EQ set...\n"); @@ -860,14 +861,13 @@ static uint32_t xive_alloc_eq_set(struct xive *x, bool alloc_indirect) xive_dbg(x, "Allocation from EQ bitmap failed !\n"); return XIVE_ALLOC_NO_SPACE; } - bitmap_set_bit(*x->eq_map, idx); - idx <<= 3; + eq_base_idx = idx << 3; - xive_vdbg(x, "Got EQs 0x%x..0x%x\n", idx, idx + 7); + xive_vdbg(x, "Got EQs 0x%x..0x%x\n", eq_base_idx, eq_base_idx + 7); /* Calculate the indirect page where the EQs reside */ - ind_idx = idx / EQ_PER_PAGE; + ind_idx = eq_base_idx / EQ_PER_PAGE; /* Is there an indirect page ? If not, check if we can provision it */ if (!x->eq_ind_base[ind_idx]) { @@ -902,14 +902,15 @@ static uint32_t xive_alloc_eq_set(struct xive *x, bool alloc_indirect) /* Any cache scrub needed ? */ } - return idx; + bitmap_set_bit(*x->eq_map, idx); + return eq_base_idx; } static void xive_free_eq_set(struct xive *x, uint32_t eqs) { uint32_t idx; - xive_vdbg(x, "Freeing EQ set...\n"); + xive_vdbg(x, "Freeing EQ 0x%x..0x%x\n", eqs, eqs + 7); assert((eqs & 7) == 0); assert(x->eq_map);