mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sui jingfeng <suijingfeng@loongson.cn>
To: kernel test robot <lkp@intel.com>,
	suijingfeng <15330273260@189.cn>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>
Cc: oe-kbuild-all@lists.linux.dev, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Li Yi <liyi@loongson.cn>
Subject: Re: [PATCH v6 1/2] drm: add kms driver for loongson display controller
Date: Wed, 1 Mar 2023 22:43:29 +0800	[thread overview]
Message-ID: <cfd87ccf-bf75-2ce5-7393-920a643c0747@loongson.cn> (raw)
In-Reply-To: <202303012148.S6ymQNI9-lkp@intel.com>


On 2023/3/1 21:30, kernel test robot wrote:
> Hi suijingfeng,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on drm-misc/drm-misc-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/suijingfeng/MAINTAINERS-add-maintainers-for-DRM-LOONGSON-driver/20230301-153240
> base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
> patch link:    https://lore.kernel.org/r/20230301072306.572685-1-15330273260%40189.cn
> patch subject: [PATCH v6 1/2] drm: add kms driver for loongson display controller
> config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230301/202303012148.S6ymQNI9-lkp@intel.com/config)
> compiler: mips-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/125bbfe8c188e62159ecd4d143246d36b1801f79
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review suijingfeng/MAINTAINERS-add-maintainers-for-DRM-LOONGSON-driver/20230301-153240
>          git checkout 125bbfe8c188e62159ecd4d143246d36b1801f79
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/loongson/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303012148.S6ymQNI9-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>     drivers/gpu/drm/loongson/lsdc_plane.c: In function 'lsdc_update_primary_plane':
>>> drivers/gpu/drm/loongson/lsdc_plane.c:95:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>        95 |         if (IS_ERR((void *)bo_offset)) {
>           |                    ^

Loongson 3a4000 is a 64 bit cpu,  on 64 bit platform sizeof (void *) == 
sizeof (u64) = 8 bytes.


I complie drm-time  with following command:

1) on loongarch

|make -j$(nproc) ARCH=loongarch CROSS_COMPILE=loongarch64-linux-gnu- W=1|

2) On mips64el

|make -j$(nproc) ARCH=mips CROSS_COMPILE=mips64el-linux-gnuabi64- W=1|


It report no warnings. I think this test robot compile this driver with 
32 bit machine environment.


