AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emily Deng <Emily.Deng@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <Alexander.Deucher@amd.com>,
	<Christian.Koenig@amd.com>
Subject: [RFC PATCH v1 00/34] drm/amd/sriov: add PF SR-IOV host driver
Date: Fri, 4 Dec 2026 18:52:00 +0800	[thread overview]
Message-ID: <cover.1796380206.git.Emily.Deng@amd.com> (raw)

This RFC adds SR-IOV PF host mode to the amdgpu driver.  It introduces a
new `drivers/gpu/drm/amd/sriov/` control plane under the existing amdgpu PF
device lifecycle.  The validation target is 1VF bring-up on real asic:
after a clean PF host load with one VF configured, a single VF is created,
the guest amdgpu driver load and reload complete, and a guest workload runs.

Thirty-four patches are attached.

Ownership map
-------------

`struct amdgpu_device` remains the single source of truth for PF physical
state: PCI lifecycle, BAR, IP discovery, firmware, IRQ, reset, RAS, PSP,
SMU, GMC, GART, TTM, VRAM, and other hardware-facing PF initialization
stay in the existing amdgpu owner paths.

SR-IOV PF host mode adds:

  - `adev->num_vfs` — resolved VF count from boot-time module
    parameters
  - `adev->sriov` — SR-IOV host subsystem root object
  - `drivers/gpu/drm/amd/sriov/` — PF-side control plane for VF
    management and service orchestration

Integration uses one host-style IP block, `sriov_host_v1_0_ip_block`,
mounted through the existing amdgpu IP block discovery path.  GPUIOV,
mailbox, FFBM, VFMGR, and scheduler are service objects under
`adev->sriov`; they are not registered as separate physical IP blocks.


Request flow
------------

Guest VF lifecycle request (VF2PF mailbox message):

  VF2PF mailbox ingress
    -> decode message, manage valid/ACK state
  scheduler event service
    -> queue/worker, timeout, full-access state, PF2VF response
  manual world switch (single-VF path)
    -> idle/save/load/run/shutdown/reset through scheduler-owned actions
  middle services
    -> VFMGR (resource view, boot data)
    -> GPUIOV (command/state, VF PCI exposure)
    -> FFBM (VF backing map/unmap, GPA-to-SPA)
  hardware / firmware providers
    -> IOVM PSP command transport
    -> NBIF mailbox registers
    -> GC/GMC provider hooks

PF physical bring-up (firmware, discovery, PM/user-path policy) stays in
the existing amdgpu owner paths and gates entry into the flow above.


Boot-time contract
------------------

The user-visible module parameter remains `amdgpu.sriov_numvfs`.

Supported forms:

  amdgpu.sriov_numvfs=all,N
  amdgpu.sriov_numvfs=dddd:bb:dd.f,N

`amdgpu_parse_sriov_host_params()` runs immediately after IP discovery
data is parsed and `adev->ip_versions[]` is available, before display,
multimedia, and SR-IOV host IP block registration that depend on
`amdgpu_sriov_pf(adev)`.

Mode helpers:

  `amdgpu_sriov_pf_supported(adev)` — hardware / IP version capability
  `amdgpu_sriov_pf(adev)` — `adev->num_vfs > 0`

Unsupported devices, malformed parameters, zero VF count, or a device
without SR-IOV VFs fail closed and keep the bare-metal path unchanged.
If the requested count exceeds the device TotalVFs, the driver warns and
falls back to one VF.


