summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/subdev
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2026-02-23 10:09:45 +0100
committerMaxime Ripard <mripard@kernel.org>2026-02-23 10:09:45 +0100
commitc17ee635fd3a482b2ad2bf5e269755c2eae5f25e (patch)
treee3f147462d8a9fd0cf2312c8cd3c5a94da15c3e4 /drivers/gpu/drm/nouveau/nvkm/subdev
parent803ec1faf7c1823e6e3b1f2aaa81be18528c9436 (diff)
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f (diff)
Merge drm/drm-fixes into drm-misc-fixes
7.0-rc1 was just released, let's merge it to kick the new release cycle. Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gp10b.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv40.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/rammcp77.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fsp/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv4e.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c10
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c88
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h16
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c2
100 files changed, 199 insertions, 168 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
index 13d829593180..4c7745cd6ae5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/base.c
@@ -251,7 +251,7 @@ nvkm_acr_oneinit(struct nvkm_subdev *subdev)
nvkm_falcon_put(lsfw->falcon, subdev);
- if (!(lsf = kmalloc(sizeof(*lsf), GFP_KERNEL)))
+ if (!(lsf = kmalloc_obj(*lsf)))
return -ENOMEM;
lsf->func = lsfw->func;
lsf->falcon = lsfw->falcon;
@@ -422,7 +422,7 @@ nvkm_acr_new_(const struct nvkm_acr_fwif *fwif, struct nvkm_device *device,
struct nvkm_acr *acr;
long wprfw;
- if (!(acr = *pacr = kzalloc(sizeof(*acr), GFP_KERNEL)))
+ if (!(acr = *pacr = kzalloc_obj(*acr)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_acr, device, type, inst, &acr->subdev);
INIT_LIST_HEAD(&acr->hsfw);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga100.c
index e3370c1551c0..b3f84345ee53 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga100.c
@@ -37,7 +37,7 @@ ga100_acr_hsfw_ctor(struct nvkm_acr *acr, const char *bl, const char *fw,
{
struct nvkm_acr_hsfw *hsfw;
- if (!(hsfw = kzalloc(sizeof(*hsfw), GFP_KERNEL)))
+ if (!(hsfw = kzalloc_obj(*hsfw)))
return -ENOMEM;
hsfw->falcon_id = fwif->falcon_id;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
index c7d38609bb7e..a9f0090b2310 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/ga102.c
@@ -32,7 +32,7 @@ ga102_acr_wpr_patch(struct nvkm_acr *acr, s64 adjust)
struct nvkm_acr_lsfw *lsfw;
u32 offset = 0;
- lsb = kvmalloc(sizeof(*lsb), GFP_KERNEL);
+ lsb = kvmalloc_obj(*lsb);
if (!lsb)
return -ENOMEM;
@@ -67,7 +67,7 @@ ga102_acr_wpr_build_lsb(struct nvkm_acr *acr, struct nvkm_acr_lsfw *lsfw)
if (WARN_ON(lsfw->sig->size != sizeof(hdr->signature)))
return -EINVAL;
- hdr = kvzalloc(sizeof(*hdr), GFP_KERNEL);
+ hdr = kvzalloc_obj(*hdr);
if (!hdr)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c
index 31079c947758..fd78965d841f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/gm200.c
@@ -247,7 +247,7 @@ gm200_acr_hsfw_ctor(struct nvkm_acr *acr, const char *bl, const char *fw, const
{
struct nvkm_acr_hsfw *hsfw;
- if (!(hsfw = kzalloc(sizeof(*hsfw), GFP_KERNEL)))
+ if (!(hsfw = kzalloc_obj(*hsfw)))
return -ENOMEM;
hsfw->falcon_id = fwif->falcon_id;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
index bd104a030243..acb5e1dd4744 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c
@@ -71,7 +71,7 @@ nvkm_acr_lsfw_add(const struct nvkm_acr_lsf_func *func, struct nvkm_acr *acr,
}
if (!lsfw) {
- if (!(lsfw = kzalloc(sizeof(*lsfw), GFP_KERNEL)))
+ if (!(lsfw = kzalloc_obj(*lsfw)))
return ERR_PTR(-ENOMEM);
lsfw->id = id;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
index e5e60915029c..a1fa1b0c8954 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
@@ -165,7 +165,7 @@ gf100_bar_new_(const struct nvkm_bar_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_bar **pbar)
{
struct gf100_bar *bar;
- if (!(bar = kzalloc(sizeof(*bar), GFP_KERNEL)))
+ if (!(bar = kzalloc_obj(*bar)))
return -ENOMEM;
nvkm_bar_ctor(func, device, type, inst, &bar->base);
bar->bar2_halve = nvkm_boolopt(device->cfgopt, "NvBar2Halve", false);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
index 6a881becb02c..cf3bbaf1a85a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
@@ -223,7 +223,7 @@ nv50_bar_new_(const struct nvkm_bar_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, u32 pgd_addr, struct nvkm_bar **pbar)
{
struct nv50_bar *bar;
- if (!(bar = kzalloc(sizeof(*bar), GFP_KERNEL)))
+ if (!(bar = kzalloc_obj(*bar)))
return -ENOMEM;
nvkm_bar_ctor(func, device, type, inst, &bar->base);
bar->pgd_addr = pgd_addr;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
index 91f486ee4c42..fd3192df452e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
@@ -156,7 +156,7 @@ nvkm_bios_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct bit_entry bit_i;
int ret, idx = 0;
- if (!(bios = *pbios = kzalloc(sizeof(*bios), GFP_KERNEL)))
+ if (!(bios = *pbios = kzalloc_obj(*bios)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_bios, device, type, inst, &bios->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
index dea444d48f94..5a481fa56fd5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/iccsense.c
@@ -73,8 +73,7 @@ nvbios_iccsense_parse(struct nvkm_bios *bios, struct nvbios_iccsense *iccsense)
}
iccsense->nr_entry = cnt;
- iccsense->rail = kmalloc_array(cnt, sizeof(struct pwr_rail_t),
- GFP_KERNEL);
+ iccsense->rail = kmalloc_objs(struct pwr_rail_t, cnt);
if (!iccsense->rail)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
index cb05f7f48a98..e963090f95be 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
@@ -58,7 +58,7 @@ of_init(struct nvkm_bios *bios, const char *name)
struct priv *priv;
if (!(dn = pci_device_to_OF_node(pdev)))
return ERR_PTR(-ENODEV);
- if (!(priv = kzalloc(sizeof(*priv), GFP_KERNEL)))
+ if (!(priv = kzalloc_obj(*priv)))
return ERR_PTR(-ENOMEM);
if ((priv->data = of_get_property(dn, "NVDA,BMP", &priv->size)))
return priv;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
index 8d9812a51ef6..cb07c2a2d362 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowpci.c
@@ -65,7 +65,7 @@ pcirom_init(struct nvkm_bios *bios, const char *name)
if (!(ret = pci_enable_rom(pdev))) {
if (ret = -ENOMEM,
- (priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+ (priv = kmalloc_obj(*priv))) {
if (ret = -EFAULT,
(priv->rom = pci_map_rom(pdev, &priv->size))) {
priv->pdev = pdev;
@@ -104,7 +104,7 @@ platform_init(struct nvkm_bios *bios, const char *name)
if (!pdev->rom || pdev->romlen == 0)
return ERR_PTR(-ENODEV);
- if ((priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+ if ((priv = kmalloc_obj(*priv))) {
priv->size = pdev->romlen;
if (ret = -ENODEV,
(priv->rom = ioremap(pdev->rom, pdev->romlen)))
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
index 023ddc7c5399..d5411d176e3a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowramin.c
@@ -102,7 +102,7 @@ pramin_init(struct nvkm_bios *bios, const char *name)
}
/* modify bar0 PRAMIN window to cover the bios image */
- if (!(priv = kmalloc(sizeof(*priv), GFP_KERNEL))) {
+ if (!(priv = kmalloc_obj(*priv))) {
nvkm_error(subdev, "... out of memory\n");
return ERR_PTR(-ENOMEM);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c
index 0e5a46db52ea..ca1825b71669 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c
@@ -56,7 +56,7 @@ nvkm_bus_new_(const struct nvkm_bus_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_bus **pbus)
{
struct nvkm_bus *bus;
- if (!(bus = *pbus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = *pbus = kzalloc_obj(*bus)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_bus, device, type, inst, &bus->subdev);
bus->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c
index 2a5668938f2f..7cd19e77f6a1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c
@@ -45,7 +45,7 @@ nvkm_hwsq_init(struct nvkm_subdev *subdev, struct nvkm_hwsq **phwsq)
{
struct nvkm_hwsq *hwsq;
- hwsq = *phwsq = kmalloc(sizeof(*hwsq), GFP_KERNEL);
+ hwsq = *phwsq = kmalloc_obj(*hwsq);
if (hwsq) {
hwsq->subdev = subdev;
hwsq->addr = ~0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
index 71420f81714b..572e63846315 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
@@ -239,7 +239,7 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
if (volt && nvkm_volt_map_min(volt, cstepX.voltage) > volt->max_uv)
return -EINVAL;
- cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
+ cstate = kzalloc_obj(*cstate);
if (!cstate)
return -ENOMEM;
@@ -416,7 +416,7 @@ nvkm_pstate_new(struct nvkm_clk *clk, int idx)
if (perfE.pstate == 0xff)
return 0;
- pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
+ pstate = kzalloc_obj(*pstate);
if (!pstate)
return -ENOMEM;
@@ -710,7 +710,7 @@ int
nvkm_clk_new_(const struct nvkm_clk_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, bool allow_reclock, struct nvkm_clk **pclk)
{
- if (!(*pclk = kzalloc(sizeof(**pclk), GFP_KERNEL)))
+ if (!(*pclk = kzalloc_obj(**pclk)))
return -ENOMEM;
return nvkm_clk_ctor(func, device, type, inst, allow_reclock, *pclk);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
index 6eea11aefb70..163c1b2b9b8d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gf100.c
@@ -473,7 +473,7 @@ gf100_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct gf100_clk *clk;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
index 0d8e2ddcc5ee..9860a50bb4ca 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk104.c
@@ -509,7 +509,7 @@ gk104_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct gk104_clk *clk;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
index 65f5d0f1f3bf..b1197fa70687 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gk20a.c
@@ -649,7 +649,7 @@ gk20a_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct gk20a_clk *clk;
int ret;
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk);
if (!clk)
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
index fa8ca53acbd1..73d696dbb698 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gm20b.c
@@ -919,7 +919,7 @@ gm20b_clk_new_speedo0(struct nvkm_device *device, enum nvkm_subdev_type type, in
struct gk20a_clk *clk;
int ret;
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk);
if (!clk)
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gp10b.c
index 492b62c0ee96..7fa8beb95180 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gp10b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gp10b.c
@@ -165,7 +165,7 @@ gp10b_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct gp10b_clk *clk;
int ret, i;
- clk = kzalloc(sizeof(*clk), GFP_KERNEL);
+ clk = kzalloc_obj(*clk);
if (!clk)
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c
index b5f3969727a2..5421200282b9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c
@@ -542,7 +542,7 @@ gt215_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct gt215_clk *clk;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
index 81f103f88dc8..3d01de9b892c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/mcp77.c
@@ -414,7 +414,7 @@ mcp77_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct mcp77_clk *clk;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv40.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv40.c
index 7ddd8cecb805..7fcba24855ba 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv40.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv40.c
@@ -223,7 +223,7 @@ nv40_clk_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct nv40_clk *clk;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
clk->base.pll_calc = nv04_clk_pll_calc;
clk->base.pll_prog = nv04_clk_pll_prog;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c
index e1d31c62f9ec..630c4fc26500 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/nv50.c
@@ -513,7 +513,7 @@ nv50_clk_new_(const struct nvkm_clk_func *func, struct nvkm_device *device,
struct nv50_clk *clk;
int ret;
- if (!(clk = kzalloc(sizeof(*clk), GFP_KERNEL)))
+ if (!(clk = kzalloc_obj(*clk)))
return -ENOMEM;
ret = nvkm_clk_ctor(func, device, type, inst, allow_reclock, &clk->base);
*pclk = &clk->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c
index 88bc890f89a2..ab97a177ea97 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv04.c
@@ -439,7 +439,7 @@ nv04_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *devi
{
struct nv04_devinit *init;
- if (!(init = kzalloc(sizeof(*init), GFP_KERNEL)))
+ if (!(init = kzalloc_obj(*init)))
return -ENOMEM;
*pinit = &init->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
index 07ed8fd778b2..0983a29a6655 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.c
@@ -150,7 +150,7 @@ nv50_devinit_new_(const struct nvkm_devinit_func *func, struct nvkm_device *devi
{
struct nv50_devinit *init;
- if (!(init = kzalloc(sizeof(*init), GFP_KERNEL)))
+ if (!(init = kzalloc_obj(*init)))
return -ENOMEM;
*pinit = &init->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
index 666eb93b1742..9921dd3d3fd9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/r535.c
@@ -36,7 +36,7 @@ r535_devinit_new(const struct nvkm_devinit_func *hw,
struct nvkm_devinit_func *rm;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_devinit_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
index d8d32bb5bcd9..92e38755c218 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
@@ -76,7 +76,7 @@ nvkm_fault_oneinit_buffer(struct nvkm_fault *fault, int id)
struct nvkm_fault_buffer *buffer;
int ret;
- if (!(buffer = kzalloc(sizeof(*buffer), GFP_KERNEL)))
+ if (!(buffer = kzalloc_obj(*buffer)))
return -ENOMEM;
buffer->fault = fault;
buffer->id = id;
@@ -156,7 +156,7 @@ nvkm_fault_new_(const struct nvkm_fault_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_fault **pfault)
{
struct nvkm_fault *fault;
- if (!(fault = *pfault = kzalloc(sizeof(*fault), GFP_KERNEL)))
+ if (!(fault = *pfault = kzalloc_obj(*fault)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_fault, device, type, inst, &fault->subdev);
fault->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c
index 7ce1b65e2c1c..6f521653adaa 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c
@@ -296,7 +296,7 @@ int
nvkm_fb_new_(const struct nvkm_fb_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_fb **pfb)
{
- if (!(*pfb = kzalloc(sizeof(**pfb), GFP_KERNEL)))
+ if (!(*pfb = kzalloc_obj(**pfb)))
return -ENOMEM;
return nvkm_fb_ctor(func, device, type, inst, *pfb);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c
index 64281a09fb39..dc5cb6c54b13 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c
@@ -112,7 +112,7 @@ gf100_fb_new_(const struct nvkm_fb_func *func, struct nvkm_device *device,
{
struct gf100_fb *fb;
- if (!(fb = kzalloc(sizeof(*fb), GFP_KERNEL)))
+ if (!(fb = kzalloc_obj(*fb)))
return -ENOMEM;
nvkm_fb_ctor(func, device, type, inst, &fb->base);
*pfb = &fb->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c
index 076d968b7297..f1413fd193ad 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/nv50.c
@@ -244,7 +244,7 @@ nv50_fb_new_(const struct nv50_fb_func *func, struct nvkm_device *device,
{
struct nv50_fb *fb;
- if (!(fb = kzalloc(sizeof(*fb), GFP_KERNEL)))
+ if (!(fb = kzalloc_obj(*fb)))
return -ENOMEM;
nvkm_fb_ctor(&nv50_fb_, device, type, inst, &fb->base);
fb->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c
index d32515010167..9db6accc75a8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/r535.c
@@ -35,7 +35,7 @@ r535_fb_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
struct nvkm_ram *ram;
int ret;
- if (!(ram = *pram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = *pram = kzalloc_obj(*ram)))
return -ENOMEM;
ram->func = &r535_fb_ram;
@@ -71,7 +71,7 @@ r535_fb_new(const struct nvkm_fb_func *hw,
struct nvkm_fb_func *rm;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_fb_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c
index c826980bf70e..66274083e215 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.c
@@ -127,7 +127,7 @@ nvkm_ram_wrap(struct nvkm_device *device, u64 addr, u64 size,
return -ENODEV;
ram = device->fb->ram;
- if (!(vram = kzalloc(sizeof(*vram), GFP_KERNEL)))
+ if (!(vram = kzalloc_obj(*vram)))
return -ENOMEM;
nvkm_memory_ctor(&nvkm_vram, &vram->memory);
@@ -135,7 +135,7 @@ nvkm_ram_wrap(struct nvkm_device *device, u64 addr, u64 size,
vram->page = NVKM_RAM_MM_SHIFT;
*pmemory = &vram->memory;
- vram->mn = kzalloc(sizeof(*vram->mn), GFP_KERNEL);
+ vram->mn = kzalloc_obj(*vram->mn);
if (!vram->mn)
return -ENOMEM;
@@ -163,7 +163,7 @@ nvkm_ram_get(struct nvkm_device *device, u8 heap, u8 type, u8 rpage, u64 size,
ram = device->fb->ram;
mm = &ram->vram;
- if (!(vram = kzalloc(sizeof(*vram), GFP_KERNEL)))
+ if (!(vram = kzalloc_obj(*vram)))
return -ENOMEM;
nvkm_memory_ctor(&nvkm_vram, &vram->memory);
vram->ram = ram;
@@ -257,7 +257,7 @@ int
nvkm_ram_new_(const struct nvkm_ram_func *func, struct nvkm_fb *fb,
enum nvkm_ram_type type, u64 size, struct nvkm_ram **pram)
{
- if (!(*pram = kzalloc(sizeof(**pram), GFP_KERNEL)))
+ if (!(*pram = kzalloc_obj(**pram)))
return -ENOMEM;
return nvkm_ram_ctor(func, fb, type, size, *pram);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
index ba43fe158b22..b6b8398eb254 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgf100.c
@@ -572,7 +572,7 @@ gf100_ram_new_(const struct nvkm_ram_func *func,
struct gf100_ram *ram;
int ret;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
index 2b678b60b4d3..f89e7101e65c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c
@@ -1371,7 +1371,7 @@ gk104_ram_train_init(struct nvkm_ram *ram)
struct gk104_ram_train *train;
int ret, i;
- if (!(train = kzalloc(sizeof(*train), GFP_KERNEL)))
+ if (!(train = kzalloc_obj(*train)))
return -ENOMEM;
for (i = 0; i < 0x100; i++) {
@@ -1446,7 +1446,7 @@ gk104_ram_ctor_data(struct gk104_ram *ram, u8 ramcfg, int i)
u32 data;
int ret;
- if (!(cfg = kmalloc(sizeof(*cfg), GFP_KERNEL)))
+ if (!(cfg = kmalloc_obj(*cfg)))
return -ENOMEM;
p = &list_last_entry(&ram->cfg, typeof(*cfg), head)->bios;
n = &cfg->bios;
@@ -1530,7 +1530,7 @@ gk104_ram_new_(const struct nvkm_ram_func *func, struct nvkm_fb *fb,
u8 ramcfg = nvbios_ramcfg_index(subdev);
u32 tmp;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp100.c
index 8987a21e81d1..980aa9f2a7a1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp100.c
@@ -91,7 +91,7 @@ gp100_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
{
struct nvkm_ram *ram;
- if (!(ram = *pram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = *pram = kzalloc_obj(*ram)))
return -ENOMEM;
return gf100_ram_ctor(&gp100_ram, fb, ram);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
index bbfde1cb3a17..3135b46cbfcd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c
@@ -942,7 +942,7 @@ gt215_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
struct gt215_ram *ram;
int ret, i;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/rammcp77.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/rammcp77.c
index 7de18e53ef45..56605cbf0130 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/rammcp77.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/rammcp77.c
@@ -66,7 +66,7 @@ mcp77_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
struct mcp77_ram *ram;
int ret;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
index 97b3a28ca5c0..53d37c9cc7ba 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv40.c
@@ -192,7 +192,7 @@ nv40_ram_new_(struct nvkm_fb *fb, enum nvkm_ram_type type, u64 size,
struct nvkm_ram **pram)
{
struct nv40_ram *ram;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
return nvkm_ram_ctor(&nv40_ram_func, fb, type, size, &ram->base);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
index 7b1eb44ff3da..be15519d0c96 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c
@@ -587,7 +587,7 @@ nv50_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
struct nv50_ram *ram;
int ret, i;
- if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
+ if (!(ram = kzalloc_obj(*ram)))
return -ENOMEM;
*pram = &ram->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fsp/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fsp/base.c
index e366a980baa9..b782fef91dca 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fsp/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fsp/base.c
@@ -55,7 +55,7 @@ nvkm_fsp_new_(const struct nvkm_fsp_func *func,
{
struct nvkm_fsp *fsp;
- fsp = *pfsp = kzalloc(sizeof(*fsp), GFP_KERNEL);
+ fsp = *pfsp = kzalloc_obj(*fsp);
if (!fsp)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c
index 375dfce09f84..c1318e92e1f4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c
@@ -45,7 +45,7 @@ nvkm_fuse_new_(const struct nvkm_fuse_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_fuse **pfuse)
{
struct nvkm_fuse *fuse;
- if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL)))
+ if (!(fuse = *pfuse = kzalloc_obj(*fuse)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_fuse, device, type, inst, &fuse->subdev);
fuse->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
index b2c34878a68f..7a90196d2d09 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
@@ -227,7 +227,7 @@ nvkm_gpio_new_(const struct nvkm_gpio_func *func, struct nvkm_device *device,
{
struct nvkm_gpio *gpio;
- if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL)))
+ if (!(gpio = *pgpio = kzalloc_obj(*gpio)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_gpio, device, type, inst, &gpio->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c
index 30cb843ba35c..9ba1316831e7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c
@@ -132,7 +132,7 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
{
struct nvkm_gsp *gsp;
- if (!(gsp = *pgsp = kzalloc(sizeof(*gsp), GFP_KERNEL)))
+ if (!(gsp = *pgsp = kzalloc_obj(*gsp)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_gsp, device, type, inst, &gsp->subdev);
@@ -148,7 +148,7 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
if (fwif->rm) {
nvkm_info(&gsp->subdev, "RM version: %s\n", fwif->ver);
- gsp->rm = kzalloc(sizeof(*gsp->rm), GFP_KERNEL);
+ gsp->rm = kzalloc_obj(*gsp->rm);
if (!gsp->rm)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
index 3b0e83b2f57f..2156cc414648 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
@@ -44,7 +44,7 @@ nvkm_rm_engine_obj_new(struct nvkm_gsp_object *chan, int chid, const struct nvkm
struct nvkm_rm_engine_obj *obj;
int ret;
- obj = kzalloc(sizeof(*obj), GFP_KERNEL);
+ obj = kzalloc_obj(*obj);
if (!obj)
return -ENOMEM;
@@ -106,7 +106,7 @@ nvkm_rm_engine_ctor(void *(*dtor)(struct nvkm_engine *), struct nvkm_rm *rm,
{
struct nvkm_engine_func *func;
- func = kzalloc(struct_size(func, sclass, nclass + 1), GFP_KERNEL);
+ func = kzalloc_flex(*func, sclass, nclass + 1);
if (!func)
return -ENOMEM;
@@ -130,7 +130,7 @@ nvkm_rm_engine_new_(struct nvkm_rm *rm, enum nvkm_subdev_type type, int inst, u3
struct nvkm_engine *engine;
int ret;
- engine = kzalloc(sizeof(*engine), GFP_KERNEL);
+ engine = kzalloc_obj(*engine);
if (!engine)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
index f40b8fcc2bcb..6cc65e19528d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
@@ -56,7 +56,7 @@ nvkm_rm_gr_new(struct nvkm_rm *rm)
struct nvkm_gr_func *func;
struct r535_gr *gr;
- func = kzalloc(struct_size(func, sclass, ARRAY_SIZE(classes) + 1), GFP_KERNEL);
+ func = kzalloc_flex(*func, sclass, ARRAY_SIZE(classes) + 1);
if (!func)
return -ENOMEM;
@@ -74,7 +74,7 @@ nvkm_rm_gr_new(struct nvkm_rm *rm)
func->sclass[i].ctor = nvkm_rm_gr_obj_ctor;
}
- gr = kzalloc(sizeof(*gr), GFP_KERNEL);
+ gr = kzalloc_obj(*gr);
if (!gr) {
kfree(func);
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c
index d9fbfc377864..e2a74973a1e8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c
@@ -17,7 +17,7 @@ nvkm_rm_nvdec_new(struct nvkm_rm *rm, int inst)
struct nvkm_nvdec *nvdec;
int ret;
- nvdec = kzalloc(sizeof(*nvdec), GFP_KERNEL);
+ nvdec = kzalloc_obj(*nvdec);
if (!nvdec)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c
index 6dfa7b789e07..0da6a3e0c8f9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c
@@ -17,7 +17,7 @@ nvkm_rm_nvenc_new(struct nvkm_rm *rm, int inst)
struct nvkm_nvenc *nvenc;
int ret;
- nvenc = kzalloc(sizeof(*nvenc), GFP_KERNEL);
+ nvenc = kzalloc_obj(*nvenc);
if (!nvenc)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c
index d06bf95b9a4a..fae08ac3b18c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c
@@ -169,7 +169,7 @@ r535_bar_new_(const struct nvkm_bar_func *hw, struct nvkm_device *device,
struct nvkm_bar *bar;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_bar_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c
index e962d0e8f837..700cea5def35 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c
@@ -184,7 +184,7 @@ fbsr_vram(struct fbsr *fbsr, const char *type, u64 addr, u64 size)
{
struct fbsr_item *item;
- if (!(item = kzalloc(sizeof(*item), GFP_KERNEL)))
+ if (!(item = kzalloc_obj(*item)))
return false;
item->type = type;
@@ -309,7 +309,7 @@ r535_instmem_new(const struct nvkm_instmem_func *hw,
struct nvkm_instmem_func *rm;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_instmem_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
index 4ed54b386a60..76ee938efea3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
@@ -591,7 +591,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device,
const struct nvkm_rm_gpu *gpu = device->gsp->rm->gpu;
struct nvkm_fifo_func *rm;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_fifo_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c
index ddb57d5e73d6..7fe488d4d5ff 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c
@@ -147,7 +147,7 @@ r535_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *chan, const struct nvkm
struct r535_gr_chan *grc;
int ret;
- if (!(grc = kzalloc(sizeof(*grc), GFP_KERNEL)))
+ if (!(grc = kzalloc_obj(*grc)))
return -ENOMEM;
nvkm_object_ctor(&r535_gr_chan, oclass, &grc->object);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
index a575a8dbf727..0121d5639471 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c
@@ -2003,7 +2003,7 @@ static void r535_gsp_retain_logging(struct nvkm_gsp *gsp)
goto exit;
}
- log = kzalloc(sizeof(*log), GFP_KERNEL);
+ log = kzalloc_obj(*log);
if (!log)
goto error;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c
index f25ea610cd99..1ff42f1a8486 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/vmm.c
@@ -171,7 +171,7 @@ r535_mmu_new(const struct nvkm_mmu_func *hw,
struct nvkm_mmu_func *rm;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_mmu_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
index 6c76e5e14b75..f01abe193e25 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
@@ -107,7 +107,7 @@ anx9805_bus_new(struct nvkm_i2c_pad *base, int id, u8 drive,
struct anx9805_bus *bus;
int ret;
- if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = kzalloc_obj(*bus)))
return -ENOMEM;
*pbus = &bus->base;
bus->pad = pad;
@@ -236,7 +236,7 @@ anx9805_aux_new(struct nvkm_i2c_pad *base, int id, u8 drive,
struct anx9805_aux *aux;
int ret;
- if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL)))
+ if (!(aux = kzalloc_obj(*aux)))
return -ENOMEM;
*pbus = &aux->base;
aux->pad = pad;
@@ -267,7 +267,7 @@ anx9805_pad_new(struct nvkm_i2c_bus *bus, int id, u8 addr,
{
struct anx9805_pad *pad;
- if (!(pad = kzalloc(sizeof(*pad), GFP_KERNEL)))
+ if (!(pad = kzalloc_obj(*pad)))
return -ENOMEM;
*ppad = &pad->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c
index fafc634acbf6..383af72f006e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxch.c
@@ -209,7 +209,7 @@ nvkm_i2c_aux_new_(const struct nvkm_i2c_aux_func *func,
struct nvkm_i2c_pad *pad, int id,
struct nvkm_i2c_aux **paux)
{
- if (!(*paux = kzalloc(sizeof(**paux), GFP_KERNEL)))
+ if (!(*paux = kzalloc_obj(**paux)))
return -ENOMEM;
return nvkm_i2c_aux_ctor(func, pad, id, *paux);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
index 854bb4b5fdb4..f41bd332064d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
@@ -171,7 +171,7 @@ g94_i2c_aux_new_(const struct nvkm_i2c_aux_func *func,
{
struct g94_i2c_aux *aux;
- if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL)))
+ if (!(aux = kzalloc_obj(*aux)))
return -ENOMEM;
*paux = &aux->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
index 3c5005e3b330..b8a16eddc553 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
@@ -177,7 +177,7 @@ gm200_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
{
struct gm200_i2c_aux *aux;
- if (!(aux = kzalloc(sizeof(*aux), GFP_KERNEL)))
+ if (!(aux = kzalloc_obj(*aux)))
return -ENOMEM;
*paux = &aux->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
index 454bb21815a2..bd256e99feed 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
@@ -266,7 +266,7 @@ nvkm_i2c_new_(const struct nvkm_i2c_func *func, struct nvkm_device *device,
u8 ver, hdr;
int ret, i, ids;
- if (!(i2c = *pi2c = kzalloc(sizeof(*i2c), GFP_KERNEL)))
+ if (!(i2c = *pi2c = kzalloc_obj(*i2c)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_i2c, device, type, inst, &i2c->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
index ed50cc3736b9..5129f692ae1c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c
@@ -232,7 +232,7 @@ nvkm_i2c_bus_ctor(const struct nvkm_i2c_bus_func *func,
if ( bus->func->drive_scl &&
!nvkm_boolopt(device->cfgopt, "NvI2C", internal)) {
- if (!(bit = kzalloc(sizeof(*bit), GFP_KERNEL)))
+ if (!(bit = kzalloc_obj(*bit)))
return -ENOMEM;
bit->udelay = 10;
bit->timeout = usecs_to_jiffies(2200);
@@ -258,7 +258,7 @@ nvkm_i2c_bus_new_(const struct nvkm_i2c_bus_func *func,
struct nvkm_i2c_pad *pad, int id,
struct nvkm_i2c_bus **pbus)
{
- if (!(*pbus = kzalloc(sizeof(**pbus), GFP_KERNEL)))
+ if (!(*pbus = kzalloc_obj(**pbus)))
return -ENOMEM;
return nvkm_i2c_bus_ctor(func, pad, id, *pbus);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
index 96bbdda0f439..a0fdc623d204 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busgf119.c
@@ -85,7 +85,7 @@ gf119_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 drive,
{
struct gf119_i2c_bus *bus;
- if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = kzalloc_obj(*bus)))
return -ENOMEM;
*pbus = &bus->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c
index a58db159231f..04e180257553 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv04.c
@@ -85,7 +85,7 @@ nv04_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 drive, u8 sense,
{
struct nv04_i2c_bus *bus;
- if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = kzalloc_obj(*bus)))
return -ENOMEM;
*pbus = &bus->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv4e.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv4e.c
index cdd73dcb1197..b9b08860939d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv4e.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv4e.c
@@ -76,7 +76,7 @@ nv4e_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 drive,
{
struct nv4e_i2c_bus *bus;
- if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = kzalloc_obj(*bus)))
return -ENOMEM;
*pbus = &bus->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv50.c
index 8db8399381ca..29db5cae8358 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/busnv50.c
@@ -102,7 +102,7 @@ nv50_i2c_bus_new(struct nvkm_i2c_pad *pad, int id, u8 drive,
return -ENODEV;
}
- if (!(bus = kzalloc(sizeof(*bus), GFP_KERNEL)))
+ if (!(bus = kzalloc_obj(*bus)))
return -ENOMEM;
*pbus = &bus->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c
index 2c5fcb9c504b..b4b9c24b7130 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c
@@ -109,7 +109,7 @@ int
nvkm_i2c_pad_new_(const struct nvkm_i2c_pad_func *func, struct nvkm_i2c *i2c,
int id, struct nvkm_i2c_pad **ppad)
{
- if (!(*ppad = kzalloc(sizeof(**ppad), GFP_KERNEL)))
+ if (!(*ppad = kzalloc_obj(**ppad)))
return -ENOMEM;
nvkm_i2c_pad_ctor(func, i2c, id, *ppad);
return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
index 8f0ccd3664eb..3ccdbbe2fad0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -188,7 +188,7 @@ nvkm_iccsense_create_sensor(struct nvkm_iccsense *iccsense, u8 id)
return NULL;
}
- sensor = kmalloc(sizeof(*sensor), GFP_KERNEL);
+ sensor = kmalloc_obj(*sensor);
if (!sensor)
return NULL;
@@ -279,7 +279,7 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
continue;
}
- rail = kmalloc(sizeof(*rail), GFP_KERNEL);
+ rail = kmalloc_obj(*rail);
if (!rail)
return -ENOMEM;
@@ -322,7 +322,7 @@ int
nvkm_iccsense_new_(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct nvkm_iccsense **iccsense)
{
- if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL)))
+ if (!(*iccsense = kzalloc_obj(**iccsense)))
return -ENOMEM;
INIT_LIST_HEAD(&(*iccsense)->sensors);
INIT_LIST_HEAD(&(*iccsense)->rails);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
index 201022ae9214..8f85fc88bdb6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/gk20a.c
@@ -387,7 +387,7 @@ gk20a_instobj_ctor_dma(struct gk20a_instmem *imem, u32 npages, u32 align,
struct nvkm_subdev *subdev = &imem->base.subdev;
struct device *dev = subdev->device->dev;
- if (!(node = kzalloc(sizeof(*node), GFP_KERNEL)))
+ if (!(node = kzalloc_obj(*node)))
return -ENOMEM;
*_node = &node->base;
@@ -577,7 +577,7 @@ gk20a_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int in
struct nvkm_device_tegra *tdev = device->func->tegra(device);
struct gk20a_instmem *imem;
- if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
+ if (!(imem = kzalloc_obj(*imem)))
return -ENOMEM;
nvkm_instmem_ctor(&gk20a_instmem, device, type, inst, &imem->base);
mutex_init(&imem->lock);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
index e5320ef849bf..c6859a775085 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv04.c
@@ -125,7 +125,7 @@ nv04_instobj_new(struct nvkm_instmem *base, u32 size, u32 align, bool zero,
struct nv04_instobj *iobj;
int ret;
- if (!(iobj = kzalloc(sizeof(*iobj), GFP_KERNEL)))
+ if (!(iobj = kzalloc_obj(*iobj)))
return -ENOMEM;
*pmemory = &iobj->base.memory;
@@ -267,7 +267,7 @@ nv04_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int ins
{
struct nv04_instmem *imem;
- if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
+ if (!(imem = kzalloc_obj(*imem)))
return -ENOMEM;
nvkm_instmem_ctor(&nv04_instmem, device, type, inst, &imem->base);
*pimem = &imem->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c
index 2544b9f0ec85..ee790d70a92b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv40.c
@@ -124,7 +124,7 @@ nv40_instobj_new(struct nvkm_instmem *base, u32 size, u32 align, bool zero,
struct nv40_instobj *iobj;
int ret;
- if (!(iobj = kzalloc(sizeof(*iobj), GFP_KERNEL)))
+ if (!(iobj = kzalloc_obj(*iobj)))
return -ENOMEM;
*pmemory = &iobj->base.memory;
@@ -240,7 +240,7 @@ nv40_instmem_new(struct nvkm_device *device, enum nvkm_subdev_type type, int ins
{
struct nv40_instmem *imem;
- if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
+ if (!(imem = kzalloc_obj(*imem)))
return -ENOMEM;
nvkm_instmem_ctor(&nv40_instmem, device, type, inst, &imem->base);
*pimem = &imem->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
index 4ca6fb30743d..6fbaa1e5876d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.c
@@ -360,7 +360,7 @@ nv50_instobj_wrap(struct nvkm_instmem *base,
struct nv50_instmem *imem = nv50_instmem(base);
struct nv50_instobj *iobj;
- if (!(iobj = kzalloc(sizeof(*iobj), GFP_KERNEL)))
+ if (!(iobj = kzalloc_obj(*iobj)))
return -ENOMEM;
*pmemory = &iobj->base.memory;
@@ -431,7 +431,7 @@ nv50_instmem_new_(const struct nvkm_instmem_func *func,
{
struct nv50_instmem *imem;
- if (!(imem = kzalloc(sizeof(*imem), GFP_KERNEL)))
+ if (!(imem = kzalloc_obj(*imem)))
return -ENOMEM;
nvkm_instmem_ctor(func, device, type, inst, &imem->base);
INIT_LIST_HEAD(&imem->lru);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
index f742a7b7b175..371892c9cf44 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
@@ -133,7 +133,7 @@ nvkm_ltc_new_(const struct nvkm_ltc_func *func, struct nvkm_device *device,
{
struct nvkm_ltc *ltc;
- if (!(ltc = *pltc = kzalloc(sizeof(*ltc), GFP_KERNEL)))
+ if (!(ltc = *pltc = kzalloc_obj(*ltc)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_ltc, device, type, inst, &ltc->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
index c85600ba69f9..5f85c806abd7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
@@ -130,7 +130,7 @@ nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device,
struct nvkm_mc *mc;
int ret;
- if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL)))
+ if (!(mc = *pmc = kzalloc_obj(*mc)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_mc, device, type, inst, &mc->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c
index b67ace7ae93c..df86214183cc 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c
@@ -68,13 +68,13 @@ nvkm_mmu_ptp_get(struct nvkm_mmu *mmu, u32 size, bool zero)
struct nvkm_mmu_ptp *ptp;
int slot;
- if (!(pt = kzalloc(sizeof(*pt), GFP_KERNEL)))
+ if (!(pt = kzalloc_obj(*pt)))
return NULL;
ptp = list_first_entry_or_null(&mmu->ptp.list, typeof(*ptp), head);
if (!ptp) {
/* Need to allocate a new parent to sub-allocate from. */
- if (!(ptp = kmalloc(sizeof(*ptp), GFP_KERNEL))) {
+ if (!(ptp = kmalloc_obj(*ptp))) {
kfree(pt);
return NULL;
}
@@ -126,7 +126,7 @@ nvkm_mmu_ptc_find(struct nvkm_mmu *mmu, u32 size)
return ptc;
}
- ptc = kmalloc(sizeof(*ptc), GFP_KERNEL);
+ ptc = kmalloc_obj(*ptc);
if (ptc) {
INIT_LIST_HEAD(&ptc->item);
ptc->size = size;
@@ -199,7 +199,7 @@ nvkm_mmu_ptc_get(struct nvkm_mmu *mmu, u32 size, u32 align, bool zero)
mutex_unlock(&mmu->ptc.mutex);
/* No such luck, we need to allocate. */
- if (!(pt = kmalloc(sizeof(*pt), GFP_KERNEL)))
+ if (!(pt = kmalloc_obj(*pt)))
return NULL;
pt->ptc = ptc;
pt->sub = false;
@@ -434,7 +434,7 @@ int
nvkm_mmu_new_(const struct nvkm_mmu_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_mmu **pmmu)
{
- if (!(*pmmu = kzalloc(sizeof(**pmmu), GFP_KERNEL)))
+ if (!(*pmmu = kzalloc_obj(**pmmu)))
return -ENOMEM;
nvkm_mmu_ctor(func, device, type, inst, *pmmu);
return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
index 92e363dbbc5a..81fecf852e98 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/mem.c
@@ -163,7 +163,7 @@ nvkm_mem_new_host(struct nvkm_mmu *mmu, int type, u8 page, u64 size,
if (page != PAGE_SHIFT)
return -EINVAL;
- if (!(mem = kzalloc(sizeof(*mem), GFP_KERNEL)))
+ if (!(mem = kzalloc_obj(*mem)))
return -ENOMEM;
mem->target = target;
mem->mmu = mmu;
@@ -191,9 +191,9 @@ nvkm_mem_new_host(struct nvkm_mmu *mmu, int type, u8 page, u64 size,
nvkm_memory_ctor(&nvkm_mem_dma, &mem->memory);
size = ALIGN(size, PAGE_SIZE) >> PAGE_SHIFT;
- if (!(mem->mem = kvmalloc_array(size, sizeof(*mem->mem), GFP_KERNEL)))
+ if (!(mem->mem = kvmalloc_objs(*mem->mem, size)))
return -ENOMEM;
- if (!(mem->dma = kvmalloc_array(size, sizeof(*mem->dma), GFP_KERNEL)))
+ if (!(mem->dma = kvmalloc_objs(*mem->dma, size)))
return -ENOMEM;
if (mmu->dma_bits > 32)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c
index e530bb8b3b17..456d7356b3e5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c
@@ -161,7 +161,7 @@ nvkm_umem_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
if (type >= mmu->type_nr)
return -EINVAL;
- if (!(umem = kzalloc(sizeof(*umem), GFP_KERNEL)))
+ if (!(umem = kzalloc_obj(*umem)))
return -ENOMEM;
nvkm_object_ctor(&nvkm_umem, oclass, &umem->object);
umem->mmu = mmu;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c
index 6870fda4b188..cc450e7bb3fd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c
@@ -172,7 +172,7 @@ nvkm_ummu_new(struct nvkm_device *device, const struct nvkm_oclass *oclass,
} else
return ret;
- if (!(ummu = kzalloc(sizeof(*ummu), GFP_KERNEL)))
+ if (!(ummu = kzalloc_obj(*ummu)))
return -ENOMEM;
nvkm_object_ctor(&nvkm_ummu, oclass, &ummu->object);
ummu->mmu = mmu;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
index cf490ff2b9f1..fefbe65af9f1 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/uvmm.c
@@ -551,7 +551,7 @@ nvkm_uvmm_new(const struct nvkm_oclass *oclass, void *argv, u32 argc,
} else
return ret;
- if (!(uvmm = kzalloc(sizeof(*uvmm), GFP_KERNEL)))
+ if (!(uvmm = kzalloc_obj(*uvmm)))
return -ENOMEM;
nvkm_object_ctor(&nvkm_uvmm, oclass, &uvmm->object);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
index f95c58b67633..958fd78080bd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
@@ -53,13 +53,13 @@ nvkm_vmm_pt_new(const struct nvkm_vmm_desc *desc, bool sparse,
}
}
- if (!(pgt = kzalloc(sizeof(*pgt) + lpte, GFP_KERNEL)))
+ if (!(pgt = kzalloc(sizeof(*pgt) + (sizeof(pgt->pte[0]) * lpte), GFP_KERNEL)))
return NULL;
pgt->page = page ? page->shift : 0;
pgt->sparse = sparse;
if (desc->type == PGD) {
- pgt->pde = kvcalloc(pten, sizeof(*pgt->pde), GFP_KERNEL);
+ pgt->pde = kvzalloc_objs(*pgt->pde, pten);
if (!pgt->pde) {
kfree(pgt);
return NULL;
@@ -208,7 +208,7 @@ nvkm_vmm_unref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
*/
for (lpti = ptei >> sptb; ptes; spti = 0, lpti++) {
const u32 pten = min(sptn - spti, ptes);
- pgt->pte[lpti] -= pten;
+ pgt->pte[lpti].s.sptes -= pten;
ptes -= pten;
}
@@ -218,9 +218,9 @@ nvkm_vmm_unref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
for (ptei = pteb = ptei >> sptb; ptei < lpti; pteb = ptei) {
/* Skip over any LPTEs that still have valid SPTEs. */
- if (pgt->pte[pteb] & NVKM_VMM_PTE_SPTES) {
+ if (pgt->pte[pteb].s.sptes) {
for (ptes = 1, ptei++; ptei < lpti; ptes++, ptei++) {
- if (!(pgt->pte[ptei] & NVKM_VMM_PTE_SPTES))
+ if (!(pgt->pte[ptei].s.sptes))
break;
}
continue;
@@ -232,24 +232,27 @@ nvkm_vmm_unref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
*
* Determine how many LPTEs need to transition state.
*/
- pgt->pte[ptei] &= ~NVKM_VMM_PTE_VALID;
+ pgt->pte[ptei].s.spte_valid = false;
for (ptes = 1, ptei++; ptei < lpti; ptes++, ptei++) {
- if (pgt->pte[ptei] & NVKM_VMM_PTE_SPTES)
+ if (pgt->pte[ptei].s.sptes)
break;
- pgt->pte[ptei] &= ~NVKM_VMM_PTE_VALID;
+ pgt->pte[ptei].s.spte_valid = false;
}
- if (pgt->pte[pteb] & NVKM_VMM_PTE_SPARSE) {
+ if (pgt->pte[pteb].s.sparse) {
TRA(it, "LPTE %05x: U -> S %d PTEs", pteb, ptes);
pair->func->sparse(vmm, pgt->pt[0], pteb, ptes);
- } else
- if (pair->func->invalid) {
- /* If the MMU supports it, restore the LPTE to the
- * INVALID state to tell the MMU there is no point
- * trying to fetch the corresponding SPTEs.
- */
- TRA(it, "LPTE %05x: U -> I %d PTEs", pteb, ptes);
- pair->func->invalid(vmm, pgt->pt[0], pteb, ptes);
+ } else if (!pgt->pte[pteb].s.lpte_valid) {
+ if (pair->func->invalid) {
+ /* If the MMU supports it, restore the LPTE to the
+ * INVALID state to tell the MMU there is no point
+ * trying to fetch the corresponding SPTEs.
+ */
+ TRA(it, "LPTE %05x: U -> I %d PTEs", pteb, ptes);
+ pair->func->invalid(vmm, pgt->pt[0], pteb, ptes);
+ }
+ } else {
+ TRA(it, "LPTE %05x: V %d PTEs", pteb, ptes);
}
}
}
@@ -280,6 +283,15 @@ nvkm_vmm_unref_ptes(struct nvkm_vmm_iter *it, bool pfn, u32 ptei, u32 ptes)
if (desc->type == SPT && (pgt->refs[0] || pgt->refs[1]))
nvkm_vmm_unref_sptes(it, pgt, desc, ptei, ptes);
+ if (desc->type == LPT && (pgt->refs[0] || pgt->refs[1])) {
+ for (u32 lpti = ptei; ptes; lpti++) {
+ pgt->pte[lpti].s.lptes--;
+ if (pgt->pte[lpti].s.lptes == 0)
+ pgt->pte[lpti].s.lpte_valid = false;
+ ptes--;
+ }
+ }
+
/* PT no longer needed? Destroy it. */
if (!pgt->refs[type]) {
it->lvl++;
@@ -307,7 +319,7 @@ nvkm_vmm_ref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
*/
for (lpti = ptei >> sptb; ptes; spti = 0, lpti++) {
const u32 pten = min(sptn - spti, ptes);
- pgt->pte[lpti] += pten;
+ pgt->pte[lpti].s.sptes += pten;
ptes -= pten;
}
@@ -317,9 +329,9 @@ nvkm_vmm_ref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
for (ptei = pteb = ptei >> sptb; ptei < lpti; pteb = ptei) {
/* Skip over any LPTEs that already have valid SPTEs. */
- if (pgt->pte[pteb] & NVKM_VMM_PTE_VALID) {
+ if (pgt->pte[pteb].s.spte_valid) {
for (ptes = 1, ptei++; ptei < lpti; ptes++, ptei++) {
- if (!(pgt->pte[ptei] & NVKM_VMM_PTE_VALID))
+ if (!pgt->pte[ptei].s.spte_valid)
break;
}
continue;
@@ -331,14 +343,16 @@ nvkm_vmm_ref_sptes(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgt,
*
* Determine how many LPTEs need to transition state.
*/
- pgt->pte[ptei] |= NVKM_VMM_PTE_VALID;
+ pgt->pte[ptei].s.spte_valid = true;
+ pgt->pte[ptei].s.lpte_valid = false;
for (ptes = 1, ptei++; ptei < lpti; ptes++, ptei++) {
- if (pgt->pte[ptei] & NVKM_VMM_PTE_VALID)
+ if (pgt->pte[ptei].s.spte_valid)
break;
- pgt->pte[ptei] |= NVKM_VMM_PTE_VALID;
+ pgt->pte[ptei].s.spte_valid = true;
+ pgt->pte[ptei].s.lpte_valid = false;
}
- if (pgt->pte[pteb] & NVKM_VMM_PTE_SPARSE) {
+ if (pgt->pte[pteb].s.sparse) {
const u32 spti = pteb * sptn;
const u32 sptc = ptes * sptn;
/* The entire LPTE is marked as sparse, we need
@@ -374,6 +388,15 @@ nvkm_vmm_ref_ptes(struct nvkm_vmm_iter *it, bool pfn, u32 ptei, u32 ptes)
if (desc->type == SPT)
nvkm_vmm_ref_sptes(it, pgt, desc, ptei, ptes);
+ if (desc->type == LPT) {
+ for (u32 lpti = ptei; ptes; lpti++) {
+ pgt->pte[lpti].s.spte_valid = false;
+ pgt->pte[lpti].s.lpte_valid = true;
+ pgt->pte[lpti].s.lptes++;
+ ptes--;
+ }
+ }
+
return true;
}
@@ -386,7 +409,8 @@ nvkm_vmm_sparse_ptes(const struct nvkm_vmm_desc *desc,
pgt->pde[ptei++] = NVKM_VMM_PDE_SPARSE;
} else
if (desc->type == LPT) {
- memset(&pgt->pte[ptei], NVKM_VMM_PTE_SPARSE, ptes);
+ union nvkm_pte_tracker sparse = { .s.sparse = 1 };
+ memset32(&pgt->pte[ptei].u, sparse.u, ptes);
}
}
@@ -398,7 +422,7 @@ nvkm_vmm_sparse_unref_ptes(struct nvkm_vmm_iter *it, bool pfn, u32 ptei, u32 pte
memset(&pt->pde[ptei], 0x00, sizeof(pt->pde[0]) * ptes);
else
if (it->desc->type == LPT)
- memset(&pt->pte[ptei], 0x00, sizeof(pt->pte[0]) * ptes);
+ memset32(&pt->pte[ptei].u, 0x00, ptes);
return nvkm_vmm_unref_ptes(it, pfn, ptei, ptes);
}
@@ -445,9 +469,9 @@ nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgd, u32 pdei)
* the SPTEs on some GPUs.
*/
for (ptei = pteb = 0; ptei < pten; pteb = ptei) {
- bool spte = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
+ bool spte = !!pgt->pte[ptei].s.sptes;
for (ptes = 1, ptei++; ptei < pten; ptes++, ptei++) {
- bool next = pgt->pte[ptei] & NVKM_VMM_PTE_SPTES;
+ bool next = !!pgt->pte[ptei].s.sptes;
if (spte != next)
break;
}
@@ -457,11 +481,11 @@ nvkm_vmm_ref_hwpt(struct nvkm_vmm_iter *it, struct nvkm_vmm_pt *pgd, u32 pdei)
desc->func->sparse(vmm, pt, pteb, ptes);
else
desc->func->invalid(vmm, pt, pteb, ptes);
- memset(&pgt->pte[pteb], 0x00, ptes);
+ memset32(&pgt->pte[pteb].u, 0x00, ptes);
} else {
desc->func->unmap(vmm, pt, pteb, ptes);
while (ptes--)
- pgt->pte[pteb++] |= NVKM_VMM_PTE_VALID;
+ pgt->pte[pteb++].s.spte_valid = true;
}
}
} else {
@@ -799,7 +823,7 @@ nvkm_vmm_ptes_get_map(struct nvkm_vmm *vmm, const struct nvkm_vmm_page *page,
struct nvkm_vma *
nvkm_vma_new(u64 addr, u64 size)
{
- struct nvkm_vma *vma = kzalloc(sizeof(*vma), GFP_KERNEL);
+ struct nvkm_vma *vma = kzalloc_obj(*vma);
if (vma) {
vma->addr = addr;
vma->size = size;
@@ -1202,7 +1226,7 @@ nvkm_vmm_new_(const struct nvkm_vmm_func *func, struct nvkm_mmu *mmu,
struct lock_class_key *key, const char *name,
struct nvkm_vmm **pvmm)
{
- if (!(*pvmm = kzalloc(sizeof(**pvmm), GFP_KERNEL)))
+ if (!(*pvmm = kzalloc_obj(**pvmm)))
return -ENOMEM;
return nvkm_vmm_ctor(func, mmu, hdr, managed, addr, size, key, name, *pvmm);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
index 4586a425dbe4..4ec0a3a21169 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.h
@@ -4,6 +4,17 @@
#include <core/memory.h>
enum nvkm_memory_target;
+union nvkm_pte_tracker {
+ u32 u;
+ struct {
+ u32 sparse:1;
+ u32 spte_valid:1;
+ u32 lpte_valid:1;
+ u32 lptes:13;
+ u32 sptes:16;
+ } s;
+};
+
struct nvkm_vmm_pt {
/* Some GPUs have a mapping level with a dual page tables to
* support large and small pages in the same address-range.
@@ -44,10 +55,7 @@ struct nvkm_vmm_pt {
*
* This information is used to manage LPTE state transitions.
*/
-#define NVKM_VMM_PTE_SPARSE 0x80
-#define NVKM_VMM_PTE_VALID 0x40
-#define NVKM_VMM_PTE_SPTES 0x3f
- u8 pte[];
+ union nvkm_pte_tracker pte[];
};
typedef void (*nvkm_vmm_pxe_func)(struct nvkm_vmm *,
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c
index ff08ad5005a9..5217ce64d005 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmmnv50.c
@@ -346,7 +346,7 @@ nv50_vmm_join(struct nvkm_vmm *vmm, struct nvkm_memory *inst)
u64 data;
u32 pdei;
- if (!(join = kmalloc(sizeof(*join), GFP_KERNEL)))
+ if (!(join = kmalloc_obj(*join)))
return -ENOMEM;
join->inst = inst;
list_add_tail(&join->head, &vmm->join);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
index c1acfe642da3..26ec50b66e66 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
@@ -238,7 +238,7 @@ nvkm_mxm_new_(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
u8 ver, len;
u16 data;
- if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL)))
+ if (!(mxm = *pmxm = kzalloc_obj(*mxm)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_mxm, device, type, inst, &mxm->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
index 0f3e0d324a52..bd421d5b1faf 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
@@ -162,7 +162,7 @@ nvkm_pci_new_(const struct nvkm_pci_func *func, struct nvkm_device *device,
{
struct nvkm_pci *pci;
- if (!(pci = *ppci = kzalloc(sizeof(**ppci), GFP_KERNEL)))
+ if (!(pci = *ppci = kzalloc_obj(**ppci)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_pci_func, device, type, inst, &pci->subdev);
pci->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
index 9e9004ec4588..e556b1905702 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
@@ -161,7 +161,7 @@ nvkm_pmu_new_(const struct nvkm_pmu_fwif *fwif, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_pmu **ppmu)
{
struct nvkm_pmu *pmu;
- if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL)))
+ if (!(pmu = *ppmu = kzalloc_obj(*pmu)))
return -ENOMEM;
return nvkm_pmu_ctor(fwif, device, type, inst, *ppmu);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
index b5e52b35f5d0..9831d849e4d7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
@@ -215,7 +215,7 @@ gk20a_pmu_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
struct gk20a_pmu *pmu;
int ret;
- if (!(pmu = kzalloc(sizeof(*pmu), GFP_KERNEL)))
+ if (!(pmu = kzalloc_obj(*pmu)))
return -ENOMEM;
*ppmu = &pmu->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
index 22eaebefced3..cdbadb5b71d7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/memx.c
@@ -53,7 +53,7 @@ nvkm_memx_init(struct nvkm_pmu *pmu, struct nvkm_memx **pmemx)
if (ret)
return ret;
- memx = *pmemx = kzalloc(sizeof(*memx), GFP_KERNEL);
+ memx = *pmemx = kzalloc_obj(*memx);
if (!memx)
return -ENOMEM;
memx->pmu = pmu;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
index 1510aba33956..224222914f1c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
@@ -447,7 +447,7 @@ nvkm_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device,
{
struct nvkm_therm *therm;
- if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL)))
+ if (!(therm = *ptherm = kzalloc_obj(*therm)))
return -ENOMEM;
nvkm_therm_ctor(therm, device, type, inst, func);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c
index 8ae300f911b6..8970422c9eeb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fannil.c
@@ -40,7 +40,7 @@ nvkm_fannil_create(struct nvkm_therm *therm)
{
struct nvkm_fan *priv;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc_obj(*priv);
therm->fan = priv;
if (!priv)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c
index b13ba9b2f6be..7e61be4bcf88 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fanpwm.c
@@ -97,7 +97,7 @@ nvkm_fanpwm_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)
therm->func->pwm_get(therm, func->line, &divs, &duty) == -ENODEV)
return -ENODEV;
- fan = kzalloc(sizeof(*fan), GFP_KERNEL);
+ fan = kzalloc_obj(*fan);
if (!fan)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c
index bfdf4ca5625c..4b8e2c3bef59 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fantog.c
@@ -99,7 +99,7 @@ nvkm_fantog_create(struct nvkm_therm *therm, struct dcb_gpio_func *func)
return ret;
}
- fan = kzalloc(sizeof(*fan), GFP_KERNEL);
+ fan = kzalloc_obj(*fan);
if (!fan)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c
index 45e295c271fb..b816fd304238 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/gk104.c
@@ -112,7 +112,7 @@ gk104_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device,
const struct gf100_idle_filter *idle_filter,
struct nvkm_therm **ptherm)
{
- struct gk104_therm *therm = kzalloc(sizeof(*therm), GFP_KERNEL);
+ struct gk104_therm *therm = kzalloc_obj(*therm);
if (!therm)
return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c
index ddb2b2c600ca..b828dec2e3e7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c
@@ -119,7 +119,7 @@ nvkm_therm_sensor_event(struct nvkm_therm *therm, enum nvkm_therm_thrs thrs,
if (active) {
struct work_struct *work;
- work = kmalloc(sizeof(*work), GFP_ATOMIC);
+ work = kmalloc_obj(*work, GFP_ATOMIC);
if (work) {
INIT_WORK(work, nv_poweroff_work);
schedule_work(work);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
index a5c3c282b5d0..e971b6643483 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
@@ -187,7 +187,7 @@ nvkm_timer_new_(const struct nvkm_timer_func *func, struct nvkm_device *device,
{
struct nvkm_timer *tmr;
- if (!(tmr = *ptmr = kzalloc(sizeof(*tmr), GFP_KERNEL)))
+ if (!(tmr = *ptmr = kzalloc_obj(*tmr)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_timer, device, type, inst, &tmr->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c
index eb348dfc1d7a..c987c4abe15c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c
@@ -26,7 +26,7 @@
struct nvkm_top_device *
nvkm_top_device_new(struct nvkm_top *top)
{
- struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL);
+ struct nvkm_top_device *info = kmalloc_obj(*info);
if (info) {
info->type = NVKM_SUBDEV_NR;
info->inst = -1;
@@ -152,7 +152,7 @@ nvkm_top_new_(const struct nvkm_top_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_top **ptop)
{
struct nvkm_top *top;
- if (!(top = *ptop = kzalloc(sizeof(*top), GFP_KERNEL)))
+ if (!(top = *ptop = kzalloc_obj(*top)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_top, device, type, inst, &top->subdev);
top->func = func;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c
index 62e81d551f44..c0258bcfe8f5 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c
@@ -39,7 +39,7 @@ nvkm_vfn_new_(const struct nvkm_vfn_func *func, struct nvkm_device *device,
struct nvkm_vfn *vfn;
int ret;
- if (!(vfn = *pvfn = kzalloc(sizeof(*vfn), GFP_KERNEL)))
+ if (!(vfn = *pvfn = kzalloc_obj(*vfn)))
return -ENOMEM;
nvkm_subdev_ctor(&nvkm_vfn, device, type, inst, &vfn->subdev);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c
index d294844d9eae..36709c0e3bb4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/r535.c
@@ -38,7 +38,7 @@ r535_vfn_new(const struct nvkm_vfn_func *hw,
struct nvkm_vfn_func *rm;
int ret;
- if (!(rm = kzalloc(sizeof(*rm), GFP_KERNEL)))
+ if (!(rm = kzalloc_obj(*rm)))
return -ENOMEM;
rm->dtor = r535_vfn_dtor;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c
index 4e64d8843373..0004cf642ec6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/uvfn.c
@@ -56,7 +56,7 @@ nvkm_uvfn_new(struct nvkm_device *device, const struct nvkm_oclass *oclass,
if (argc != 0)
return -ENOSYS;
- if (!(uvfn = kzalloc(sizeof(*uvfn), GFP_KERNEL)))
+ if (!(uvfn = kzalloc_obj(*uvfn)))
return -ENOMEM;
nvkm_object_ctor(&nvkm_uvfn, oclass, &uvfn->object);
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c
index 803b98df4858..f0c66f9b4b1f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c
@@ -321,7 +321,7 @@ int
nvkm_volt_new_(const struct nvkm_volt_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_volt **pvolt)
{
- if (!(*pvolt = kzalloc(sizeof(**pvolt), GFP_KERNEL)))
+ if (!(*pvolt = kzalloc_obj(**pvolt)))
return -ENOMEM;
nvkm_volt_ctor(func, device, type, inst, *pvolt);
return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c
index d1ce4309cfb8..7bc264fb753b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c
@@ -113,7 +113,7 @@ gk104_volt_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
volt_func = &gk104_volt_pwm;
}
- if (!(volt = kzalloc(sizeof(*volt), GFP_KERNEL)))
+ if (!(volt = kzalloc_obj(*volt)))
return -ENOMEM;
nvkm_volt_ctor(volt_func, device, type, inst, &volt->base);
*pvolt = &volt->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
index ccac88da8864..5aef95c9f20f 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c
@@ -176,7 +176,7 @@ gk20a_volt_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
{
struct gk20a_volt *volt;
- volt = kzalloc(sizeof(*volt), GFP_KERNEL);
+ volt = kzalloc_obj(*volt);
if (!volt)
return -ENOMEM;
*pvolt = &volt->base;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c
index c2e9694d333f..5a2a909b57eb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gm20b.c
@@ -77,7 +77,7 @@ gm20b_volt_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
return -EINVAL;
}
- volt = kzalloc(sizeof(*volt), GFP_KERNEL);
+ volt = kzalloc_obj(*volt);
if (!volt)
return -ENOMEM;
*pvolt = &volt->base;