From nobody Sat Nov 30 04:44:22 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 A096518E043 for ; Thu, 12 Sep 2024 09:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726133459; cv=none; b=aoOMXJvmPQ6IwyHD0QrQy13h79gsZQ8SdklVyjm+m/LI+OIeO/oKueOTTnVYzqvWOYt6HQjLGkN/E47cQzcBZp0Gm8qnM0f8PNOBHnGvj+rbWsxFcj+xdju8xvzSZVXbYZeZ85gtB0ehgghi8iJfT5VryL61E4A81Kizgoem6QA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726133459; c=relaxed/simple; bh=rEUqW9oolS1ZbQA6o5E7zY4CEzIagsK5es9wQLtgzYY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NRz/uhfS8q4UlDnQLNRwdoqnPoOBBMSZHc3ZS9ivXH7r3a++YgRWntf9xwRP0CdZTBbdWfZntxNm1ZvUKZ1365F8RRbDca7qzSyScAFZnXl/cLND5AWx05+ZeHRQyQvtVPDwff/SibZCiQoCAKiptjcX9ZyGZLzYSFcgOo/JMKo= 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=NmvFOPI0; arc=none smtp.client-ip=170.10.133.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="NmvFOPI0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726133456; 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; bh=FDMghLFgcsxYTyp2Pq6X9LDi/Bu3IBWDr5oyhSEBic0=; b=NmvFOPI0paBHgWdgvn5B3PCw8n+aTfZinztNAAexZjlPa29mf/HRLinIUvTgh35OKicJRh /inEZaRy/YBgMf/WBVHBJbf8HC+BQVZiZk6D70CDXnCe8ZC3rylKf+ugvVvSKK+EUMTfM0 t2CSCOfB18/il2CzzecWhLpVdFjd0VE= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-Z4R8wFC2OCGSvgZGOmxhmA-1; Thu, 12 Sep 2024 05:30:55 -0400 X-MC-Unique: Z4R8wFC2OCGSvgZGOmxhmA-1 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-71926732629so856975b3a.1 for ; Thu, 12 Sep 2024 02:30:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726133454; x=1726738254; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FDMghLFgcsxYTyp2Pq6X9LDi/Bu3IBWDr5oyhSEBic0=; b=bYh0jOLuoeGvOwCPwOfjXA16VfBnSRT8oV+FAcycYxXXC+acdotRWFCTOZa980lccb gjOJgLTqTYf7u5EiDegxRe+lR1B1D2xqDfos9seWYlSAq6Psh6hB4r5zjNjcbCXsYdy0 jWX2PlHl1l/xcVSK/AOgbabVgJQRbk1hsYVNHvpeJrYNGmts0rYbhcnObU4bZ43F1Zmt 15XkSG4mY7qB9rzMKHWbHk4A8bhdo8QaJUedTxbBB9eB+8DRf1Txw5u+ZSquPhBcNCpH ePWJsSFWs787NXhhtUoyHvf4FcsBlodn9pf8yxnjCUSrnk7jHraDn5XRz1Q1SK+AHXqm ctNg== X-Forwarded-Encrypted: i=1; AJvYcCUyJ7UiHG4pMu1lvL1KWWj7AMR6/Hc7ijud2P4QnDkKFZtwpNnEAmwrv+f2hJHQKc4a78AvFI3FKNFjUuM=@vger.kernel.org X-Gm-Message-State: AOJu0YzkGTgam6AYJEOH9Wk65LXeMX2NfiAvQRXJnb3JwxRUPrDyGaO9 SIJr78TQonSNZgSaFLBlWgRvUU7n34YcZF8+/ACQT6rjD1mxCTtVyfC5DcXNUOdxPJgxTBSDMwU XwJBnKAjViBLEFufhE9beFEH263U0ruJfZwLY5cvcFiulc2WL/6tqyNYXnGHweQ== X-Received: by 2002:a05:6a00:14d0:b0:717:85e2:28fa with SMTP id d2e1a72fcca58-71926087294mr3469653b3a.16.1726133453942; Thu, 12 Sep 2024 02:30:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTwiKHtvqtPQiXIT9Pbj2q0MFlc8jnTspx3/Qxq+j46pcBDlxb5l/unp4fcC6H2WDgeryRrA== X-Received: by 2002:a05:6a00:14d0:b0:717:85e2:28fa with SMTP id d2e1a72fcca58-71926087294mr3469607b3a.16.1726133453279; Thu, 12 Sep 2024 02:30:53 -0700 (PDT) Received: from zeus.elecom ([240b:10:83a2:bd00:6e35:f2f5:2e21:ae3a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71908fca189sm4230931b3a.23.2024.09.12.02.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2024 02:30:52 -0700 (PDT) From: Ryosuke Yasuoka To: airlied@redhat.com, kraxel@redhat.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, daniel@ffwll.ch Cc: Ryosuke Yasuoka , virtualization@lists.linux.dev, spice-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, jfalempe@redhat.com Subject: [PATCH] drm/qxl: Add drm_panic support Date: Thu, 12 Sep 2024 18:30:22 +0900 Message-ID: <20240912093024.661498-1-ryasuoka@redhat.com> X-Mailer: git-send-email 2.46.0 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 Content-Type: text/plain; charset="utf-8" QXL supports the drm_panic module, which displays a message to the screen when a kernel panic occurs. Signed-off-by: Ryosuke Yasuoka --- Sorry for sending similar mails again and again. Please ignore the following my mails. Let me add dri-devel mailing list and Jocelyn who developped a drm_panic core and look forward to your comments on this mail. https://lore.kernel.org/all/20240911094644.616280-1-ryasuoka@redhat.com/T/#u https://lore.kernel.org/all/20240911101043.618043-1-ryasuoka@redhat.com/T/#= u=20 =20 drivers/gpu/drm/qxl/qxl_cmd.c | 29 ++++++++++ drivers/gpu/drm/qxl/qxl_display.c | 94 +++++++++++++++++++++++++++++++ drivers/gpu/drm/qxl/qxl_draw.c | 57 ++++++++++++++++++- drivers/gpu/drm/qxl/qxl_drv.h | 21 +++++++ drivers/gpu/drm/qxl/qxl_image.c | 27 +++++++++ drivers/gpu/drm/qxl/qxl_object.c | 62 ++++++++++++++++++++ drivers/gpu/drm/qxl/qxl_object.h | 4 ++ 7 files changed, 293 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c index d6ea01f3797b..c70041ce55c0 100644 --- a/drivers/gpu/drm/qxl/qxl_cmd.c +++ b/drivers/gpu/drm/qxl/qxl_cmd.c @@ -174,6 +174,35 @@ static bool qxl_ring_pop(struct qxl_ring *ring, return true; } =20 +/* For drm panic */ +int +qxl_push_command_ring_without_release(struct qxl_device *qdev, + struct qxl_bo *bo, uint32_t type, uint32_t offset) +{ + struct qxl_command cmd; + struct qxl_ring *ring =3D qdev->command_ring; + struct qxl_ring_header *header =3D &(ring->ring->header); + uint8_t *elt; + int idx; + + cmd.type =3D type; + cmd.data =3D qxl_bo_physical_address(qdev, bo, offset); + + idx =3D header->prod & (ring->n_elements - 1); + elt =3D ring->ring->elements + idx * ring->element_size; + + memcpy((void *)elt, &cmd, ring->element_size); + + header->prod++; + + mb(); + + if (header->prod =3D=3D header->notify_on_prod) + outb(0, ring->prod_notify); + + return 0; +} + int qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release = *release, uint32_t type, bool interruptible) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_di= splay.c index bc24af08dfcd..b5f2ddfe71a9 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -37,6 +37,7 @@ #include #include #include +#include =20 #include "qxl_drv.h" #include "qxl_object.h" @@ -889,6 +890,97 @@ static void qxl_plane_cleanup_fb(struct drm_plane *pla= ne, } } =20 +static int qxl_primary_plane_helper_get_scanout_buffer(struct drm_plane *p= lane, + struct drm_scanout_buffer *sb) +{ + struct qxl_bo *bo; + + if (!plane->state || !plane->state->fb) + return -ENODEV; + + bo =3D gem_to_qxl_bo(plane->state->fb->obj[0]); + + if (!bo->map.vaddr) { + int ret; + + ret =3D qxl_bo_pin_and_vmap(bo, &sb->map[0]); + if (ret) + return ret; + } else { + iosys_map_set_vaddr(&sb->map[0], bo->map.vaddr); + } + + sb->format =3D plane->state->fb->format; + sb->height =3D plane->state->fb->height; + sb->width =3D plane->state->fb->width; + sb->pitch[0] =3D plane->state->fb->pitches[0]; + return 0; +} + +static void qxl_panic_flush(struct drm_plane *plane) +{ + struct qxl_device *qdev =3D to_qxl(plane->dev); + struct qxl_bo *_bo =3D gem_to_qxl_bo(plane->state->fb->obj[0]); + uint8_t *surface_base =3D _bo->map.vaddr; + struct drm_clip_rect rect =3D { + .x1 =3D 0, + .y1 =3D 0, + .x2 =3D plane->state->fb->width, + .y2 =3D plane->state->fb->height + }; + unsigned int num_clips =3D 1; + struct qxl_bo clips_bo =3D {}; + struct qxl_bo image_bo =3D {}; + struct qxl_bo chunk_bo =3D {}; + struct qxl_drm_image dimage; + struct qxl_drm_chunk chunk; + int width =3D rect.x2; + int height =3D rect.y2; + int stride =3D plane->state->fb->pitches[0]; + int depth =3D plane->state->fb->format->cpp[0] * 8; + struct qxl_rect *rects; + struct qxl_rect drawable_rect =3D { + .left =3D 0, + .right =3D width, + .top =3D 0, + .bottom =3D height, + }; + int cur_idx =3D 0; + int size =3D 256; + struct qxl_bo *bo =3D qxl_bo_ref(qdev->current_release_bo[cur_idx]); + uint32_t offset =3D qdev->current_release_bo_offset[cur_idx] * size; + int ret; + + qxl_panic_bo_create(qdev, sizeof(struct qxl_clip_rects) + sizeof(struct q= xl_rect), + false, false, QXL_GEM_DOMAIN_VRAM, 0, NULL, &clips_bo); + + ret =3D qxl_image_alloc_objects_without_release(qdev, &dimage, &chunk, &i= mage_bo, &chunk_bo, + surface_base, width, height, depth, stride); + if (ret) + return; + + ret =3D make_drawable_without_release(qdev, &drawable_rect, bo, &clips_bo, + &dimage, offset, height, width); + if (ret) + return; + + rects =3D drawable_set_clipping(qdev, num_clips, &clips_bo); + if (!rects) + return; + rects[0].left =3D 0; + rects[0].right =3D width; + rects[0].top =3D 0; + rects[0].bottom =3D height; + + qxl_push_command_ring_without_release(qdev, bo, QXL_CMD_DRAW, offset); + + qxl_gem_object_free(&chunk_bo.tbo.base); + qxl_gem_object_free(&image_bo.tbo.base); + + qxl_bo_vunmap_locked(&clips_bo); + qxl_gem_object_free(&clips_bo.tbo.base); +} + static const uint32_t qxl_cursor_plane_formats[] =3D { DRM_FORMAT_ARGB8888, }; @@ -920,6 +1012,8 @@ static const struct drm_plane_helper_funcs primary_hel= per_funcs =3D { .atomic_disable =3D qxl_primary_atomic_disable, .prepare_fb =3D qxl_plane_prepare_fb, .cleanup_fb =3D qxl_plane_cleanup_fb, + .get_scanout_buffer =3D qxl_primary_plane_helper_get_scanout_buffer, + .panic_flush =3D qxl_panic_flush, }; =20 static const struct drm_plane_funcs qxl_primary_plane_funcs =3D { diff --git a/drivers/gpu/drm/qxl/qxl_draw.c b/drivers/gpu/drm/qxl/qxl_draw.c index 3a3e127ce297..49fdc0162377 100644 --- a/drivers/gpu/drm/qxl/qxl_draw.c +++ b/drivers/gpu/drm/qxl/qxl_draw.c @@ -41,7 +41,8 @@ static int alloc_clips(struct qxl_device *qdev, /* returns a pointer to the already allocated qxl_rect array inside * the qxl_clip_rects. This is *not* the same as the memory allocated * on the device, it is offset to qxl_clip_rects.chunk.data */ -static struct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, + +struct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, unsigned int num_clips, struct qxl_bo *clips_bo) { @@ -74,6 +75,60 @@ free_drawable(struct qxl_device *qdev, struct qxl_releas= e *release) qxl_release_free(qdev, release); } =20 +/* For drm panic */ +int +make_drawable_without_release(struct qxl_device *qdev, + struct qxl_rect *drawable_rect, + struct qxl_bo *bo, + struct qxl_bo *clips_bo, + struct qxl_drm_image *dimage, + uint32_t offset, int height, int width) +{ + struct qxl_drawable *drawable; + union qxl_release_info *info; + void *ptr; + int i; + + ptr =3D qxl_bo_kmap_atomic_page(qdev, bo, offset & PAGE_MASK); + if (!ptr) + return -ENOMEM; + drawable =3D ptr + (offset & ~PAGE_MASK); + + drawable->type =3D QXL_DRAW_COPY; + drawable->surface_id =3D 0; + drawable->effect =3D QXL_EFFECT_OPAQUE; + drawable->self_bitmap =3D 0; + drawable->self_bitmap_area.top =3D 0; + drawable->self_bitmap_area.left =3D 0; + drawable->self_bitmap_area.bottom =3D 0; + drawable->self_bitmap_area.right =3D 0; + + for (i =3D 0; i < 3; ++i) + drawable->surfaces_dest[i] =3D -1; + + drawable->bbox =3D *drawable_rect; + drawable->mm_time =3D qdev->rom->mm_clock; + drawable->clip.type =3D SPICE_CLIP_TYPE_RECTS; + drawable->clip.data =3D qxl_bo_physical_address(qdev, clips_bo, 0); + drawable->u.copy.src_area.top =3D 0; + drawable->u.copy.src_area.bottom =3D height; + drawable->u.copy.src_area.left =3D 0; + drawable->u.copy.src_area.right =3D width; + drawable->u.copy.rop_descriptor =3D SPICE_ROPD_OP_PUT; + drawable->u.copy.scale_mode =3D 0; + drawable->u.copy.mask.flags =3D 0; + drawable->u.copy.mask.pos.x =3D 0; + drawable->u.copy.mask.pos.y =3D 0; + drawable->u.copy.mask.bitmap =3D 0; + drawable->u.copy.src_bitmap =3D qxl_bo_physical_address(qdev, dimage->bo,= 0); + + info =3D &drawable->release_info; + ptr =3D ((void *)info) - (offset & ~PAGE_MASK); + qxl_bo_kunmap_atomic_page(qdev, bo, ptr); + + return 0; +} + /* release needs to be reserved at this point */ static int make_drawable(struct qxl_device *qdev, int surface, uint8_t type, diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 32069acd93f8..93dd0de06c23 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -334,6 +334,13 @@ int qxl_image_init(struct qxl_device *qdev, const uint8_t *data, int x, int y, int width, int height, int depth, int stride); + +int qxl_image_alloc_objects_without_release(struct qxl_device *qdev, + struct qxl_drm_image *image, struct qxl_drm_chunk *chunk, + struct qxl_bo *image_bo, struct qxl_bo *chunk_bo, + uint8_t *surface_base, int width, + int height, int depth, int stride); + int qxl_image_alloc_objects(struct qxl_device *qdev, struct qxl_release *release, @@ -376,6 +383,9 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev,= unsigned long size, int type, struct qxl_release **release, struct qxl_bo **rbo); =20 +int qxl_push_command_ring_without_release(struct qxl_device *qdev, + struct qxl_bo *bo, uint32_t type, uint32_t offset); + int qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release = *release, uint32_t type, bool interruptible); @@ -387,6 +397,9 @@ int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, struct qxl_bo **_bo); /* qxl drawing commands */ +struct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, + unsigned int num_clips, + struct qxl_bo *clips_bo); =20 void qxl_draw_dirty_fb(struct qxl_device *qdev, struct drm_framebuffer *fb, @@ -399,6 +412,14 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, void qxl_release_free(struct qxl_device *qdev, struct qxl_release *release); =20 +int +make_drawable_without_release(struct qxl_device *qdev, + struct qxl_rect *drawable_rect, + struct qxl_bo *bo, + struct qxl_bo *clips_bo, + struct qxl_drm_image *dimage, + uint32_t offset, int height, int width); + /* used by qxl_debugfs_release */ struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, uint64_t id); diff --git a/drivers/gpu/drm/qxl/qxl_image.c b/drivers/gpu/drm/qxl/qxl_imag= e.c index ffff54e5fb31..2efe0cf133a6 100644 --- a/drivers/gpu/drm/qxl/qxl_image.c +++ b/drivers/gpu/drm/qxl/qxl_image.c @@ -52,6 +52,33 @@ qxl_allocate_chunk(struct qxl_device *qdev, return 0; } =20 +/* For drm panic */ +int +qxl_image_alloc_objects_without_release(struct qxl_device *qdev, + struct qxl_drm_image *image, struct qxl_drm_chunk *chunk, + struct qxl_bo *image_bo, struct qxl_bo *chunk_bo, + uint8_t *surface_base, int width, int height, + int depth, int stride) +{ + int ret; + unsigned int chunk_size =3D sizeof(struct qxl_data_chunk) + stride * heig= ht; + + INIT_LIST_HEAD(&image->chunk_list); + qxl_panic_bo_create(qdev, sizeof(struct qxl_image), false, false, + QXL_GEM_DOMAIN_VRAM, 0, NULL, image_bo); + image->bo =3D image_bo; + + qxl_panic_bo_create(qdev, chunk_size, false, false, + QXL_GEM_DOMAIN_VRAM, 0, NULL, chunk_bo); + chunk->bo =3D chunk_bo; + list_add_tail(&chunk->head, &image->chunk_list); + + ret =3D qxl_image_init(qdev, NULL, image, surface_base, + 0, 0, width, height, depth, stride); + return ret; + +} + int qxl_image_alloc_objects(struct qxl_device *qdev, struct qxl_release *release, diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_obj= ect.c index 66635c55cf85..9e00700f8f03 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -29,6 +29,23 @@ #include "qxl_drv.h" #include "qxl_object.h" =20 +/* for drm panic */ +static void qxl_panic_ttm_bo_destroy(struct ttm_buffer_object *tbo) +{ + struct qxl_bo *bo; + struct qxl_device *qdev; + + bo =3D to_qxl_bo(tbo); + qdev =3D to_qxl(bo->tbo.base.dev); + + qxl_surface_evict(qdev, bo, false); + WARN_ON_ONCE(bo->map_count > 0); + mutex_lock(&qdev->gem.mutex); + list_del_init(&bo->list); + mutex_unlock(&qdev->gem.mutex); + drm_gem_object_release(&bo->tbo.base); +} + static void qxl_ttm_bo_destroy(struct ttm_buffer_object *tbo) { struct qxl_bo *bo; @@ -101,6 +118,51 @@ static const struct drm_gem_object_funcs qxl_object_fu= ncs =3D { .print_info =3D drm_gem_ttm_print_info, }; =20 +/* for drm_panic */ +int qxl_panic_bo_create(struct qxl_device *qdev, unsigned long size, + bool kernel, bool pinned, u32 domain, u32 priority, + struct qxl_surface *surf, struct qxl_bo *bo) +{ + struct ttm_operation_ctx ctx =3D { !kernel, false }; + enum ttm_bo_type type; + int r; + + if (kernel) + type =3D ttm_bo_type_kernel; + else + type =3D ttm_bo_type_device; + + size =3D roundup(size, PAGE_SIZE); + r =3D drm_gem_object_init(&qdev->ddev, &bo->tbo.base, size); + if (unlikely(r)) + return r; + bo->tbo.base.funcs =3D &qxl_object_funcs; + bo->type =3D domain; + bo->surface_id =3D 0; + INIT_LIST_HEAD(&bo->list); + + if (surf) + bo->surf =3D *surf; + + qxl_ttm_placement_from_domain(bo, domain); + + bo->tbo.priority =3D priority; + r =3D ttm_bo_init_reserved(&qdev->mman.bdev, &bo->tbo, type, + &bo->placement, 0, &ctx, NULL, NULL, + &qxl_panic_ttm_bo_destroy); + if (unlikely(r !=3D 0)) { + if (r !=3D -ERESTARTSYS) + dev_err(qdev->ddev.dev, + "object_init failed for (%lu, 0x%08X)\n", + size, domain); + return r; + } + if (pinned) + ttm_bo_pin(&bo->tbo); + ttm_bo_unreserve(&bo->tbo); + return 0; +} + int qxl_bo_create(struct qxl_device *qdev, unsigned long size, bool kernel, bool pinned, u32 domain, u32 priority, struct qxl_surface *surf, diff --git a/drivers/gpu/drm/qxl/qxl_object.h b/drivers/gpu/drm/qxl/qxl_obj= ect.h index 875f63221074..4debb8ce6d08 100644 --- a/drivers/gpu/drm/qxl/qxl_object.h +++ b/drivers/gpu/drm/qxl/qxl_object.h @@ -53,6 +53,10 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *b= o) return bo->tbo.base.size; } =20 +extern int qxl_panic_bo_create(struct qxl_device *qdev, unsigned long size, + bool kernel, bool pinned, u32 domain, u32 priority, + struct qxl_surface *surf, + struct qxl_bo *bo); extern int qxl_bo_create(struct qxl_device *qdev, unsigned long size, bool kernel, bool pinned, u32 domain, --=20 2.46.0