Why does kgd2kfd_interrupt() have to schedule work on a specific CPU?

2023-06-27 Thread Philipp Stanner
Hello folks, I'm currently trying to learn more about DRM and discovered the following code sequence: drivers/gpu/drm/amd/amdkfd/kfd_device.c, Line 824 on 6.4-rc7 static inline void kfd_queue_work(struct workqueue_struct *wq, struct work_struct *work) {

Re: [PATCH 1/2] drm/sched: memset() 'job' in drm_sched_job_init()

2024-08-20 Thread Philipp Stanner
*PING* On Tue, 2024-08-06 at 16:38 +0200, Philipp Stanner wrote: > drm_sched_job_init() has no control over how users allocate struct > drm_sched_job. Unfortunately, the function can also not set some > struct > members such as job->sched. > > This could theoreticall

[PATCH] drm/sched: Document drm_sched_job_arm()'s effect on fences

2024-08-26 Thread Philipp Stanner
ed_job_arm() does in this regard and which rules the API-User has to follow once the function has been called. Add a section to drm_sched_job_arm()'s docstring which details the function's consequences regarding the job's fences. Signed-off-by: Philipp Stanner --- drivers/gpu/drm/s

[PATCH] drm/sched: Fix UB pointer dereference

2024-08-27 Thread Philipp Stanner
3f0a ("drm/sched: Convert the GPU scheduler to variable number of run-queues") Reported-by: Danilo Krummrich Closes: https://lore.kernel.org/lkml/20231108022716.15250-1-d...@redhat.com/ Signed-off-by: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 2 +- 1 file changed, 1 insert

Re: [PATCH] drm/sched: Fix UB pointer dereference

