Skip to content

Commit

Permalink
drm/amdgpu: fix amdgpu pmu to use hwc->config instead of hwc->conf
Browse files Browse the repository at this point in the history
hwc->conf was designated specifically for AMD APU IOMMU purposes.  This
could cause problems in performance and/or function since APU IOMMU
implementation is elsewhere.  Also hwc->conf and hwc->config are
different members of an anonymous union so hwc->conf aliases as
hw->last_tag.

Change-Id: I5d0c8396bc5a11dd69262a6a5423633d9ca6df3d
Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
  • Loading branch information
Jonathan Kim authored and Stanley.Yang committed Feb 7, 2020
1 parent 12c2763 commit 8c91349
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ static int amdgpu_perf_event_init(struct perf_event *event)
return -ENOENT;

/* update the hw_perf_event struct with config data */
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
hwc->conf = event->attr.config;
#else
hwc->config = event->attr.config;
#endif

return 0;
}
Expand All @@ -78,13 +74,9 @@ static void amdgpu_perf_start(struct perf_event *event, int flags)
switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
if (!(flags & PERF_EF_RELOAD))
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 1);
pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 0);
#else
pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 1);

pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 0);
#endif
break;
default:
break;
Expand All @@ -109,13 +101,8 @@ static void amdgpu_perf_read(struct perf_event *event)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_get_count(pe->adev, hwc->conf,
&count);
#else
pe->adev->df.funcs->pmc_get_count(pe->adev, hwc->config,
&count);
#endif
break;
default:
count = 0;
Expand All @@ -139,11 +126,7 @@ static void amdgpu_perf_stop(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->conf, 0);
#else
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, 0);
#endif
break;
default:
break;
Expand Down Expand Up @@ -173,11 +156,7 @@ static int amdgpu_perf_add(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
retval = pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 1);
#else
retval = pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 1);
#endif
break;
default:
return 0;
Expand Down Expand Up @@ -205,11 +184,7 @@ static void amdgpu_perf_del(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->conf, 1);
#else
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, 1);
#endif
break;
default:
break;
Expand Down

0 comments on commit 8c91349

Please sign in to comment.