From patchwork Wed Mar 20 08:56:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1058973 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 44PPBl38Z0z9sNG for ; Wed, 20 Mar 2019 20:05:03 +1100 (AEDT) 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="YIh4z2b1"; 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 44PPBl1ZL0zDqNX for ; Wed, 20 Mar 2019 20:05:03 +1100 (AEDT) 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::42f; helo=mail-pf1-x42f.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="YIh4z2b1"; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 44PP1k5bPpzDqMr for ; Wed, 20 Mar 2019 19:57:14 +1100 (AEDT) Received: by mail-pf1-x42f.google.com with SMTP id t21so688418pfe.2 for ; Wed, 20 Mar 2019 01:57:14 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KtaQZ/OpIe5kc+M66gSlW+5pdDnUe+4udHl4bHM4//A=; b=YIh4z2b1Gs2io2W668GEiRFOwx/n5SOF2V/o2U+XYJYU0xCJUaKeO+D+4y7iMHvR2i xnCScxaSRowYjw2RrnSIXUprLMzaN7xkejb2eBBmgs5cuxoeD7W6LNKBZo592tXn7TcS eDk8sxygdKii5avEDnU8fJpF5KJtBWvCK6W5sBqJuhK3D8OLta9/g1RnymBHC9gFMer3 WX0+2SHo5e8/01rYvUnpCxZS0OCzX8OLqW0nG6StsaJDP28RbmbGrowuBIJ66pOaJLDH 0RcjcJqoBBJMvGaokSaune22NTkWiqZXtYog1/CyuKygtc+b0QdKB/f0HQtF1NeBVZDH o7xA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KtaQZ/OpIe5kc+M66gSlW+5pdDnUe+4udHl4bHM4//A=; b=QcMblXVcPj2WdHiiC9PhxUsCH8LlKO4yP7e9m4gtotJJLjGwHO+8h81/sKIg2bfwR9 8IK13coSHN7uo/AyYanSYvoapEDqMr/gScQ/qDFh4TKAzsvr3rHt115/MNjvZaC/MUHi szCEEMMgbYeWXz+Y90FT+ATk08Y4x/vI46T561SVGGNmO2RcTdC8xg7oWjVewXBDo1Fu r2M5g3rGF/p8JuIsKkrf2vSWhttC6MsAmt1NOsmLUcM2AtX+tYizU907xzMu6ufFp2x3 7XauS2B50DyZg9Mhl0NPhshO21NzfEzse6wmlMMr1wwq1xw/xqTmO+R2daHTaoUtCMqK hWEw== X-Gm-Message-State: APjAAAVRcLmY6NNYYgGfMTGRcIoz1sAs/w3n6oKxQsF+9iaQFV0ZnWXs j13Gz/8R7stnDSx9lIW69CovstnG X-Google-Smtp-Source: APXvYqz0LuyNF1BY6WFU404I7OiyV6EwNHo3C1+ZMp4+AjPDQU2qq6y6Me9Hymc5/l1dth0jascprA== X-Received: by 2002:a63:cd06:: with SMTP id i6mr6357187pgg.267.1553072231911; Wed, 20 Mar 2019 01:57:11 -0700 (PDT) Received: from wafer.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id p20sm1616379pgi.3.2019.03.20.01.57.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 01:57:11 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Wed, 20 Mar 2019 19:56:54 +1100 Message-Id: <20190320085656.32078-2-oohall@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190320085656.32078-1-oohall@gmail.com> References: <20190320085656.32078-1-oohall@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 2/4] hw/phb4: Remove FRESET presence check 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: , Cc: mikey@neuling.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When we do an freset the first step is to check if a card is present in the slot. However, this only occurs when we enter phb4_freset() with the slot state set to SLOT_NORMAL. This occurs in: a) The creset path, and b) When the OS manually requests an FRESET via an OPAL call. a) is problematic because in the boot path the generic code will put the slot into FRESET_START manually before calling into phb4_freset(). This can result in a situation where a device is detected on boot, but not after a CRESET. I've noticed this occurring on systems where the PHB's slot presence detect signal is not wired to an adapter. In this situation we can rely on the in-band presence mechanism, but the presence check will make us exit before that has a chance to work. Additionally, if we enter from the CRESET path this early exit leaves the slot's PERST signal being left asserted. This isn't currently an issue, but if we want to support hotplug of devices into the root port it will be. Signed-off-by: Oliver O'Halloran --- hw/phb4.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 4f15b2b9a4b4..353f866a5dc1 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -2931,30 +2931,20 @@ static int64_t phb4_hreset(struct pci_slot *slot) static int64_t phb4_freset(struct pci_slot *slot) { struct phb4 *p = phb_to_phb4(slot->phb); - uint8_t presence = 1; uint64_t reg; uint16_t reg16; switch(slot->state) { case PHB4_SLOT_NORMAL: + case PHB4_SLOT_FRESET_START: PHBDBG(p, "FRESET: Starts\n"); /* Reset max link speed for training */ p->max_link_speed = phb4_get_max_link_speed(p, NULL); - /* Nothing to do without adapter connected */ - if (slot->ops.get_presence_state) - slot->ops.get_presence_state(slot, &presence); - if (!presence) { - PHBDBG(p, "FRESET: No device\n"); - return OPAL_SUCCESS; - } - PHBDBG(p, "FRESET: Prepare for link down\n"); - phb4_prepare_link_change(slot, false); - /* fall through */ - case PHB4_SLOT_FRESET_START: + phb4_pcicfg_read16(&p->phb, 0, p->ecap + PCICAP_EXP_LCTL, ®16); reg16 |= PCICAP_EXP_LCTL_LINK_DIS;