2024-08-27 Thread Philipp Stanner
On Tue, 2024-08-27 at 11:00 +0200, Christian König wrote: > Am 27.08.24 um 10:39 schrieb Danilo Krummrich: > > On 8/27/24 9:45 AM, Philipp Stanner wrote: > > > In drm_sched_job_init(), commit 56e449603f0a ("drm/sched: Convert > > > the > > > GPU s

Re: [PATCH 1/4] drm/sched: add optional errno to drm_sched_start()

2024-08-28 Thread Philipp Stanner
On Mon, 2024-08-26 at 14:25 +0200, Christian König wrote: > The current implementation of drm_sched_start uses a hardcoded > -ECANCELED to dispose of a job when the parent/hw fence is NULL. > This results in drm_sched_job_done being called with -ECANCELED for > each job with a NULL parent in the pe

[PATCH v2 1/2] drm/sched: memset() 'job' in drm_sched_job_init()

2024-08-28 Thread Philipp Stanner
bug such issues if these pointers are initialized to NULL, so dereferencing them causes a NULL pointer exception. Accordingly, drm_sched_entity_init() does precisely that and initializes its struct with memset(). Initialize parameter "job" to 0 in drm_sched_job_init(). Signed-off-by: Phili

[PATCH v2 2/2] drm/sched: warn about drm_sched_job_init()'s partial init

2024-08-28 Thread Philipp Stanner
ruct members. Document that job->sched in particular is uninitialized before drm_sched_job_arm(). Signed-off-by: Philipp Stanner --- Changes in v2: - Change grammar in the new comments a bit. --- drivers/gpu/drm/scheduler/sched_main.c | 4 include/drm/gpu_scheduler.h|

Re: [PATCH] drm/meson: switch to a managed drm device

2024-08-28 Thread Philipp Stanner
On Wed, 2024-08-28 at 14:04 +0300, Anastasia Belova wrote: > Switch to a managed drm device to cleanup some error handling > and make future work easier. It's best to state what the current situation is like and then how this patch addresses it. If the cleanup topic is separate from the addressed

Re: [PATCH 1/4] drm/sched: add optional errno to drm_sched_start()

2024-09-02 Thread Philipp Stanner
On Fri, 2024-08-30 at 15:15 +0200, Christian König wrote: > Am 28.08.24 um 11:30 schrieb Philipp Stanner: > > On Mon, 2024-08-26 at 14:25 +0200, Christian König wrote: > > > The current implementation of drm_sched_start uses a hardcoded > > > -ECANCELED to dispose of a j

[RFC PATCH] drm/sched: Fix teardown leaks with waitqueue

2024-09-03 Thread Philipp Stanner
that to happen. Suggested-by: Danilo Krummrich Signed-off-by: Philipp Stanner --- Hi all, since the scheduler has many stake holders, I want this solution discussed as an RFC first. This version here has IMO the advantage (and disadvantage...) that it blocks infinitly if the driver messed up the

[RFC PATCH] drm/sched: Fix teardown leaks with refcounting

2024-09-03 Thread Philipp Stanner
Signed-off-by: Philipp Stanner --- Hi all, since the scheduler has many stake holders, I want this solution discussed as an RFC first. The advantage of this version would be that it does not block drm_sched_fini(), but the price paid for that is that the scheduler keeps running until all jobs are gone

Re: [PATCH v2 1/2] drm/sched: memset() 'job' in drm_sched_job_init()

2024-09-04 Thread Philipp Stanner
Luben? Christian? On Wed, 2024-08-28 at 11:41 +0200, Philipp Stanner wrote: > drm_sched_job_init() has no control over how users allocate struct > drm_sched_job. Unfortunately, the function can also not set some > struct > members such as job->sched. > > This could theore

Re: [RFC PATCH] drm/sched: Fix teardown leaks with waitqueue

2024-09-05 Thread Philipp Stanner
On Wed, 2024-09-04 at 19:47 +0200, Simona Vetter wrote: > On Tue, Sep 03, 2024 at 11:44:47AM +0200, Philipp Stanner wrote: > > The GPU scheduler currently does not ensure that its pending_list > > is > > empty before performing various other teardown tasks in > > dr

Re: [RFC 0/4] DRM scheduler fixes, or not, or incorrect kind

2024-09-09 Thread Philipp Stanner
Hi, On Fri, 2024-09-06 at 19:06 +0100, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > In a recent conversation with Christian there was a thought that > drm_sched_entity_modify_sched() should start using the entity- > >rq_lock to be > safe against job submission and simultaneous priority chang

Re: [RFC 1/4] drm/sched: Add locking to drm_sched_entity_modify_sched

2024-09-09 Thread Philipp Stanner
On Fri, 2024-09-06 at 19:06 +0100, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > Without the locking amdgpu currently can race > amdgpu_ctx_set_entity_priority() and drm_sched_job_arm(),  I would explicitly say "amdgpu's amdgpu_ctx_set_entity_priority() races through drm_sched_entity_modify_s

[PATCH 0/5] Introduce new wrappers to copy user-arrays

2023-08-30 Thread Philipp Stanner
merged. P. Philipp Stanner (5): string.h: add array-wrappers for (v)memdup_user() kernel: kexec: copy user-array safely kernel: watch_queue: copy user-array safely drm_lease.c: copy user-array safely drm: vmgfx_surface.c: copy user-array safely drivers/gpu/drm/drm_lease.c

[PATCH 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-08-30 Thread Philipp Stanner
vmemdup_user() to provide a standardized and safe way for duplicating user arrays. This is both for new code as well as replacing usage of (v)memdup_user() in existing code that uses, e.g., n * size to calculate array sizes. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- include/linux

[PATCH 2/5] kernel: kexec: copy user-array safely

2023-08-30 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- kernel/kexec.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 3/5] kernel: watch_queue: copy user-array safely

2023-08-30 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- kernel/watch_queue.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 4/5] drm_lease.c: copy user-array safely

2023-08-30 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- drivers/gpu/drm/drm_lease.c | 4 ++-- 1 file changed, 2

[PATCH 5/5] drm: vmgfx_surface.c: copy user-array safely

2023-08-30 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++-- 1 file

