gpu: nvgpu: posix: add os_priv for channel

Add os_priv for channel, to store error notifier.
Updated the following functions to use error notifier
in ch->os_priv, when present:
- nvgpu_set_err_notifier_locked
- nvgpu_set_err_notifier
- nvgpu_set_err_notifier_if_emtpy
- nvgpu_is_err_notifier_set

Jira NVGPU-4387

Change-Id: I9718d045fc780f721548201981b038de46b36a7e
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2248160
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2019-11-26 15:38:31 -05:00
committed by Alex Waterman
parent 1fc9a427e0
commit dd8be7cb82
3 changed files with 53 additions and 0 deletions

View File

@@ -21,20 +21,37 @@
*/
#include <nvgpu/error_notifier.h>
#include <nvgpu/channel.h>
#include <nvgpu/posix/posix-channel.h>
void nvgpu_set_err_notifier_locked(struct nvgpu_channel *ch, u32 error)
{
struct nvgpu_posix_channel *cp = ch->os_priv;
if (cp != NULL) {
cp->err_notifier.error = error;
cp->err_notifier.status = 0xffff;
}
}
void nvgpu_set_err_notifier(struct nvgpu_channel *ch, u32 error)
{
nvgpu_set_err_notifier_locked(ch, error);
}
void nvgpu_set_err_notifier_if_empty(struct nvgpu_channel *ch, u32 error)
{
struct nvgpu_posix_channel *cp = ch->os_priv;
if (cp != NULL && cp->err_notifier.status == 0) {
nvgpu_set_err_notifier_locked(ch, error);
}
}
bool nvgpu_is_err_notifier_set(struct nvgpu_channel *ch, u32 error_notifier)
{
struct nvgpu_posix_channel *cp = ch->os_priv;
if ((cp != NULL) && (cp->err_notifier.status != 0)) {
return cp->err_notifier.error == error_notifier;
}
return false;
}