Message ID | 20210430092508.60710-7-christian.koenig@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/13] drm/ttm: add ttm_sys_manager v2 | expand |
On Fri, 30 Apr 2021 at 10:25, Christian König <ckoenig.leichtzumerken@gmail.com> wrote: > > Make sure to allocate a resource object here. > > Signed-off-by: Christian König <christian.koenig@amd.com> Ok, I guess I have to keep reading, Reviewed-by: Matthew Auld <matthew.auld@intel.com> > --- > drivers/gpu/drm/ttm/ttm_sys_manager.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c > index ed92615214e3..a926114edfe5 100644 > --- a/drivers/gpu/drm/ttm/ttm_sys_manager.c > +++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c > @@ -3,18 +3,25 @@ > #include <drm/ttm/ttm_resource.h> > #include <drm/ttm/ttm_device.h> > #include <drm/ttm/ttm_placement.h> > +#include <linux/slab.h> > > static int ttm_sys_man_alloc(struct ttm_resource_manager *man, > struct ttm_buffer_object *bo, > const struct ttm_place *place, > struct ttm_resource *mem) > { > + mem->mm_node = kzalloc(sizeof(*mem), GFP_KERNEL); > + if (!mem->mm_node) > + return -ENOMEM; > + > + ttm_resource_init(bo, place, mem->mm_node); > return 0; > } > > static void ttm_sys_man_free(struct ttm_resource_manager *man, > struct ttm_resource *mem) > { > + kfree(mem->mm_node); > } > > static const struct ttm_resource_manager_func ttm_sys_manager_func = { > -- > 2.25.1 >
On Fri, 30 Apr 2021 at 10:25, Christian König <ckoenig.leichtzumerken@gmail.com> wrote: > > Make sure to allocate a resource object here. > > Signed-off-by: Christian König <christian.koenig@amd.com> > --- > drivers/gpu/drm/ttm/ttm_sys_manager.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c > index ed92615214e3..a926114edfe5 100644 > --- a/drivers/gpu/drm/ttm/ttm_sys_manager.c > +++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c > @@ -3,18 +3,25 @@ > #include <drm/ttm/ttm_resource.h> > #include <drm/ttm/ttm_device.h> > #include <drm/ttm/ttm_placement.h> > +#include <linux/slab.h> > > static int ttm_sys_man_alloc(struct ttm_resource_manager *man, > struct ttm_buffer_object *bo, > const struct ttm_place *place, > struct ttm_resource *mem) > { > + mem->mm_node = kzalloc(sizeof(*mem), GFP_KERNEL); > + if (!mem->mm_node) > + return -ENOMEM; > + > + ttm_resource_init(bo, place, mem->mm_node); Yeah, why are we passing the mm_node here, it's not the ttm_resource? > return 0; > } > > static void ttm_sys_man_free(struct ttm_resource_manager *man, > struct ttm_resource *mem) > { > + kfree(mem->mm_node); > } > > static const struct ttm_resource_manager_func ttm_sys_manager_func = { > -- > 2.25.1 >
Am 30.04.21 um 17:04 schrieb Matthew Auld: > On Fri, 30 Apr 2021 at 10:25, Christian König > <ckoenig.leichtzumerken@gmail.com> wrote: >> Make sure to allocate a resource object here. >> >> Signed-off-by: Christian König <christian.koenig@amd.com> >> --- >> drivers/gpu/drm/ttm/ttm_sys_manager.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c >> index ed92615214e3..a926114edfe5 100644 >> --- a/drivers/gpu/drm/ttm/ttm_sys_manager.c >> +++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c >> @@ -3,18 +3,25 @@ >> #include <drm/ttm/ttm_resource.h> >> #include <drm/ttm/ttm_device.h> >> #include <drm/ttm/ttm_placement.h> >> +#include <linux/slab.h> >> >> static int ttm_sys_man_alloc(struct ttm_resource_manager *man, >> struct ttm_buffer_object *bo, >> const struct ttm_place *place, >> struct ttm_resource *mem) >> { >> + mem->mm_node = kzalloc(sizeof(*mem), GFP_KERNEL); >> + if (!mem->mm_node) >> + return -ENOMEM; >> + >> + ttm_resource_init(bo, place, mem->mm_node); > Yeah, why are we passing the mm_node here, it's not the ttm_resource? Well it temporary is the ttm_resource object until I flip the switch in the last patch. Christian. > >> return 0; >> } >> >> static void ttm_sys_man_free(struct ttm_resource_manager *man, >> struct ttm_resource *mem) >> { >> + kfree(mem->mm_node); >> } >> >> static const struct ttm_resource_manager_func ttm_sys_manager_func = { >> -- >> 2.25.1 >>
diff --git a/drivers/gpu/drm/ttm/ttm_sys_manager.c b/drivers/gpu/drm/ttm/ttm_sys_manager.c index ed92615214e3..a926114edfe5 100644 --- a/drivers/gpu/drm/ttm/ttm_sys_manager.c +++ b/drivers/gpu/drm/ttm/ttm_sys_manager.c @@ -3,18 +3,25 @@ #include <drm/ttm/ttm_resource.h> #include <drm/ttm/ttm_device.h> #include <drm/ttm/ttm_placement.h> +#include <linux/slab.h> static int ttm_sys_man_alloc(struct ttm_resource_manager *man, struct ttm_buffer_object *bo, const struct ttm_place *place, struct ttm_resource *mem) { + mem->mm_node = kzalloc(sizeof(*mem), GFP_KERNEL); + if (!mem->mm_node) + return -ENOMEM; + + ttm_resource_init(bo, place, mem->mm_node); return 0; } static void ttm_sys_man_free(struct ttm_resource_manager *man, struct ttm_resource *mem) { + kfree(mem->mm_node); } static const struct ttm_resource_manager_func ttm_sys_manager_func = {
Make sure to allocate a resource object here. Signed-off-by: Christian König <christian.koenig@amd.com> --- drivers/gpu/drm/ttm/ttm_sys_manager.c | 7 +++++++ 1 file changed, 7 insertions(+)