Re: [PATCH 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-08-31 Thread Philipp Stanner
o wrote: > > > > > On Wed, Aug 30, 2023 at 4:46 PM Philipp Stanner > > > > > > > > Alphabetical. > > > > > > compiler.h > > > err.h > > > overflow.h > > > ...the rest that is a bit unordered... > > >

Re: [PATCH 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-08-31 Thread Philipp Stanner
On Wed, 2023-08-30 at 17:11 +0300, Andy Shevchenko wrote: > On Wed, Aug 30, 2023 at 4:46 PM Philipp Stanner > wrote: > > > > Currently, user array duplications are sometimes done without an > > overflow check. Sometimes the checks are done manually; sometimes > > th

[PATCH v2 0/5] Introduce new wrappers to copy user-arrays

2023-09-08 Thread Philipp Stanner
ora38 @ x86_64 does also boot fine. If there is more I can do to verify the early boot stages are fine, please let me know! P. Philipp Stanner (5): string.h: add array-wrappers for (v)memdup_user() kernel: kexec: copy user-array safely kernel: watch_queue: copy user-array safely drm_lease.c:

[PATCH v2 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-09-08 Thread Philipp Stanner
vmemdup_user() to provide a standardized and safe way for duplicating user arrays. This is both for new code as well as replacing usage of (v)memdup_user() in existing code that uses, e.g., n * size to calculate array sizes. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- include/linux

[PATCH v2 2/5] kernel: kexec: copy user-array safely

2023-09-08 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- kernel/kexec.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v2 3/5] kernel: watch_queue: copy user-array safely

2023-09-08 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- kernel/watch_queue.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v2 4/5] drm_lease.c: copy user-array safely

2023-09-08 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- drivers/gpu/drm/drm_lease.c | 4 ++-- 1 file changed, 2

[PATCH v2 5/5] drm: vmgfx_surface.c: copy user-array safely

2023-09-08 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++-- 1 file

Re: [PATCH v4 00/10] Make PCI's devres API more consistent

2024-03-11 Thread Philipp Stanner
Gentle ping because the Merge Window opened 8-) On Fri, 2024-03-01 at 12:29 +0100, Philipp Stanner wrote: > This v4 now can (hopefully) be applied to linux-next, but not to > mainline/master. > > Changes in v4: >   - Rebase against linux-next > > Changes in v3: >   -

Re: [PATCH v9 10/13] PCI: Give pci_intx() its own devres callback

2024-07-09 Thread Philipp Stanner
@Bjorn, @Krzysztof On Mon, 2024-07-08 at 21:46 +, Ashish Kalra wrote: > With this patch applied, we are observing unloading and then > reloading issues with the AMD Crypto (CCP) driver: Thank you very much for digging into this, Ashish Could you give me some pointers how one could test CCP b

Re: [PATCH v9 10/13] PCI: Give pci_intx() its own devres callback

2024-07-09 Thread Philipp Stanner
>From c24bd5b66e798a341caf183fb7cdbdf235502d90 Mon Sep 17 00:00:00 2001 From: Philipp Stanner Date: Tue, 9 Jul 2024 09:45:48 +0200 Subject: [PATCH] PCI: Fix pcim_intx() recursive calls pci_intx() calls into pcim_intx() in managed mode, i.e., when pcim_enable_device() had been called. T

[PATCH] drm/nouveau: Improve variable names in nouveau_sched_init()

2024-07-11 Thread Philipp Stanner
7;s "timeout" parameter. The actual "hang_limit" parameter is directly set to 0. Define a new variable and rename the existing one to make naming congruent with the function API. Signed-off-by: Philipp Stanner --- drivers/gpu/drm/nouveau/nouveau_sched.c | 5 +++-- 1 file

[PATCH v2] drm/nouveau: Improve variable names in nouveau_sched_init()

2024-07-11 Thread Philipp Stanner
7;s "timeout" parameter. The actual "hang_limit" parameter is directly set to 0. Rename "job_hang_limit" to "timeout". Signed-off-by: Philipp Stanner --- Changes in v2: - Remove variable "hang_limit". (Danilo) --- drivers/gpu/drm/nouveau/nouveau_sc

[PATCH] drm/scheduler: Use ternary operator in standardized manner

2024-07-15 Thread Philipp Stanner
places in drm/scheduler where the ternary operator is used. Replace the expression with the standard one. [1] https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Conditionals.html Suggested-by: Marco Pagani Signed-off-by: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 2 +- 1 file changed

Re: [PATCH 1/2] drm/scheduler: improve GPU scheduler documentation v2

2024-07-19 Thread Philipp Stanner
On Thu, 2023-11-16 at 15:15 +0100, Christian König wrote: > Start to improve the scheduler document. Especially document the > lifetime of each of the objects as well as the restrictions around > DMA-fence handling and userspace compatibility. Hallo Christian, thanks for working on this. I'm cur

[PATCH 0/2] Use pcim_request_region() in vboxvideo

2024-07-29 Thread Philipp Stanner
Hi everyone, Now that we've got the simplified PCI devres API available we can slowly start using it in drivers and step by step phase the more problematic API out. vboxvideo currently does not have a region request, so it is a suitable first user. P. Philipp Stanner (2): PCI:

