[Nouveau] [PATCH 9/9] nouveau/svm: Implement atomic SVM access

2021-02-08 Thread Alistair Popple
Some NVIDIA GPUs do not support direct atomic access to system memory via PCIe. Instead this must be emulated by granting the GPU exclusive access to the memory. This is achieved by migrating the userspace mappings to device private pages whilst leaving the actual page in place. The driver then

[Nouveau] [PATCH 8/9] nouveau/dmem: Add support for multiple page types

2021-02-08 Thread Alistair Popple
Device private pages are used to track a per-page migrate_to_ram() callback which is called when the CPU attempts to access a GPU page from the CPU. Currently the same callback is used for all GPU pages tracked by Nouveau. However a future patch requires support for calling a different callback

[Nouveau] [PATCH 7/9] nouveau/svm: Refactor nouveau_range_fault

2021-02-08 Thread Alistair Popple
Call mmu_interval_notifier_insert() as part of nouveau_range_fault(). This doesn't introduce any functional change but makes it easier for a subsequent patch to alter the behaviour of nouveau_range_fault() to support GPU atomic operations. Signed-off-by: Alistair Popple ---

[Nouveau] [PATCH 6/9] nouveau/dmem: Only map migrating pages

2021-02-08 Thread Alistair Popple
Only pages which were actually migrated should be mapped on the GPU. migrate_vma_pages() clears MIGRATE_PFN_MIGRATE in the src_pfn array, so test this prior to mapping the pages on the GPU. If any pages failed to migrate don't install any mappings - the GPU will demand fault any as required.

[Nouveau] [PATCH 5/9] hmm-tests: Add test for unmap and pin

2021-02-08 Thread Alistair Popple
Adds a basic test of the HMM unmap and pin operation. Signed-off-by: Alistair Popple --- lib/test_hmm.c | 107 + lib/test_hmm_uapi.h| 1 + tools/testing/selftests/vm/hmm-tests.c | 49 +++ 3 files changed, 140

[Nouveau] [PATCH 4/9] Documentation: Add unmap and pin to HMM

2021-02-08 Thread Alistair Popple
Update the HMM documentation to include information on the unmap and pin operation. Signed-off-by: Alistair Popple --- Documentation/vm/hmm.rst | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Documentation/vm/hmm.rst b/Documentation/vm/hmm.rst index

[Nouveau] [PATCH 3/9] mm/migrate: Add a unmap and pin migration mode

2021-02-08 Thread Alistair Popple
Some drivers need to ensure that a device has access to a particular user page whilst preventing userspace access to that page. For example this is required to allow a driver to implement atomic access to a page when the device hardware does not support atomic access to system memory. This could

[Nouveau] [PATCH 1/9] mm/migrate.c: Always allow device private pages to migrate

2021-02-08 Thread Alistair Popple
Device private pages are used to represent device memory that is not directly accessible from the CPU. Extra references to a device private page are only used to ensure the struct page itself remains valid whilst waiting for migration entries. Therefore extra references should not prevent device

[Nouveau] [PATCH 2/9] mm/migrate.c: Allow pfn flags to be passed to migrate_vma_setup()

2021-02-08 Thread Alistair Popple
Currently migrate_vma_setup() zeros both src and dst pfn arrays. This means it is not possible to pass per-pfn flags to migrate_vma_setup(). A future patch introduces per-pfn flags for migrate_vma_setup(), so ensure existing callers will not be affected by having the caller zero both src and dst

[Nouveau] [PATCH 0/9] Add support for SVM atomics in Nouveau

2021-02-08 Thread Alistair Popple
This series adds support to Nouveau for atomic memory operations on OpenCL shared virtual memory (SVM). This is achieved using the atomic PTE bits on the GPU to only permit atomic operations to system memory when a page is not mapped in userspace on the CPU. This is implemented by adding a mode

[Nouveau] [RFC v4 03/11] drm/i915/dpcd_bl: Remove redundant AUX backlight frequency calculations

2021-02-08 Thread Lyude Paul
Noticed this while moving all of the VESA backlight code in i915 over to DRM helpers: it would appear that we calculate the frequency value we want to write to DP_EDP_BACKLIGHT_FREQ_SET twice even though this value never actually changes during runtime. So, let's simplify things by just caching