Patch list
----------

 0001 drm/amd/sriov: add PF host build wiring
 0002 drm/amd/sriov: add PF host boot parameters
 0003 drm/amd/sriov: disable PF host PM defaults
 0004 drm/amd/sriov: block PF host user submissions
 0005 drm/amd/sriov: block PF host KFD user queues
 0006 drm/amd/sriov: skip MM IP blocks on PF host
 0007 drm/amd/sriov: skip display blocks on PF host
 0008 drm/amd/sriov: add PF host IP block init and fini
 0009 drm/amd/sriov: load PF RLC firmware variant
 0010 drm/amd/sriov: extend PSP GFX interface for IOVM
 0011 drm/amd/sriov: add PSP 15.0.3 IOVM driver bootloader callback
 0012 drm/amd/sriov: update PF PSP init for IOVM firmware
 0013 drm/amd/sriov: add IOVM driver PSP command submission
 0014 drm/amd/sriov: add IOVM PSP command helpers
 0015 drm/amd/sriov: add GPUIOV service
 0016 drm/amd/sriov: add GC 13.0.1 GPUIOV provider
 0017 drm/amd/sriov: add GMC 13.0.1 GPUIOV provider
 0018 drm/amd/sriov: add PF mailbox service
 0019 drm/amd/sriov: add NBIF 7.10.0 PF mailbox backend
 0020 drm/amd/sriov: add FFBM service
 0021 drm/amd/sriov: add VF manager
 0022 drm/amd/sriov: add VF resource setup
 0023 drm/amd/sriov: add PSP 15.0.3 VF access gate provider
 0024 drm/amd/sriov: add NBIF 7.10.0 VF access gate headers
 0025 drm/amd/sriov: add NBIF 7.10.0 VF access gate backend
 0026 drm/amd/sriov: add VF mailbox boot layout
 0027 drm/amd/sriov: add VF IP discovery table builder
 0028 drm/amd/sriov: add guest VBIOS image builder
 0029 drm/amd/sriov: export VF boot data to guest FB
 0030 drm/amd/sriov: add PF scheduler documentation
 0031 drm/amd/sriov: add scheduler event handling
 0032 drm/amd/sriov: add manual scheduler topology
 0033 drm/amd/sriov: add manual world switch support
 0034 drm/amd/sriov: add VF guard event limits

Thanks,
Emily Deng

