From patchwork Fri Aug 28 04:30:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1353001 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 4Bd6B95TTWz9sSn for ; Fri, 28 Aug 2020 14:31:45 +1000 (AEST) 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.a=rsa-sha256 header.s=20161025 header.b=O5LEVcNF; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4Bd6B94459zDqlr for ; Fri, 28 Aug 2020 14:31:45 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::444; helo=mail-pf1-x444.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.a=rsa-sha256 header.s=20161025 header.b=O5LEVcNF; dkim-atps=neutral Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Bd69X5Vn6zDqlh; Fri, 28 Aug 2020 14:31:12 +1000 (AEST) Received: by mail-pf1-x444.google.com with SMTP id t185so5159437pfd.13; Thu, 27 Aug 2020 21:31:12 -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=/2yoI/B6E47WWK4C1jky6+YGksunM5trUAT4Co1wgxQ=; b=O5LEVcNFcCZRER+FjPB2J1EGzTvqKHtA9berplq2RA9uIPfTiNq91cvmJa3boIrJJv 9r9qxm3r5sb6XtOrFLKnyvblJrgducA7bYAYfbhfBu/nFE7IXFPAB1YsqU0LFigy77K3 Cd4auS1F9jzCSmjPv78CiuHDywVVayk/aXlWXaivJ181WHh6XTwQFPY6vGLbW2FlDFl0 p6vB5ZL4KEIqoOkGD24L4daZb+BOTAAPhraPEYyMFljCgR6a38ArSQTk5iBIJ35tyViw TmY8My13kKHNp2EVf/25uPRkS7eZNBBEKFzffX7k9i34+jNWyMd6rlDfQ35uMIJs7dGB 5g5A== 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=/2yoI/B6E47WWK4C1jky6+YGksunM5trUAT4Co1wgxQ=; b=YxmmsLWvwAyBwJeeR4WwiqgmmutO025dXV1V/AYA4Z88fIJ1s1z2VZw3TtnkeFqRyP 2B7LMpfMtcytD2uRO5c9O/0WrUUITj8aMhIt9SwwdJTT7Gz/YAXjxj2GP8cqUELRLoa6 SqsSOnI4FHpeDEudRf3bDhfITYWjwO+ZRNP8BL1MPyVfSpWDAJltsVrqQJEFnRBJ3p3s us2Nr/YhBiIxGDSuwiwuJWKPWQ/dGfe+225SFBz0F+4VLIz9AHt7A47/ZvmuDGAHwLGD jVcXcLshIc/CrVIXzW1g5cqDl334Zjblcma/fn4q078dcEouRyZ5KVjdxRhfmreNNQIz UTzA== X-Gm-Message-State: AOAM532kv/nFccNz+ZAsMCgSIF3RPXnmXSrQZef/Wrkln8XKJfmgERRS zqhoVylYsm+l6RfcGKLqhBoCEo+EjoSVOQ== X-Google-Smtp-Source: ABdhPJyTuYl/aW2La82KjlzvzPmPLCHqyRhZQ/HDAZadnVQ4Oef57s4sN20IWxdaNh8pqCPTrpbr9g== X-Received: by 2002:a65:568b:: with SMTP id v11mr16898680pgs.396.1598589069603; Thu, 27 Aug 2020 21:31:09 -0700 (PDT) Received: from localhost.ibm.com (194-193-34-182.tpgi.com.au. [194.193.34.182]) by smtp.gmail.com with ESMTPSA id np4sm37151pjb.4.2020.08.27.21.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 21:31:09 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 28 Aug 2020 14:30:55 +1000 Message-Id: <20200828043055.1563069-2-oohall@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828043055.1563069-1-oohall@gmail.com> References: <20200828043055.1563069-1-oohall@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 2/2] hw/phb4: Verify AER support before initialising AER regs 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: skiboot-stable@lists.ozlabs.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Check the AER capability offset pointer is non-zero before enabling the AER messages. If the device doesn't support AER we end up writing garbage to config offset 0x0 + PCIECAP_AER_CAPCTL, or 0x18. For a normal device this is one of the BARs so this doesn't do much, but for a bridge this results in overriding: 0x18 - The primary bus number 0x19 - The secondary bus number 0x1A - The subordinate bus number 0x1B - The latency timer 0x1B is hardwired to zero for PCIe devices, but overwriting the bus number register can cause issues with routing of config space accesses. It's worth pointing out that we write actual values for the secondary and subordinate bus numbers before scanning the secondary bus, but the primary bus number is never restored. Cc: skiboot-stable@lists.ozlabs.org Signed-off-by: Oliver O'Halloran --- hw/phb4.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/phb4.c b/hw/phb4.c index 328621917667..17a233f39ff1 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -788,6 +788,9 @@ static void phb4_endpoint_init(struct phb *phb, pci_cfg_write16(phb, bdfn, ecap + PCICAP_EXP_DEVCTL, val16); /* Enable ECRC generation and check */ + if (!aercap) + return; + pci_cfg_read32(phb, bdfn, aercap + PCIECAP_AER_CAPCTL, &val32); val32 |= (PCIECAP_AER_CAPCTL_ECRCG_EN | PCIECAP_AER_CAPCTL_ECRCC_EN);