[Nouveau] [RFC v4 10/11] drm/dp: Extract i915's eDP backlight code into DRM helpers

2021-02-08 Thread Lyude Paul
Since we're about to implement eDP backlight support in nouveau using the standard protocol from VESA, we might as well just take the code that's already written for this and move it into a set of shared DRM helpers. Note that these helpers are intended to handle DPCD related backlight control

[Nouveau] [RFC v4 11/11] drm/nouveau/kms/nv50-: Add basic DPCD backlight support for nouveau

2021-02-08 Thread Lyude Paul
This adds support for controlling panel backlights over eDP using VESA's standard backlight control interface. Luckily, Nvidia was cool enough to never come up with their own proprietary backlight control interface (at least, not any that I or the laptop manufacturers I've talked to are aware of),

[Nouveau] [RFC v4 09/11] drm/i915/dpcd_bl: Print return codes for VESA backlight failures

2021-02-08 Thread Lyude Paul
Also, stop printing the DPCD register that failed, and just describe it instead. Saves us from having to look up each register offset when reading through kernel logs (plus, DPCD dumping with drm.debug |= 0x100 will give us that anyway). Signed-off-by: Lyude Paul ---

[Nouveau] [RFC v4 08/11] drm/i915/dpcd_bl: Return early in vesa_calc_max_backlight if we can't read PWMGEN_BIT_COUNT

2021-02-08 Thread Lyude Paul
If we can't read DP_EDP_PWMGEN_BIT_COUNT in intel_dp_aux_vesa_calc_max_backlight() but do have a valid PWM frequency defined in the VBT, we'll keep going in the function until we inevitably fail on reading DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN. There's not much point in doing this, so just return early.

[Nouveau] [RFC v4 04/11] drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly

2021-02-08 Thread Lyude Paul
This is kind of an annoying aspect of DRM's DP helpers: drm_dp_dpcd_readb/writeb() return the size of bytes read/written on success, thus we want to check against that instead of checking if the return value is less than 0. I'll probably be fixing this in the near future once I start doing DP

[Nouveau] [RFC v4 07/11] drm/i915/dpcd_bl: Move VESA backlight enabling code closer together

2021-02-08 Thread Lyude Paul
No functional changes, just move set_vesa_backlight_enable() closer to it's only caller: intel_dp_aux_vesa_enable_backlight(). Signed-off-by: Lyude Paul Reviewed-by: Rodrigo Vivi --- .../drm/i915/display/intel_dp_aux_backlight.c | 54 +-- 1 file changed, 27 insertions(+), 27

[Nouveau] [RFC v4 06/11] drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight

2021-02-08 Thread Lyude Paul
Since we're about to be moving this code into shared DRM helpers, we might as well start to cache certain backlight capabilities that can be determined from the EDP DPCD, and are likely to be relevant to the majority of drivers using said helpers. The main purpose of this is just to prevent every

[Nouveau] [RFC v4 05/11] drm/i915/dpcd_bl: Cleanup intel_dp_aux_vesa_enable_backlight() a bit

2021-02-08 Thread Lyude Paul
Get rid of the extraneous switch case in here, and just open code edp_backlight_mode as we only ever use it once. v4: * Check that backlight mode is DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD, not DP_EDP_BACKLIGHT_CONTROL_MODE_MASK - imirkin Signed-off-by: Lyude Paul ---

[Nouveau] [RFC v4 02/11] drm/nouveau/kms: Don't probe eDP connectors more then once

2021-02-08 Thread Lyude Paul
eDP doesn't do hotplugging, so there's no reason for us to reprobe it (unless a connection status change is being forced, of course). Signed-off-by: Lyude Paul Cc: Jani Nikula Cc: Dave Airlie Cc: greg.depo...@gmail.com --- drivers/gpu/drm/nouveau/nouveau_connector.c | 6 ++ 1 file

[Nouveau] [RFC v4 00/11] drm: Extract DPCD backlight helpers from i915, add support in nouveau

