Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2426368ybv; Fri, 21 Feb 2020 15:38:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwb/GqqRuSXRwGXNCKTvudc8bno2HzNO6wyPj6WWVzxGoocOkLGf5So7gRdubsRbTjfxgaF X-Received: by 2002:aca:510a:: with SMTP id f10mr4231487oib.100.1582328324760; Fri, 21 Feb 2020 15:38:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582328324; cv=none; d=google.com; s=arc-20160816; b=HH/F4Ggc7N9fVmz0QnJUHhtN5UhDa3j3kZeVttldR6ulUYsB/IwDptHBwxQoEpGp1P 5dMWpMttpkL4rtk7rXixJKiO2V2LxQULOe9+biTdioXuL5nZIqCQcnkW079wRKiC1EAT UAccckKrJK0VGorUFSNI8d2Ca6kRtIfXZLIQ83bXMm37QNrRYsZsaJAN/iJ7V2Tw5eU1 r+ILoB+GPA8L42jPjLrQvog4ortlLdYYts0O/R1rxdYe8q6LYmqsqeM22w+vmQ6lI35s nNE7E8sF4iA4hRHoF30s5eCA9/DrnW6276waDmhrepdgc1NLJhzWe0kO0YjPLZWWiN5b fS7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=U8GTXDQYqxVMWeiE3CeM22iOXjrDkwUgtcNqh51keqY=; b=Pd+ASFXmvDMBZfNNph6W8MYuYlBbNYw0MgYwjW3CkbvzcB9u/fGKwZDIVXXwuw5mEu ZkmtQ958eHG71ivSFdCY6Yy3bbsRauSHTQoGz8dWqVjGv+BDRpAFl2O3wJjsATnM02is d4yjfs1RxeRPxUUIrYrSLOtvqet4fzxS+aFcduIvSxLXlcQFohQRoj/FkIbelTELgLvr G4iRuKYVtAb61LHm2L+C2GyQsnJ0RPSGgLtoEM2W+XSO7kMixTNTWd8FIZKBaf6bx63B fQgWaZKaYOE4ID+J7o/pgzuHeSaFBz8T93Rk4xeQI3phbcSkXk0AnShSZ13cv9A9SJVf FB1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=BTbJ9DV5; 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 l14si2242865otk.225.2020.02.21.15.38.31; Fri, 21 Feb 2020 15:38:44 -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=BTbJ9DV5; 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 S1729173AbgBUXhx (ORCPT + 99 others); Fri, 21 Feb 2020 18:37:53 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45801 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729100AbgBUXhx (ORCPT ); Fri, 21 Feb 2020 18:37:53 -0500 Received: by mail-pf1-f194.google.com with SMTP id 2so2069765pfg.12 for ; Fri, 21 Feb 2020 15:37:52 -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-transfer-encoding:content-language; bh=U8GTXDQYqxVMWeiE3CeM22iOXjrDkwUgtcNqh51keqY=; b=BTbJ9DV5UnhS6c59epTpH7XTEnU2oooXg+g6bAhjUyVbujp1zj/9TaRU8cj0TPZwd3 CG8U0vdI5gFnoJTHTJLwe669yrJzuJv13qa3AVL8dmiMh5v19I5goaubVFzUpLjj3wTs 7lQz+6WG62x4T5Z+CFsJPY2Ds6kbuZLZW2JXM= 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-transfer-encoding :content-language; bh=U8GTXDQYqxVMWeiE3CeM22iOXjrDkwUgtcNqh51keqY=; b=ILvBN3SPiaQPjPPagR4V8vl25p26nakMvO0Io/WsTWVb36tpZn6XsNKyBGBZnd22v/ dlbgY1YxbjyL7lbHkEbC7M0Pi8KLfLhiSVqiYc+muQ04q7KluAraJT0COcP3fn8L4osM nhgU3Yl34ywvRNsa3T1AGRpsCFciTCWVZ7dUx8wW1pgAQ6C+dmCl3nEKrO3C76LzNMJh UhqmBkpFbn6/IYIbQsSTnWS5bzVTeCWeoM2Yt6BmpNa38oW0Q+YZDqcIG0nPEM1UhLQZ q9GlmDswiUUHqzMMxcdRb9YbSPBLM5Q+2ZDavI9Ey7CjAjFqXR+FBRASDKBiIoOu2/Qh vJ9A== X-Gm-Message-State: APjAAAV7rHvj1MjRIdjZ0PPB4afzSkueWbacDInVKw5xqrHz0MzjkE7W jXl2bDK+p5eZjpBCjIPBnwIBOA== X-Received: by 2002:a63:3c08:: with SMTP id j8mr40832260pga.223.1582328272147; Fri, 21 Feb 2020 15:37:52 -0800 (PST) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id u23sm3891110pfm.29.2020.02.21.15.37.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Feb 2020 15:37:51 -0800 (PST) Subject: Re: [PATCH 2/7] firmware: add offset to request_firmware_into_buf To: Arnd Bergmann 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" 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> From: Scott Branden Message-ID: <3731a882-8784-b957-7628-49edfa9683e7@broadcom.com> Date: Fri, 21 Feb 2020 15:37:47 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, 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. 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? ssize_t __vfs_read(struct file *file, char __user *buf, size_t count,            loff_t *pos) {     if (file->f_op->read)         return file->f_op->read(file, buf, count, pos);     else if (file->f_op->read_iter)         return new_sync_read(file, buf, count, pos);     else         return -EINVAL; } ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) {     mm_segment_t old_fs;     ssize_t result;     old_fs = get_fs();     set_fs(KERNEL_DS);     /* The cast to a user pointer is valid due to the set_fs() */     result = vfs_read(file, (void __user *)buf, count, pos);     set_fs(old_fs);     return result; }