Re: [PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by

2023-09-22 Thread Zack Rusin
On Fri, 2023-09-22 at 10:32 -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array

[PATCH] drm/amdkfd: Wait vm update fence after retry fault recovered

2023-09-22 Thread Philip Yang
Otherwise kfd flush tlb does nothing if vm update fence callback doesn't update vm->tlb_seq. H/W will generate retry fault again. This works now because retry fault keep coming, recover will update page table again after AMDGPU_SVM_RANGE_RETRY_FAULT_PENDING timeout and flush tlb. Remove wait

[PATCH] drm/amdgpu: Fix a memory leak

2023-09-22 Thread Luben Tuikov
Fix a memory leak in amdgpu_fru_get_product_info(). Cc: Alex Deucher Reported-by: Yang Wang Fixes: 0dbf2c56262532 ("drm/amdgpu: Interpret IPMI data for product information (v2)") --- drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 1 + 1 file changed, 1 insertion(+) diff --git

Re: [PATCH] drm/amdgpu: fix memory leak in amdgpu_fru_get_product_info()

2023-09-22 Thread Luben Tuikov
On 2023-09-22 16:58, Luben Tuikov wrote: > On 2023-09-22 01:27, Yang Wang wrote: >> fix a memory leak that occurs when csum is 0, >> the origin function will return directly and forgets to free 'pia' resource. >> >> Fixes: 0dbf2c562625 ("drm/amdgpu: Interpret IPMI data for product >> information

Re: [PATCH] drm/amdgpu: fix memory leak in amdgpu_fru_get_product_info()

2023-09-22 Thread Luben Tuikov
On 2023-09-22 01:27, Yang Wang wrote: > fix a memory leak that occurs when csum is 0, > the origin function will return directly and forgets to free 'pia' resource. > > Fixes: 0dbf2c562625 ("drm/amdgpu: Interpret IPMI data for product information > (v2)") > > CC: Luben Tuikov > Signed-off-by:

Re: [PATCH 14/15] platform/x86/amd/pmf: Add PMF-AMDSFH interface for HPD

2023-09-22 Thread Mario Limonciello
On 9/22/2023 14:04, Mario Limonciello wrote: On 9/22/2023 12:50, Shyam Sundar S K wrote: From: Basavaraj Natikar AMDSFH has information about the User presence information via the Human Presence Detection (HPD) sensor which is part of the AMD sensor fusion hub. Add PMF and AMDSFH interface

Re: [PATCH] drm/amdgpu: fix memory leak in amdgpu_fru_get_product_info()

2023-09-22 Thread Luben Tuikov
On 2023-09-22 01:27, Yang Wang wrote: > fix a memory leak that occurs when csum is 0, > the origin function will return directly and forgets to free 'pia' resource. > > Fixes: 0dbf2c562625 ("drm/amdgpu: Interpret IPMI data for product information > (v2)") > > CC: Luben Tuikov > Signed-off-by:

[PATCH] drm/amd: Propagate failures in dc_set_power_state()

2023-09-22 Thread Mario Limonciello
During the suspend process dc_set_power_state() will use kzalloc to allocate memory, but this potentially fails with memory pressure. If it fails, the suspend should be aborted. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362 Signed-off-by: Mario Limonciello --- Cc:

Re: [PATCH][V3] drm/amd/display: Remove unwanted drm edid references

2023-09-22 Thread Harry Wentland
On 2023-09-18 09:04, Alex Hung wrote: [WHY] edid_override and drm_edid_override_connector_update, according to drm documentation, should not be referred outside drm_edid. [HOW] Remove and replace them accordingly. This can tested by IGT's kms_hdmi_inject test. Signed-off-by: Alex Hung

Re: [PATCH 15/15] platform/x86/amd/pmf: Add PMF-AMDSFH interface for ALS

2023-09-22 Thread Mario Limonciello
On 9/22/2023 12:50, Shyam Sundar S K wrote: From: Basavaraj Natikar AMDSFH has information about the Ambient light via the Ambient Light Sensor (ALS) which is part of the AMD sensor fusion hub. Add PMF and AMDSFH interface to get this information. Co-developed-by: Shyam Sundar S K

Re: [PATCH 14/15] platform/x86/amd/pmf: Add PMF-AMDSFH interface for HPD

2023-09-22 Thread Mario Limonciello
On 9/22/2023 12:50, Shyam Sundar S K wrote: From: Basavaraj Natikar AMDSFH has information about the User presence information via the Human Presence Detection (HPD) sensor which is part of the AMD sensor fusion hub. Add PMF and AMDSFH interface to get this information. Co-developed-by: Shyam

Re: [PATCH 11/15] platform/x86/amd/pmf: dump policy binary data

2023-09-22 Thread Mario Limonciello
On 9/22/2023 12:50, Shyam Sundar S K wrote: Sometimes policy binary retrieved from the BIOS maybe incorrect that can end up in failing to enable the Smart PC solution feature. Use print_hex_dump_debug() to dump the policy binary in hex, so that we debug the issues related to the binary even

Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by

2023-09-22 Thread Lyude Paul
Reviewed-by: Lyude Paul Thanks! On Fri, 2023-09-22 at 10:32 -0700, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via

Re: [PATCH 04/15] platform/x86/amd/pmf: Add support for PMF Policy Binary

2023-09-22 Thread Mario Limonciello
On 9/22/2023 12:50, Shyam Sundar S K wrote: PMF Policy binary is a encrypted and signed binary that will be part of the BIOS. PMF driver via the ACPI interface checks the existence of Smart PC bit. If the advertised bit is found, PMF driver walks the acpi namespace to find out the policy binary

[PATCH 15/15] platform/x86/amd/pmf: Add PMF-AMDSFH interface for ALS

2023-09-22 Thread Shyam Sundar S K
From: Basavaraj Natikar AMDSFH has information about the Ambient light via the Ambient Light Sensor (ALS) which is part of the AMD sensor fusion hub. Add PMF and AMDSFH interface to get this information. Co-developed-by: Shyam Sundar S K Signed-off-by: Shyam Sundar S K Signed-off-by:

[PATCH 14/15] platform/x86/amd/pmf: Add PMF-AMDSFH interface for HPD

2023-09-22 Thread Shyam Sundar S K
From: Basavaraj Natikar AMDSFH has information about the User presence information via the Human Presence Detection (HPD) sensor which is part of the AMD sensor fusion hub. Add PMF and AMDSFH interface to get this information. Co-developed-by: Shyam Sundar S K Signed-off-by: Shyam Sundar S K

[PATCH 13/15] platform/x86/amd/pmf: Add PMF-AMDGPU set interface

2023-09-22 Thread Shyam Sundar S K
For the Smart PC Solution to fully work, it has to enact to the actions coming from TA. Add the initial code path for set interface to AMDGPU. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Signed-off-by: Shyam Sundar S K --- drivers/gpu/drm/amd/amdgpu/amdgpu_pmf.c | 21

[PATCH 12/15] platform/x86/amd/pmf: Add PMF-AMDGPU get interface

2023-09-22 Thread Shyam Sundar S K
In order to provide GPU inputs to TA for the Smart PC solution to work, we need to have interface between the PMF driver and the AMDGPU driver. Add the initial code path for get interface from AMDGPU. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Signed-off-by: Shyam

[PATCH 11/15] platform/x86/amd/pmf: dump policy binary data

2023-09-22 Thread Shyam Sundar S K
Sometimes policy binary retrieved from the BIOS maybe incorrect that can end up in failing to enable the Smart PC solution feature. Use print_hex_dump_debug() to dump the policy binary in hex, so that we debug the issues related to the binary even before sending that to TA. Signed-off-by: Shyam

[PATCH 08/15] platform/x86/amd/pmf: Add support to update system state

2023-09-22 Thread Shyam Sundar S K
PMF driver based on the output actions from the TA can request to update the system states like entering s0i3, lock screen etc. by generating an uevent. Based on the udev rules set in the userspace the event id matching the uevent shall get updated accordingly using the systemctl. Sample udev

[PATCH 07/15] platform/x86/amd/pmf: Add support update p3t limit

2023-09-22 Thread Shyam Sundar S K
P3T (Peak Package Power Limit) is a metric within the SMU controller that can influence the power limits. Add support from the driver to update P3T limits accordingly. Reviewed-by: Mario Limonciello Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/pmf.h| 3 +++

[PATCH 01/15] platform/x86/amd/pmf: Add PMF TEE interface

2023-09-22 Thread Shyam Sundar S K
AMD PMF driver loads the PMF TA (Trusted Application) into the AMD ASP's (AMD Security Processor) TEE (Trusted Execution Environment). PMF Trusted Application is a secured firmware placed under /lib/firmware/amdtee gets loaded only when the TEE environment is initialized. Add the initial code

[PATCH 10/15] platform/x86/amd/pmf: Add capability to sideload of policy binary

2023-09-22 Thread Shyam Sundar S K
A policy binary is OS agnostic, and the same policies are expected to work across the OSes. At times it becomes difficult to debug when the policies inside the policy binaries starts to misbehave. Add a way to sideload such policies independently to debug them via a debugfs entry. Reviewed-by:

[PATCH 09/15] platform/x86/amd/pmf: Add facility to dump TA inputs

2023-09-22 Thread Shyam Sundar S K
PMF driver sends constant inputs to TA which its gets via the other subsystems in the kernel. To debug certain TA issues knowing what inputs being sent to TA becomes critical. Add debug facility to the driver which can isolate Smart PC and TA related issues. Reviewed-by: Mario Limonciello

[PATCH 03/15] platform/x86/amd/pmf: Change signature of amd_pmf_set_dram_addr

2023-09-22 Thread Shyam Sundar S K
Make amd_pmf_set_dram_addr() as non-static so that same function can be used across files. Reviewed-by: Mario Limonciello Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/core.c | 14 -- drivers/platform/x86/amd/pmf/pmf.h | 1 + 2 files changed, 9 insertions(+), 6

[PATCH 05/15] platform/x86/amd/pmf: change debugfs init sequence

2023-09-22 Thread Shyam Sundar S K
amd_pmf_dbgfs_register() needs to be called before amd_pmf_init_features(). Hence change the sequence. Reviewed-by: Mario Limonciello Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 06/15] platform/x86/amd/pmf: Add support to get inputs from other subsystems

2023-09-22 Thread Shyam Sundar S K
PMF driver sends changing inputs from each subystem to TA for evaluating the conditions in the policy binary. Add initial support of plumbing in the PMF driver for Smart PC to get information from other subsystems in the kernel. Signed-off-by: Shyam Sundar S K ---

[PATCH 04/15] platform/x86/amd/pmf: Add support for PMF Policy Binary

2023-09-22 Thread Shyam Sundar S K
PMF Policy binary is a encrypted and signed binary that will be part of the BIOS. PMF driver via the ACPI interface checks the existence of Smart PC bit. If the advertised bit is found, PMF driver walks the acpi namespace to find out the policy binary size and the address which has to be passed to

[PATCH 02/15] platform/x86/amd/pmf: Add support PMF-TA interaction

2023-09-22 Thread Shyam Sundar S K
PMF TA (Trusted Application) loads via the TEE environment into the AMD ASP. PMF-TA supports two commands: 1) Init: Initialize the TA with the PMF Smart PC policy binary and start the policy engine. A policy is a combination of inputs and outputs, where; - the inputs are the changing dynamics of

