Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp106975ybv; Sat, 22 Feb 2020 00:08:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxJg2eGwgyNz1ONtrPTxVk1f33B1bdUyrurdtY2oElZ0mJJvjE3HM/m+ZJgzBdjEgGM9wr/ X-Received: by 2002:aca:b80a:: with SMTP id i10mr5205978oif.106.1582358905190; Sat, 22 Feb 2020 00:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582358905; cv=none; d=google.com; s=arc-20160816; b=pLmxfz+LQzbHlrEckqaiBoLrA73WwseTCiOxWshKEcHE0NVZ1jrM52lB3AsrWSZDkI JmNWReS4ICVkUn7boIiBqc06NKkPgWA5wNizos7SNNeym/1XRXINpv1joJuv3wx1htxp JZm8E0wlQmoNcs1xMqRurDGSiDyp+spXpShFkot5PY0UMYWtPzmMA5brTydxbGx6S2qF URFRr2537WnOAhgbSH2JOMo4ffoP5tZpLqkxW2LVad+Qp7cyJb8DUTQWEYW1tjSa/ub4 1hPzujAd2yeRrUp/XYoL1A6bh5L6+PUXhqNZxU1mooZxsTHpeTB4zu/J8q9eaKZy2Z6f 0E8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=QcR3qeeEdpGXf4Hk+VsZNVcCAWRyaGav9pITQWtdmAk=; b=t00DKf9Tmih8UogV98sTdsWhxTHDQ0ZWFCe4omBdn9JiPugBoUg4EEJ4qqpdEYpyaD BCN+klvHGetLnI8ZCrFb2kEsUvrU3cdSVN4AXb7wmWdYzoL1nx5LtdjxHro4VAewuFd6 qHT4Ciu2mkZH2scSwspLH9l5AZ1jN3Bj4jHLXp33wcRLW5gX5qbhQNhSNf9uDSRm8Wio DsU5NrTh14JBBSiG7cQUKRW/T6WtAYQEzh+zcxLST4tPmdRVhJDJgyYPBwvXLC7XbhD0 V5n0bFSTl53JuScd5zhHyyzZyFOpMWLjJpILkZcZJPSAQ6e9mtXrPuu0Q7CDk4JembOF BRDw== ARC-Authentication-Results: i=1; mx.google.com; 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 a14si2031138oid.102.2020.02.22.00.08.11; Sat, 22 Feb 2020 00:08:25 -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; 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 S1727027AbgBVIHQ (ORCPT + 99 others); Sat, 22 Feb 2020 03:07:16 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:34631 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgBVIHP (ORCPT ); Sat, 22 Feb 2020 03:07:15 -0500 Received: from mail-lf1-f49.google.com ([209.85.167.49]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MOzfO-1img6m1muK-00PPN4; Sat, 22 Feb 2020 09:07:12 +0100 Received: by mail-lf1-f49.google.com with SMTP id s23so3185669lfs.10; Sat, 22 Feb 2020 00:07:12 -0800 (PST) X-Gm-Message-State: APjAAAUERwCvXvfjPktZvxZvux4aBnbtp9P35O/TrUejem6kA48vhnWq afcYUy01GmsjFZw8KKXjaFN8ssB9XvvVXa2LFRM= X-Received: by 2002:a19:c1cc:: with SMTP id r195mr10024414lff.173.1582358831729; Sat, 22 Feb 2020 00:07:11 -0800 (PST) MIME-Version: 1.0 References: <20190822192451.5983-1-scott.branden@broadcom.com> <20190822192451.5983-3-scott.branden@broadcom.com> <10461fcf-9eca-32b6-0f9d-23c63b3f3442@broadcom.com> <93b8285a-e5eb-d4a4-545d-426bbbeb8008@broadcom.com> <20191011133120.GP16384@42.do-not-panic.com> <3731a882-8784-b957-7628-49edfa9683e7@broadcom.com> In-Reply-To: <3731a882-8784-b957-7628-49edfa9683e7@broadcom.com> From: Arnd Bergmann Date: Sat, 22 Feb 2020 09:06:55 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/7] firmware: add offset to request_firmware_into_buf To: Scott Branden Cc: Luis Chamberlain , Takashi Iwai , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , Bjorn Andersson , Shuah Khan , "Rafael J . Wysocki" , "linux-kernel@vger.kernel.org" , linux-arm-msm , Linux FS-devel Mailing List , BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:VSS0lrE+jTxSYsb/3xTXnnGOMtXSAO7qXek1a9Rhtelg8xUYL0k fYS3SFDkUeYRUIun/OF7XYx+FDGgQn70Q0idx6i8+7cupOe8RkJsdjX/lKIHsqK8mkzUIn+ z7Kc2hOUQxxOaim+CfznkvXqaZOGsexPB0JupZqg+oSQbP/9jWLqK4La6+Kzg8oodyGRyQy +cK9sVsoiY3AkxbmFUxHg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:sKEdyQlfYT8=:lOsUdoWyit+edBrSNGaJH6 fxEvNN89AAEeHmesWC6DvvGMy3EZnNAF/yrfLlpan6ioYigGgldWsfteZ6UsI8Em6rY4w+0BL VnuGSpt+OlrmQZz14DIgcbFjiUgO0tKivCIX6yUVVuOw+FKvNcFfLUWcOmBXb3yOOt/TdChDb KKnrICkid7Rymi22DdDqYhj6i32MOOcnGOF/qfwjmdnsb/iIxwk6AQC2vPYd3npVHj0E/sKeV +CKfnHYYnemOD2oWRCBGirjRmB87PJY9Np+lzuFLZ0kp1rF15H0yelAm7WDHqxkT3EcMDfLSP K5Yl9Bz1NIQidm0B9g8Ys2ea2tH2ALly0oAMyJT1iOHjUX+X3o5Ybc6q4R2YePmCRbstctlhp lUxTY4TJk742AZFu9MhD9d+tqDJtiVpfAClRvckTKiZ2iCwwJPRGOeEdxNGvCzk750hxpPNwF lPFCyRZSAgAdCmNAjW1JX/pDp/2jwuyHUgt0ddwsF2fUBYnoUQEDoPN1xxKlrEBwOGo3Oy45Z eaPMINxrznxDg+eqLLM+oHyxyvRuAdS/xls023biXYhy72kNSRqJOEtHDlCbdy8uKY2VPUH2S 8SbHjeD6181EPf2ZeXq0hLgQRNBkxCKFFKgyFY7bDrf8xCLMLgvKcmPzNfK0AsHAeN/m94ZZ+ yOe/B706FUVu4iqKKIybavt7uzKk2rIpk/wwHKBfsRs3+wB6/gYUQtZSUZJQ7OiWsESX+N1QT Voi3IGbWAasmARnf/J1KJFJwWSlCcqdxLWzyt6Y9CxVbSNiiogO9R3fuDgrQDtjCXcqRcwhMA bRk2mjg5n5HSQcMnvIEK1ZrODImlNYCelQ20HpDXqniLe3IfHw= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 22, 2020 at 12:37 AM Scott Branden wrote: > On 2020-02-21 12:44 a.m., Arnd Bergmann wrote: > > On Fri, Feb 21, 2020 at 1:11 AM Scott Branden > > wrote: > >> On 2019-10-11 6:31 a.m., Luis Chamberlain wrote: > >>> On Tue, Aug 27, 2019 at 12:40:02PM +0200, Takashi Iwai wrote: > >>>> On Mon, 26 Aug 2019 19:24:22 +0200, > >>>> Scott Branden wrote: > >>>>> I will admit I am not familiar with every subtlety of PCI > >>>>> accesses. Any comments to the Valkyrie driver in this patch series are > >>>>> appreciated. > >>>>> But not all drivers need to work on all architectures. I can add a > >>>>> depends on x86 64bit architectures to the driver to limit it to such. > >>>> But it's an individual board on PCIe, and should work no matter which > >>>> architecture is? Or is this really exclusive to x86? > >>> Poke Scott. > >> Yes, this is exclusive to x86. > >> In particular, 64-bit x86 server class machines with PCIe gen3 support. > >> There is no reason for these PCIe boards to run in other lower end > >> machines or architectures. > > It doesn't really matter that much what you expect your customers to > > do with your product, or what works a particular machine today, drivers > > should generally be written in a portable manner anyway and use > > the documented APIs. memcpy() into an __iomem pointer is not > > portable and while it probably works on any x86 machine today, please > > just don't do it. If you use 'sparse' to check your code, that would normally > > result in an address space warning, unless you add __force and a > > long comment explaining why you cannot just use memcpy_to_io() > > instead. At that point, you are already better off usingn memcpy_to_io() ;-) > > > > Arnd > I am a not performing a memcpy at all right now. > I am calling a request_firmware_into_buf call and do not need to make a > copy. > This function eventually calls kernel_read_file, which then makes at > indirect call in __vfs_read to perform the read to memory. Well, that comes down to a memcpy() in the end, even if you don't spell it like that in your driver. It may be a copy_from_user(), but clearly not a memcpy_to_io(). > From there I am lost as to what operation happens to achieve this. > The read function would need to detect the buf is in io space and > perform the necessary operation. > Anyone with any knowledge on how to make this read to io space would be > appreciated? I don't think modifying the common code is helpful in this case: any access to PCI MMIO space is inevitably going to be slow, so an extra memcpy() in your driver is not going to cause any noticeable overhead, but the generic functions are meant to be fast for the normal use case and not gain any other features. Arnd