All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
Cc: Yong Zhao <Yong.Zhao-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 07/10] drm/amdkfd: Reuse CHIP_* from amdgpu v2
Date: Sun, 24 Sep 2017 14:06:31 +0300	[thread overview]
Message-ID: <CAFCwf10XJ8TbqS_QU4DzaOcvLfWANBR9U3XK6VSOKVkAYOepuA@mail.gmail.com> (raw)
In-Reply-To: <1505945422-8851-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>

On Thu, Sep 21, 2017 at 1:10 AM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Yong Zhao <Yong.Zhao@amd.com>
>
> There are already CHIP_* definitions under amd_shared.h file on amdgpu
> side, so KFD should reuse them rather than defining new ones.
>
> Using enum for asic type requires default cases on switch statements
> to prevent compiler warnings. WARN on unsupported ASICs. It should never
> get there because KFD should not be initialized on unsupported devices.
>
> v2: Replace BUG() with WARN and error return
>
> Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c |  4 ++++
>  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c         | 18 ++++++++++++------
>  drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c          |  3 +++
>  drivers/gpu/drm/amd/amdkfd/kfd_priv.h                 |  9 +++------
>  4 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> index 87f8742..fe0f0de 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
> @@ -1130,6 +1130,10 @@ struct device_queue_manager *device_queue_manager_init(struct kfd_dev *dev)
>         case CHIP_KAVERI:
>                 device_queue_manager_init_cik(&dqm->ops_asic_specific);
>                 break;
> +       default:
> +               WARN(1, "Unexpected ASIC family %u",
> +                    dev->device_info->asic_family);
> +               goto out_free;
>         }
>
>         if (!dqm->ops.initialize(dqm))
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> index a47ca3c..d7ed10e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.c
> @@ -291,14 +291,20 @@ struct kernel_queue *kernel_queue_init(struct kfd_dev *dev,
>         case CHIP_KAVERI:
>                 kernel_queue_init_cik(&kq->ops_asic_specific);
>                 break;
> +       default:
> +               WARN(1, "Unexpected ASIC family %u",
> +                    dev->device_info->asic_family);
> +               goto out_free;
>         }
>
> -       if (!kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE)) {
> -               pr_err("Failed to init kernel queue\n");
> -               kfree(kq);
> -               return NULL;
> -       }
> -       return kq;
> +       if (kq->ops.initialize(kq, dev, type, KFD_KERNEL_QUEUE_SIZE))
> +               return kq;
> +
> +       pr_err("Failed to init kernel queue\n");
> +
> +out_free:
> +       kfree(kq);
> +       return NULL;
>  }
>
>  void kernel_queue_uninit(struct kernel_queue *kq)
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> index b1ef136..dfd260e 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c
> @@ -31,6 +31,9 @@ struct mqd_manager *mqd_manager_init(enum KFD_MQD_TYPE type,
>                 return mqd_manager_init_cik(type, dev);
>         case CHIP_CARRIZO:
>                 return mqd_manager_init_vi(type, dev);
> +       default:
> +               WARN(1, "Unexpected ASIC family %u",
> +                    dev->device_info->asic_family);
>         }
>
>         return NULL;
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> index 4d989b9..47eee77 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
> @@ -33,6 +33,8 @@
>  #include <linux/kfd_ioctl.h>
>  #include <kgd_kfd_interface.h>
>
> +#include "amd_shared.h"
> +
>  #define KFD_SYSFS_FILE_MODE 0444
>
>  #define KFD_MMAP_DOORBELL_MASK 0x8000000000000
> @@ -112,11 +114,6 @@ enum cache_policy {
>         cache_policy_noncoherent
>  };
>
> -enum asic_family_type {
> -       CHIP_KAVERI = 0,
> -       CHIP_CARRIZO
> -};
> -
>  struct kfd_event_interrupt_class {
>         bool (*interrupt_isr)(struct kfd_dev *dev,
>                                 const uint32_t *ih_ring_entry);
> @@ -125,7 +122,7 @@ struct kfd_event_interrupt_class {
>  };
>
>  struct kfd_device_info {
> -       unsigned int asic_family;
> +       enum amd_asic_type asic_family;
>         const struct kfd_event_interrupt_class *event_interrupt_class;
>         unsigned int max_pasid_bits;
>         unsigned int max_no_of_hqd;
> --
> 2.7.4
>

This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-09-24 11:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 22:10 [PATCH 00/10] KFD fixes v2 Felix Kuehling
     [not found] ` <1505945422-8851-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-09-20 22:10   ` [PATCH 01/10] drm/amdkfd: Reorganize kfd resume code Felix Kuehling
2017-09-20 22:10   ` [PATCH 02/10] drm/amdkfd: Fix suspend/resume issue on Carrizo v2 Felix Kuehling
2017-09-20 22:10   ` [PATCH 03/10] drm/amdkfd: Rectify the jiffies calculation error with milliseconds v2 Felix Kuehling
     [not found]     ` <1505945422-8851-4-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-09-24 10:32       ` Oded Gabbay
2017-09-20 22:10   ` [PATCH 04/10] drm/amdkfd: Adjust dequeue latencies and timeouts Felix Kuehling
2017-09-20 22:10   ` [PATCH 05/10] drm/amdkfd: Fix incorrect destroy_mqd parameter Felix Kuehling
2017-09-20 22:10   ` [PATCH 06/10] drm/amdkfd: Use VMID bitmap from KGD v2 Felix Kuehling
2017-09-20 22:10   ` [PATCH 07/10] drm/amdkfd: Reuse CHIP_* from amdgpu v2 Felix Kuehling
     [not found]     ` <1505945422-8851-8-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-09-24 11:06       ` Oded Gabbay [this message]
2017-09-20 22:10   ` [PATCH 08/10] drm/amdkfd: Drop _nocpsch suffix from shared functions Felix Kuehling
2017-09-20 22:10   ` [PATCH 09/10] drm/amdkfd: Fix kernel-queue wrapping bugs Felix Kuehling
     [not found]     ` <1505945422-8851-10-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
2017-09-24 11:09       ` Oded Gabbay
2017-09-20 22:10   ` [PATCH 10/10] drm/amdkfd: Print event limit messages only once per process Felix Kuehling
2017-09-24 11:13   ` [PATCH 00/10] KFD fixes v2 Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFCwf10XJ8TbqS_QU4DzaOcvLfWANBR9U3XK6VSOKVkAYOepuA@mail.gmail.com \
    --to=oded.gabbay-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Felix.Kuehling-5C7GfCeVMHo@public.gmane.org \
    --cc=Yong.Zhao-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.