From patchwork Fri Oct 30 02:22:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Su X-Patchwork-Id: 1390663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (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 4CMmLT12HGz9sSG for ; Fri, 30 Oct 2020 13:22:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=wistron.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CMmLS2BprzDqYK for ; Fri, 30 Oct 2020 13:22:56 +1100 (AEDT) X-Original-To: skiboot-stable@lists.ozlabs.org Delivered-To: skiboot-stable@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=wistron.com (client-ip=103.200.3.19; helo=segapp02.wistron.com; envelope-from=lulu_su@wistron.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=wistron.com Received: from segapp02.wistron.com (segapp02.wistron.com [103.200.3.19]) by lists.ozlabs.org (Postfix) with ESMTP id 4CMmLN2VX1zDqXW for ; Fri, 30 Oct 2020 13:22:50 +1100 (AEDT) Received: from EXCHAPP03.whq.wistron (unverified [10.37.38.26]) by TWNHUMSW3.wistron.com (Clearswift SMTPRS 5.6.0) with ESMTP id ; Fri, 30 Oct 2020 10:22:44 +0800 Received: from EXCHAPP02.whq.wistron (10.37.38.25) by EXCHAPP03.whq.wistron (10.37.38.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 30 Oct 2020 10:22:32 +0800 Received: from gitserver.wistron.com (10.37.38.233) by EXCHAPP02.whq.wistron (10.37.38.25) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 30 Oct 2020 10:22:32 +0800 From: Lulu Su To: , Stewart Smith Date: Fri, 30 Oct 2020 10:22:29 +0800 Message-ID: <20201030022230.21949-1-Lulu_Su@wistron.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-TM-SNTS-SMTP: 7D4B07C5345EE79583F10876D8022C32CFA9A9FFDB2825D6F26EC75A9AD4A33C2000:8 Subject: [Skiboot-stable] [PATCH 1/2] mowgli: Limit slot1 to Gen3 by default X-BeenThere: skiboot-stable@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches, review, and discussion for stable releases of skiboot" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oliver OHalloran , LuluTHSu , skiboot-stable@lists.ozlabs.org, Klaus Heinrich Kiwi Errors-To: skiboot-stable-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot-stable" From: LuluTHSu Refer to the spec. of mowgli, limit the slot to Gen3 speed. For mowgli platform spec. Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: LuluTHSu --- hw/phb4.c | 21 +++++++++++++++++++++ include/phb4.h | 1 + platforms/astbmc/mowgli.c | 16 ++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/hw/phb4.c b/hw/phb4.c index 17a233f..de10bb0 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -2991,6 +2991,27 @@ static unsigned int phb4_get_max_link_speed(struct phb4 *p, struct dt_node *np) return max_link_speed; } +/* + * Has the same effect as the ibm,max-link-speed property. + * i.e. sets the default link speed, while allowing NVRAM + * overrides, etc to still take effect. + */ +void phb4_set_dt_max_link_speed(struct phb4 *p, int new_max) +{ + uint64_t scr; + int max; + + /* take into account nvram settings, etc */ + if (pcie_max_link_speed) + max = pcie_max_link_speed; + else + max = new_max; + + scr = phb4_read_reg(p, PHB_PCIE_SCR); + scr = SETFIELD(PHB_PCIE_SCR_MAXLINKSPEED, scr, max); + phb4_write_reg(p, PHB_PCIE_SCR, scr); +} + static void phb4_assert_perst(struct pci_slot *slot, bool assert) { struct phb4 *p = phb_to_phb4(slot->phb); diff --git a/include/phb4.h b/include/phb4.h index abba2d9..47a46b7 100644 --- a/include/phb4.h +++ b/include/phb4.h @@ -259,4 +259,5 @@ static inline int phb4_get_opal_id(unsigned int chip_id, unsigned int index) void phb4_pec2_dma_engine_realloc(struct phb4 *p); +void phb4_set_dt_max_link_speed(struct phb4 *p, int new_max); #endif /* __PHB4_H */ diff --git a/platforms/astbmc/mowgli.c b/platforms/astbmc/mowgli.c index 9bfe7a4..0246bff 100644 --- a/platforms/astbmc/mowgli.c +++ b/platforms/astbmc/mowgli.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include "astbmc.h" @@ -71,6 +73,19 @@ static int mowgli_secvar_init(void) return secvar_main(secboot_tpm_driver, edk2_compatible_v1); } +/* + * Limit PHB0/(pec0) to gen3 speeds. + */ +static void mowgli_setup_phb(struct phb *phb, unsigned int __unused index) +{ + struct phb4 *p = phb_to_phb4(phb); + + if (p->pec == 0) { + phb4_set_dt_max_link_speed(p, 3); + prlog(PR_DEBUG, "Mowgli: Force the PHB%d Speed to Gen3.\n", p->pec); + } +} + DECLARE_PLATFORM(mowgli) = { .name = "Mowgli", .probe = mowgli_probe, @@ -80,6 +95,7 @@ DECLARE_PLATFORM(mowgli) = { .bmc = &bmc_plat_ast2500_openbmc, .pci_get_slot_info = slot_table_get_slot_info, .pci_probe_complete = check_all_slot_table, + .pci_setup_phb = mowgli_setup_phb, .cec_power_down = astbmc_ipmi_power_down, .cec_reboot = astbmc_ipmi_reboot, .elog_commit = ipmi_elog_commit, From patchwork Fri Oct 30 02:22:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Su X-Patchwork-Id: 1390665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (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 4CMmLx60Y1z9sSG for ; Fri, 30 Oct 2020 13:23:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=wistron.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CMmLx4sVczDqcK for ; Fri, 30 Oct 2020 13:23:21 +1100 (AEDT) X-Original-To: skiboot-stable@lists.ozlabs.org Delivered-To: skiboot-stable@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=wistron.com (client-ip=103.200.3.19; helo=segapp02.wistron.com; envelope-from=lulu_su@wistron.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=wistron.com Received: from segapp02.wistron.com (segapp02.wistron.com [103.200.3.19]) by lists.ozlabs.org (Postfix) with ESMTP id 4CMmLW1yDKzDqXw for ; Fri, 30 Oct 2020 13:22:58 +1100 (AEDT) Received: from EXCHAPP03.whq.wistron (unverified [10.37.38.26]) by TWNHUMSW3.wistron.com (Clearswift SMTPRS 5.6.0) with ESMTP id ; Fri, 30 Oct 2020 10:22:55 +0800 Received: from EXCHAPP02.whq.wistron (10.37.38.25) by EXCHAPP03.whq.wistron (10.37.38.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 30 Oct 2020 10:22:43 +0800 Received: from gitserver.wistron.com (10.37.38.233) by EXCHAPP02.whq.wistron (10.37.38.25) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 30 Oct 2020 10:22:43 +0800 From: Lulu Su To: , Stewart Smith Date: Fri, 30 Oct 2020 10:22:30 +0800 Message-ID: <20201030022230.21949-2-Lulu_Su@wistron.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201030022230.21949-1-Lulu_Su@wistron.com> References: <20201030022230.21949-1-Lulu_Su@wistron.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 04AA1A3B952544FCE3DDCD9CE30CC49CC61A9B576BA060109B52B2A18A32CFF62000:8 Subject: [Skiboot-stable] [PATCH 2/2] platform/mowgli: modify slot_name X-BeenThere: skiboot-stable@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches, review, and discussion for stable releases of skiboot" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oliver OHalloran , LuluTHSu , skiboot-stable@lists.ozlabs.org, Klaus Heinrich Kiwi Errors-To: skiboot-stable-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot-stable" From: LuluTHSu Since Mowgli has only one slot, modify the names of other slots to avoid confusion. Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: LuluTHSu --- platforms/astbmc/mowgli.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platforms/astbmc/mowgli.c b/platforms/astbmc/mowgli.c index 0246bff..083255f 100644 --- a/platforms/astbmc/mowgli.c +++ b/platforms/astbmc/mowgli.c @@ -17,17 +17,17 @@ #include "astbmc.h" -ST_PLUGGABLE(mowgli_slot1, "Pcie Slot1 (16x)"); -ST_PLUGGABLE(mowgli_slot2, "Pcie Slot2 (8x)"); +ST_PLUGGABLE(mowgli_slot1, "Pcie Slot1"); +ST_PLUGGABLE(mowgli_builtin_SAS, "Builtin SAS"); ST_BUILTIN_DEV(mowgli_builtin_bmc, "BMC"); -ST_PLUGGABLE(mowgli_slot3, "Pcie Slot3 (8x)"); +ST_PLUGGABLE(mowgli_builtin_ethernet, "Builtin Ethernet"); ST_BUILTIN_DEV(mowgli_builtin_usb, "Builtin USB"); static const struct slot_table_entry mowgli_phb_table[] = { ST_PHB_ENTRY(0, 0, mowgli_slot1), - ST_PHB_ENTRY(0, 1, mowgli_slot2), + ST_PHB_ENTRY(0, 1, mowgli_builtin_SAS), ST_PHB_ENTRY(0, 2, mowgli_builtin_bmc), - ST_PHB_ENTRY(0, 3, mowgli_slot3), + ST_PHB_ENTRY(0, 3, mowgli_builtin_ethernet), ST_PHB_ENTRY(0, 4, mowgli_builtin_usb), { .etype = st_end },