mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Pull drm updates from Dave Airlie:
"Highlights:
- xe: add initial CRI platform support
- amdgpu: initial HDMI 2.1 FRL support
- rust: add some new type concepts for device lifetimes
- scheduler: moves to a fair algorithm and lots of cleanups
But it's mostly the usual mountain of changes across the board.
core:
- add docbook for DRM_IOCTL_SYNCOBJ_EVENTFD
- change signature of drm_connector_attach_hdr_output_metadata_property
- dedup counter and timestamp retrieval in vblank code
- parse AMD VSDB v3 in CTA extension blocks
- add P230, Y7, XYYY2101010, T430, XVUY210101010 formats
- don't call drop master on file close if not master
- use drm_printf_indent in atomic / bridge
- fix 32b format descriptions
- docs: fix toctree
- hdmi: add common TMDS character rates
- fix drm_syncobj_find_fence leak
rust:
- introduce Higher-Ranked lifetime types
- replace drvdata with scoped registration data
- add GPUVM immediate mode abstraction for rust GPU drivers
- introduce DeviceContext type state for drm::Device
bridge:
- clarify drm_bridge_get/put
- create drm_get_bridge_by_endpoint and use it
- analogix_dp: add panel probing
- ite-it6211 - use drm audio hdmi helpers
buddy:
- add lockdep annotations
dp:
- add PR and VRR updates
- mst: fix buffer overflows
- add Adaptive Sync SDP decoding support
- fix OOB reads in dp-mst
ttm:
- bump fpfn/lpfn to 64-bit
scheduler:
- change default to fair scheduler
- map runqueue 1:1 with scheduler
dma-buf:
- port selftests to kunit
- convert dma-buf system/heap allocators to module
- add separate DMABUF_HEAPS_SYSTEM_CC_SHARED Kconfig
udmabuf:
- revert hugetlb support
- fix error with CONFIG_DMA_API_DEBUG
dma-fence:
- fix tracepoints lifetime
- remove unused signal on any support
ras:
- add clear error counter netlink command to drm ras
gpusvm:
- reject VMAs with VM_IO or VM_PFNMAP when creating SVM ranges
- use IOVA allocations
pagemap:
- use IOVA allocations
panels:
- update to use ref counts
- add support for CSW PNB601LS1-2, LGD LP116WHA-SPB1
- add support for waveshare panels
- CMN N116BCN-EA1, CMN N140HCA-EEK, IVO M140NWFQ R5,
- IVO, R140NWFW R0, BOE NT140*, BOE NV133FHM-N4F,
- AUO B140*, AUO B133HAN06.6 and AUO B116XTN02.3 eDP panels
- Surface Pro 12 Panel
xe:
- add CRI PCI-IDs
- debugfs add multi-lrc info
- engine init cleanup
- PF fair scheduling auto provisioning
- system controller support for CRI/Xe3p
- PXP state machine fixes
- Reset/wedge/unload corner case fixes
- Wedge path memory allocation fixes
- PAT type cleanups
- Reject unsafe PAT for CPU cached memory
- OA improvements for CRI device memory
- kernel doc syntax in xe headers
- xe_drm.h documentation fixes
- include guard cleanups
- VF CCS memory pool
- i915/xe step unification
- Xe3p GT tuning fixes
- forcewake cleanup in GT and GuC
- admin-only PF mode
- enable hwmon energy attributes for CRI
- enable GT_MI_USER_INTERRUPT
- refactor emit functions
- oa workarounds
- multi_queue: allow QUEUE_TIMESTAMP register
- convert stolen memory to ttm range manager
- use xe2 style blitter as a feature flag
- make drm_driver const
- add/use IRQ page to HW engine definition
- fix oops when display disabled
i915:
- enable PIPEDMC_ERROR interrupt
- more common display code refactoring
- restructure DP/HDMI sink format handling
- eliminate FB usage from lowlevel pinning code
- panel replay bw optimization
- integrate sharpness filter into the scaler
- new fb_pin abstraction for xe/i915 fb transparent handling
- skip inactive MST connectors on HDCP
- start switching to display specific registers
- use polling when irq unavailable
- Adaptive-sync SDP prep
amdgpu:
- use drm_display_info for AMD VSDB data
- Initial HDMI 2.1 FRL support
- Initial DCN 4.2.1 support
- GART fixes for non-4k pages
- GC 11.5.6/SDMA 6.4.0/and other new IPs
- GFX9/DCE6/Hawaii/SDMA4/GART/Userq fixes
- Finish support for using multiple SDMA queues for TTM operations
- SWSMU updates
- GC 12.1 updates
- SMU 15.0.8 updates
- DCN 4.2 updates
- DC type conversion fixes
- Enable DC power module
- Replay/PSR updates
- SMU 13.x updates
- Compute queue quantum MQD updates
- ASPM fix
- Align VKMS with common implementation
- DC analog support fixes
- UVD 3 fixes
- TCC harvesting fixes for SI
- GC 11 APU module reload fix
- NBIO 6.3.2 support
- IH 7.1 updates
- DC cursor fixes
- VCN/JPEG user fence fixes
- DC support for connectors without DDC
- Prefer ROM BAR for default VGA device
- DC bandwidth fixes
- Add PTL support for profiler
- Introduce dc_plane_cm and migrate surface update color path
- Add FRL registers for HDMI 2.1
- Restructure VM state machine
- Auxless ALPM support
- GEM_OP locking/warning fixes
- switch to system_dfl_wq
amdkfd:
- GPUVM TLB flush fix
- Hotplug fix
- Boundary check fixes
- SVM fixes
- CRIU fixes
- add profiler API
- MES 12.1 updates
msm:
- core:
- fix shrinker documentation
- IFPC enabled for gen8
- PERFCNTR_CONFIG ioctl support
- GPU:
- reworked UBWC handling
- a810 support
- MDSS:
- add support for Milos platform
- reworked UBWC handling
- DisplayPort:
- reworked HPD handling as prep for MST
- DPU:
- Milos platform support
- reworked UBWC handling
- DSI:
- Milos platform support
nova:
- Hopper/Blackwell enablement (GH100/GB100/GB202)
- FSP support
- 32-bit firmware support
- HAL functions
- refactor GSP boot/unload
- GA100 support
- VBIOS hardening/refactoring
- Adopt higher order lifetime types
tyr:
- define register blocks
- add shmem backed GEM objects
- adopt higher order lifetime types
- move clock cleanup into Drop
radeon:
- Hawaii SMU fixes
- CS parser fix
- use struct drm_edid instead of edid
amdxdna:
- export per-client BO memory via fdinfo
- AIE4 device support
- support medium/lower power modes
- expandable device heap support
- revert read-only user-pointer BO mappings
ivpu:
- support frequency limiting
panthor:
- enable GEM shrinker support
- add eviction and reclaim info to fdinfo
v3d:
- enable runtime PM
mgag200:
- support XRGB1555 + C8
ast:
- support XRGB1555 + C8
- use constants for lots of registers
- fix register handling
imagination:
- fence handling refactoring
nouveau:
- fix sched double call
- expose VBIOS on GSP-RM systems
- add GA100 support
virtio:
- add VIRTIO_GPU_F_BLOB_ALIGNMENT flag
- add deferred mapping support
gud:
- add RCade Display Adapter
hibmc:
- fix no connectors usage
mediatek:
- hdmi: convert error handling
- simplify mtk_crtc allocation
exynos:
- move fbdev emulation to drm client buffers
- use drm format helpers for geometry/size
- adopt core DMA tracking
- fix framebuffer offset handling
renesas:
- add RZ/T2H SOC support
versilicon:
- add cursor plane support
tegra:
- use drm client for framebuffer"
* tag 'drm-next-2026-06-17' of https://gitlab.freedesktop.org/drm/kernel: (1731 commits)
dma-buf: move system_cc_shared heap under separate Kconfig
accel/amdxdna: Clear sva pointer after unbind
agp/amd64: Fix broken error propagation in agp_amd64_probe()
accel/amdxdna: Require carveout when PASID and force_iova are disabled
drm/amdkfd: always resume_all after suspend_all
drm/amdgpu/gfx: move fault and EOP IRQ get/put to hw_init/hw_fini
drm/amd/display: Consult MCCS FreeSync cap only if requested & supported
drm/amd/pm: Use strscpy in profile mode parsing
drm/amdkfd: Fix infinite loop parsing CRAT with zero subtype length
drm/amdkfd: fix sysfs topology prop length on buffer truncation
drm/amdgpu: drop retry loop in amdgpu_hmm_range_get_pages
drm/amd/pm: bound OD parameter parsing to stack array size
drm/amd/pm: Stop pp_od_clk_voltage emit at PAGE_SIZE
drm/amdkfd: Unwind debug trap enable on copy_to_user failure
drm/amdgpu: validate the mes firmware version for gfx12.1
drm/amdgpu: validate the mes firmware version for gfx12
drm/amdgpu: compare MES firmware version ucode for gfx11
drm/amdkfd: Add bounds check for AMDKFD_IOC_WAIT_EVENTS
drm/amdgpu: restart the CS if some parts of the VM are still invalidated
drm/amd/display: use unsigned types for local pipe and REG_GET counters
...
263 lines
6.6 KiB
C
263 lines
6.6 KiB
C
/*
|
|
* Copyright (C) 2015 Red Hat, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* Authors:
|
|
* Dave Airlie <airlied@redhat.com>
|
|
* Gerd Hoffmann <kraxel@redhat.com>
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the next
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
* Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#include <linux/aperture.h>
|
|
#include <linux/module.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/poll.h>
|
|
#include <linux/vgaarb.h>
|
|
#include <linux/wait.h>
|
|
|
|
#include <drm/clients/drm_client_setup.h>
|
|
#include <drm/drm.h>
|
|
#include <drm/drm_atomic_helper.h>
|
|
#include <drm/drm_drv.h>
|
|
#include <drm/drm_fbdev_shmem.h>
|
|
#include <drm/drm_file.h>
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "virtgpu_drv.h"
|
|
|
|
#define PCI_DEVICE_ID_VIRTIO_GPU 0x1050
|
|
|
|
static const struct drm_driver driver;
|
|
|
|
static int virtio_gpu_modeset = -1;
|
|
|
|
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
|
|
module_param_named(modeset, virtio_gpu_modeset, int, 0400);
|
|
|
|
static int virtio_gpu_pci_quirk(struct drm_device *dev)
|
|
{
|
|
struct pci_dev *pdev = to_pci_dev(dev->dev);
|
|
const char *pname = dev_name(&pdev->dev);
|
|
bool vga = pci_is_vga(pdev);
|
|
int ret;
|
|
|
|
DRM_INFO("pci: %s detected at %s\n",
|
|
vga ? "virtio-vga" : "virtio-gpu-pci",
|
|
pname);
|
|
if (vga) {
|
|
ret = aperture_remove_conflicting_pci_devices(pdev, driver.name);
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int virtio_gpu_probe(struct virtio_device *vdev)
|
|
{
|
|
struct drm_device *dev;
|
|
int ret;
|
|
|
|
if (drm_firmware_drivers_only() && virtio_gpu_modeset == -1)
|
|
return -EINVAL;
|
|
|
|
if (virtio_gpu_modeset == 0)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* The virtio-gpu device is a virtual device that doesn't have DMA
|
|
* ops assigned to it, nor DMA mask set and etc. Its parent device
|
|
* is actual GPU device we want to use it for the DRM's device in
|
|
* order to benefit from using generic DRM APIs.
|
|
*/
|
|
dev = drm_dev_alloc(&driver, vdev->dev.parent);
|
|
if (IS_ERR(dev))
|
|
return PTR_ERR(dev);
|
|
vdev->priv = dev;
|
|
|
|
if (dev_is_pci(vdev->dev.parent)) {
|
|
ret = virtio_gpu_pci_quirk(dev);
|
|
if (ret)
|
|
goto err_free;
|
|
}
|
|
|
|
dma_set_max_seg_size(dev->dev, dma_max_mapping_size(dev->dev) ?: UINT_MAX);
|
|
ret = virtio_gpu_init(vdev, dev);
|
|
if (ret)
|
|
goto err_free;
|
|
|
|
ret = drm_dev_register(dev, 0);
|
|
if (ret)
|
|
goto err_deinit;
|
|
|
|
drm_client_setup(vdev->priv, NULL);
|
|
|
|
return 0;
|
|
|
|
err_deinit:
|
|
virtio_gpu_deinit(dev);
|
|
err_free:
|
|
drm_dev_put(dev);
|
|
return ret;
|
|
}
|
|
|
|
static void virtio_gpu_remove(struct virtio_device *vdev)
|
|
{
|
|
struct drm_device *dev = vdev->priv;
|
|
|
|
drm_dev_unplug(dev);
|
|
|
|
if (drm_core_check_feature(dev, DRIVER_ATOMIC))
|
|
drm_atomic_helper_shutdown(dev);
|
|
|
|
virtio_gpu_deinit(dev);
|
|
drm_dev_put(dev);
|
|
}
|
|
|
|
static void virtio_gpu_shutdown(struct virtio_device *vdev)
|
|
{
|
|
struct drm_device *dev = vdev->priv;
|
|
|
|
/* stop talking to the device */
|
|
drm_dev_unplug(dev);
|
|
}
|
|
|
|
static void virtio_gpu_config_changed(struct virtio_device *vdev)
|
|
{
|
|
struct drm_device *dev = vdev->priv;
|
|
struct virtio_gpu_device *vgdev = dev->dev_private;
|
|
|
|
schedule_work(&vgdev->config_changed_work);
|
|
}
|
|
|
|
static struct virtio_device_id id_table[] = {
|
|
{ VIRTIO_ID_GPU, VIRTIO_DEV_ANY_ID },
|
|
{ 0 },
|
|
};
|
|
|
|
static unsigned int features[] = {
|
|
#ifdef __LITTLE_ENDIAN
|
|
/*
|
|
* Gallium command stream send by virgl is native endian.
|
|
* Because of that we only support little endian guests on
|
|
* little endian hosts.
|
|
*/
|
|
VIRTIO_GPU_F_VIRGL,
|
|
#endif
|
|
VIRTIO_GPU_F_EDID,
|
|
VIRTIO_GPU_F_RESOURCE_UUID,
|
|
VIRTIO_GPU_F_RESOURCE_BLOB,
|
|
VIRTIO_GPU_F_CONTEXT_INIT,
|
|
VIRTIO_GPU_F_BLOB_ALIGNMENT,
|
|
};
|
|
static struct virtio_driver virtio_gpu_driver = {
|
|
.feature_table = features,
|
|
.feature_table_size = ARRAY_SIZE(features),
|
|
.driver.name = KBUILD_MODNAME,
|
|
.id_table = id_table,
|
|
.probe = virtio_gpu_probe,
|
|
.remove = virtio_gpu_remove,
|
|
.shutdown = virtio_gpu_shutdown,
|
|
.config_changed = virtio_gpu_config_changed
|
|
};
|
|
|
|
static int __init virtio_gpu_driver_init(void)
|
|
{
|
|
struct pci_dev *pdev;
|
|
int ret;
|
|
|
|
pdev = pci_get_device(PCI_VENDOR_ID_REDHAT_QUMRANET,
|
|
PCI_DEVICE_ID_VIRTIO_GPU,
|
|
NULL);
|
|
if (pdev && pci_is_vga(pdev)) {
|
|
ret = vga_get_interruptible(pdev,
|
|
VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM);
|
|
if (ret) {
|
|
pci_dev_put(pdev);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
ret = register_virtio_driver(&virtio_gpu_driver);
|
|
|
|
if (pdev) {
|
|
if (pci_is_vga(pdev))
|
|
vga_put(pdev,
|
|
VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM);
|
|
|
|
pci_dev_put(pdev);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void __exit virtio_gpu_driver_exit(void)
|
|
{
|
|
unregister_virtio_driver(&virtio_gpu_driver);
|
|
}
|
|
|
|
module_init(virtio_gpu_driver_init);
|
|
module_exit(virtio_gpu_driver_exit);
|
|
|
|
MODULE_DEVICE_TABLE(virtio, id_table);
|
|
MODULE_DESCRIPTION("Virtio GPU driver");
|
|
MODULE_LICENSE("GPL and additional rights");
|
|
MODULE_AUTHOR("Dave Airlie <airlied@redhat.com>");
|
|
MODULE_AUTHOR("Gerd Hoffmann <kraxel@redhat.com>");
|
|
MODULE_AUTHOR("Alon Levy");
|
|
|
|
DEFINE_DRM_GEM_FOPS(virtio_gpu_driver_fops);
|
|
|
|
static const struct drm_driver driver = {
|
|
/*
|
|
* If KMS is disabled DRIVER_MODESET and DRIVER_ATOMIC are masked
|
|
* out via drm_device::driver_features:
|
|
*/
|
|
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_RENDER | DRIVER_ATOMIC |
|
|
DRIVER_SYNCOBJ | DRIVER_SYNCOBJ_TIMELINE | DRIVER_CURSOR_HOTSPOT,
|
|
.open = virtio_gpu_driver_open,
|
|
.postclose = virtio_gpu_driver_postclose,
|
|
|
|
.dumb_create = virtio_gpu_mode_dumb_create,
|
|
|
|
DRM_FBDEV_SHMEM_DRIVER_OPS,
|
|
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
.debugfs_init = virtio_gpu_debugfs_init,
|
|
#endif
|
|
.gem_prime_import = virtgpu_gem_prime_import,
|
|
.gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table,
|
|
|
|
.gem_create_object = virtio_gpu_create_object,
|
|
.fops = &virtio_gpu_driver_fops,
|
|
|
|
.ioctls = virtio_gpu_ioctls,
|
|
.num_ioctls = DRM_VIRTIO_NUM_IOCTLS,
|
|
|
|
.name = DRIVER_NAME,
|
|
.desc = DRIVER_DESC,
|
|
.major = DRIVER_MAJOR,
|
|
.minor = DRIVER_MINOR,
|
|
.patchlevel = DRIVER_PATCHLEVEL,
|
|
|
|
.release = virtio_gpu_release,
|
|
};
|