From: "Christian König" <christian.koenig@amd.com>
To: Ujwal Kundur <ujwal.kundur@gmail.com>, alexander.deucher@amd.com
Cc: airlied@gmail.com, simona@ffwll.ch, lijo.lazar@amd.com,
sunil.khatri@amd.com, Hawking.Zhang@amd.com, Jun.Ma2@amd.com,
Yunxiang.Li@amd.com, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] drm/amdgpu: Block userspace mapping of IO
Date: Wed, 16 Apr 2025 09:51:02 +0200 [thread overview]
Message-ID: <241a9bbb-6d59-4c24-8e18-a0acebc6f536@amd.com> (raw)
In-Reply-To: <20250416072825.3790-1-ujwal.kundur@gmail.com>
Am 16.04.25 um 09:28 schrieb Ujwal Kundur:
> This is a RFC patch for blocking userspace mapping of IO register(s)
> before ioremap() calls are made. Out of the available IRQ sources, CRTC
> seemed the most appropriate for this task, however I'm not quite sure
> about that as well as the type, which I've set to 0.
Hui what? Why do you think that grabbing a reference to an interrupt would block userspace mapping of IO registers?
Christian.
>
> If I understand correctly, we actually want to block certain ioctls from
> userspace that can interfere with ioremap but I don't see a dedicated
> source for that.
>
> Signed-off-by: Ujwal Kundur <ujwal.kundur@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index a30111d2c3ea..365af52af6e5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -47,6 +47,7 @@
> #include <linux/vga_switcheroo.h>
> #include <linux/efi.h>
> #include "amdgpu.h"
> +#include "amdgpu_irq.h"
> #include "amdgpu_trace.h"
> #include "amdgpu_i2c.h"
> #include "atom.h"
> @@ -4367,7 +4368,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
> ratelimit_set_flags(&adev->throttling_logging_rs, RATELIMIT_MSG_ON_RELEASE);
>
> /* Registers mapping */
> - /* TODO: block userspace mapping of io register */
> + /* Block userspace mapping of io register */
> + amdgpu_irq_put(adev, &adev->crtc_irq, 0);
> +
> if (adev->asic_type >= CHIP_BONAIRE) {
> adev->rmmio_base = pci_resource_start(adev->pdev, 5);
> adev->rmmio_size = pci_resource_len(adev->pdev, 5);
> @@ -4380,6 +4383,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
> atomic_set(&adev->pm.pwr_state[i], POWER_STATE_UNKNOWN);
>
> adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
> +
> + amdgpu_irq_get(adev, &adev->crtc_irq, 0);
> +
> if (!adev->rmmio)
> return -ENOMEM;
>
next prev parent reply other threads:[~2025-04-16 7:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 7:28 Ujwal Kundur
2025-04-16 7:51 ` Christian König [this message]
2025-04-16 11:43 ` Ujwal Kundur
2025-04-16 12:29 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=241a9bbb-6d59-4c24-8e18-a0acebc6f536@amd.com \
--to=christian.koenig@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Jun.Ma2@amd.com \
--cc=Yunxiang.Li@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=lijo.lazar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=sunil.khatri@amd.com \
--cc=ujwal.kundur@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®