Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4264504pxu; Mon, 21 Dec 2020 08:08:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAl/FpPRUwW5nqT2JeGJ1j5h0T6giPIgtnkwn6zn+oIOpzlUGGYgzaKo0yHYMewFy9mb+S X-Received: by 2002:a17:907:4126:: with SMTP id mx6mr15801792ejb.91.1608566921218; Mon, 21 Dec 2020 08:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608566921; cv=none; d=google.com; s=arc-20160816; b=F8tTWyKVpF29Dr1fFZWFLCSut8a3myegNK6acfiL3myQ4ShOADBhIjBmBmN7U3kTS1 EuNdjULaHy8nsiUkGpSJOlZHmr/K/7Cs5Gnqk4kof4Bz+Kd8ZEh0KvAlLTVyWVhsWhgZ yqOhj2Vfse0Y5uaOGvXRiw2obT5neML3i6JEKFU0aZ0BHCvujKxuBgEpDrFBJWal8CCU TWd1I+hAgqbaUHUx73VEl6jJpQBaotLjdADJwhROeRG6IumCeCLlH1+Sv5QpEoxNkKrz lWudfldi9aFb6IAQWYKDIiFjimTspUG1iYuPznDv9205NdThJ9sEiVhegmMVTIlFcUW2 jOyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FHlnrf8Ncx5ek2HlhO/rutDYUdRB0ZruipCn0edsH60=; b=Qf9L8vtnY/wYuNiNJ0XzAGKJvFmn+MemVIY/8axePhG1Jx9DA9b0oJjk/l3oIPCYv/ pFVANS8YlPiL62yM82jq7iwNCpD22BaTbYdyNgb7E+lrj7tNiaFHQWu5tndftM327UlW pTRpisSAO00k3EJfSLZqGEbkhRujqh554X7e/DHipSYOGfNTVC1rYq+NoQK/X+8si5iO C9/187NBIp6ZR8R4Bhd8yPpuYGQvVcd2Xr/FKL2pFVzfeUg08l9rkAB+MyOS3lK85AZt MQmZA/B3uyDC71zAR4+GtZkij/0vLGjulXcEkKM3/Ae58uk83Mw4c3ycsyRZ08ciK7Jl U1Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TnxfTS8U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu13si8788695ejb.588.2020.12.21.08.08.18; Mon, 21 Dec 2020 08:08:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TnxfTS8U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725911AbgLUQH3 (ORCPT + 99 others); Mon, 21 Dec 2020 11:07:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:48190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbgLUQH3 (ORCPT ); Mon, 21 Dec 2020 11:07:29 -0500 X-Gm-Message-State: AOAM532JhukNF2wFfQjyw2lIFW8Edpju8iI2N9UH47mmSMZi4rNhBrHO LVVPTzjZKwM5Bi0B8EG3bhfJYgEDFeUJGHfkVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608566808; bh=bt012kUB8DBMRxTaaQcKv/3tMYUHD4Nw6aawgMmHUko=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TnxfTS8U0vqfogcSANriPHtm51UD673sYV6CkOKq4hcl3Ksevxgp0ygieebJY4/If pNzt10zLjAXXOEEUCjupemId2CTpCEoJSYKAg6MdwO8v0Znu4CRgcEtZ9cF29aMkuD CoUBU5n63wd2whhukNyY6zp4/TyCRGhgE/Y069+ayHHbIBNqSOyB9mlMGebdIsci05 VPa3oaZ79xskWusXM6tK4JUBqZ+DNuMd1u2QamJKqBKaCqIB6NTqih1OQjkMAppYDp AEWGiNSXxVYpVulFgbrlzJL6OLqJHcCrQb55LsJFkD1HmvHvIXZxD4BuyPMbdUDc5W 9uwKEx/9nsZeA== X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr16788882edy.194.1608566806574; Mon, 21 Dec 2020 08:06:46 -0800 (PST) MIME-Version: 1.0 References: <1608305434-31685-1-git-send-email-shradha.t@samsung.com> In-Reply-To: <1608305434-31685-1-git-send-email-shradha.t@samsung.com> From: Rob Herring Date: Mon, 21 Dec 2020 09:06:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] PCI: dwc: Add upper limit address for outbound iATU To: Shradha Todi Cc: "linux-kernel@vger.kernel.org" , PCI , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , Pankaj Dubey Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 20, 2020 at 6:56 PM Shradha Todi wrote: > > The size parameter is unsigned long type which can accept > size > 4GB. In that case, the upper limit address must be > programmed. Add support to program the upper limit > address and set INCREASE_REGION_SIZE in case size > 4GB. Not all DWC h/w versions have the upper register and bit. Is it safe to write to the non-existent register? > > Signed-off-by: Shradha Todi > --- > drivers/pci/controller/dwc/pcie-designware.c | 8 ++++++-- > drivers/pci/controller/dwc/pcie-designware.h | 1 + > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 28c56a1..7eba3b2 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -290,12 +290,16 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, > upper_32_bits(cpu_addr)); > dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT, > lower_32_bits(cpu_addr + size - 1)); > + dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_LIMIT, > + upper_32_bits(cpu_addr + size - 1)); If not safe, perhaps only write if non-zero. > dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET, > lower_32_bits(pci_addr)); > dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_TARGET, > upper_32_bits(pci_addr)); > - dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, type | > - PCIE_ATU_FUNC_NUM(func_no)); > + val = type | PCIE_ATU_FUNC_NUM(func_no); > + val = upper_32_bits(size - 1) ? > + val | PCIE_ATU_INCREASE_REGION_SIZE : val; > + dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val); > dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, PCIE_ATU_ENABLE); > > /* > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index b09329b..28b72fb 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -106,6 +106,7 @@ > #define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) > #define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) > #define PCIE_ATU_UPPER_TARGET 0x91C > +#define PCIE_ATU_UPPER_LIMIT 0x924 > > #define PCIE_MISC_CONTROL_1_OFF 0x8BC > #define PCIE_DBI_RO_WR_EN BIT(0) > -- > 2.7.4 >