Received: by 10.192.165.148 with SMTP id m20csp4181641imm; Mon, 30 Apr 2018 13:20:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZZeWd/PJZMRj+bvaith/m0fs+MtPQFIzMWZkN83PoKWnA5ookgcZTuKI3skSdbuQSuoB0 X-Received: by 2002:a17:902:59ce:: with SMTP id d14-v6mr13941966plj.253.1525119643013; Mon, 30 Apr 2018 13:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525119642; cv=none; d=google.com; s=arc-20160816; b=vex1CC7My36g2E5akohQsbNZb5l9qqK3taGKwfUgilivbS+Q5VeUI3nAN8pI0s8oaM sY6QJd0Odx6I4tY7COXJ6F7P5A4zPLN14BcojZV1tjF5tIT8mUSQ70tVNyoNJmsBAfTZ soWtRqiQRV4znbIE+KRDKGDPTyiqlf56P/Sa479Q2y7eC2KLUnRTYTcpAQ+Ht25JQ/EH Rxy0wB86Yfg7n9MH6VqkS6OluRDlrMOeANH3y+9Laole2ygsT6fnSQIrD+UtIy1P8NfZ HshxxHJ8yvqY9XpywEpw64G6oeLueiviOceIYckaVjsRLLvmgbGRLYTjw34YMXmoZAoS cwBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=Zs4vI/tEVv9WbzZDkMUBmqON3HW2yGDZyDkb92o+ewI=; b=QH1XyapiHg39W+k38jG3BEAL8Xcmy+fIjruTuGd7O1j4frah3ug4ligfkLl9/RlTzm 4VR6EL6+voHFjo7DlOfDSYRM60WOfok/ravCmrvpx172c9l7qWrp6E0fdnlSJK0B8Y2E d4Uhy/Qg/iUM/nZLmECVOsLQvWNaF3qQZ6+3qn2NpcAXIe9cEIDvXkK7Tow+hipzZ/lH 1rVex9hk8fMSylVtow+p5qoP95lIbVpW1AkKmyU+dbajGuiKwsPPkHPBejQLPnJcQM2e EzMliSUAuzghfBzCP/C2SA2nZjXO0lFG0eiRPlA+5DSLZobliY7othlzCazFiw7PcoSq /FaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a71-v6si6648745pge.159.2018.04.30.13.20.28; Mon, 30 Apr 2018 13:20:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756101AbeD3UUI (ORCPT + 99 others); Mon, 30 Apr 2018 16:20:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:60654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755775AbeD3T0r (ORCPT ); Mon, 30 Apr 2018 15:26:47 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A69DE22DAE; Mon, 30 Apr 2018 19:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A69DE22DAE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Victor Gu , Wilson Ding , Nadav Haklai , Thomas Petazzoni , Lorenzo Pieralisi Subject: [PATCH 4.9 41/61] PCI: aardvark: Fix logic in advk_pcie_{rd,wr}_conf() Date: Mon, 30 Apr 2018 12:24:44 -0700 Message-Id: <20180430183954.816681682@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430183951.312721450@linuxfoundation.org> References: <20180430183951.312721450@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Victor Gu commit 660661afcd40ed7f515ef3369721ed58e80c0fc5 upstream. The PCI configuration space read/write functions were special casing the situation where PCI_SLOT(devfn) != 0, and returned PCIBIOS_DEVICE_NOT_FOUND in this case. However, while this is what is intended for the root bus, it is not intended for the child busses, as it prevents discovering devices with PCI_SLOT(x) != 0. Therefore, we return PCIBIOS_DEVICE_NOT_FOUND only if we're on the root bus. Fixes: 8c39d710363c1 ("PCI: aardvark: Add Aardvark PCI host controller driver") Cc: Signed-off-by: Victor Gu Reviewed-by: Wilson Ding Reviewed-by: Nadav Haklai [Thomas: tweak commit log.] Signed-off-by: Thomas Petazzoni Signed-off-by: Lorenzo Pieralisi Signed-off-by: Greg Kroah-Hartman --- drivers/pci/host/pci-aardvark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/pci/host/pci-aardvark.c +++ b/drivers/pci/host/pci-aardvark.c @@ -439,7 +439,7 @@ static int advk_pcie_rd_conf(struct pci_ u32 reg; int ret; - if (PCI_SLOT(devfn) != 0) { + if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) { *val = 0xffffffff; return PCIBIOS_DEVICE_NOT_FOUND; } @@ -493,7 +493,7 @@ static int advk_pcie_wr_conf(struct pci_ int offset; int ret; - if (PCI_SLOT(devfn) != 0) + if ((bus->number == pcie->root_bus_nr) && PCI_SLOT(devfn) != 0) return PCIBIOS_DEVICE_NOT_FOUND; if (where % size)