Re: [Nouveau] [PATCH 2/2] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state
Hi Lyude, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.3-rc5 next-20230406] [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/Lyude-Paul/drm-nouveau-kms-Add-INHERIT-ioctl-to-nvkm-nvif-for-reading-IOR-state/20230408-062329 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230407222133.1425969-2-lyude%40redhat.com patch subject: [PATCH 2/2] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state config: arm64-buildonly-randconfig-r001-20230403 (https://download.01.org/0day-ci/archive/20230408/202304081129.amxcmyn2-...@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 2c57868e2e877f73c339796c3374ae660bb77f0d) 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 # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/a3d963915cf6f2d87b57146f7bc57a6a89d90cf6 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Lyude-Paul/drm-nouveau-kms-Add-INHERIT-ioctl-to-nvkm-nvif-for-reading-IOR-state/20230408-062329 git checkout a3d963915cf6f2d87b57146f7bc57a6a89d90cf6 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-kbuild-all/202304081129.amxcmyn2-...@intel.com/ All warnings (new ones prefixed by >>): >> drivers/gpu/drm/nouveau/dispnv50/disp.c:2554:1: warning: no previous >> prototype for function 'nv50_display_read_hw_state' [-Wmissing-prototypes] nv50_display_read_hw_state(struct nouveau_drm *drm) ^ drivers/gpu/drm/nouveau/dispnv50/disp.c:2553:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void ^ static drivers/gpu/drm/nouveau/dispnv50/disp.c:2618:1: warning: no previous prototype for function 'nv50_display_create' [-Wmissing-prototypes] nv50_display_create(struct drm_device *dev) ^ drivers/gpu/drm/nouveau/dispnv50/disp.c:2617:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int ^ static 2 warnings generated. vim +/nv50_display_read_hw_state +2554 drivers/gpu/drm/nouveau/dispnv50/disp.c 2551 2552 /* Read back the currently programmed display state */ 2553 void > 2554 nv50_display_read_hw_state(struct nouveau_drm *drm) 2555 { 2556 struct drm_device *dev = drm->dev; 2557 struct drm_encoder *encoder; 2558 struct drm_modeset_acquire_ctx ctx; 2559 struct nv50_disp *disp = nv50_disp(dev); 2560 int ret; 2561 2562 DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); 2563 2564 drm_for_each_encoder(encoder, dev) { 2565 if (encoder->encoder_type == DRM_MODE_ENCODER_DPMST) 2566 continue; 2567 2568 nv50_display_read_hw_or_state(dev, disp, nouveau_encoder(encoder)); 2569 } 2570 2571 DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); 2572 } 2573 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Re: [Nouveau] [PATCH 2/2] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state
Hi Lyude, kernel test robot noticed the following build warnings: [auto build test WARNING on drm-misc/drm-misc-next] [also build test WARNING on drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.3-rc5 next-20230406] [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/Lyude-Paul/drm-nouveau-kms-Add-INHERIT-ioctl-to-nvkm-nvif-for-reading-IOR-state/20230408-062329 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230407222133.1425969-2-lyude%40redhat.com patch subject: [PATCH 2/2] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230408/202304080927.xi7meodx-...@intel.com/config) compiler: sparc64-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/a3d963915cf6f2d87b57146f7bc57a6a89d90cf6 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Lyude-Paul/drm-nouveau-kms-Add-INHERIT-ioctl-to-nvkm-nvif-for-reading-IOR-state/20230408-062329 git checkout a3d963915cf6f2d87b57146f7bc57a6a89d90cf6 # 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=sparc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/gpu/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-kbuild-all/202304080927.xi7meodx-...@intel.com/ All warnings (new ones prefixed by >>): >> drivers/gpu/drm/nouveau/dispnv50/disp.c:2554:1: warning: no previous >> prototype for 'nv50_display_read_hw_state' [-Wmissing-prototypes] 2554 | nv50_display_read_hw_state(struct nouveau_drm *drm) | ^~ drivers/gpu/drm/nouveau/dispnv50/disp.c:2618:1: warning: no previous prototype for 'nv50_display_create' [-Wmissing-prototypes] 2618 | nv50_display_create(struct drm_device *dev) | ^~~ vim +/nv50_display_read_hw_state +2554 drivers/gpu/drm/nouveau/dispnv50/disp.c 2551 2552 /* Read back the currently programmed display state */ 2553 void > 2554 nv50_display_read_hw_state(struct nouveau_drm *drm) 2555 { 2556 struct drm_device *dev = drm->dev; 2557 struct drm_encoder *encoder; 2558 struct drm_modeset_acquire_ctx ctx; 2559 struct nv50_disp *disp = nv50_disp(dev); 2560 int ret; 2561 2562 DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); 2563 2564 drm_for_each_encoder(encoder, dev) { 2565 if (encoder->encoder_type == DRM_MODE_ENCODER_DPMST) 2566 continue; 2567 2568 nv50_display_read_hw_or_state(dev, disp, nouveau_encoder(encoder)); 2569 } 2570 2571 DRM_MODESET_LOCK_ALL_END(dev, ctx, ret); 2572 } 2573 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Re: [Nouveau] [PATCH] drm/nouveau/fb: add missing sysmen flush callbacks
Reviewed-by: Lyude Paul On Wed, 2023-04-05 at 13:04 +0200, Karol Herbst wrote: > Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/203 > Fixes: 5728d064190e1 ("drm/nouveau/fb: handle sysmem flush page from common > code") > Signed-off-by: Karol Herbst > --- > drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf108.c | 1 + > drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c | 1 + > drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk110.c | 1 + > drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c | 1 + > 4 files changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf108.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf108.c > index 76678dd60f93f..c4c6f67af7ccc 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf108.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf108.c > @@ -31,6 +31,7 @@ gf108_fb = { > .init = gf100_fb_init, > .init_page = gf100_fb_init_page, > .intr = gf100_fb_intr, > + .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, > .ram_new = gf108_ram_new, > .default_bigpage = 17, > }; > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c > index f73442ccb424b..433fa966ba231 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c > @@ -77,6 +77,7 @@ gk104_fb = { > .init = gf100_fb_init, > .init_page = gf100_fb_init_page, > .intr = gf100_fb_intr, > + .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, > .ram_new = gk104_ram_new, > .default_bigpage = 17, > .clkgate_pack = gk104_fb_clkgate_pack, > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk110.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk110.c > index 45d6cdffafeed..4dc283dedf8b5 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk110.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk110.c > @@ -59,6 +59,7 @@ gk110_fb = { > .init = gf100_fb_init, > .init_page = gf100_fb_init_page, > .intr = gf100_fb_intr, > + .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, > .ram_new = gk104_ram_new, > .default_bigpage = 17, > .clkgate_pack = gk110_fb_clkgate_pack, > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c > index de52462a92bf0..90bfff616d35b 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c > @@ -31,6 +31,7 @@ gm107_fb = { > .init = gf100_fb_init, > .init_page = gf100_fb_init_page, > .intr = gf100_fb_intr, > + .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, > .ram_new = gm107_ram_new, > .default_bigpage = 17, > }; -- Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
[Nouveau] [PATCH 2/2] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state
Now that we're supporting things like Ada and the GSP, there's situations where we really need to actually know the display state that we're starting with when loading the driver in order to prevent breaking GSP expectations. The first step in doing this is making it so that we can read the current state of IORs from nvkm in DRM, so that we can fill in said into into the atomic state. We do this by introducing an INHERIT ioctl to nvkm/nvif. This is basically another form of ACQUIRE, except that it will only acquire the given output path for userspace if it's already set up in hardware. This way, we can go through and probe each outp object we have in DRM in order to figure out the current hardware state of each one. If the outp isn't in use, it simply returns -ENODEV. This is also part of the work that will be required for implementing GSP support for display. While the GSP should mostly work without this commit, this commit should fix some edge case bugs that can occur on initial driver load. This also paves the way for some of the initial groundwork for fastboot support. Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 103 +- drivers/gpu/drm/nouveau/include/nvif/if0012.h | 18 +++ drivers/gpu/drm/nouveau/include/nvif/outp.h | 5 + drivers/gpu/drm/nouveau/nvif/outp.c | 68 .../gpu/drm/nouveau/nvkm/engine/disp/outp.c | 40 +-- .../gpu/drm/nouveau/nvkm/engine/disp/outp.h | 3 + .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 64 +++ 7 files changed, 288 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index ed9d374147b8..1c2dfae75c76 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -1711,7 +1711,8 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe) drm_connector_attach_encoder(connector, encoder); - disp->core->func->sor->get_caps(disp, nv_encoder, ffs(dcbe->or) - 1); + nv_encoder->or = ffs(dcbe->or) - 1; + disp->core->func->sor->get_caps(disp, nv_encoder, nv_encoder->or); nv50_outp_dump_caps(drm, nv_encoder); if (dcbe->type == DCB_OUTPUT_DP) { @@ -2473,6 +2474,103 @@ nv50_display_fini(struct drm_device *dev, bool runtime, bool suspend) cancel_work_sync(>hpd_work); } +static inline void +nv50_display_read_hw_or_state(struct drm_device *dev, struct nv50_disp *disp, + struct nouveau_encoder *outp) +{ + struct drm_crtc *crtc; + struct drm_connector_list_iter conn_iter; + struct drm_connector *conn; + struct nv50_head_atom *armh; + const u32 encoder_mask = drm_encoder_mask(>base.base); + bool found_conn = false, found_head = false; + u8 proto; + int head_idx; + int ret; + + switch (outp->dcb->type) { + case DCB_OUTPUT_TMDS: + ret = nvif_outp_inherit_tmds(>outp, ); + break; + case DCB_OUTPUT_DP: + ret = nvif_outp_inherit_dp(>outp, ); + break; + case DCB_OUTPUT_LVDS: + ret = nvif_outp_inherit_lvds(>outp, ); + break; + case DCB_OUTPUT_ANALOG: + ret = nvif_outp_inherit_rgb_crt(>outp, ); + break; + default: + drm_dbg_kms(dev, "Readback for %s not implemented yet, skipping\n", + outp->base.base.name); + drm_WARN_ON(dev, true); + return; + } + if (ret >= 0) { + head_idx = ret; + ret = 0; + } else if (ret == -ENODEV) { + return; + } + + drm_for_each_crtc(crtc, dev) { + if (crtc->index != head_idx) + continue; + + armh = nv50_head_atom(crtc->state); + found_head = true; + break; + } + if (drm_WARN_ON(dev, !found_head)) + return; + + /* Figure out which connector is being used by this encoder */ + drm_connector_list_iter_begin(dev, _iter); + nouveau_for_each_non_mst_connector_iter(conn, _iter) { + if (nouveau_connector(conn)->index == outp->dcb->connector) { + found_conn = true; + break; + } + } + drm_connector_list_iter_end(_iter); + if (drm_WARN_ON(dev, !found_conn)) + return; + + armh->state.encoder_mask = encoder_mask; + armh->state.connector_mask = drm_connector_mask(conn); + armh->state.active = true; + armh->state.enable = true; + + outp->crtc = crtc; + outp->ctrl = NVVAL(NV507D, SOR_SET_CONTROL, PROTOCOL, proto) | BIT(crtc->index); + + conn->state->crtc = crtc; + conn->state->best_encoder = >base.base; +} + +/* Read back the currently programmed display state
[Nouveau] [PATCH 1/2] drm/nouveau/nvkm/outp: Use WARN_ON() in conditionals in nvkm_outp_init_route()
Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c index 6094805fbd63..06b19883a06b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c @@ -229,10 +229,8 @@ nvkm_outp_init_route(struct nvkm_outp *outp) return; ior = nvkm_ior_find(disp, type, -1); - if (!ior) { - WARN_ON(1); + if (WARN_ON(!ior)) return; - } /* Determine the specific OR, if any, this device is attached to. */ if (ior->func->route.get) { @@ -248,10 +246,8 @@ nvkm_outp_init_route(struct nvkm_outp *outp) } ior = nvkm_ior_find(disp, type, id); - if (!ior) { - WARN_ON(1); + if (WARN_ON(!ior)) return; - } /* Determine if the OR is already configured for this device. */ ior->func->state(ior, >arm); -- 2.39.2
Re: [Nouveau] [PATCH] drm/nouveau/acr: remove unused loc variable
On Fri, Mar 31, 2023 at 1:42 PM Tom Rix wrote: > > clang with W=1 reports > drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c:221:7: error: variable > 'loc' set but not used [-Werror,-Wunused-but-set-variable] > u32 loc, sig, cnt, *meta; > ^ > This variable is not used so remove it. > > Signed-off-by: Tom Rix Ben, any idea if this was supposed to be used somewhere? If not: Fixes: 4b569ded09fd ("drm/nouveau/acr/ga102: initial support") Reviewed-by: Nick Desaulniers > --- > drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c > index f36a359d4531..bd104a030243 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/lsfw.c > @@ -218,7 +218,7 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev > *subdev, > const struct firmware *hsbl; > const struct nvfw_ls_hsbl_bin_hdr *hdr; > const struct nvfw_ls_hsbl_hdr *hshdr; > - u32 loc, sig, cnt, *meta; > + u32 sig, cnt, *meta; > > ret = nvkm_firmware_load_name(subdev, path, "hs_bl_sig", ver, > ); > if (ret) > @@ -227,7 +227,6 @@ nvkm_acr_lsfw_load_sig_image_desc_v2(struct nvkm_subdev > *subdev, > hdr = nvfw_ls_hsbl_bin_hdr(subdev, hsbl->data); > hshdr = nvfw_ls_hsbl_hdr(subdev, hsbl->data + > hdr->header_offset); > meta = (u32 *)(hsbl->data + hshdr->meta_data_offset); > - loc = *(u32 *)(hsbl->data + hshdr->patch_loc); > sig = *(u32 *)(hsbl->data + hshdr->patch_sig); > cnt = *(u32 *)(hsbl->data + hshdr->num_sig); > > -- > 2.27.0 > -- Thanks, ~Nick Desaulniers
Re: [Nouveau] [PATCH] drm/nouveau/svm: remove unused ret variable
On Wed, Mar 29, 2023 at 4:14 PM Tom Rix wrote: > > clang with W=1 reports > drivers/gpu/drm/nouveau/nouveau_svm.c:929:6: error: variable > 'ret' set but not used [-Werror,-Wunused-but-set-variable] > int ret; > ^ > This variable is not used so remove it. > > Signed-off-by: Tom Rix > --- > drivers/gpu/drm/nouveau/nouveau_svm.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c > b/drivers/gpu/drm/nouveau/nouveau_svm.c > index a74ba8d84ba7..e072d610f2f9 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -926,15 +926,14 @@ nouveau_pfns_map(struct nouveau_svmm *svmm, struct > mm_struct *mm, > unsigned long addr, u64 *pfns, unsigned long npages) > { > struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); > - int ret; > > args->p.addr = addr; > args->p.size = npages << PAGE_SHIFT; > > mutex_lock(>mutex); > > - ret = nvif_object_ioctl(>vmm->vmm.object, args, > - struct_size(args, p.phys, npages), NULL); > + nvif_object_ioctl(>vmm->vmm.object, args, > + struct_size(args, p.phys, npages), NULL); nvif_object_ioctl() may return -ENOSYS. Seeing other call sites have comments like: 114 /*XXX: warn? */ 134 /*XXX: warn? */ or other places where the return code isn't checked makes me think that a better approach would be to 1. plumb error codes back up through nouveau_pfns_map() (and other call sites of nvif_object_ioctl) 2. consider making nvif_object_ioctl __must_check > > mutex_unlock(>mutex); > } > -- > 2.27.0 > -- Thanks, ~Nick Desaulniers