> --
>     In file included from include/linux/printk.h:566,
>                      from include/asm-generic/bug.h:22,
>                      from arch/mips/include/asm/bug.h:42,
>                      from include/linux/bug.h:5,
>                      from include/linux/thread_info.h:13,
>                      from include/asm-generic/preempt.h:5,
>                      from ./arch/mips/include/generated/asm/preempt.h:1,
>                      from include/linux/preempt.h:78,
>                      from include/linux/spinlock.h:56,
>                      from include/linux/kref.h:16,
>                      from include/drm/drm_device.h:5,
>                      from include/drm/drm_drv.h:35,
>                      from drivers/gpu/drm/loongson/lsdc_ttm.c:3:
>     drivers/gpu/drm/loongson/lsdc_ttm.c: In function 'lsdc_dumb_create':
>>> drivers/gpu/drm/loongson/lsdc_ttm.c:378:23: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
>       378 |         drm_dbg(ddev, "pitch: %lu, height: %u\n", pitch, args->height);
>           |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~
>           |                                                   |
>           |                                                   size_t {aka unsigned int}
>     include/linux/dynamic_debug.h:223:29: note: in definition of macro '__dynamic_func_call_cls'
>       223 |                 func(&id, ##__VA_ARGS__);                       \
>           |                             ^~~~~~~~~~~
>     include/drm/drm_print.h:413:9: note: in expansion of macro '_dynamic_func_call_cls'
>       413 |         _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg,         \
>           |         ^~~~~~~~~~~~~~~~~~~~~~
>     include/drm/drm_print.h:492:9: note: in expansion of macro 'drm_dev_dbg'
>       492 |         drm_dev_dbg((drm) ? (drm)->dev : NULL, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>           |         ^~~~~~~~~~~
>     include/drm/drm_print.h:510:33: note: in expansion of macro 'drm_dbg_driver'
>       510 | #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
>           |                                 ^~~~~~~~~~~~~~
>     drivers/gpu/drm/loongson/lsdc_ttm.c:378:9: note: in expansion of macro 'drm_dbg'
>       378 |         drm_dbg(ddev, "pitch: %lu, height: %u\n", pitch, args->height);
>           |         ^~~~~~~
>     drivers/gpu/drm/loongson/lsdc_ttm.c:378:33: note: format string is defined here
>       378 |         drm_dbg(ddev, "pitch: %lu, height: %u\n", pitch, args->height);
>           |                               ~~^
>           |                                 |
>           |                                 long unsigned int
>           |                               %u
>
here is the same reason, on 64 bit machine, sizeof (long unsigned int) 
== sizeof (size_t) == 8.

> vim +95 drivers/gpu/drm/loongson/lsdc_plane.c
>
>      77	
>      78	static void lsdc_update_primary_plane(struct drm_plane *plane,
>      79					      struct drm_atomic_state *state)
>      80	{
>      81		struct drm_device *ddev = plane->dev;
>      82		struct lsdc_device *ldev = to_lsdc(ddev);
>      83		struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane);
>      84		struct drm_crtc *crtc = new_plane_state->crtc;
>      85		struct drm_framebuffer *fb = new_plane_state->fb;
>      86		struct ttm_buffer_object *tbo = to_ttm_bo(fb->obj[0]);
>      87		unsigned int pipe = drm_crtc_index(crtc);
>      88		unsigned int fb_offset = lsdc_get_fb_offset(fb, new_plane_state, 0);
>      89		u64 bo_offset = lsdc_bo_gpu_offset(tbo);
>      90		u64 fb_addr = ldev->vram_base + bo_offset + fb_offset;
>      91		u32 stride = fb->pitches[0];
>      92		u32 cfg;
>      93		u32 lo, hi;
>      94	
>    > 95		if (IS_ERR((void *)bo_offset)) {
>      96			drm_warn(ddev, "bo not pinned, should not happen\n");
>      97			return;
>      98		}
>      99	
>     100		/* 40-bit width physical address bus */
>     101		lo = fb_addr & 0xFFFFFFFF;
>     102		hi = (fb_addr >> 32) & 0xFF;
>     103	
>     104		cfg = lsdc_crtc_rreg32(ldev, LSDC_CRTC0_CFG_REG, pipe);
>     105		if (cfg & CFG_FB_IN_USING) {
>     106			drm_dbg(ddev, "CRTC-%u(FB1) is in using\n", pipe);
>     107			lsdc_crtc_wreg32(ldev, LSDC_CRTC0_FB1_LO_ADDR_REG, pipe, lo);
>     108			lsdc_crtc_wreg32(ldev, LSDC_CRTC0_FB1_HI_ADDR_REG, pipe, hi);
>     109		} else {
>     110			drm_dbg(ddev, "CRTC-%u(FB0) is in using\n", pipe);
>     111			lsdc_crtc_wreg32(ldev, LSDC_CRTC0_FB0_LO_ADDR_REG, pipe, lo);
>     112			lsdc_crtc_wreg32(ldev, LSDC_CRTC0_FB0_HI_ADDR_REG, pipe, hi);
>     113		}
>     114	
>     115		drm_dbg(ddev, "CRTC-%u scanout from 0x%llx\n", pipe, fb_addr);
>     116	
>     117		lsdc_crtc_wreg32(ldev, LSDC_CRTC0_STRIDE_REG, pipe, stride);
>     118	
>     119		cfg &= ~CFG_PIX_FMT_MASK;
>     120		cfg |= LSDC_PF_XRGB8888;
>     121	
>     122		lsdc_crtc_wreg32(ldev, LSDC_CRTC0_CFG_REG, pipe, cfg);
>     123	}
>     124	
>
Ok, will fixed at next version.


      reply	other threads:[~2023-03-01 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  7:23 suijingfeng
2023-03-01  7:23 ` [PATCH v6 2/2] MAINTAINERS: add maintainers for DRM LOONGSON driver suijingfeng
2023-03-01 13:30 ` [PATCH v6 1/2] drm: add kms driver for loongson display controller kernel test robot
2023-03-01 14:43   ` Sui jingfeng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfd87ccf-bf75-2ce5-7393-920a643c0747@loongson.cn \
    --to=suijingfeng@loongson.cn \
    --cc=15330273260@189.cn \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyi@loongson.cn \
    --cc=lkp@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®