From nobody Fri Dec 27 22:19:10 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A14F1E04A4 for ; Tue, 3 Dec 2024 09:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733218150; cv=none; b=IrH7i28fSr2TnlwhEKDNCwIIptGAQlqMpkia/mzByyCG86LnFcnxBTbZjvFE8zxQ0GqZxdG+4njS7yxJix0OaP06ZnvEpfAD0T4khndeqn5RbCfFJQZ7ND5dBZ3SjZcL0j0jruq5CIOH9TJYvRGoj+B28xvfaztXPEGbEdnVFrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733218150; c=relaxed/simple; bh=10LZqXVa0XlZajs7yy4vLLl+ywHGqExXm3/iP5F5wdw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MHYlJBMvbPqQjHy+SZ0N8wNN271Y2LXZQzythkyh65JMhQu0B+4BdPVkzx06W7+nJzSHLfufCEi9D7f+Kfy9KZIlKdxpX7TY+evBxd+bXuXX8lcZxBM5eemdqu6wipY3ftvOB6mMLMsZzAMa3GiH+kjpa9OWP8CKZJ93kc5JTpU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Mvc0BVCA; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Mvc0BVCA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733218147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LLFrnYQ41CCOjuPl6f8oeYH5LOqoEfmgCGYQJHMDPKs=; b=Mvc0BVCA6QNsSyxSvIE5A/NjGGE70J3nA7ckO2eVoBKHgRTCImmTWwqchpJzs5g48hA+u2 n17bh2Ktf4elQshJi4MvTy8ni+PEwH1sBsZVvDkHeQpYM1T0WNn1OfoxshfPbmoFwP0UmD EIGjwPTRDmVHo4Fy+4Yzg4MPG3SJDZo= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-PxBEi9Z0NFycgyb8Te_jHg-1; Tue, 03 Dec 2024 04:29:02 -0500 X-MC-Unique: PxBEi9Z0NFycgyb8Te_jHg-1 X-Mimecast-MFC-AGG-ID: PxBEi9Z0NFycgyb8Te_jHg Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AF0BA1955DD7; Tue, 3 Dec 2024 09:29:00 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.255]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 39D1819560A3; Tue, 3 Dec 2024 09:28:56 +0000 (UTC) From: Jocelyn Falempe To: Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , David Airlie , Simona Vetter , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Jocelyn Falempe Subject: [PATCH v2 1/5] drm/i915/fbdev: Add intel_fbdev_get_vaddr() Date: Tue, 3 Dec 2024 09:50:18 +0100 Message-ID: <20241203092836.426422-2-jfalempe@redhat.com> In-Reply-To: <20241203092836.426422-1-jfalempe@redhat.com> References: <20241203092836.426422-1-jfalempe@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" The vaddr of the fbdev framebuffer is private to the struct intel_fbdev, so this function is needed to access it for drm_panic. Also the struct i915_vma is different between i915 and xe, so it requires a few functions to access fbdev->vma->iomap. Signed-off-by: Jocelyn Falempe --- v2: * Add intel_fb_get_vaddr() and i915_vma_get_iomap() to build with Xe drive= r. drivers/gpu/drm/i915/display/intel_fb_pin.c | 5 +++++ drivers/gpu/drm/i915/display/intel_fb_pin.h | 1 + drivers/gpu/drm/i915/display/intel_fbdev.c | 5 +++++ drivers/gpu/drm/i915/display/intel_fbdev.h | 6 ++++++ drivers/gpu/drm/i915/i915_vma.h | 5 +++++ drivers/gpu/drm/xe/display/xe_fb_pin.c | 5 +++++ 6 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.c b/drivers/gpu/drm/= i915/display/intel_fb_pin.c index d3a86f9c6bc86..c44019c7ab56b 100644 --- a/drivers/gpu/drm/i915/display/intel_fb_pin.c +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.c @@ -327,3 +327,8 @@ void intel_plane_unpin_fb(struct intel_plane_state *old= _plane_state) intel_dpt_unpin_from_ggtt(fb->dpt_vm); } } + +void *intel_fb_get_vaddr(struct i915_vma *vma) +{ + return i915_vma_get_iomap(vma); +} diff --git a/drivers/gpu/drm/i915/display/intel_fb_pin.h b/drivers/gpu/drm/= i915/display/intel_fb_pin.h index ac0319b53af08..0141f5f2b1c7a 100644 --- a/drivers/gpu/drm/i915/display/intel_fb_pin.h +++ b/drivers/gpu/drm/i915/display/intel_fb_pin.h @@ -25,5 +25,6 @@ void intel_fb_unpin_vma(struct i915_vma *vma, unsigned lo= ng flags); =20 int intel_plane_pin_fb(struct intel_plane_state *plane_state); void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state); +void *intel_fb_get_vaddr(struct i915_vma *vma); =20 #endif diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i= 915/display/intel_fbdev.c index 00852ff5b2470..1d12d1c047d02 100644 --- a/drivers/gpu/drm/i915/display/intel_fbdev.c +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c @@ -695,3 +695,8 @@ struct intel_framebuffer *intel_fbdev_framebuffer(struc= t intel_fbdev *fbdev) =20 return to_intel_framebuffer(fbdev->helper.fb); } + +void *intel_fbdev_get_vaddr(struct intel_fbdev *fbdev) +{ + return intel_fb_get_vaddr(fbdev->vma); +} diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.h b/drivers/gpu/drm/i= 915/display/intel_fbdev.h index 08de2d5b34338..f033d4f1efe96 100644 --- a/drivers/gpu/drm/i915/display/intel_fbdev.h +++ b/drivers/gpu/drm/i915/display/intel_fbdev.h @@ -17,6 +17,7 @@ struct intel_framebuffer; void intel_fbdev_setup(struct drm_i915_private *dev_priv); void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synch= ronous); struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbde= v); +void *intel_fbdev_get_vaddr(struct intel_fbdev *fbdev); #else static inline void intel_fbdev_setup(struct drm_i915_private *dev_priv) { @@ -30,6 +31,11 @@ static inline struct intel_framebuffer *intel_fbdev_fram= ebuffer(struct intel_fbd { return NULL; } + +static inline void *intel_fbdev_get_vaddr(struct intel_fbdev *fbdev) +{ + return NULL; +} #endif =20 #endif /* __INTEL_FBDEV_H__ */ diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vm= a.h index 6a6be8048aa83..4ae610927fa77 100644 --- a/drivers/gpu/drm/i915/i915_vma.h +++ b/drivers/gpu/drm/i915/i915_vma.h @@ -353,6 +353,11 @@ static inline bool i915_node_color_differs(const struc= t drm_mm_node *node, return drm_mm_node_allocated(node) && node->color !=3D color; } =20 +static inline void __iomem *i915_vma_get_iomap(struct i915_vma *vma) +{ + return READ_ONCE(vma->iomap); +} + /** * i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the apert= ure * @vma: VMA to iomap diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/di= splay/xe_fb_pin.c index 761510ae06904..576b1e98f39cd 100644 --- a/drivers/gpu/drm/xe/display/xe_fb_pin.c +++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c @@ -421,3 +421,8 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma) { return 0; } + +void *intel_fb_get_vaddr(struct i915_vma *vma) +{ + return NULL; +} --=20 2.47.1