Emily Deng (34):
  drm/amd/sriov: add PF host build wiring
  drm/amd/sriov: add PF host boot parameters
  drm/amd/sriov: disable PF host PM defaults
  drm/amd/sriov: block PF host user submissions
  drm/amd/sriov: block PF host KFD user queues
  drm/amd/sriov: skip MM IP blocks on PF host
  drm/amd/sriov: skip display blocks on PF host
  drm/amd/sriov: add PF host IP block init and fini
  drm/amd/sriov: load PF RLC firmware variant
  drm/amd/sriov: extend PSP GFX interface for IOVM
  drm/amd/sriov: add PSP 15.0.3 IOVM driver bootloader callback
  drm/amd/sriov: update PF PSP init for IOVM firmware
  drm/amd/sriov: add IOVM driver PSP command submission
  drm/amd/sriov: add IOVM PSP command helpers
  drm/amd/sriov: add GPUIOV service
  drm/amd/sriov: add GC 13.0.1 GPUIOV provider
  drm/amd/sriov: add GMC 13.0.1 GPUIOV provider
  drm/amd/sriov: add PF mailbox service
  drm/amd/sriov: add NBIF 7.10.0 PF mailbox backend
  drm/amd/sriov: add FFBM service
  drm/amd/sriov: add VF manager
  drm/amd/sriov: add VF resource setup
  drm/amd/sriov: add PSP 15.0.3 VF access gate provider
  drm/amd/sriov: add NBIF 7.10.0 VF access gate headers
  drm/amd/sriov: add NBIF 7.10.0 VF access gate backend
  drm/amd/sriov: add VF mailbox boot layout
  drm/amd/sriov: add VF IP discovery table builder
  drm/amd/sriov: add guest VBIOS image builder
  drm/amd/sriov: export VF boot data to guest FB
  drm/amd/sriov: add PF scheduler documentation
  drm/amd/sriov: add scheduler event handling
  drm/amd/sriov: add manual scheduler topology
  drm/amd/sriov: add manual world switch support
  drm/amd/sriov: add VF guard event limits

 Documentation/gpu/amdgpu/index.rst            |    1 +
 Documentation/gpu/amdgpu/sriov-scheduler.rst  |  737 ++++++++
 MAINTAINERS                                   |    1 +
 drivers/gpu/drm/amd/amdgpu/Makefile           |    3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |    7 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  138 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |   54 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   60 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ip.c        |    1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |   22 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c       |  132 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h       |   21 +
 .../gpu/drm/amd/amdgpu/amdgpu_sriov_host.h    |   37 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       |    5 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c     |    8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h     |    1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c     |    3 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c      |  103 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h      |    5 +
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h   |   13 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c        |   23 +-
 drivers/gpu/drm/amd/amdgpu/nbif_v7_10.c       |    4 +
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h       |   55 +-
 drivers/gpu/drm/amd/amdgpu/psp_v15_0_3.c      |   13 +
 drivers/gpu/drm/amd/amdgpu/sdma_v8_0.c        |    5 +
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c      |   38 +
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c     |   55 +-
 drivers/gpu/drm/amd/include/amd_shared.h      |    2 +
 .../asic_reg/nbif/nbif_7_10_0_offset.h        |    6 +
 .../asic_reg/nbif/nbif_7_10_0_sh_mask.h       |   11 +
 drivers/gpu/drm/amd/sriov/Makefile            |   46 +
 drivers/gpu/drm/amd/sriov/sriov.c             |  590 +++++++
 drivers/gpu/drm/amd/sriov/sriov.h             |  162 ++
 drivers/gpu/drm/amd/sriov/sriov_ffbm.c        |  332 ++++
 drivers/gpu/drm/amd/sriov/sriov_ffbm.h        |   71 +
 drivers/gpu/drm/amd/sriov/sriov_gfx_v13_0.c   |  295 ++++
 drivers/gpu/drm/amd/sriov/sriov_gfx_v13_0.h   |   32 +
 drivers/gpu/drm/amd/sriov/sriov_gmc_v13_0.c   |   77 +
 drivers/gpu/drm/amd/sriov/sriov_gmc_v13_0.h   |   32 +
 drivers/gpu/drm/amd/sriov/sriov_gpuiov.c      |  695 ++++++++
 drivers/gpu/drm/amd/sriov/sriov_gpuiov.h      |  184 ++
 drivers/gpu/drm/amd/sriov/sriov_guard.c       |  255 +++
 drivers/gpu/drm/amd/sriov/sriov_guard.h       |  100 ++
 drivers/gpu/drm/amd/sriov/sriov_hwsm.c        |  235 +++
 drivers/gpu/drm/amd/sriov/sriov_hwsm.h        |   50 +
 drivers/gpu/drm/amd/sriov/sriov_iovm.c        |  715 ++++++++
 drivers/gpu/drm/amd/sriov/sriov_iovm.h        |  111 ++
 .../gpu/drm/amd/sriov/sriov_ip_discovery.c    |  627 +++++++
 .../gpu/drm/amd/sriov/sriov_ip_discovery.h    |   47 +
 drivers/gpu/drm/amd/sriov/sriov_mailbox.c     |  582 ++++++
 drivers/gpu/drm/amd/sriov/sriov_mailbox.h     |   89 +
 drivers/gpu/drm/amd/sriov/sriov_nbif_v7_10.c  |  401 +++++
 drivers/gpu/drm/amd/sriov/sriov_nbif_v7_10.h  |   32 +
 drivers/gpu/drm/amd/sriov/sriov_psp_15_0_3.c  |  298 ++++
 drivers/gpu/drm/amd/sriov/sriov_psp_15_0_3.h  |   32 +
 drivers/gpu/drm/amd/sriov/sriov_sched.c       |  192 ++
 drivers/gpu/drm/amd/sriov/sriov_sched_event.c | 1428 +++++++++++++++
 drivers/gpu/drm/amd/sriov/sriov_sched_event.h |  190 ++
 .../drm/amd/sriov/sriov_sched_event_data.h    |   84 +
 .../amd/sriov/sriov_sched_event_dispatch.c    |   88 +
 .../amd/sriov/sriov_sched_event_dispatch.h    |   62 +
 .../amd/sriov/sriov_sched_event_handlers.c    |  179 ++
 .../amd/sriov/sriov_sched_event_handlers.h    |   55 +
 .../drm/amd/sriov/sriov_sched_event_priv.h    |   78 +
 .../gpu/drm/amd/sriov/sriov_sched_switch.c    | 1564 +++++++++++++++++
 .../gpu/drm/amd/sriov/sriov_sched_switch.h    |  209 +++
 .../gpu/drm/amd/sriov/sriov_sched_ws_manual.c |  512 ++++++
 .../gpu/drm/amd/sriov/sriov_sched_ws_manual.h |   33 +
 drivers/gpu/drm/amd/sriov/sriov_vfmgr.c       | 1295 ++++++++++++++
 drivers/gpu/drm/amd/sriov/sriov_vfmgr.h       |  130 ++
 70 files changed, 13696 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/gpu/amdgpu/sriov-scheduler.rst
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_sriov_host.h
 create mode 100644 drivers/gpu/drm/amd/sriov/Makefile
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_ffbm.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_ffbm.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gfx_v13_0.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gfx_v13_0.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gmc_v13_0.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gmc_v13_0.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gpuiov.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_gpuiov.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_guard.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_guard.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_hwsm.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_hwsm.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_iovm.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_iovm.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_ip_discovery.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_ip_discovery.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_mailbox.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_mailbox.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_nbif_v7_10.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_nbif_v7_10.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_psp_15_0_3.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_psp_15_0_3.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_data.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_dispatch.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_dispatch.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_handlers.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_handlers.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_event_priv.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_switch.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_switch.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_ws_manual.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_sched_ws_manual.h
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_vfmgr.c
 create mode 100644 drivers/gpu/drm/amd/sriov/sriov_vfmgr.h