2021-02-08 Thread Lyude Paul
This series: * Cleans up i915's DPCD backlight code a little bit * Extracts i915's DPCD backlight code into a set of shared DRM helpers * Starts using those helpers in nouveau to add support to nouveau for DPCD backlight control v2 series-wide changes: * Rebase v3 series-wide changes: * Split

[Nouveau] [RFC v4 01/11] drm/nouveau/kms/nv40-/backlight: Assign prop type once

2021-02-08 Thread Lyude Paul
Signed-off-by: Lyude Paul Cc: Jani Nikula Cc: Dave Airlie Cc: greg.depo...@gmail.com --- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c

Re: [Nouveau] [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers

2021-02-08 Thread Lyude Paul
On Mon, 2021-02-08 at 09:46 +0100, Thomas Zimmermann wrote: > Hi > > Am 06.02.21 um 00:45 schrieb Lyude Paul: > > Since we're about to implement eDP backlight support in nouveau using the > > standard protocol from VESA, we might as well just take the code that's > > already written for this and

Re: [Nouveau] [RFC v3 00/10] drm: Extract DPCD backlight helpers from i915, add support in nouveau

2021-02-08 Thread Lyude Paul
thanks for the review comments everyone! I'm going through them now but realized I should probably point out that I somehow sent this patch series and did not realize I did so in the middle of a rebase, and as such completely forgot the parts here that actually started using these helpers in

Re: [Nouveau] nouveau 1.0.17 and GT-710 (GK208B): graphics stack freezes when turning off display

2021-02-08 Thread Ilia Mirkin
The referenced issue is a context switching error / timeout. Is that what you're seeing? Is there anything in dmesg when the problem occurs? Can you reproduce it by forcing the monitor to sleep (xset s off or equivalent)? What you're describing sounds most like a display engine hang. Cursor

[Nouveau] nouveau 1.0.17 and GT-710 (GK208B): graphics stack freezes when turning off display

2021-02-08 Thread Uwe Sauter
Hello, I don't know if this is the appropriate list to post; if not please point me in the right direction. I have an issue with the nouveau driver for a GT 710 (GK208B) card, hardware details and software versions below. Once the X server decides to switch into power saving mode and turns

Re: [Nouveau] [RFC v3 07/10] drm/i915/dpcd_bl: Move VESA backlight enabling code closer together

2021-02-08 Thread Rodrigo Vivi
On Fri, Feb 05, 2021 at 06:45:11PM -0500, Lyude Paul wrote: > No functional changes, just move set_vesa_backlight_enable() closer to it's > only caller: intel_dp_aux_vesa_enable_backlight(). > > Signed-off-by: Lyude Paul Reviewed-by: Rodrigo Vivi > --- >

Re: [Nouveau] [RFC v3 06/10] drm/i915/dpcd_bl: Cache some backlight capabilities in intel_panel.backlight

2021-02-08 Thread Rodrigo Vivi
On Fri, Feb 05, 2021 at 06:45:10PM -0500, Lyude Paul wrote: > Since we're about to be moving this code into shared DRM helpers, we might > as well start to cache certain backlight capabilities that can be > determined from the EDP DPCD, and are likely to be relevant to the majority > of drivers

Re: [Nouveau] [RFC v3 04/10] drm/i915/dpcd_bl: Handle drm_dpcd_read/write() return values correctly

2021-02-08 Thread Rodrigo Vivi
On Fri, Feb 05, 2021 at 06:45:08PM -0500, Lyude Paul wrote: > This is kind of an annoying aspect of DRM's DP helpers: > drm_dp_dpcd_readb/writeb() return the size of bytes read/written on > success, thus we want to check against that instead of checking if the > return value is less than 0. > >

Re: [Nouveau] [RFC v3 10/10] drm/dp: Extract i915's eDP backlight code into DRM helpers

2021-02-08 Thread Thomas Zimmermann
Hi Am 06.02.21 um 00:45 schrieb Lyude Paul: Since we're about to implement eDP backlight support in nouveau using the standard protocol from VESA, we might as well just take the code that's already written for this and move it into a set of shared DRM helpers. Note that these helpers are