Message ID | 20190417062734.24021-2-vicamo.yang@canonical.com |
---|---|
State | New |
Headers | show |
Series | [1/1,SRU,B] drm/amdgpu: fix&cleanups for wb_clear | expand |
On 17.04.19 08:27, You-Sheng Yang wrote: > From: Monk Liu <Monk.Liu@amd.com> > > BugLink: https://bugs.launchpad.net/bugs/1825074 > > fix: > should do right shift on wb before clearing > > cleanups: > 1,should memset all wb buffer > 2,set max wb number to 128 (total 4KB) is big enough > > Signed-off-by: Monk Liu <Monk.Liu@amd.com> > Acked-by: Alex Deucher <alexander.deucher@amd.com> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > (cherry picked from commit 73469585510d5161368c899b7eacd58c824b2b24) > Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- What about Cosmic and Disco? -Stefan > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index c90346191e5ac..9d0891a146a17 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -1155,7 +1155,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p, > /* > * Writeback > */ > -#define AMDGPU_MAX_WB 512 /* Reserve at most 512 WB slots for amdgpu-owned rings. */ > +#define AMDGPU_MAX_WB 128 /* Reserve at most 128 WB slots for amdgpu-owned rings. */ > > struct amdgpu_wb { > struct amdgpu_bo *wb_obj; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 1e3461ec43919..ade8d0eaccb04 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -526,7 +526,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) > memset(&adev->wb.used, 0, sizeof(adev->wb.used)); > > /* clear wb memory */ > - memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t)); > + memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8); > } > > return 0; > @@ -564,8 +564,9 @@ int amdgpu_wb_get(struct amdgpu_device *adev, u32 *wb) > */ > void amdgpu_wb_free(struct amdgpu_device *adev, u32 wb) > { > + wb >>= 3; > if (wb < adev->wb.num_wb) > - __clear_bit(wb >> 3, adev->wb.used); > + __clear_bit(wb, adev->wb.used); > } > > /** >
Acked-By: AceLan Kao <acelan.kao@canonical.com>
On 2019/4/18 9:55 PM, Stefan Bader wrote:
> What about Cosmic and Disco?
This has been landed to v4.16, so Cosmic/Disco are not affected.
You-Sheng Yang
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c90346191e5ac..9d0891a146a17 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1155,7 +1155,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p, /* * Writeback */ -#define AMDGPU_MAX_WB 512 /* Reserve at most 512 WB slots for amdgpu-owned rings. */ +#define AMDGPU_MAX_WB 128 /* Reserve at most 128 WB slots for amdgpu-owned rings. */ struct amdgpu_wb { struct amdgpu_bo *wb_obj; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 1e3461ec43919..ade8d0eaccb04 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -526,7 +526,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) memset(&adev->wb.used, 0, sizeof(adev->wb.used)); /* clear wb memory */ - memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t)); + memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8); } return 0; @@ -564,8 +564,9 @@ int amdgpu_wb_get(struct amdgpu_device *adev, u32 *wb) */ void amdgpu_wb_free(struct amdgpu_device *adev, u32 wb) { + wb >>= 3; if (wb < adev->wb.num_wb) - __clear_bit(wb >> 3, adev->wb.used); + __clear_bit(wb, adev->wb.used); } /**