linux/arch/powerpc/platforms/cell/spu_notify.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-or-later
   2/*
   3 * Move OProfile dependencies from spufs module to the kernel so it
   4 * can run on non-cell PPC.
   5 *
   6 * Copyright (C) IBM 2005
   7 */
   8
   9#undef DEBUG
  10
  11#include <linux/export.h>
  12#include <linux/notifier.h>
  13#include <asm/spu.h>
  14#include "spufs/spufs.h"
  15
  16static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
  17
  18void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
  19{
  20        blocking_notifier_call_chain(&spu_switch_notifier,
  21                                     ctx ? ctx->object_id : 0, spu);
  22}
  23EXPORT_SYMBOL_GPL(spu_switch_notify);
  24
  25int spu_switch_event_register(struct notifier_block *n)
  26{
  27        int ret;
  28        ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
  29        if (!ret)
  30                notify_spus_active();
  31        return ret;
  32}
  33EXPORT_SYMBOL_GPL(spu_switch_event_register);
  34
  35int spu_switch_event_unregister(struct notifier_block *n)
  36{
  37        return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
  38}
  39EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
  40
  41void spu_set_profile_private_kref(struct spu_context *ctx,
  42                                  struct kref *prof_info_kref,
  43                                  void (* prof_info_release) (struct kref *kref))
  44{
  45        ctx->prof_priv_kref = prof_info_kref;
  46        ctx->prof_priv_release = prof_info_release;
  47}
  48EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
  49
  50void *spu_get_profile_private_kref(struct spu_context *ctx)
  51{
  52        return ctx->prof_priv_kref;
  53}
  54EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
  55
  56