From patchwork Wed Mar 15 09:58:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 739092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vjnJ474fLz9s0g for ; Wed, 15 Mar 2017 21:04:04 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vjnJ4643qzDqcM for ; Wed, 15 Mar 2017 21:04:04 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vjnHb0QSfzDqbg for ; Wed, 15 Mar 2017 21:03:38 +1100 (AEDT) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v2F9x7Mi010085; Wed, 15 Mar 2017 04:59:59 -0500 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Wed, 15 Mar 2017 20:58:58 +1100 Message-Id: <20170315095900.13962-9-benh@kernel.crashing.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170315095900.13962-1-benh@kernel.crashing.org> References: <20170315095900.13962-1-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH 09/11] xive: Always reset queue state in opal_xive_set_queue_info() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We used to require an enable/disable transition, however that doesn't work well with how KVM does "upgrade" a queue so instead just always reset the queue state (queue pointer and generation) whenever a queue is reconfigured. Escalations are reset to "masked" when the queue is disabled. Signed-off-by: Benjamin Herrenschmidt --- hw/xive.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/xive.c b/hw/xive.c index dc5f279..67c0126 100644 --- a/hw/xive.c +++ b/hw/xive.c @@ -3599,16 +3599,22 @@ static int64_t opal_xive_set_queue_info(uint64_t vp, uint32_t prio, if (qflags & OPAL_XIVE_EQ_ESCALATE) eq.w0 |= EQ_W0_ESCALATE_CTL; - /* Check enable transition. On any transition we clear PQ, - * set the generation bit, clear the offset and mask the - * escalation interrupt + /* Unconditionally clear the current queue pointer, set + * generation to 1 and disable escalation interrupts. */ - if ((qflags & OPAL_XIVE_EQ_ENABLED) && !(eq.w0 & EQ_W0_VALID)) { + eq.w1 = EQ_W1_GENERATION | + (old_eq->w1 & (EQ_W1_ESe_P | EQ_W1_ESe_Q | + EQ_W1_ESn_P | EQ_W1_ESn_Q)); + + /* Enable or disable. We always enable backlog for an + * enable queue otherwise escalations won't work. + */ + if (qflags & OPAL_XIVE_EQ_ENABLED) eq.w0 |= EQ_W0_VALID | EQ_W0_BACKLOG; - eq.w1 = EQ_W1_GENERATION | EQ_W1_ESe_Q; - } else if (!(qflags & OPAL_XIVE_EQ_ENABLED)) { + else { eq.w0 &= ~EQ_W0_VALID; - eq.w1 = EQ_W1_GENERATION | EQ_W1_ESe_Q; + eq.w1 &= ~(EQ_W1_ESe_P | EQ_W1_ESn_P); + eq.w1 |= EQ_W1_ESe_Q | EQ_W1_ESn_Q; } /* Update EQ, non-synchronous */