[PATCH 1/2] PCI: Make pcim_request_region() a public function

2024-07-29 Thread Philipp Stanner
: Philipp Stanner --- drivers/pci/devres.c | 1 + drivers/pci/pci.h| 2 -- include/linux/pci.h | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 3780a9f9ec00..0127ca58c6e5 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci

[PATCH 2/2] drm/vboxvideo: Add PCI region request

2024-07-29 Thread Philipp Stanner
vboxvideo currently does not reserve its PCI BAR through a region request. Implement the request through the managed function pcim_request_region(). Signed-off-by: Philipp Stanner --- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm

[PATCH 1/2] drm/sched: memset() 'job' in drm_sched_job_init()

2024-08-06 Thread Philipp Stanner
bug such issues if these pointers are initialized to NULL, so dereferencing them causes a NULL pointer exception. Accordingly, drm_sched_entity_init() does precisely that and initializes its struct with memset(). Initialize parameter "job" to 0 in drm_sched_job_init(). Signed-off-by: Phili

[PATCH 2/2] drm/sched: warn about drm_sched_job_init()'s partial init

2024-08-06 Thread Philipp Stanner
ruct members. Document that job->sched in particular is uninitialized before drm_sched_job_arm(). Signed-off-by: Philipp Stanner --- drivers/gpu/drm/scheduler/sched_main.c | 4 include/drm/gpu_scheduler.h| 7 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/gp

[PATCH 1/2] PCI: Deprecate pcim_iomap_regions() in favor of pcim_iomap_region()

2024-08-07 Thread Philipp Stanner
pcim_iomap_region() a public function. Mark pcim_iomap_regions() as deprecated. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 8 ++-- include/linux/pci.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index

[PATCH 2/2] drm/ast: Request PCI BAR with devres

2024-08-07 Thread Philipp Stanner
(). Suggested-by: Thomas Zimmermann Signed-off-by: Philipp Stanner --- drivers/gpu/drm/ast/ast_drv.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index aae019e79bda..1fadaadfbe39 100644 --- a

