Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3389839ybp; Sun, 6 Oct 2019 10:52:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoc0Hnd/LJ6W74LjDrvhJdyosjt3ac0sQZ/SAVFXXYIcI33oCGcdK07h0n2eamJSd0kpS1 X-Received: by 2002:a17:906:65c2:: with SMTP id z2mr20267645ejn.31.1570384350490; Sun, 06 Oct 2019 10:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384350; cv=none; d=google.com; s=arc-20160816; b=bBZ/JKdutnWUk3FW3wv0OFhk9fQNkHk7mJioXp+i91tlZN/4Ihru/XV9NBPHnDFJkt 2FSqqTQ4+lp8JRc1uRyJFOx0iGNAUSJvMVcITjmbVvjPOXX9HzFc9ZS+exJjZE37YQdl MQf2JIeUhvdK67r56JoupxcED+4FM2EGvHbG78lZSmGq5EgT6iAvSVUUQs+hS16Ba4eS UPpp8exI5Q7wxuK/x+RmZxveIYeywJaO4pP/zNsrW65ddHnuFKpkzocFoIc/+pzCpZE6 2/GEHu2VlyGfIH7LDoXhwkWaAJvpwsdepBKgGziCYcdjRczst6UF3Y8oxLS+KSNhSbEF WciA== 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=83QU9q6/V2W0z+Hq+cfv94ThoMinhbTnMG5tj+I90ag=; b=So8ve2PdYCVwRaY/Cp0gi3FMNbhxf4JPfc+rbbFlaGfsTKCpyDS7BSguPYn9q9hdtT c9KJqhQlVXWnldevWgJTROhes339E/vquQTpLv8juqA+u3KXj7OeOBdnXBtjmmzANeiO 22jXseVLWLMH4dqsh1PjzCH0J67iXPQQ+XTKknn5r6nlopvGkc8slEpELK/CqrfQPpt3 YxjY3fma+VnT/UDJrKa7pxJfRxHKCw2ybgbmf6KyWz01dZ9MPWsqPPhvL6LRlG3/T3TU zCZ0K4o3EMc9+kLTl0FB9ezIkpKxjwO9nT5DMWCBHTZ/LBAih5y38PATU1pMltymfpL7 SEGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fAizaskT; 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 n25si717280ejr.206.2019.10.06.10.52.06; Sun, 06 Oct 2019 10:52:30 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fAizaskT; 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 S1731474AbfJFRnM (ORCPT + 99 others); Sun, 6 Oct 2019 13:43:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731455AbfJFRnK (ORCPT ); Sun, 6 Oct 2019 13:43:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 3862B2080F; Sun, 6 Oct 2019 17:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383789; bh=PxSi+cTwfa9Lu6cGhKDYSq72x622R/OQZffxCTUfG8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fAizaskTFjwEoeubWexfYcyOTXekqnGxfSkMb5o1T4zunA6aoWlE/qcWbP+OFn2tD /WM4uVLH/nSsGiY9zpUc6wkrHy+xujRb8gLRxJsAg1uHhN93DAnD2tz7E2H9h89ZqC 7XVSK9pV0AZUSUL1cNjmMaItgVYsv0nNIaB/qD00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Zhiqiang , Lorenzo Pieralisi , Minghuan Lian , Subrahmanya Lingappa , Sasha Levin Subject: [PATCH 5.3 097/166] PCI: mobiveil: Fix the CPU base address setup in inbound window Date: Sun, 6 Oct 2019 19:21:03 +0200 Message-Id: <20191006171221.740048947@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171212.850660298@linuxfoundation.org> References: <20191006171212.850660298@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Hou Zhiqiang [ Upstream commit df901c85cc28b538c62f6bc20b16a8bd05fcb756 ] Current code erroneously sets-up the CPU base address through the parameter 'pci_addr', which is passed to initialize the CPU (AXI) base address of the inbound window where the controller maps the PCI address space into CPU physical address space; furthermore, it also truncates it by programming only the lower 32-bit value into the inbound CPU address register. Fix both issues by introducing a new parameter 'u64 cpu_addr' to initialize both lower 32-bit and upper 32-bit of the CPU physical base address mapping PCI inbound transactions into CPU (AXI) ones. Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver") Signed-off-by: Hou Zhiqiang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Minghuan Lian Reviewed-by: Subrahmanya Lingappa Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-mobiveil.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pcie-mobiveil.c b/drivers/pci/controller/pcie-mobiveil.c index 672e633601c78..a45a6447b01d9 100644 --- a/drivers/pci/controller/pcie-mobiveil.c +++ b/drivers/pci/controller/pcie-mobiveil.c @@ -88,6 +88,7 @@ #define AMAP_CTRL_TYPE_MASK 3 #define PAB_EXT_PEX_AMAP_SIZEN(win) PAB_EXT_REG_ADDR(0xbef0, win) +#define PAB_EXT_PEX_AMAP_AXI_WIN(win) PAB_EXT_REG_ADDR(0xb4a0, win) #define PAB_PEX_AMAP_AXI_WIN(win) PAB_REG_ADDR(0x4ba4, win) #define PAB_PEX_AMAP_PEX_WIN_L(win) PAB_REG_ADDR(0x4ba8, win) #define PAB_PEX_AMAP_PEX_WIN_H(win) PAB_REG_ADDR(0x4bac, win) @@ -462,7 +463,7 @@ static int mobiveil_pcie_parse_dt(struct mobiveil_pcie *pcie) } static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, - u64 pci_addr, u32 type, u64 size) + u64 cpu_addr, u64 pci_addr, u32 type, u64 size) { u32 value; u64 size64 = ~(size - 1); @@ -482,7 +483,10 @@ static void program_ib_windows(struct mobiveil_pcie *pcie, int win_num, csr_writel(pcie, upper_32_bits(size64), PAB_EXT_PEX_AMAP_SIZEN(win_num)); - csr_writel(pcie, pci_addr, PAB_PEX_AMAP_AXI_WIN(win_num)); + csr_writel(pcie, lower_32_bits(cpu_addr), + PAB_PEX_AMAP_AXI_WIN(win_num)); + csr_writel(pcie, upper_32_bits(cpu_addr), + PAB_EXT_PEX_AMAP_AXI_WIN(win_num)); csr_writel(pcie, lower_32_bits(pci_addr), PAB_PEX_AMAP_PEX_WIN_L(win_num)); @@ -624,7 +628,7 @@ static int mobiveil_host_init(struct mobiveil_pcie *pcie) CFG_WINDOW_TYPE, resource_size(pcie->ob_io_res)); /* memory inbound translation window */ - program_ib_windows(pcie, WIN_NUM_0, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE); + program_ib_windows(pcie, WIN_NUM_0, 0, 0, MEM_WINDOW_TYPE, IB_WIN_SIZE); /* Get the I/O and memory ranges from DT */ resource_list_for_each_entry(win, &pcie->resources) { -- 2.20.1