Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3645999ima; Mon, 4 Feb 2019 02:44:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IbQbNC6QvKXCW7nzsrZXEskbJ67GY0AUbUkKCIJCwLGMgj6fndzr9galmF8U3OBFFVLg8pU X-Received: by 2002:a63:6f0d:: with SMTP id k13mr12317415pgc.42.1549277075933; Mon, 04 Feb 2019 02:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549277075; cv=none; d=google.com; s=arc-20160816; b=xWhQE9v4zjPrg+wptn5Nb1xldnP0cLjIuC19iuM3DP3NoVVAEcjYJ+syqfYM4BEo6F Y4+ddHOSbX/HMUM1gXxq9MK4peGE20oLedRhGfVwTicvaysvmYinXxFDFLQzEp7mlttp 1D6z+1N8CWfIuZ32GTZAREunvWzh3OlaHfhzcP0o9itnByfJ1QivXH1vd0EYf8H3arx3 WiX5sx9/1ed9GQUl11KUxuOr5SfqNuFMyWY434b/00dORciRdhBFBDdwNojNq5crdOz1 dRuBmTczBaz8GKCDBtN9swW+dGR/igd7o13Bq7uFFg1D52ICtn5hHX/smUT3ctuNQ69F mYUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SplhSs2Yhk6P8Aj6UvzY5b9BouPqTNA/yvb7+6JQ+5M=; b=Rqp/Gc3iK+kQ41ZcFX6n1b76Xs03c5iX6QKKfvNK+ubpyv6Gks2YsTq9t0/llM2DQ9 xlHmH9yIcZMnayUK3wdx/DeE0LMDBM2i6fsW+iBSPTxNsIG7cWZNMrNQvxD3Y3vwh+g8 keLa/yRC75p3l9vfQ7E4a4UC+GltZEs91eChZk9QAcpZ2ioTlFLWvw4pUS3y1+10JxgF 7SAhW3dgWnHjKzsdMpjK7ZNA5m2B6aADA6uN5AoleQh9IpouKz6aErrCsL3w1gdwVKuJ YcRDp/i7WRulro+CWIwkCsCz0/KIATTVnq/nos3Ke3Ny8ln+4eb3w4jNnQu+3a2WOObx /GQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q+kH6eJo; 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 w11si13833722pgp.161.2019.02.04.02.44.19; Mon, 04 Feb 2019 02:44:35 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Q+kH6eJo; 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 S1729181AbfBDKmM (ORCPT + 99 others); Mon, 4 Feb 2019 05:42:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:40068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730481AbfBDKmJ (ORCPT ); Mon, 4 Feb 2019 05:42:09 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 183F22075B; Mon, 4 Feb 2019 10:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549276928; bh=d/QwTGXrQD4BQS6BGySYZpyfitdk0Ggab8sZE7NX7/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+kH6eJoTpsKrkOZ0m0qEWCCaIGYs+g7h2j6bteLWcqN6p2O8pj8BQm3NXjhUAonv sLuB4bLsKk+biOSas2hGDtSbrnan+4OwjMY5FvDvs+WS4qho7nI50jVJwpvRswVYZ/ ZXNRq6NPcOl3gHbXIyjjrPzB6UcbsKu815Dlopoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Koen Vandeputte , Lorenzo Pieralisi , Krzysztof Halasa , Tim Harvey , Arnd Bergmann , Bjorn Helgaas , Olof Johansson , Robin Leblon , Rob Herring , Russell King Subject: [PATCH 4.4 44/65] ARM: cns3xxx: Fix writing to wrong PCI config registers after alignment Date: Mon, 4 Feb 2019 11:36:37 +0100 Message-Id: <20190204103618.091610036@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103610.583715954@linuxfoundation.org> References: <20190204103610.583715954@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Koen Vandeputte commit 65dbb423cf28232fed1732b779249d6164c5999b upstream. Originally, cns3xxx used its own functions for mapping, reading and writing config registers. Commit 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") removed the internal PCI config write function in favor of the generic one: cns3xxx_pci_write_config() --> pci_generic_config_write() cns3xxx_pci_write_config() expected aligned addresses, being produced by cns3xxx_pci_map_bus() while the generic one pci_generic_config_write() actually expects the real address as both the function and hardware are capable of byte-aligned writes. This currently leads to pci_generic_config_write() writing to the wrong registers. For instance, upon ath9k module loading: - driver ath9k gets loaded - The driver wants to write value 0xA8 to register PCI_LATENCY_TIMER, located at 0x0D - cns3xxx_pci_map_bus() aligns the address to 0x0C - pci_generic_config_write() effectively writes 0xA8 into register 0x0C (CACHE_LINE_SIZE) Fix the bug by removing the alignment in the cns3xxx mapping function. Fixes: 802b7c06adc7 ("ARM: cns3xxx: Convert PCI to use generic config accessors") Signed-off-by: Koen Vandeputte [lorenzo.pieralisi@arm.com: updated commit log] Signed-off-by: Lorenzo Pieralisi Acked-by: Krzysztof Halasa Acked-by: Tim Harvey Acked-by: Arnd Bergmann CC: stable@vger.kernel.org # v4.0+ CC: Bjorn Helgaas CC: Olof Johansson CC: Robin Leblon CC: Rob Herring CC: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-cns3xxx/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c @@ -83,7 +83,7 @@ static void __iomem *cns3xxx_pci_map_bus } else /* remote PCI bus */ base = cnspci->cfg1_regs + ((busno & 0xf) << 20); - return base + (where & 0xffc) + (devfn << 12); + return base + where + (devfn << 12); } static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn,