mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drm: nova: Move VRAM BAR size query to GPU info
Nova exposes static information via its DRM_IOCTL_NOVA_INFO ioctl, thus add vram_bar_size to struct drm_nova_info_gpu and remove DRM_IOCTL_NOVA_GETPARAM and its uAPI definitions. This breaks the uAPI, which is still fine at this point. It requires the corresponding drm-test change in [1]. Link: https://gitlab.freedesktop.org/dakr/drm-test/-/merge_requests/2 [1] Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> Link: https://patch.msgid.link/20260927142258.1260711-1-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
parent
dc90f13368
commit
04476103b7
|
|
@ -95,9 +95,8 @@ impl drm::Driver for NovaDriver {
|
|||
const FEAT_RENDER: bool = true;
|
||||
|
||||
kernel::declare_drm_ioctls! {
|
||||
(NOVA_GETPARAM, drm_nova_getparam, ioctl::RENDER_ALLOW, File::get_param),
|
||||
(NOVA_INFO, drm_nova_info, ioctl::RENDER_ALLOW, File::info),
|
||||
(NOVA_GEM_CREATE, drm_nova_gem_create, ioctl::AUTH | ioctl::RENDER_ALLOW, File::gem_create),
|
||||
(NOVA_GEM_INFO, drm_nova_gem_info, ioctl::AUTH | ioctl::RENDER_ALLOW, File::gem_info),
|
||||
(NOVA_INFO, drm_nova_info, ioctl::RENDER_ALLOW, File::info),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ fn new(reg_data: &DrmRegData<'_>) -> Result<Self> {
|
|||
architecture: spec.chipset.arch().into(),
|
||||
chipid: spec.chipset.into(),
|
||||
vram_size: gsp_static_info.vram_size(),
|
||||
vram_bar_size: reg_data.api.with(|api| api.bar1_size())?,
|
||||
gpu_gid: gsp_static_info.gpu_gid,
|
||||
..pin_init::zeroed()
|
||||
};
|
||||
|
|
@ -108,23 +109,6 @@ fn open(_dev: &NovaDevice) -> Result<Pin<KBox<Self>>> {
|
|||
}
|
||||
|
||||
impl File {
|
||||
/// IOCTL: get_param: Query GPU / driver metadata.
|
||||
pub(crate) fn get_param(
|
||||
_dev: &NovaDevice<Registered>,
|
||||
reg_data: &DrmRegData<'_>,
|
||||
getparam: &mut uapi::drm_nova_getparam,
|
||||
_file: &drm::File<File>,
|
||||
) -> Result<u32> {
|
||||
let value = match getparam.param.try_into()? {
|
||||
uapi::NOVA_GETPARAM_VRAM_BAR_SIZE => reg_data.api.with(|api| api.bar1_size())?,
|
||||
_ => return Err(EINVAL),
|
||||
};
|
||||
|
||||
getparam.value = Into::<u64>::into(value);
|
||||
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
/// IOCTL: gem_create: Create a new DRM GEM object.
|
||||
pub(crate) fn gem_create(
|
||||
dev: &NovaDevice<Registered>,
|
||||
|
|
|
|||
|
|
@ -18,13 +18,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOVA_GETPARAM_VRAM_BAR_SIZE
|
||||
*
|
||||
* Query the VRAM BAR size in bytes.
|
||||
*/
|
||||
#define NOVA_GETPARAM_VRAM_BAR_SIZE 0x1
|
||||
|
||||
/**
|
||||
* enum drm_nova_architecture - GPU architecture identifier
|
||||
*/
|
||||
|
|
@ -77,21 +70,6 @@ enum drm_nova_chipid {
|
|||
NOVA_DRM_CHIPID_GB207 = 0x1b7,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_nova_getparam - query GPU and driver metadata
|
||||
*/
|
||||
struct drm_nova_getparam {
|
||||
/**
|
||||
* @param: The identifier of the parameter to query.
|
||||
*/
|
||||
__u64 param;
|
||||
|
||||
/**
|
||||
* @value: The value for the specified parameter.
|
||||
*/
|
||||
__u64 value;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_nova_gem_create - create a new DRM GEM object
|
||||
*/
|
||||
|
|
@ -189,6 +167,11 @@ struct drm_nova_info_gpu {
|
|||
*/
|
||||
__u64 vram_size;
|
||||
|
||||
/**
|
||||
* @vram_bar_size: Size of the PCI BAR aperture used to access VRAM, in bytes.
|
||||
*/
|
||||
__u64 vram_bar_size;
|
||||
|
||||
/**
|
||||
* @gpu_name: NUL-terminated full GPU name.
|
||||
*/
|
||||
|
|
@ -205,21 +188,18 @@ struct drm_nova_info_gpu {
|
|||
__u8 gpu_gid[16];
|
||||
};
|
||||
|
||||
#define DRM_NOVA_GETPARAM 0x00
|
||||
#define DRM_NOVA_INFO 0x00
|
||||
#define DRM_NOVA_GEM_CREATE 0x01
|
||||
#define DRM_NOVA_GEM_INFO 0x02
|
||||
#define DRM_NOVA_INFO 0x03
|
||||
|
||||
/* Note: this is an enum so that it can be resolved by Rust bindgen. */
|
||||
enum {
|
||||
DRM_IOCTL_NOVA_GETPARAM = DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GETPARAM,
|
||||
struct drm_nova_getparam),
|
||||
DRM_IOCTL_NOVA_INFO = DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_INFO,
|
||||
struct drm_nova_info),
|
||||
DRM_IOCTL_NOVA_GEM_CREATE = DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GEM_CREATE,
|
||||
struct drm_nova_gem_create),
|
||||
DRM_IOCTL_NOVA_GEM_INFO = DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_GEM_INFO,
|
||||
struct drm_nova_gem_info),
|
||||
DRM_IOCTL_NOVA_INFO = DRM_IOWR(DRM_COMMAND_BASE + DRM_NOVA_INFO,
|
||||
struct drm_nova_info),
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user