modeset: fix flags overwrite in nvRmMuxPre/nvRmMuxPost - #1312
Draft
rootkiller6788 wants to merge 1 commit into
Draft
modeset: fix flags overwrite in nvRmMuxPre/nvRmMuxPost#1312rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
nvRmMuxPre() and nvRmMuxPost() initialize params.flags with DRF_DEF(0073_CTRL_DFP, _DISP_MUX_FLAGS, _SR_ENTER_SKIP, _NO) and then unconditionally overwrite the whole flags word with '=' when selecting the mux switch type. The initial SR_ENTER_SKIP field is therefore dead code: the driver can never request SR_ENTER_SKIP_YES, so RM always performs the PSR-enter sequence during pre-mux operations even on platforms that refuse it (NV_ERR_NOT_SUPPORTED). nvRmMuxPost() also initializes the skip field with the _SR_ENTER_SKIP macro, but the POST command defines the field as _SR_EXIT_SKIP. Both fields share bit 1:1 so the compiled value is identical, but the name does not match the command being issued. OR the switch type into the flags already set, and use the correct _SR_EXIT_SKIP field in nvRmMuxPost(). No functional change: the flag values are unchanged (SR_ENTER_SKIP_NO / SR_EXIT_SKIP_NO are 0 and the switch type values are the same). Issue: NVIDIA#1311
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the latent flags bug described in issue #1311.
In
nvRmMuxPre()andnvRmMuxPost()(src/nvidia-modeset/src/nvkms-rm.c),params.flagsis initialized withDRF_DEF(0073_CTRL_DFP, _DISP_MUX_FLAGS, _SR_ENTER_SKIP, _NO)and then overwritten (not OR-ed) with the switch-type value when a mux state is selected:Because the second assignment replaces the whole
flagsword, the initial_SR_ENTER_SKIPfield is dead code and the driver can never requestNV0073_CTRL_DFP_DISP_MUX_FLAGS_SR_ENTER_SKIP_YES. Per the RM documentation inctrl0073dfp.h, RM performs the PSR-enter sequence during pre-mux operations unless that bit is set — so on platforms where PSR-enter is unsupported, the entire pre-mux operation fails withNV_ERR_NOT_SUPPORTED(issue #1311 reporter hit exactly this).Additionally,
nvRmMuxPost()initializes the skip field with the_SR_ENTER_SKIPmacro, but the POST command defines the field as_SR_EXIT_SKIP(bit 1:1 in both cases, so the compiled value is unchanged).Changes
nvRmMuxPre(): OR the switch type intoparams.flagsinstead of overwriting it (=→|=).nvRmMuxPost(): same=→|=fix, and use the correct_SR_EXIT_SKIPfield in the initialDRF_DEF.Verification
ctrl0073dfp.h:SWITCH_TYPEis bit 0:0 (IGPU_TO_DGPU=0x0,DGPU_TO_IGPU=0x1),SR_ENTER_SKIP/SR_EXIT_SKIPare bit 1:1 (_NO=0x0,_YES=0x1).DRF_DEF(...)expands to(value << DRF_SHIFT(field)); with_NOit yields 0, so with|=the resultingparams.flagsvalues are byte-identical to before (0x0 for iGPU→dGPU, 0x1 for dGPU→iGPU). No functional change for existing callers — the fix makes the intended flag composition actually reach the RM command and uses the correct field name for the POST command.No open PR covers this change.