From patchwork Sun Feb 9 01:48:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Heinrich Kiwi X-Patchwork-Id: 1235403 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48FX5N2X4gz9s3x for ; Sun, 9 Feb 2020 12:49:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48FX5M3jJGzDqW1 for ; Sun, 9 Feb 2020 12:49:11 +1100 (AEDT) X-Original-To: Skiboot@lists.ozlabs.org Delivered-To: Skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=klaus@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 48FX562cl8zDqTX for ; Sun, 9 Feb 2020 12:48:57 +1100 (AEDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0191dVCd171645 for ; Sat, 8 Feb 2020 20:48:52 -0500 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y1u7xtgx9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 08 Feb 2020 20:48:52 -0500 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 0191j7dw032451 for ; Sun, 9 Feb 2020 01:48:51 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01dal.us.ibm.com with ESMTP id 2y1mm60b98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 09 Feb 2020 01:48:51 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0191moQm56492360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 9 Feb 2020 01:48:50 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B664BE053; Sun, 9 Feb 2020 01:48:50 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66A09BE04F; Sun, 9 Feb 2020 01:48:49 +0000 (GMT) Received: from klaus-virtual-ubuntu.mshome.net (unknown [9.85.175.191]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP; Sun, 9 Feb 2020 01:48:49 +0000 (GMT) From: Klaus Heinrich Kiwi To: Skiboot@lists.ozlabs.org Date: Sat, 8 Feb 2020 22:48:42 -0300 Message-Id: <20200209014842.30189-1-klaus@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-08_08:2020-02-07, 2020-02-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 suspectscore=1 impostorscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002090011 Subject: [Skiboot] [PATCH] ibm-fsp/lxvpd: check for upstream port on slot labeling 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: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Certain FSP configurations include PCIe switches that can have LXVPD slot map entries using the same switch-id and dev-id, even if they are referring to different upstream and downstream ports of the same link. The slot matching function (lxvpd_get_slot()) will match the first occurence, that can be the upstream port with, and ignore the downstream port. The main symptom for the above is an incorrect label for those slots, but I believe other slot attributes could be incorrect as well (as we are associating a slot with an upstream port). This patch picks-up an existing "upstream port" attribute from the 1005 version of the LXVPD slot map to prevent matching upstream ports on the slot matching function. Signed-off-by: Klaus Heinrich Kiwi --- platforms/ibm-fsp/lxvpd.c | 9 +++++---- platforms/ibm-fsp/lxvpd.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platforms/ibm-fsp/lxvpd.c b/platforms/ibm-fsp/lxvpd.c index 81cb612e..f6d92370 100644 --- a/platforms/ibm-fsp/lxvpd.c +++ b/platforms/ibm-fsp/lxvpd.c @@ -111,8 +111,8 @@ void *lxvpd_get_slot(struct pci_slot *slot) return s; } - /* Match switch port with switch_id != 0 */ - if (!is_phb && s->switch_id != 0 && s->dev_id == slot_num) { + /* Match downstream switch port with switch_id != 0 */ + if (!is_phb && s->switch_id != 0 && !s->upstream_port && s->dev_id == slot_num) { slot->data = s; s->pci_slot = slot; prlog(PR_DEBUG, "Found [%s] for slot %016llx\n", @@ -251,6 +251,7 @@ static void lxvpd_parse_1005_map(struct phb *phb, s->dev_id = entry->switch_device_id; s->pluggable = (entry->p0.pluggable == 0); s->power_ctl = entry->p0.power_ctl; + s->upstream_port = entry->p0.upstream_port; s->bus_clock = entry->p2.bus_clock; s->connector_type = entry->p2.connector_type; s->card_desc = entry->p3.byte >> 6; @@ -261,8 +262,8 @@ static void lxvpd_parse_1005_map(struct phb *phb, if (s->wired_lanes > PCI_SLOT_WIRED_LANES_PCIE_X32) s->wired_lanes = PCI_SLOT_WIRED_LANES_UNKNOWN; - prlog(PR_DEBUG, "1005 Platform data [%s] %02x %02x on PHB%04x\n", - s->label, s->switch_id, s->dev_id, phb->opal_id); + prlog(PR_DEBUG, "1005 Platform data [%s] %02x %02x %s on PHB%04x\n", + s->label, s->switch_id, s->dev_id, s->upstream_port ? "upstream" : "downstream", phb->opal_id); } } diff --git a/platforms/ibm-fsp/lxvpd.h b/platforms/ibm-fsp/lxvpd.h index 46acf674..d0fddd28 100644 --- a/platforms/ibm-fsp/lxvpd.h +++ b/platforms/ibm-fsp/lxvpd.h @@ -142,6 +142,7 @@ struct lxvpd_pci_slot { char label[9]; bool pluggable; bool power_ctl; + bool upstream_port; uint8_t wired_lanes; uint8_t bus_clock; uint8_t connector_type;