All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Scott Branden <scott.branden@broadcom.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Takashi Iwai <tiwai@suse.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	David Brown <david.brown@linaro.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Shuah Khan <shuah@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	Olof Johansson <olof@lixom.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Colin Ian King <colin.king@canonical.com>,
	Kees Cook <keescook@chromium.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH 2/7] firmware: add offset to request_firmware_into_buf
Date: Sat, 22 Feb 2020 09:06:55 +0100	[thread overview]
Message-ID: <CAK8P3a0WWeNxaLYZBOipsALu_Y9isY6jKjRy9tc4Xokktoa1Pg@mail.gmail.com> (raw)
In-Reply-To: <3731a882-8784-b957-7628-49edfa9683e7@broadcom.com>

On Sat, Feb 22, 2020 at 12:37 AM Scott Branden
<scott.branden@broadcom.com> wrote:
> On 2020-02-21 12:44 a.m., Arnd Bergmann wrote:
> > On Fri, Feb 21, 2020 at 1:11 AM Scott Branden
> > <scott.branden@broadcom.com> 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

  reply	other threads:[~2020-02-22  8:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 19:24 [PATCH 0/7] firmware: add partial read support in request_firmware_into_buf Scott Branden
2019-08-22 19:24 ` [PATCH 1/7] fs: introduce kernel_pread_file* support Scott Branden
2019-08-23 12:29   ` Takashi Iwai
2019-08-23 19:55     ` Scott Branden
2019-08-23 21:29       ` Luis Chamberlain
2019-08-22 19:24 ` [PATCH 2/7] firmware: add offset to request_firmware_into_buf Scott Branden
2019-08-22 19:47   ` Luis Chamberlain
2019-08-22 20:07     ` Scott Branden
2019-08-22 21:12       ` Luis Chamberlain
2019-08-22 23:30         ` Scott Branden
2019-08-23 15:47           ` Luis Chamberlain
2019-08-23 20:16             ` Scott Branden
2019-08-23 10:05   ` Takashi Iwai
2019-08-23 19:44     ` Scott Branden
2019-08-26 15:20       ` Takashi Iwai
2019-08-26 15:41         ` Scott Branden
2019-08-26 15:57           ` Takashi Iwai
2019-08-26 17:12           ` Takashi Iwai
2019-08-26 17:24             ` Scott Branden
2019-08-27 10:40               ` Takashi Iwai
2019-10-11 13:31                 ` Luis Chamberlain
2020-02-21  0:11                   ` Scott Branden
2020-02-21  8:44                     ` Arnd Bergmann
2020-02-21 18:23                       ` Scott Branden
2020-02-21 23:37                       ` Scott Branden
2020-02-22  8:06                         ` Arnd Bergmann [this message]
2019-08-22 19:24 ` [PATCH 3/7] test_firmware: add partial read support for request_firmware_into_buf Scott Branden
2019-08-22 19:24 ` [PATCH 4/7] selftests: firmware: Test partial file reads of request_firmware_into_buf Scott Branden
2019-08-22 19:24 ` [PATCH 5/7] bcm-vk: add bcm_vk UAPI Scott Branden
2019-08-27 13:54   ` Arnd Bergmann
2019-08-27 14:49   ` Kieran Bingham
2019-10-08 15:59     ` Olof Johansson
2019-08-22 19:24 ` [PATCH 6/7] misc: bcm-vk: add Broadcom Valkyrie driver Scott Branden
2019-08-27 14:14   ` Arnd Bergmann
2019-08-27 14:14     ` Arnd Bergmann
2019-08-27 15:25     ` Nicolas Dufresne
2019-08-27 15:25       ` Nicolas Dufresne
2019-08-22 19:24 ` [PATCH 7/7] MAINTAINERS: bcm-vk: Add maintainer for Broadcom Valkyrie Driver Scott Branden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a0WWeNxaLYZBOipsALu_Y9isY6jKjRy9tc4Xokktoa1Pg@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=colin.king@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=david.brown@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=olof@lixom.net \
    --cc=rafael@kernel.org \
    --cc=scott.branden@broadcom.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tiwai@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.