Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3669459ima; Mon, 4 Feb 2019 03:09:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN76yc7SDCRrVZ3r2yNgtAiETq2/e7abSzKDnTu0yNJtMqdHWa3cpa0m8qvE9SL1r7792nP2 X-Received: by 2002:a62:4851:: with SMTP id v78mr51034845pfa.97.1549278560688; Mon, 04 Feb 2019 03:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278560; cv=none; d=google.com; s=arc-20160816; b=xZGGw/T9rb8OhdxMuU2eC+0+KMs3vwZnsEi/93q+J1dFnTTiMOUm570mOKXjkBXvKr fzD1hVqZLCNYSLaAY+CJcvXZhZPQwq5x4Oi9Z2EMfMDiHDkD10EgOeA+G9Sdyl0IOQhA yiey7mL8OmQ4Ap/loiJijy9kiu2R8RoTWn/RR3aU6ox0hsiiIRSaVChVlr4AI8uIsxWv riyJ8zQ41comZSIIdbZ/i6Cr6Nq2KHEWEzfDE39snd3etT/JSXDvcNUv6sCYmm7UI/CL GHRcCW/e4PAGDJfiwdcSRsUzMENKfim7nM7/ggZfhj3GLcIpJDV94rVLa/MBhbeUlptu hvhw== 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=ECrwPoYO8HFTL8khpmRSGqsH27tMm8t3f52qYmPBtQ4=; b=x5P5uBeERUpI6cMxkdUg6QzFKWx69NEIAhX1vi8UwtVZWnnRWWhc0RbzlnEJaHtsKN /ovXRRQ4t+uWweJ3/KQme15kl4tOcEZnZdxJ67ZrNrVuvuRIZWw087Wd0V26ZK9M0y/r oxvLX+fcHYlv75CJQFDS9sZj7N5NKAJI7xeMKr8RSSjkZFWJR3lPeeEZcndtg6zSNvS7 vj55R3z5a2xK/06xoX4Mxoz+NmPGH967cTUC603nr5/aKVWx3bJFBtqSTUOIHf153gOg MUPp0QjQtYPQSl+RwRWTUdkdaxtezKqfCQXSbL7nJ21fxMsGDHcs0uEta/SDoUfz0jke YVuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1zKVyEqM; 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 g19si8587853pgj.358.2019.02.04.03.09.04; Mon, 04 Feb 2019 03:09:20 -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=1zKVyEqM; 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 S1730710AbfBDLHG (ORCPT + 99 others); Mon, 4 Feb 2019 06:07:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:40986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729390AbfBDKnH (ORCPT ); Mon, 4 Feb 2019 05:43:07 -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 C4928217D6; Mon, 4 Feb 2019 10:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549276986; bh=Mo8UDXMspZVi6+e91mB5rR57ODlKNOyJ8CymD81GOrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1zKVyEqMvuhjojVsKghBNHPtCyxuwz9uu8Yzkf8lHXUEOqRJcd/Lmhbbwd3qWpWjK EkcuR4eBRRDw6ojIfYDmY5FsUli3m59QK+DyxB0VwpuObVVBJOgu2U+zQ0bwXMpUdc H7XDDaiqTrRaMlNcG5x9zvfxva/xpH0pvLK8QVj0= 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.9 15/30] ARM: cns3xxx: Fix writing to wrong PCI config registers after alignment Date: Mon, 4 Feb 2019 11:36:53 +0100 Message-Id: <20190204103608.151205622@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103605.271746870@linuxfoundation.org> References: <20190204103605.271746870@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.9-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,