[PATCH 00/15] Introduce PMF Smart PC Solution Builder Feature

2023-09-22 Thread Shyam Sundar S K
Smart PC Solutions Builder allows for OEM to define a large number of custom system states to dynamically switch to. The system states are referred to as policies, and multiple policies can be loaded onto the system at any given time, however only one policy can be active at a given time. Policy

[PATCH 9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by

2023-09-22 Thread Alex Deucher
On Fri, Sep 22, 2023 at 1:33 PM Kees Cook wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array

Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by

2023-09-22 Thread Alex Deucher
On Fri, Sep 22, 2023 at 1:32 PM Kees Cook wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array

[PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 0/9] drm: Annotate structs with __counted_by

2023-09-22 Thread Kees Cook
Hi, This is a batch of patches touching drm for preparing for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and

[PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

[PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by

2023-09-22 Thread Kees Cook
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family

Re: [PATCH] drm/amdgpu: fix memory leak in amdgpu_fru_get_product_info()

2023-09-22 Thread Alex Deucher
On Fri, Sep 22, 2023 at 2:06 AM Yang Wang wrote: > > fix a memory leak that occurs when csum is 0, > the origin function will return directly and forgets to free 'pia' resource. > > Fixes: 0dbf2c562625 ("drm/amdgpu: Interpret IPMI data for product information > (v2)") > > CC: Luben Tuikov >

[PATCH] drm/amdkfd: reduce stack size in kfd_topology_add_device()

2023-09-22 Thread Alex Deucher
kfd_topology.c:2082:1: warning: the frame size of 1440 bytes is larger than 1024 bytes Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2866 Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff

Re: [PATCH] drm/amd/display: switch DC over to the new DRM logging macros

2023-09-22 Thread Rodrigo Siqueira Jordao
On 9/22/23 08:42, Hamza Mahfooz wrote: On 9/22/23 10:36, Rodrigo Siqueira Jordao wrote: Hi Hamza, This is a very nice improvement and overall lgtm. I just one comment and one question. For future series like this, I recommend splitting your commit into minor changes to make it easier to

RE: [PATCH] drm/amdgpu/vpe: fix truncation warnings

2023-09-22 Thread Zhang, Yifan
[AMD Official Use Only - General] Reviewed-by: Yifan Zhang -Original Message- From: amd-gfx On Behalf Of Lang Yu Sent: Friday, September 22, 2023 4:16 PM To: amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander ; Chiu, Solomon ; Yu, Lang ; kernel test robot Subject: [PATCH]

Re: [PATCH] drm/amd/display: switch DC over to the new DRM logging macros

2023-09-22 Thread Hamza Mahfooz
On 9/22/23 10:36, Rodrigo Siqueira Jordao wrote: Hi Hamza, This is a very nice improvement and overall lgtm. I just one comment and one question. For future series like this, I recommend splitting your commit into minor changes to make it easier to review and revert changes in case of

RE: [PATCH] drm/amdgpu: not to save bo in the case of RAS err_event_athub

2023-09-22 Thread Liu, Leo
[AMD Official Use Only - General] Acked-by: Leo Liu -Original Message- From: Wu, David Sent: Thursday, September 21, 2023 3:18 PM To: amd-gfx@lists.freedesktop.org Cc: Koenig, Christian ; Deucher, Alexander ; Liu, Leo Subject: [PATCH] drm/amdgpu: not to save bo in the case of RAS

Re: [PATCH] drm/amd/display: switch DC over to the new DRM logging macros

2023-09-22 Thread Rodrigo Siqueira Jordao
Hi Hamza, This is a very nice improvement and overall lgtm. I just one comment and one question. For future series like this, I recommend splitting your commit into minor changes to make it easier to review and revert changes in case of regressions. Also, with a patchset, you could add a

Re: [PATCH] drm/amd/display: Remove unused DPCD declarations

2023-09-22 Thread Harry Wentland
On 2023-09-22 05:58, Stylon Wang wrote: [Why & How] These DPCD addresses are either declared in other header files where it makes more sense or simply not used by any DC code. Remove them to reduce redundancies and potential confusion. Signed-off-by: Stylon Wang Reviewed-by: Harry

Re: 回复: [PATCH] drm/amdgpu: Ignore first evction failure during suspend

2023-09-22 Thread Christian König
Am 14.09.23 um 15:59 schrieb Christian König: Am 14.09.23 um 15:37 schrieb Felix Kuehling: Userptr and SVM restore work is scheduled to the system WQ with schedule_delayed_work. See amdgpu_amdkfd_evict_userptr and svm_range_evict. This would need to use queue_delayed_work with the

Re: [PATCH 3/3] drm/amdgpu/gmc11: disable AGP on GC 11.5

2023-09-22 Thread Christian König
Am 21.09.23 um 16:13 schrieb Alex Deucher: AGP aperture is deprecated and no longer functional. v2: fix typo (Alex) v3: just skip the agp setup call v4: revert back to the original model v5: back to v3 Signed-off-by: Alex Deucher Reviewed-by: Christian König ---

Re: [PATCH 2/3] drm/amdgpu/gmc: set a default disable value for AGP

2023-09-22 Thread Christian König
Am 21.09.23 um 16:12 schrieb Alex Deucher: To disable AGP, the start needs to be set to a higher value than the end. Set a default disable value for the AGP aperture and allow the IP specific GMC code to enable it selectively be calling amdgpu_gmc_agp_location(). Signed-off-by: Alex Deucher

Re: [PATCH 1/3] drm/amdgpu/gmc6-8: properly disable the AGP aperture

2023-09-22 Thread Christian König
Am 21.09.23 um 16:12 schrieb Alex Deucher: The BOT register needs to be larger than the TOP register for this to be properly disabled. The lower 22 bits of the BOT address are always 0 and the lower 22 bits of the TOP register are always 1 so you need to make the upper bits of BOT larger than

[PATCH] drm/amd/display: Remove unused DPCD declarations

2023-09-22 Thread Stylon Wang
[Why & How] These DPCD addresses are either declared in other header files where it makes more sense or simply not used by any DC code. Remove them to reduce redundancies and potential confusion. Signed-off-by: Stylon Wang --- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 59

[PATCH] drm/amdgpu/vpe: fix truncation warnings

2023-09-22 Thread Lang Yu
Fixes: ab041551f4a7 ("drm/amdgpu: add VPE 6.1.0 support") Signed-off-by: Lang Yu Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202309200028.auvum8os-...@intel.com --- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-)