Re: [PATCH v2 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-09-18 Thread Philipp Stanner
On Sat, 2023-09-16 at 17:32 +0300, Dan Carpenter wrote: > On Fri, Sep 08, 2023 at 09:59:40PM +0200, Philipp Stanner wrote: > > +static inline void *memdup_array_user(const void __user *src, > > size_t n, size_t size) > > +{ > > +   size_t nbytes; >

[PATCH v3 1/5] string.h: add array-wrappers for (v)memdup_user()

2023-09-20 Thread Philipp Stanner
vmemdup_user() to provide a standardized and safe way for duplicating user arrays. This is both for new code as well as replacing usage of (v)memdup_user() in existing code that uses, e.g., n * size to calculate array sizes. Suggested-by: David Airlie Signed-off-by: Philipp Stanner Reviewed-by: Andy

[PATCH v3 0/5] Introduce new wrappers to copy user-arrays

2023-09-20 Thread Philipp Stanner
' docstrings - Return -EOVERFLOW instead of -EINVAL from wrapper functions P. Philipp Stanner (5): string.h: add array-wrappers for (v)memdup_user() kernel: kexec: copy user-array safely kernel: watch_queue: copy user-array safely drm_lease.c: copy user-array safely drm: vmgfx_surface.c:

[PATCH v3 2/5] kernel: kexec: copy user-array safely

2023-09-20 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner Acked-by: Baoquan He Reviewed-by: Kees Cook Reviewed-by: Zack

[PATCH v3 3/5] kernel: watch_queue: copy user-array safely

2023-09-20 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner Reviewed-by: Kees Cook Reviewed-by: Zack Rusin --- kernel

[PATCH v3 4/5] drm_lease.c: copy user-array safely

2023-09-20 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner Reviewed-by: Kees Cook Reviewed-by: Zack Rusin --- drivers/gpu

[PATCH v3 5/5] drm: vmgfx_surface.c: copy user-array safely

2023-09-20 Thread Philipp Stanner
Currently, there is no overflow-check with memdup_user(). Use the new function memdup_array_user() instead of memdup_user() for duplicating the user-space array safely. Suggested-by: David Airlie Signed-off-by: Philipp Stanner Reviewed-by: Kees Cook Reviewed-by: Zack Rusin --- drivers/gpu

[PATCH] drm/ast: use managed devres functions

2023-10-30 Thread Philipp Stanner
ed-by: Thomas Zimmermann Signed-off-by: Philipp Stanner --- ¡Hola! I picked up the memory-region-request-task from the DRM-TODO-List [1] and began with this driver. Please have a first look. I wasn't entirely sure about -ENOMEM... for example, as far as my understanding goes, it should not be ab

[PATCH] drivers/video/fbdev: use new array-copying-wrapper

2023-11-02 Thread Philipp Stanner
viafbdev.c utilizes memdup_user() to copy an array from userspace. There is a new wrapper, specifically designed for copying arrays. Use this one instead. Suggested-by: Dave Airlie Signed-off-by: Philipp Stanner --- drivers/video/fbdev/via/viafbdev.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH v2] drm/ast: use managed devres functions

2023-11-03 Thread Philipp Stanner
ed-by: Thomas Zimmermann Signed-off-by: Philipp Stanner --- Changes in v2: - Remove unnecessary return code checks for pcim_iomap_regions() (Jocelyn) Thx Jocelyn for the kind review --- drivers/gpu/drm/ast/ast_main.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --

Re: [PATCH v2] drm/ast: use managed devres functions

2023-11-10 Thread Philipp Stanner
On Fri, 2023-11-03 at 19:25 +0100, Philipp Stanner wrote: > Currently, tha ast-driver just maps the PCI-dev's regions with > pcim_iomap(). It does not actually reserve the regions exclusively > with, e.g., pci_request_regions(). > > Replace the calls to pcim_

Re: [PATCH v3 00/10] Make PCI's devres API more consistent

2024-02-29 Thread Philipp Stanner
@Bjorn: Hey Bjorn, are we good with this series? Any more wishes or suggestions? P. On Tue, 2024-02-06 at 14:39 +0100, Philipp Stanner wrote: > Changes in v3: >   - Use the term "PCI devres API" in some forgotten places. >   - Fix more grammar errors in patch #3. >

Re: [PATCH v3 00/10] Make PCI's devres API more consistent

2024-03-01 Thread Philipp Stanner
On Thu, 2024-02-29 at 14:57 -0600, Bjorn Helgaas wrote: > On Thu, Feb 29, 2024 at 09:31:20AM +0100, Philipp Stanner wrote: > > @Bjorn: > > Hey Bjorn, are we good with this series? Any more wishes or > > suggestions? > > Sorry, haven't had a chance to go through i

[PATCH v4 00/10] Make PCI's devres API more consistent

2024-03-01 Thread Philipp Stanner
ut having to port all existing drivers to the new API. Especially, I think that this implementation is easy to extend if the need for new managed functions arises :) Greetings, P. Philipp Stanner (10): PCI: Add new set of devres functions PCI: Deprecate iomap-table functions PCI: Warn use

[PATCH v4 01/10] PCI: Add new set of devres functions

2024-03-01 Thread Philipp Stanner
e devres directly and bypass the legacy iomap table mechanism. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 473 ++- include/linux/pci.h | 11 + 2 files changed, 479 insertions(+), 5 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/p

[PATCH v4 02/10] PCI: Deprecate iomap-table functions

2024-03-01 Thread Philipp Stanner
as much of the iomap-table-mechanism as possible. Add comments describing the path towards a cleaned-up API. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 374 +-- drivers/pci/pci.c| 20 +++ drivers/pci/pci.h| 5 + include/linux/pci.h

[PATCH v4 03/10] PCI: Warn users about complicated devres nature

2024-03-01 Thread Philipp Stanner
. This is not the case. Add comments to the relevant functions' docstrings that warn users about this behavior. Signed-off-by: Philipp Stanner --- drivers/pci/iomap.c | 18 ++ drivers/pci/pci.c | 60 - 2 files changed, 77 insertions(

[PATCH v4 04/10] PCI: Make devres region requests consistent

2024-03-01 Thread Philipp Stanner
pci_request / release functions call their pcim_ counterparts. Remove the now surplus region_mask from struct pci_devres. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 ++- drivers/pci/pci.c| 50

[PATCH v4 06/10] PCI: Move pinned status bit to struct pci_dev

2024-03-01 Thread Philipp Stanner
dev. This will later permit simplifying pcim_enable_device(). Move the 'pinned' boolean bit to struct pci_dev. Restructure bits in struct pci_dev so the pm / pme fields are next to each other. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 14 -- drive

[PATCH v4 05/10] PCI: Move dev-enabled status bit to struct pci_dev

2024-03-01 Thread Philipp Stanner
ean bit to struct pci_dev. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 11 --- drivers/pci/pci.c| 17 ++--- drivers/pci/pci.h| 1 - include/linux/pci.h | 1 + 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pc

[PATCH v4 07/10] PCI: Give pcim_set_mwi() its own devres callback

2024-03-01 Thread Philipp Stanner
Managing pci_set_mwi() with devres can easily be done with its own callback, without the necessity to store any state about it in a device-related struct. Remove the MWI state from struct pci_devres. Give pcim_set_mwi() a separate devres-callback. Signed-off-by: Philipp Stanner --- drivers/pci

[PATCH v4 09/10] PCI: Remove legacy pcim_release()

2024-03-01 Thread Philipp Stanner
the now surplus function get_pci_dr(). Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 +++- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 8a643f15140a..3e567773c556 100644

[PATCH v4 10/10] drm/vboxvideo: fix mapping leaks

2024-03-01 Thread Philipp Stanner
, functions become managed that way. The function pci_iomap_range() is never managed. Replace pci_iomap_range() with the actually managed function pcim_iomap_range(). CC: # v5.10+ Fixes: 8558de401b5f ("drm/vboxvideo: use managed pci functions") Signed-off-by: Philipp Stanner --- drive

[PATCH v4 08/10] PCI: Give pci(m)_intx its own devres callback

2024-03-01 Thread Philipp Stanner
x() in the managed case. Remove the struct pci_devres from pci.h. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 74 +++- drivers/pci/pci.c| 24 +++--- drivers/pci/pci.h| 17 +- 3 files changed, 74 insertions(+), 41

Re: [PATCH v2 10/10] drm/vboxvideo: fix mapping leaks

2024-01-29 Thread Philipp Stanner
Hi, On Mon, 2024-01-29 at 12:15 +0100, Hans de Goede wrote: > Hi Philipp, > > On 1/23/24 10:43, Philipp Stanner wrote: > > When the PCI devres API was introduced to this driver, it was > > wrongly > > assumed that initializing the device with pcim_enable_

[PATCH v3 00/10] Make PCI's devres API more consistent

2024-02-06 Thread Philipp Stanner
es and reserves resources as intended on my system. Kasan and kmemleak didn't find any problems. I believe this series cleans the API up as much as possible without having to port all existing drivers to the new API. Especially, I think that this implementation is easy to extend if the n

[PATCH v3 01/10] PCI: Add new set of devres functions

2024-02-06 Thread Philipp Stanner
e devres directly and bypass the legacy iomap table mechanism. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 473 ++- include/linux/pci.h | 11 + 2 files changed, 479 insertions(+), 5 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/p

[PATCH v3 02/10] PCI: Deprecate iomap-table functions

2024-02-06 Thread Philipp Stanner
as much of the iomap-table-mechanism as possible. Add comments describing the path towards a cleaned-up API. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 374 +-- drivers/pci/pci.c| 20 +++ drivers/pci/pci.h| 5 + include/linux/pci.h

[PATCH v3 03/10] PCI: Warn users about complicated devres nature

2024-02-06 Thread Philipp Stanner
. This is not the case. Add comments to the relevant functions' docstrings that warn users about this behavior. Signed-off-by: Philipp Stanner --- drivers/pci/iomap.c | 18 ++ drivers/pci/pci.c | 60 - 2 files changed, 77 insertions(

[PATCH v3 05/10] PCI: Move dev-enabled status bit to struct pci_dev

2024-02-06 Thread Philipp Stanner
ean bit to struct pci_dev. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 11 --- drivers/pci/pci.c| 17 ++--- drivers/pci/pci.h| 1 - include/linux/pci.h | 1 + 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pc

[PATCH v3 06/10] PCI: Move pinned status bit to struct pci_dev

2024-02-06 Thread Philipp Stanner
dev. This will later permit simplifying pcim_enable_device(). Move the 'pinned' boolean bit to struct pci_dev. Restructure bits in struct pci_dev so the pm / pme fields are next to each other. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 14 -- drive

[PATCH v3 04/10] PCI: Make devres region requests consistent

2024-02-06 Thread Philipp Stanner
pci_request / release functions call their pcim_ counterparts. Remove the now surplus region_mask from struct pci_devres. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 ++- drivers/pci/pci.c| 50

[PATCH v3 07/10] PCI: Give pcim_set_mwi() its own devres callback

2024-02-06 Thread Philipp Stanner
Managing pci_set_mwi() with devres can easily be done with its own callback, without the necessity to store any state about it in a device-related struct. Remove the MWI state from struct pci_devres. Give pcim_set_mwi() a separate devres-callback. Signed-off-by: Philipp Stanner --- drivers/pci

[PATCH v3 08/10] PCI: Give pci(m)_intx its own devres callback

2024-02-06 Thread Philipp Stanner
x() in the managed case. Remove the struct pci_devres from pci.h. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 76 ++-- drivers/pci/pci.c| 24 +++--- drivers/pci/pci.h| 21 +++- 3 files changed, 77 insertions(+), 44

[PATCH v3 09/10] PCI: Remove legacy pcim_release()

2024-02-06 Thread Philipp Stanner
the now surplus function get_pci_dr(). Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 +++- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 8a643f15140a..3e567773c556 100644

[PATCH v3 10/10] drm/vboxvideo: fix mapping leaks

2024-02-06 Thread Philipp Stanner
, functions become managed that way. The function pci_iomap_range() is never managed. Replace pci_iomap_range() with the actually managed function pcim_iomap_range(). CC: # v5.10+ Fixes: 8558de401b5f ("drm/vboxvideo: use managed pci functions") Signed-off-by: Philipp Stanner --- drive

Re: [RFC PATCH 7/8] rust: add firmware abstractions

2024-05-22 Thread Philipp Stanner
On Wed, 2024-05-22 at 08:53 +0900, FUJITA Tomonori wrote: > Hi, > Thanks for working on the firmware API! > > On Mon, 20 May 2024 19:24:19 +0200 > Danilo Krummrich wrote: > > > Add an abstraction around the kernels firmware API to request > > firmware > > images. The abstraction provides functio

Re: [RFC PATCH 0/6] Supporting GMEM (generalized memory management) for external memory devices

2023-12-01 Thread Philipp Stanner
On Fri, 2023-12-01 at 02:37 +, zhuweixi wrote: > From your argument on KVM I can see that the biggest miscommunication > between us is that you believed that GMEM wanted to share the whole > address space. No, it is not the case. GMEM is only providing > coordination via certain mmap() calls. S

Re: [PATCH v4 10/10] drm/vboxvideo: fix mapping leaks

2024-04-02 Thread Philipp Stanner
On Thu, 2024-03-28 at 12:55 -0500, Bjorn Helgaas wrote: > On Fri, Mar 01, 2024 at 12:29:58PM +0100, Philipp Stanner wrote: > > When the PCI devres API was introduced to this driver, it was > > wrongly > > assumed that initializing the device with pcim_enable_device

[PATCH v5 00/10] Make PCI's devres API more consistent

2024-04-03 Thread Philipp Stanner
1] I tested this on a x86 VM with a simple pci test-device with two regions. Operates and reserves resources as intended on my system. Kasan and kmemleak didn't find any problems. I believe this series cleans the API up as much as possible without having to port all existing drivers to the new A

[PATCH v5 01/10] PCI: Add new set of devres functions

2024-04-03 Thread Philipp Stanner
e devres directly and bypass the legacy iomap table mechanism. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 473 ++- include/linux/pci.h | 11 + 2 files changed, 479 insertions(+), 5 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/p

[PATCH v5 02/10] PCI: Deprecate iomap-table functions

2024-04-03 Thread Philipp Stanner
as much of the iomap-table-mechanism as possible. Add comments describing the path towards a cleaned-up API. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 374 +-- drivers/pci/pci.c| 20 +++ drivers/pci/pci.h| 5 + include/linux/pci.h

[PATCH v5 03/10] PCI: Warn users about complicated devres nature

2024-04-03 Thread Philipp Stanner
. This is not the case. Add comments to the relevant functions' docstrings that warn users about this behavior. Signed-off-by: Philipp Stanner --- drivers/pci/iomap.c | 18 ++ drivers/pci/pci.c | 60 - 2 files changed, 77 insertions(

[PATCH v5 04/10] PCI: Make devres region requests consistent

2024-04-03 Thread Philipp Stanner
pci_request / release functions call their pcim_ counterparts. Remove the now surplus region_mask from struct pci_devres. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 ++- drivers/pci/pci.c| 50

[PATCH v5 06/10] PCI: Move pinned status bit to struct pci_dev

2024-04-03 Thread Philipp Stanner
dev. This will later permit simplifying pcim_enable_device(). Move the 'pinned' boolean bit to struct pci_dev. Restructure bits in struct pci_dev so the pm / pme fields are next to each other. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 14 -- drive

[PATCH v5 08/10] PCI: Give pci(m)_intx its own devres callback

2024-04-03 Thread Philipp Stanner
x() in the managed case. Remove the struct pci_devres from pci.h. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 74 +++- drivers/pci/pci.c| 24 +++--- drivers/pci/pci.h| 17 +- 3 files changed, 74 insertions(+), 41

[PATCH v5 05/10] PCI: Move dev-enabled status bit to struct pci_dev

2024-04-03 Thread Philipp Stanner
ean bit to struct pci_dev. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 11 --- drivers/pci/pci.c| 17 ++--- drivers/pci/pci.h| 1 - include/linux/pci.h | 1 + 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pc

[PATCH v5 07/10] PCI: Give pcim_set_mwi() its own devres callback

2024-04-03 Thread Philipp Stanner
Managing pci_set_mwi() with devres can easily be done with its own callback, without the necessity to store any state about it in a device-related struct. Remove the MWI state from struct pci_devres. Give pcim_set_mwi() a separate devres-callback. Signed-off-by: Philipp Stanner --- drivers/pci

[PATCH v5 10/10] drm/vboxvideo: fix mapping leaks

2024-04-03 Thread Philipp Stanner
, functions become managed that way. The function pci_iomap_range() is never managed. Replace pci_iomap_range() with the actually managed function pcim_iomap_range(). Fixes: 8558de401b5f ("drm/vboxvideo: use managed pci functions") Signed-off-by: Philipp Stanner Reviewed-by: Han

[PATCH v5 09/10] PCI: Remove legacy pcim_release()

2024-04-03 Thread Philipp Stanner
the now surplus function get_pci_dr(). Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 +++- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index 8a643f15140a..3e567773c556 100644

Re: [PATCH v5 02/10] PCI: Deprecate iomap-table functions

2024-04-04 Thread Philipp Stanner
Hello, On Thu, 2024-04-04 at 09:29 +0300, Dan Carpenter wrote: > Hi Philipp, > > kernel test robot noticed the following build warnings: > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url:    > https://github.com/intel-lab-lkp/linux/commits

[PATCH v6 00/10] Make PCI's devres API more consistent

2024-04-08 Thread Philipp Stanner
isting drivers to the new API. Especially, I think that this implementation is easy to extend if the need for new managed functions arises :) Greetings, P. Philipp Stanner (10): PCI: Add new set of devres functions PCI: Deprecate iomap-table functions PCI: Warn users about complicated devres natu

[PATCH v6 01/10] PCI: Add new set of devres functions

2024-04-08 Thread Philipp Stanner
e devres directly and bypass the legacy iomap table mechanism. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 473 ++- include/linux/pci.h | 11 + 2 files changed, 479 insertions(+), 5 deletions(-) diff --git a/drivers/pci/devres.c b/drivers/p

[PATCH v6 03/10] PCI: Warn users about complicated devres nature

2024-04-08 Thread Philipp Stanner
. This is not the case. Add comments to the relevant functions' docstrings that warn users about this behavior. Signed-off-by: Philipp Stanner --- drivers/pci/iomap.c | 18 ++ drivers/pci/pci.c | 60 - 2 files changed, 77 insertions(

[PATCH v6 02/10] PCI: Deprecate iomap-table functions

2024-04-08 Thread Philipp Stanner
as much of the iomap-table-mechanism as possible. Add comments describing the path towards a cleaned-up API. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 372 +-- drivers/pci/pci.c| 20 +++ drivers/pci/pci.h| 5 + include/linux/pci.h

[PATCH v6 04/10] PCI: Make devres region requests consistent

2024-04-08 Thread Philipp Stanner
pci_request / release functions call their pcim_ counterparts. Remove the now surplus region_mask from struct pci_devres. Signed-off-by: Philipp Stanner --- drivers/pci/devres.c | 49 ++- drivers/pci/pci.c| 50

  1   2   3   4   5   6   7   >