From patchwork Tue Nov 22 01:48:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Jui X-Patchwork-Id: 9440427 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AEFCF60235 for ; Tue, 22 Nov 2016 01:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB6828B11 for ; Tue, 22 Nov 2016 01:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A04F728B73; Tue, 22 Nov 2016 01:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E561928B11 for ; Tue, 22 Nov 2016 01:48:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754362AbcKVBsz (ORCPT ); Mon, 21 Nov 2016 20:48:55 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36449 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754185AbcKVBsy (ORCPT ); Mon, 21 Nov 2016 20:48:54 -0500 Received: by mail-pf0-f179.google.com with SMTP id 189so838221pfz.3 for ; Mon, 21 Nov 2016 17:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=7HWiNCfFRMS74nU4KMEfJgS39JVhekxUbR9B8cHG80A=; b=ULO7tLys8zb+0vLVCepC9Xe9xOq7/dP5OpMgefjoDfLMLbp6Gi21uzyZW1I4Za+X9M nX6ZaUi2lQ6mh3VCDK0XTz37rApqsHa751AO8Bh/YF+1zPlcGYTPjV35JozfcRKAtPWe OdnlomKgtG7waobnpgQdNQ/XTv8waQbf6Y6VE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7HWiNCfFRMS74nU4KMEfJgS39JVhekxUbR9B8cHG80A=; b=lbHh9T4Wq7SQd4nohlowsbHpTMDuGMkCg5r9W4rKxLW1tfDBJsR9mwp+PWrcR59h0L LSQ0svSmYvEnvpGAn+CimBpYnNiuOXKfTZvRZC4AtGTmFPHbQ0zqtvANo1kRCyrY25uV QVaGWT4TGhRvKMnjGxAeThboyOhdNEIvuPWKgkP315r3XIl3I3P1UB7yOepMHiTEgM3o +M9+T3lVpH2TFyH3mDPh/mKKTB3Z938RbLKNaBK4jheqkNtbB5M8SoAScNs5DUcAcDmL CbUDJAjHEcfm7EPfFks0QyQ01nUBKSQijsUdxmx/bhk+uqY3zCu1rLbsZz8iPlRBBgbt /Q/g== X-Gm-Message-State: AKaTC03ai6GgAxnUrJtRr5btbjx7OPpudXFHu1qTyIlNGN8bEQ5QA5qP6D1tSkyLmQq77uzO X-Received: by 10.98.223.25 with SMTP id u25mr21945757pfg.96.1479779333301; Mon, 21 Nov 2016 17:48:53 -0800 (PST) Received: from lbrmn-lnxub44-1.ric.broadcom.com ([192.19.224.250]) by smtp.gmail.com with ESMTPSA id l69sm40266441pfk.34.2016.11.21.17.48.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Nov 2016 17:48:52 -0800 (PST) From: Ray Jui To: Bjorn Helgaas , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, Alex Barba , Oza Oza , Ray Jui Subject: [PATCH] PCI: iproc: Fix incorrect MSI address alignment Date: Mon, 21 Nov 2016 17:48:30 -0800 Message-Id: <1479779310-2580-1-git-send-email-ray.jui@broadcom.com> X-Mailer: git-send-email 2.1.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the code to handle PAXB v2 based MSI steering, the logic aligns the MSI register address to the size of supported inbound mapping range. This is incorrect since it rounds "up" the starting address to the next aligned address, but what we want is the starting address to be rounded "down" to the aligned address. This patch fixes the issue and allows MSI writes to be properly steered to the GIC Fixes: 4b073155fbd3 ("PCI: iproc: Add support for the next-gen PAXB controller") Signed-off-by: Ray Jui --- drivers/pci/host/pcie-iproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index 8ffb9d4..fb09668 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -1018,7 +1018,7 @@ static int iproc_pcie_paxb_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr) memset(&range, 0, sizeof(range)); range.size = SZ_32K; - range.pci_addr = range.cpu_addr = ALIGN(msi_addr, range.size); + range.pci_addr = range.cpu_addr = msi_addr & ~(range.size - 1); ret = iproc_pcie_setup_ib(pcie, &range, IPROC_PCIE_IB_MAP_IO); return ret;