-- 
2.34.1


             reply	other threads:[~2026-12-04 10:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:52 Emily Deng [this message]
2026-12-04 10:52 ` [RFC PATCH v1 01/34] drm/amd/sriov: add PF host build wiring Emily Deng
2026-12-04 10:52 ` [RFC PATCH v1 02/34] drm/amd/sriov: add PF host boot parameters Emily Deng
2026-12-04 10:52 ` [RFC PATCH v1 03/34] drm/amd/sriov: disable PF host PM defaults Emily Deng
2026-12-04 10:52 ` [RFC PATCH v1 04/34] drm/amd/sriov: block PF host user submissions Emily Deng
2026-12-04 10:52 ` [RFC PATCH v1 05/34] drm/amd/sriov: block PF host KFD user queues Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 06/34] drm/amd/sriov: skip MM IP blocks on PF host Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 07/34] drm/amd/sriov: skip display " Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 08/34] drm/amd/sriov: add PF host IP block init and fini Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 09/34] drm/amd/sriov: load PF RLC firmware variant Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 10/34] drm/amd/sriov: extend PSP GFX interface for IOVM Emily Deng
2026-12-04 10:53 ` [RFC PATCH v1 11/34] drm/amd/sriov: add PSP 15.0.3 IOVM driver bootloader callback Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 12/34] drm/amd/sriov: update PF PSP init for IOVM firmware Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 13/34] drm/amd/sriov: add IOVM driver PSP command submission Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 14/34] drm/amd/sriov: add IOVM PSP command helpers Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 15/34] drm/amd/sriov: add GPUIOV service Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 16/34] drm/amd/sriov: add GC 13.0.1 GPUIOV provider Emily Deng
2026-12-04 10:54 ` [RFC PATCH v1 17/34] drm/amd/sriov: add GMC " Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 18/34] drm/amd/sriov: add PF mailbox service Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 19/34] drm/amd/sriov: add NBIF 7.10.0 PF mailbox backend Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 20/34] drm/amd/sriov: add FFBM service Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 21/34] drm/amd/sriov: add VF manager Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 22/34] drm/amd/sriov: add VF resource setup Emily Deng
2026-12-04 10:55 ` [RFC PATCH v1 23/34] drm/amd/sriov: add PSP 15.0.3 VF access gate provider Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 24/34] drm/amd/sriov: add NBIF 7.10.0 VF access gate headers Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 25/34] drm/amd/sriov: add NBIF 7.10.0 VF access gate backend Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 26/34] drm/amd/sriov: add VF mailbox boot layout Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 27/34] drm/amd/sriov: add VF IP discovery table builder Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 28/34] drm/amd/sriov: add guest VBIOS image builder Emily Deng
2026-12-04 10:56 ` [RFC PATCH v1 29/34] drm/amd/sriov: export VF boot data to guest FB Emily Deng
2026-12-04 10:57 ` [RFC PATCH v1 30/34] drm/amd/sriov: add PF scheduler documentation Emily Deng
2026-12-04 10:57 ` [RFC PATCH v1 31/34] drm/amd/sriov: add scheduler event handling Emily Deng
2026-12-04 10:57 ` [RFC PATCH v1 32/34] drm/amd/sriov: add manual scheduler topology Emily Deng
2026-12-04 10:57 ` [RFC PATCH v1 33/34] drm/amd/sriov: add manual world switch support Emily Deng
2026-12-04 10:57 ` [RFC PATCH v1 34/34] drm/amd/sriov: add VF guard event limits Emily Deng

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=cover.1796380206.git.Emily.Deng@amd.com \
    --to=emily.deng@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox