All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Scull <ascull@google.com>
To: u-boot@lists.denx.de
Cc: sjg@chromium.org, bmeng.cn@gmail.com, trini@konsulko.com,
	 Andrew Scull <ascull@google.com>
Subject: [PATCH v3 00/18] virtio: pci: Add and fix consistency checks
Date: Thu, 21 Apr 2022 16:10:58 +0000	[thread overview]
Message-ID: <20220421161116.1202023-1-ascull@google.com> (raw)

The virtio PCI drivers forgo a number of consistency checks,
particularly around pointer validation and bounds checking. This series
focuses on the modern driver to add those checks.

The start of the series adds and fixes some basic bounds checks. Later
patches ensure PCI addresses fall within the expected regions rather
than any arbitrary address. This is acheived by introducing range
parameters to a few of the dm_pci_* functions that allow the ranges to
be checked.

The series also adds a few new configs to allow parts of virtio and PCI
to be disabled where the features may be unused and the current
implementations don't have the needed consistencty checks.

Changelog:
v2:
 - Refactor dm_pci_* functions, not adding new ones
 - Reorder patches per request in v1
v3:
 - Use CI to test more targets
 - Move EA config patch to end for dropping if needed

Andrew Scull (18):
  virtio: pci: Allow exclusion of legacy driver
  virtio: pci: Fix discovery of device config length
  virtio: pci: Bounds check device config access
  virtio: pci: Bounds check notification writes
  virtio: pci: Check virtio common config size
  virtio: pci: Check virtio capability is in bounds
  virtio: pci: Read entire capability into memory
  pci: Fix use of flags in dm_pci_map_bar()
  pci: Check region ranges are addressable
  pci: Range check address conversions
  test: pci: Test PCI address conversion functions
  pci: Map bars with offset and length
  pci: Match region flags using a mask
  pci: Update dm_pci_bus_to_virt() parameters
  pci: Add mask parameter to dm_pci_map_bar()
  virtio: pci: Check virtio configs are mapped
  virtio: pci: Make use of dm_pci_map_bar()
  pci: Add config for Enhanced Allocation

 arch/sandbox/dts/test.dts               |   2 +-
 arch/x86/cpu/baytrail/cpu.c             |   2 +-
 drivers/ata/ahci.c                      |   9 +-
 drivers/ata/sata_sil.c                  |   6 +-
 drivers/bios_emulator/atibios.c         |   4 +-
 drivers/gpio/octeon_gpio.c              |   2 +-
 drivers/i2c/designware_i2c_pci.c        |   3 +-
 drivers/i2c/intel_i2c.c                 |   2 +-
 drivers/i2c/octeon_i2c.c                |   2 +-
 drivers/mmc/octeontx_hsmmc.c            |   2 +-
 drivers/mmc/pci_mmc.c                   |   2 +-
 drivers/mtd/nand/raw/octeontx_bch.c     |   6 +-
 drivers/mtd/nand/raw/octeontx_nand.c    |   2 +-
 drivers/net/bnxt/bnxt.c                 |   9 +-
 drivers/net/e1000.c                     |   4 +-
 drivers/net/fsl_enetc.c                 |   2 +-
 drivers/net/fsl_enetc_mdio.c            |   2 +-
 drivers/net/mscc_eswitch/felix_switch.c |   4 +-
 drivers/net/octeontx/bgx.c              |   2 +-
 drivers/net/octeontx/nic_main.c         |   2 +-
 drivers/net/octeontx/nicvf_main.c       |   2 +-
 drivers/net/octeontx/smi.c              |   2 +-
 drivers/net/octeontx2/cgx.c             |   2 +-
 drivers/net/octeontx2/rvu_af.c          |   2 +-
 drivers/net/octeontx2/rvu_pf.c          |   3 +-
 drivers/net/pch_gbe.c                   |   2 +-
 drivers/nvme/nvme_pci.c                 |   4 +-
 drivers/pci/Kconfig                     |   7 +
 drivers/pci/pci-uclass.c                | 185 +++++++++++-------------
 drivers/spi/octeon_spi.c                |   2 +-
 drivers/usb/host/ehci-pci.c             |   3 +-
 drivers/usb/host/ohci-pci.c             |   2 +-
 drivers/usb/host/xhci-pci.c             |   3 +-
 drivers/virtio/Kconfig                  |   9 ++
 drivers/virtio/Makefile                 |   3 +-
 drivers/virtio/virtio_pci_legacy.c      |   3 +-
 drivers/virtio/virtio_pci_modern.c      | 143 ++++++++++++------
 include/pci.h                           |  46 ++++--
 test/dm/pci.c                           | 118 ++++++++++++++-
 39 files changed, 401 insertions(+), 209 deletions(-)

-- 
2.36.0.rc2.479.g8af0fa9b8e-goog


             reply	other threads:[~2022-04-21 16:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 16:10 Andrew Scull [this message]
2022-04-21 16:10 ` [PATCH v3 01/18] virtio: pci: Allow exclusion of legacy driver Andrew Scull
2022-05-03 23:10   ` Tom Rini
2022-04-21 16:11 ` [PATCH v3 02/18] virtio: pci: Fix discovery of device config length Andrew Scull
2022-04-21 16:11 ` [PATCH v3 03/18] virtio: pci: Bounds check device config access Andrew Scull
2022-04-21 16:11 ` [PATCH v3 04/18] virtio: pci: Bounds check notification writes Andrew Scull
2022-04-21 16:11 ` [PATCH v3 05/18] virtio: pci: Check virtio common config size Andrew Scull
2022-04-21 16:11 ` [PATCH v3 06/18] virtio: pci: Check virtio capability is in bounds Andrew Scull
2022-04-21 16:11 ` [PATCH v3 07/18] virtio: pci: Read entire capability into memory Andrew Scull
2022-04-21 16:11 ` [PATCH v3 08/18] pci: Fix use of flags in dm_pci_map_bar() Andrew Scull
2022-04-22  6:37   ` Bin Meng
2022-04-21 16:11 ` [PATCH v3 09/18] pci: Check region ranges are addressable Andrew Scull
2022-04-21 16:11 ` [PATCH v3 10/18] pci: Range check address conversions Andrew Scull
2022-04-21 16:11 ` [PATCH v3 11/18] test: pci: Test PCI address conversion functions Andrew Scull
2022-04-22  6:50   ` Bin Meng
2022-04-21 16:11 ` [PATCH v3 12/18] pci: Map bars with offset and length Andrew Scull
2022-04-22  6:52   ` Bin Meng
2022-04-21 16:11 ` [PATCH v3 13/18] pci: Match region flags using a mask Andrew Scull
2022-04-21 16:11 ` [PATCH v3 14/18] pci: Update dm_pci_bus_to_virt() parameters Andrew Scull
2022-04-22  7:38   ` Bin Meng
2022-04-21 16:11 ` [PATCH v3 15/18] pci: Add mask parameter to dm_pci_map_bar() Andrew Scull
2022-04-22  7:39   ` Bin Meng
2022-04-21 16:11 ` [PATCH v3 16/18] virtio: pci: Check virtio configs are mapped Andrew Scull
2022-04-21 16:11 ` [PATCH v3 17/18] virtio: pci: Make use of dm_pci_map_bar() Andrew Scull
2022-04-21 16:11 ` [PATCH v3 18/18] pci: Add config for Enhanced Allocation Andrew Scull

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=20220421161116.1202023-1-ascull@google.com \
    --to=ascull@google.com \
    --cc=bmeng.cn@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.