Commit 0d83be77 authored by Matthew Auld's avatar Matthew Auld Committed by Rodrigo Vivi

drm/xe/mmio: fix forcewake ref leak in xe_mmio_ioctl

Make sure we properly release the forcewake ref on all error paths.

v2(Lucas):
  - Make it less verbose and just fold the unimplemented options into
    the default. The exact return value doesn't seem to matter for the
    corresponding IGT.
  - Replace the user triggerable WARN() with drm_dbg().
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent ba00da78
...@@ -425,31 +425,28 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data, ...@@ -425,31 +425,28 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data,
if (args->flags & DRM_XE_MMIO_WRITE) { if (args->flags & DRM_XE_MMIO_WRITE) {
switch (bits_flag) { switch (bits_flag) {
case DRM_XE_MMIO_8BIT:
return -EINVAL; /* TODO */
case DRM_XE_MMIO_16BIT:
return -EINVAL; /* TODO */
case DRM_XE_MMIO_32BIT: case DRM_XE_MMIO_32BIT:
if (XE_IOCTL_ERR(xe, args->value > U32_MAX)) if (XE_IOCTL_ERR(xe, args->value > U32_MAX)) {
return -EINVAL; ret = -EINVAL;
goto exit;
}
xe_mmio_write32(to_gt(xe), args->addr, args->value); xe_mmio_write32(to_gt(xe), args->addr, args->value);
break; break;
case DRM_XE_MMIO_64BIT: case DRM_XE_MMIO_64BIT:
xe_mmio_write64(to_gt(xe), args->addr, args->value); xe_mmio_write64(to_gt(xe), args->addr, args->value);
break; break;
default: default:
drm_WARN(&xe->drm, 1, "Invalid MMIO bit size"); drm_dbg(&xe->drm, "Invalid MMIO bit size");
ret = -EINVAL; fallthrough;
case DRM_XE_MMIO_8BIT: /* TODO */
case DRM_XE_MMIO_16BIT: /* TODO */
ret = -ENOTSUPP;
goto exit; goto exit;
} }
} }
if (args->flags & DRM_XE_MMIO_READ) { if (args->flags & DRM_XE_MMIO_READ) {
switch (bits_flag) { switch (bits_flag) {
case DRM_XE_MMIO_8BIT:
return -EINVAL; /* TODO */
case DRM_XE_MMIO_16BIT:
return -EINVAL; /* TODO */
case DRM_XE_MMIO_32BIT: case DRM_XE_MMIO_32BIT:
args->value = xe_mmio_read32(to_gt(xe), args->addr); args->value = xe_mmio_read32(to_gt(xe), args->addr);
break; break;
...@@ -457,8 +454,11 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data, ...@@ -457,8 +454,11 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data,
args->value = xe_mmio_read64(to_gt(xe), args->addr); args->value = xe_mmio_read64(to_gt(xe), args->addr);
break; break;
default: default:
drm_WARN(&xe->drm, 1, "Invalid MMIO bit size"); drm_dbg(&xe->drm, "Invalid MMIO bit size");
ret = -EINVAL; fallthrough;
case DRM_XE_MMIO_8BIT: /* TODO */
case DRM_XE_MMIO_16BIT: /* TODO */
ret = -ENOTSUPP;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment