Received: by 10.223.176.46 with SMTP id f43csp1457316wra; Fri, 19 Jan 2018 11:50:34 -0800 (PST) X-Google-Smtp-Source: ACJfBouKKt3RCOXXu72i6pZUqmnJR943KirsxyGoLXNw6326YfSdiK1rFJVs8i3P1rEjZOaWaIDy X-Received: by 10.101.101.149 with SMTP id u21mr24580840pgv.251.1516391434612; Fri, 19 Jan 2018 11:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516391434; cv=none; d=google.com; s=arc-20160816; b=Zw7TYlWiB4iuGwITinlcmCCgytUTqxyeDdHARa8XSNz9a8KSw0SqnG63Vy/PGNUQx6 OswMJIcs/u0nunGQxICCuLm9jLknOu2U7LiNy8sgrMqvgNh0LpTdjj3uqDaEfdhfNbZT iXVm2NR8KIPbkn5nJyCEMa52cqhqQxlAiLtdLyRdxIx4jbgZfxMgWpSMnjzNjnvfwb/e ia17/dlB9xUMpPL0/ZE2ni+K7LPP18F9IhDTK9/7gBYaUsaOM12ooNn33sYhY18IcCBF ZvGx2kZSZOl1IdWTW5J86qzLkrr8SrQD5dYFZ9FARqBMP/oK5v1KP3pfXIX5USPUmL5D mLfg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=J9VOwdLJXDn6CV0b/YRUP485OMQx0P+DPCv3soxh36Q=; b=NK0/a7O6Fs7AzlD+ckmGuLJaNGBGEDB09Q4A+jJomd51FdjnaGkTPDhvLj2/wXDp6M ALzwTrjYHXeTIfI2Hq1c05jFYcziyX9bq/XrBdCE1JXyRMZQZefmJKP82ynzR6HTo5z5 sIYWzJSwCEoqQ48HzBbOVtyvVSg1dd7gYs/gHK8gSTrKUfwsudIqpnoN9gmBxyXWDpAR 1+l1GIxcWh37sWbs38dmdm78MB28U09VPEB9d4CmxwCd/FawWIbfHZBASYyg183GBR9u 3ueMk540Sj990onP7+3A+Kzd5LviCQkkf2Q42rNXicS81OqKNcOtxs02xyvL9bkZp8Vw sX/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=TplHvHH1; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj4-v6si1056750plb.18.2018.01.19.11.50.20; Fri, 19 Jan 2018 11:50:34 -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=@broadcom.com header.s=google header.b=TplHvHH1; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756282AbeASTsP (ORCPT + 99 others); Fri, 19 Jan 2018 14:48:15 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40575 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756214AbeASTsH (ORCPT ); Fri, 19 Jan 2018 14:48:07 -0500 Received: by mail-wr0-f195.google.com with SMTP id 100so2553963wrb.7 for ; Fri, 19 Jan 2018 11:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=J9VOwdLJXDn6CV0b/YRUP485OMQx0P+DPCv3soxh36Q=; b=TplHvHH173ezZL+TbOLNSdkos1TDtBVVP+Ve3XnqjkZ+kvbieQbjTEGqSkYOKn+ZPh FSWEGjm8uOpyEEQFuuSNL6miwx9PkziFvUj690N82rC6D69aKJnKh4S5+yuUorSjNFU4 Go6+GVO/aSyDItWjunv6LYYZKORZqbDESbzoI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=J9VOwdLJXDn6CV0b/YRUP485OMQx0P+DPCv3soxh36Q=; b=FjI3EPhqfERlzzfMMH3pm74cHejGzVRs1z7UX5APP6psrDxoll2Gk0qDKyH8a4qO1L LeNOyRpds+bZjA0gD9KmICzRd+LTpIuxWyoHqTrodP+iQkVIQKoarxxJSyfYo0MMHlkw BRueZYLOk3BPpsKtwNf51otT0thOYGxr84+sG6Qe4Y2+sqd0re4/jFq+BJI6GYkcTNJK lB9cdAT20bmm4JEdvf2IHvD2IUCy9npeT14wV872AYZRb4/dbG7wCR7DILkZrJtxbO+D C/t787/FOVsY3mZgloxCXK63OnOnKyPKzO9wUOWkKe0SRrJE0Ovqd28AbhAu+ukC9tb3 zvkg== X-Gm-Message-State: AKwxytc8v9lkdfbEMGHInN8ClYt1lEMVEh1LenCEu1A33QfsTCqP+gfT lyFKjgeZcp3UwUr3N3UZraFCpw== X-Received: by 10.223.187.13 with SMTP id r13mr8332864wrg.62.1516391285524; Fri, 19 Jan 2018 11:48:05 -0800 (PST) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id a73sm17685885wrc.53.2018.01.19.11.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jan 2018 11:48:04 -0800 (PST) Subject: Re: [PATCH v4 4/8] PCI: brcmstb: Add dma-range mapping for inbound traffic To: Christoph Hellwig , Florian Fainelli Cc: Rob Herring , Jim Quinlan , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , Catalin Marinas , Will Deacon , Brian Norris , Russell King , Robin Murphy , Jonas Gorski , Lorenzo Pieralisi , Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-MIPS , linux-pci@vger.kernel.org, Kevin Cernekee , Ralf Baechle , bcm-kernel-feedback-list@broadcom.com, Gregory Fong , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" References: <1516058925-46522-1-git-send-email-jim2101024@gmail.com> <1516058925-46522-5-git-send-email-jim2101024@gmail.com> <20180118073123.GA15766@lst.de> <20180118152331.GA24461@lst.de> From: Florian Fainelli Message-ID: Date: Fri, 19 Jan 2018 11:47:54 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180118152331.GA24461@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/18/2018 07:23 AM, Christoph Hellwig wrote: > On Thu, Jan 18, 2018 at 07:09:23AM -0800, Florian Fainelli wrote: >>> But in this case it actually is the example to follow as told >>> previously. >>> >>> NAK again for these chained dma ops that only create problems. >> >> Care to explain what should be done instead? > > Override phys_to_dma and dma_to_phys as mips and x86 do for similar > situations. How can this work well in the context of a loadable module for instance? For MIPS, this would mean that we have to override phys_to_dma() and dma_to_phys() in the platform that is *susceptible* to use this PCIe controller (arch/mips/bmips) which is fine, but there, we essentially need to find a way to make this dynamic based on whether the PCIe controller is loaded or not. As you might have seen from this patch, what needs to be done is highly dependent on the processor architecture and its memory controller physical memory map, so I don't see how we are in any better situation if we need to replicate 3 times across MIPS, ARM and ARM64 how the addresses need to be mangled. Are you suggesting we somehow decouple the memory mangling part into a portion that can be built into the kernel image (so phys_to_dma() and dma_to_phys() is resolved at vmlinux link time) and can be selected by different architectures that need it? If so, yikes. > > Bonous points of finding some generic way of doing it instead of > hiding it in arch code. > I can see value in having a generic mechanism, ala X86_DMA_REMAP allowing architectures to have the ability to override phys_to_dma() and dma_to_phys() but right now, especially if we look at arch/x86/pci/sta2x11-fixup.c this really appears to be quite messy and equally ugly than stacking operations... What is the actual problem you want to avoid with the stacking of DMA operations, is it because it becomes harder to audit, or are there are other reasons? -- Florian