From patchwork Tue Jul 23 11:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Lopez Pascual X-Patchwork-Id: 13739958 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C98E4C3DA63 for ; Tue, 23 Jul 2024 11:49:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B533510E588; Tue, 23 Jul 2024 11:49:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="V9NIuU0G"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id C94CE10E581 for ; Tue, 23 Jul 2024 11:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721735368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2ZZ7xf/f12+Tr6LA6vgO8m70M0xzWtORCsg5GqY5FWM=; b=V9NIuU0GjgVQc8bh3z1slKWDtXlBZMczataOr0UU9BQbff9TaSSCaoJ/K57ne2j4v58fwM T7mZ5cIiJGhRThkvhFK87EXIsOYE98+n4LqEUCeRcOpXHEVk9pLJondaJX0Y05HroGpwE6 qZ35Wh9mfZhozd/DZsuUSdjKS4GE564= Received: from mx-prod-mc-03.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-539-lzkINb5QNrO5cKrvekHW6Q-1; Tue, 23 Jul 2024 07:49:22 -0400 X-MC-Unique: lzkINb5QNrO5cKrvekHW6Q-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4387D19560B6; Tue, 23 Jul 2024 11:49:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.194.104]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC9FB1955D45; Tue, 23 Jul 2024 11:49:15 +0000 (UTC) From: Sergio Lopez To: gurchetansingh@chromium.org, tzimmermann@suse.de, mripard@kernel.org, olvaffe@gmail.com, kraxel@redhat.com, daniel@ffwll.ch, maarten.lankhorst@linux.intel.com, airlied@redhat.com Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org, Sergio Lopez Subject: [PATCH 0/2] drm/virtio: introduce the HOST_PAGE_SIZE feature Date: Tue, 23 Jul 2024 07:49:12 -0400 Message-ID: <20240723114914.53677-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's an incresing number of machines supporting multiple page sizes and on these machines the host and a guest can be running, each one, with a different page size. For what pertains to virtio-gpu, this is not a problem if the page size of the guest happens to be bigger or equal than the host, but will potentially lead to failures in memory allocations and/or mappings otherwise. To improve this situation, we introduce here the HOST_PAGE_SIZE feature. This feature indicates that the host has an extended virtio_gpu_config structure that include it's own page size a new field. On the second commit, we also add a new param that can be read with VIRTGPU_GETPARAM by userspace applications running in the guest to obtain the host's page size and find out the right alignment to be used in shared memory allocations. Sergio Lopez (2): drm/virtio: introduce the HOST_PAGE_SIZE feature drm/virtio: add VIRTGPU_PARAM_HOST_PAGE_SIZE to params drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 13 ++++++++++--- include/uapi/drm/virtgpu_drm.h | 1 + include/uapi/linux/virtio_gpu.h | 5 +++++ 6 files changed, 24 insertions(+), 3 deletions(-)