mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
drm/vc4: Warn if some v3d code is run on BCM2711
The BCM2711 has a separate driver for the v3d, and thus we can't call into any of the driver entrypoints that rely on the v3d being there. Let's add a bunch of checks and complain loudly if that ever happen. Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20220610115149.964394-15-maxime@cerno.tech
This commit is contained in:
@@ -99,6 +99,9 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
|
||||
if (args->pad != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN_ON_ONCE(vc4->is_vc5))
|
||||
return -ENODEV;
|
||||
|
||||
if (!vc4->v3d)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -142,11 +145,16 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
|
||||
|
||||
static int vc4_open(struct drm_device *dev, struct drm_file *file)
|
||||
{
|
||||
struct vc4_dev *vc4 = to_vc4_dev(dev);
|
||||
struct vc4_file *vc4file;
|
||||
|
||||
if (WARN_ON_ONCE(vc4->is_vc5))
|
||||
return -ENODEV;
|
||||
|
||||
vc4file = kzalloc(sizeof(*vc4file), GFP_KERNEL);
|
||||
if (!vc4file)
|
||||
return -ENOMEM;
|
||||
vc4file->dev = vc4;
|
||||
|
||||
vc4_perfmon_open_file(vc4file);
|
||||
file->driver_priv = vc4file;
|
||||
@@ -158,6 +166,9 @@ static void vc4_close(struct drm_device *dev, struct drm_file *file)
|
||||
struct vc4_dev *vc4 = to_vc4_dev(dev);
|
||||
struct vc4_file *vc4file = file->driver_priv;
|
||||
|
||||
if (WARN_ON_ONCE(vc4->is_vc5))
|
||||
return;
|
||||
|
||||
if (vc4file->bin_bo_used)
|
||||
vc4_v3d_bin_bo_put(vc4);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user