Skip to contentSkip to conversation

drm/nouveau/core: deinline nv_mask()

PATCH In review Denys Vlasenko 2 participants 2 messages May 7, 2015 – May 8, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau/core: deinline nv_mask()

Function compiles to 89 bytes of machine code.
466 callsites with this .config:
http://busybox.net/~vda/kernel_config
Size reduction:

text data bss dec hex filename
82432426 22255384 20627456 125315266 77828c2 vmlinux.before 82426986 22255416 20627456 125309858 77813a2 vmlinux

---
 drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 9 ++-------
 drivers/gpu/drm/nouveau/nvkm/core/subdev.c         | 8 ++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +2 -7
index 6fdc391..261b7ff 100644
@@ -109,11 +109,6 @@ nv_wr32(void *obj, u32 addr, u32 data)
 	iowrite32_native(data, subdev->mmio + addr);
 }
 
-static inline u32
-nv_mask(void *obj, u32 addr, u32 mask, u32 data)
-{
-	u32 temp = nv_rd32(obj, addr);
-	nv_wr32(obj, addr, (temp & ~mask) | data);
-	return temp;
-}
+u32
+nv_mask(void *obj, u32 addr, u32 mask, u32 data);
 #endif
drivers/gpu/drm/nouveau/nvkm/core/subdev.c +8 -0
index c5fb3a79..88331ea 100644
@@ -25,6 +25,14 @@
 #include <core/device.h>
 #include <core/option.h>
 
+u32
+nv_mask(void *obj, u32 addr, u32 mask, u32 data)
+{
+	u32 temp = nv_rd32(obj, addr);
+	nv_wr32(obj, addr, (temp & ~mask) | data);
+	return temp;
+}
+
 struct nvkm_subdev *
 nvkm_subdev(void *obj, int idx)
 {
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 4 lines · Denys Vlasenko

Function compiles to 89 bytes of machine code.
466 callsites with this .config:
http://busybox.net/~vda/kernel_config
Size reduction:

Much of the cruft is related to calling iowriteX.

Ben,

Isn't subdev io always mmio? (iow, never to the 64k i/o space)

Quoted 53 lines

text data bss dec hex filename
82432426 22255384 20627456 125315266 77828c2 vmlinux.before 82426986 22255416 20627456 125309858 77813a2 vmlinux

---
 drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | 9 ++-------
 drivers/gpu/drm/nouveau/nvkm/core/subdev.c         | 8 ++++++++
 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +2 -7
index 6fdc391..261b7ff 100644
@@ -109,11 +109,6 @@ nv_wr32(void *obj, u32 addr, u32 data)
 	iowrite32_native(data, subdev->mmio + addr);
 }
 
-static inline u32
-nv_mask(void *obj, u32 addr, u32 mask, u32 data)
-{
-	u32 temp = nv_rd32(obj, addr);
-	nv_wr32(obj, addr, (temp & ~mask) | data);
-	return temp;
-}
+u32
+nv_mask(void *obj, u32 addr, u32 mask, u32 data);
 #endif
drivers/gpu/drm/nouveau/nvkm/core/subdev.c +8 -0
index c5fb3a79..88331ea 100644
@@ -25,6 +25,14 @@
 #include <core/device.h>
 #include <core/option.h>
 
+u32
+nv_mask(void *obj, u32 addr, u32 mask, u32 data)
+{
+	u32 temp = nv_rd32(obj, addr);
+	nv_wr32(obj, addr, (temp & ~mask) | data);
+	return temp;
+}
+
 struct nvkm_subdev *
 nvkm_subdev(void *obj, int idx)
 {