Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp46846ybg; Tue, 9 Jun 2020 16:00:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHTAQGT2PXRy05Ma8KJNG1d98KjLxrqeAyHrvOz4pzpPaCNh2F4WAGGIRvumg5JULFN14i X-Received: by 2002:a17:906:ccdd:: with SMTP id ot29mr588761ejb.119.1591743603839; Tue, 09 Jun 2020 16:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591743603; cv=none; d=google.com; s=arc-20160816; b=oyalsxI3H2nD2wE5RCQoM0rTz+2EKnmlQfsK5mVGDUVl4zEuN6qwp9XG8VtqTTfpSP AHBavNUJM1FihgUbXSSWjVKqXkjWu6pijbIAr9l17e+8CA8t0HnjvPx2si8Zg42Pm/Sg 9NkZivN1/RIXg5RJ6VHyu2SULQdUfUHiJTyIJ9jcC7mwn6WmZqWRqJ9qivZIr76rvIS5 Jm97/YCxXbbHSdevQbNpbCuypIsT0WFxNMXz1DscHCz+EbWqymaNIQxgaa+cadyFCxrg x6vjjtK+eYn3U3CQUL65qg8I7kIavNZOVYtEFA6HGiJWW+/wM8YvsaVMuqqTiZjlYzRf 6JWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=BG3o4m9VW7EKE6RQWof5spkXsGN8jYloY6eeW3sY9aQ=; b=DckW9VhjzE1WB2jRi2ZS4le0X0sfWWzJPH9Gn3Mm5zYboDpuCGnk1zPWX5oqUvTZVP rMuFkFI0SeplmLd5HV9M/Ws5V9KFF0/BWk49UuOAumv7F43r6VdeNyQaBTduql9Wh/l9 WtVkwXDCRmpwqsps4Fc7rLhBenMz1amlIg/KPwTXtxhrOHQ4Fbdxj+90FRd5L0YgRtH3 /qOiuKWpuFg+xVpKxm5ZIu9TE//i/1WMs+yu1LzMW+m4wnqK0h4bifPDCWZOyX1gjmkq p0RuwS64NbK19/OKI37O9eh1lJLFMp8nhYDgPiP2FuiuCC8AKidRijEWUunWCi+7G515 vAHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=R8GFoOJu; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u14si8675615edo.592.2020.06.09.15.59.41; Tue, 09 Jun 2020 16:00:03 -0700 (PDT) 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=@broadcom.com header.s=google header.b=R8GFoOJu; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728754AbgFIW5N (ORCPT + 99 others); Tue, 9 Jun 2020 18:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728525AbgFIW5I (ORCPT ); Tue, 9 Jun 2020 18:57:08 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A01C08C5C4 for ; Tue, 9 Jun 2020 15:57:08 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x22so225543pfn.3 for ; Tue, 09 Jun 2020 15:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=BG3o4m9VW7EKE6RQWof5spkXsGN8jYloY6eeW3sY9aQ=; b=R8GFoOJu3YU/sFkhqOUpFwaJHJW+dgJujqwlysKLkgIsmFM1P3/+XnlW8S59aMLRQz tE5MJ0yA1Fofk8hem9RCom2WIlgc5yQXBPJkBEqPNCl3x1894g3BBdCs0QWipUq09EKv Kk3u7EgvPyBhAOKmpPNitYXFx7vTwzc0QOuBs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BG3o4m9VW7EKE6RQWof5spkXsGN8jYloY6eeW3sY9aQ=; b=I+nzCWrWGe4Kn8UzIERau/nk77O5ei1MJv4YmMpPeEaQPKdYXpn19s8RcqpDc11bMV /V7bhy/39vgu+ERgCC53wJDPoF87cz+iW2cRO7L7zxE2nFh+6I/B7ZMSVmOOsj9JFhm0 7CloxxSnuS1v8+IatNHs7Q1ZgIp4i6OKkp492pNIfj/1LnIY7Kj/hxmT8KrMtMMaEuO6 dLbInd/S9OxDyBZJCK9rDS32vN8CLRV9dkU5whwS5rXVKWHtnpOchcgIpcMF/44e2Rkc 3dYWNHBxpmd3nLfhL1x7qsHm2uzXvveYtPztze9tb+xiGvGDS6BBCIlPSK4qRPyUoG6m Bovw== X-Gm-Message-State: AOAM532GkvssKyqUBRay4dOknrMI4UN/rWZ6QgmkpvEpacMvXsR8SK63 R7IuomvWvWFQBFDfXnTlx2kiKA== X-Received: by 2002:a62:9246:: with SMTP id o67mr83649pfd.109.1591743427888; Tue, 09 Jun 2020 15:57:07 -0700 (PDT) Received: from lbrmn-lnxub113.broadcom.net ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id p8sm9104978pgs.29.2020.06.09.15.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 15:57:06 -0700 (PDT) From: Scott Branden To: Luis Chamberlain , Wolfram Sang , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann Cc: Mimi Zohar , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , Takashi Iwai , linux-kselftest@vger.kernel.org, Andy Gross , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Scott Branden Subject: [PATCH v8 0/8] firmware: add request_partial_firmware_into_buf Date: Tue, 9 Jun 2020 15:56:48 -0700 Message-Id: <20200609225656.18663-1-scott.branden@broadcom.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series adds partial read support via a new call request_partial_firmware_into_buf. Such support is needed when the whole file is not needed and/or only a smaller portion of the file will fit into allocated memory at any one time. In order to accept the enhanced API it has been requested that kernel selftests and upstreamed driver utilize the API enhancement and so are included in this patch series. Also in this patch series is the addition of a new Broadcom VK driver utilizing the new request_firmware_into_buf enhanced API. Further comment followed to add IMA support of the partial reads originating from request_firmware_into_buf calls. Changes from v8: - removed swiss army knife kernel_pread_* style approach and simply add offset parameter in addition to those needed in kernel_read_* functions thus removing need for kernel_pread enum Changes from v6: - update ima_post_read_file check on IMA_FIRMWARE_PARTIAL_READ - adjust new driver i2c-slave-eeprom.c use of request_firmware_into_buf - remove an extern Changes from v5: - add IMA FIRMWARE_PARTIAL_READ support - change kernel pread flags to enum - removed legacy support from driver - driver fixes Changes from v4: - handle reset issues if card crashes - allow driver to have min required msix - add card utilization information Changes from v3: - fix sparse warnings - fix printf format specifiers for size_t - fix 32-bit cross-compiling reports 32-bit shifts - use readl/writel,_relaxed to access pci ioremap memory, removed memory barriers and volatile keyword with such change - driver optimizations for interrupt/poll functionalities Changes from v2: - remove unnecessary code and mutex locks in lib/test_firmware.c - remove VK_IOCTL_ACCESS_BAR support from driver and use pci sysfs instead - remove bitfields - remove Kconfig default m - adjust formatting and some naming based on feedback - fix error handling conditions - use appropriate return codes - use memcpy_toio instead of direct access to PCIE bar Scott Branden (8): fs: introduce kernel_pread_file* support firmware: add offset to request_firmware_into_buf test_firmware: add partial read support for request_firmware_into_buf firmware: test partial file reads of request_firmware_into_buf bcm-vk: add bcm_vk UAPI misc: bcm-vk: add Broadcom VK driver MAINTAINERS: bcm-vk: add maintainer for Broadcom VK Driver ima: add FIRMWARE_PARTIAL_READ support MAINTAINERS | 7 + drivers/base/firmware_loader/firmware.h | 5 + drivers/base/firmware_loader/main.c | 79 +- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/bcm-vk/Kconfig | 29 + drivers/misc/bcm-vk/Makefile | 11 + drivers/misc/bcm-vk/bcm_vk.h | 407 +++++ drivers/misc/bcm-vk/bcm_vk_dev.c | 1310 +++++++++++++++ drivers/misc/bcm-vk/bcm_vk_msg.c | 1440 +++++++++++++++++ drivers/misc/bcm-vk/bcm_vk_msg.h | 202 +++ drivers/misc/bcm-vk/bcm_vk_sg.c | 271 ++++ drivers/misc/bcm-vk/bcm_vk_sg.h | 60 + drivers/misc/bcm-vk/bcm_vk_tty.c | 352 ++++ fs/exec.c | 93 +- include/linux/firmware.h | 12 + include/linux/fs.h | 15 + include/uapi/linux/misc/bcm_vk.h | 99 ++ lib/test_firmware.c | 154 +- security/integrity/ima/ima_main.c | 24 +- .../selftests/firmware/fw_filesystem.sh | 80 + 21 files changed, 4599 insertions(+), 53 deletions(-) create mode 100644 drivers/misc/bcm-vk/Kconfig create mode 100644 drivers/misc/bcm-vk/Makefile create mode 100644 drivers/misc/bcm-vk/bcm_vk.h create mode 100644 drivers/misc/bcm-vk/bcm_vk_dev.c create mode 100644 drivers/misc/bcm-vk/bcm_vk_msg.c create mode 100644 drivers/misc/bcm-vk/bcm_vk_msg.h create mode 100644 drivers/misc/bcm-vk/bcm_vk_sg.c create mode 100644 drivers/misc/bcm-vk/bcm_vk_sg.h create mode 100644 drivers/misc/bcm-vk/bcm_vk_tty.c create mode 100644 include/uapi/linux/misc/bcm_vk.h -- 2.17.1