From nobody Sat Jul 25 15:52:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1784208330; cv=none; d=zohomail.com; s=zohoarc; b=NdvvgZl0GWLKYJikBCzoallClbAeUd5ItqUN30oS9rVW2lHCpcJwfHXCjLdaUx1Dr6+5Cu+vUI40V+qW+SNEpboJnOClqBo0RFGnW+PG8EYRVssg1qKrLA+vCkFhpymTXAFZcXg0VPzOpjmttbwqPAhIWSvlXXOHLDy9y/6xcGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784208330; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fO5XG110R09Wjc++FkGBZSdG3eU1kTND/sXtT3h2tqw=; b=jJLvMofTjhtvyxg5E9I8o4HnmxhmU8lFi2R/tSgyzHWJufdGAFTAybauZWW7OLpODokDVDxtpBOO9jZ6Wmtn/cC2pKcqvgtJOEZeTGiFop9SCx1vyOO8UdDfhA19twum/jrmyuvaI4z/2P4vOsAxlig5a1EvNcNta5aT4cEABK4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784208330343703.2008422975845; Thu, 16 Jul 2026 06:25:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wkM5b-0005DU-WE; Thu, 16 Jul 2026 09:25:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5R-0004vD-8W for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5N-0004za-22 for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:10 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-548-kntJHUQaMOOb-vF1s6MDsw-1; Thu, 16 Jul 2026 09:25:05 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-493c526df6bso27990535e9.3 for ; Thu, 16 Jul 2026 06:25:05 -0700 (PDT) Received: from fedora (cst-prg-95-48.cust.vodafone.cz. [46.135.95.48]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49543e3afc2sm30347885e9.0.2026.07.16.06.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 06:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784208306; 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=fO5XG110R09Wjc++FkGBZSdG3eU1kTND/sXtT3h2tqw=; b=PdeQ9C+L/ik9HiUOGRkFr3B3hNjeZ7S34mCIRLPkPiWdYb16qes/3Rolat+6hsRctYOdd9 RH6orFW36x4vsUcheyUE2temrJ53uJNc77y/kb1OYHro9KB+zUWVozYDW47sOy+dIqBKsE 0bx2sigshEjAM0r574eBgprAxK1mdr4= X-MC-Unique: kntJHUQaMOOb-vF1s6MDsw-1 X-Mimecast-MFC-AGG-ID: kntJHUQaMOOb-vF1s6MDsw_1784208304 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1784208304; x=1784813104; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fO5XG110R09Wjc++FkGBZSdG3eU1kTND/sXtT3h2tqw=; b=CUFGAaWx/xpxr+JiuLz16tUu2oqLGC5+Ov7EoIu+45iJIQsours/juuUm5w0AcUJta MLnlhibmp2wU3afFbtoMwNeAy983YwCQ+3F3if9ptaGf7KNJg/DNclnw4yjrBLDhjorK e4yyYDXIzBa5uCMrq0fkOzYm+tyRjve2HM1srjBVNKUZMzHNEjl6Z+EuM3VgR4fHkZa8 JsZsAMTzOmcgcnl7XiRuxFyl84G6XlHVdKayrEWQl48L37+bsFUqastWxdJndHWERrKh l8CCjIb9gzOqPjI+vdy7XeZL6TkrpzJQGbck4bxOu3UYWHT0SQgLl/rbsGfLoC8DYMjD dWOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784208304; x=1784813104; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fO5XG110R09Wjc++FkGBZSdG3eU1kTND/sXtT3h2tqw=; b=plGEx/hVjwj4sqaPbyUm5dhQTkZcgm1Qff6n6462S6xgYbbULyJbOvqLWYpqVcO8PN Mp/J6dr8erfTnR61h+SaS14ExyU97sfi+hn4fSIuW/GF6KcUpW8YMBD+fnjzsJfQJs2/ 38Zn0XJtDy6ZAeuc7wX8X7ea1E8G7E7K2MsKOWUvUpHznIorU3y+ujUXU1dRA+Ufh+9V IdUgEe79lA3CyWM0q0GoLePMKOvaXydrXCEcHesZ0/+hfCJruOR+nCU0SjhZuanN1SJ4 Z2MVZrmRm+6OqqTQEUZb0JCRFo/c9u2mzkW2TnO8BTbpeHlAuTJyOczW3UrxZti9Z7k8 3DHw== X-Gm-Message-State: AOJu0YxwVX9f2YchTnsNQIbIVuS6HoPYVVWTAEL5MkCapaMYHqB802DI /+Z0St9enP0ZPonyHM584m55dueZOuIMQocxOVn8f2TGIFgmhtgpaE21NNxPcPfEJWOe2kh1VLy TBGT65EafhfDsoj0Uaa5T+tAv8Rrry3by+Ige+6iT66mUAVR1oFkZQSd76rutlYM0qmw9THBWCY BzmsqwjNyAo2UhW71yK/5SUvyF61gAN1tOUOZFsgDKVplU X-Gm-Gg: AfdE7ckfUoaiH3bpEb9jarrbbz87ZVSV7G1iklG9tmuiF2kdANbDjaWoEIYEwy4SCoe 0UN63mH7mH6SPlQaHHuuQydaqW2nnh11RRZEsiWjKBFJi1s/Pp1GLo2m+XKeDg6TEmUuMd9nEnt ERG8F+/mYC8YrHtDwC+C3kkQv6uwbrOmqD25nSyMTP2yh/z/WErIANSaECDZXhAP2mcnnevtYhH MD5Fd/kpVjlyUCe0B6lmK8yL9EEVT/WFayuhOjbFigUa4LAvmYkR9jNaW79lwf+4NONLzxgqynJ 0XeH/ZtSmUH+vD/jxyhUmvu72VWJpV+asmjivjO/So9+1S28xOd/5dWuVsBYVDNZqUJmBn8fcsz WZcQN7BXzjWALSEEPkMJt8Q== X-Received: by 2002:a05:600c:3e0c:b0:493:f176:dc69 with SMTP id 5b1f17b1804b1-49542c769a5mr28614555e9.37.1784208304009; Thu, 16 Jul 2026 06:25:04 -0700 (PDT) X-Received: by 2002:a05:600c:3e0c:b0:493:f176:dc69 with SMTP id 5b1f17b1804b1-49542c769a5mr28613865e9.37.1784208303513; Thu, 16 Jul 2026 06:25:03 -0700 (PDT) From: Dorinda Bassey To: qemu-devel@nongnu.org Cc: mhrica@redhat.com, mst@redhat.com, sgarzare@redhat.com, manos.pitsidianakis@linaro.org, marcandre.lureau@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, aesteve@redhat.com, Dorinda Bassey Subject: [PATCH 1/3] vhost-user-gpu: Forward RESOURCE_BLOB and CONTEXT_INIT flags Date: Thu, 16 Jul 2026 15:23:57 +0200 Message-ID: <20260716132359.96785-2-dbassey@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260716132359.96785-1-dbassey@redhat.com> References: <20260716132359.96785-1-dbassey@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: permerror client-ip=170.10.133.124; envelope-from=dbassey@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1784208332028158500 Content-Type: text/plain; charset="utf-8" From: Matej Hrica Forward VIRTIO_GPU_F_RESOURCE_BLOB and VIRTIO_GPU_F_CONTEXT_INIT received from a vhost backend to expose it to the guest. Use vhost_dev_has_feature() to query the backend features, matching the existing pattern for RESOURCE_UUID. This allows the guest to negotiate blob resource support and context initialization when the backend (e.g., vhost-device-gpu with Venus) advertises these capabilities. Signed-off-by: Matej Hrica Signed-off-by: Dorinda Bassey Reviewed-by: Manos Pitsidianakis --- hw/display/vhost-user-gpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 57360898ca0..06549c98e07 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -643,6 +643,12 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error= **errp) if (vhost_dev_has_feature(&g->vhost->dev, VIRTIO_GPU_F_RESOURCE_UUID))= { g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_E= NABLED; } + if (vhost_dev_has_feature(&g->vhost->dev, VIRTIO_GPU_F_RESOURCE_BLOB))= { + g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_BLOB_ENABLED; + } + if (vhost_dev_has_feature(&g->vhost->dev, VIRTIO_GPU_F_CONTEXT_INIT)) { + g->parent_obj.conf.flags |=3D 1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_EN= ABLED; + } =20 if (!virtio_gpu_base_device_realize(qdev, NULL, NULL, errp)) { return; --=20 2.52.0 From nobody Sat Jul 25 15:52:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1784208332; cv=none; d=zohomail.com; s=zohoarc; b=XJzd8QpLoMYyOz//6pHijMDOufZ3D+3hBdHXjhUv+sWyVpum3hjQyELXTNwkYSU2iatBTe08MBinmAlNbnIA6ybbzRj+0k72oEmXABH53bOsHkqLUJUdVXrLdRv08cVyJK1sQZ9jMlHzWocHItXh3ox/W+/gQvLAlzOdtZSe/no= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784208332; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XYtTJL5eAFZnnWuFKWoGFz19hddL8Efr2YkMuA32iDk=; b=LeC59DYugA9hb/kT1C/mjTKYjOdHZGZNzIPeIOLR5PHa0HcNvC4rHW1/vo7QmrNbg0sIJZyTD4PjCcZR2U6JZcbOczdG5A+LHyXWt8gx73YAElX/sZu9Ofu30v8y0x38yBISQLWyFDrZtIYzG+ag1Yd0tuc5wQaODkicqRJY0L0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784208332250192.41575081672136; Thu, 16 Jul 2026 06:25:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wkM5d-0005Lt-FA; Thu, 16 Jul 2026 09:25:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5b-00059W-2k for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5X-0005Bi-3z for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:21 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-JZDx0cIaNkuSvuAFMens1A-1; Thu, 16 Jul 2026 09:25:16 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49244130073so68912985e9.1 for ; Thu, 16 Jul 2026 06:25:16 -0700 (PDT) Received: from fedora (cst-prg-95-48.cust.vodafone.cz. [46.135.95.48]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49543e3afc2sm30347885e9.0.2026.07.16.06.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 06:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784208318; 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=XYtTJL5eAFZnnWuFKWoGFz19hddL8Efr2YkMuA32iDk=; b=AHh5rJY+v3LMKGh+TTha8Qou3iqHE8sFjMGgigWGa3dwq0bB35ojchsXSDN4rDh3szZm2x wFCM+zT+w0LumRoBX7AyM7e2wMB50u16gG7v3t7omdMVLKobP5/WQjqNpOompMl+idAPYv 1YfLBiu/IKO1NYa/assIvGX2atqCAOE= X-MC-Unique: JZDx0cIaNkuSvuAFMens1A-1 X-Mimecast-MFC-AGG-ID: JZDx0cIaNkuSvuAFMens1A_1784208316 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1784208315; x=1784813115; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XYtTJL5eAFZnnWuFKWoGFz19hddL8Efr2YkMuA32iDk=; b=Nu4c/icPcF9L/W96TNGx+wzFpJbZwzsbwHSHfow7By/L3R/gu3jhPsX4ocir2YXH0m mJOE7EJqCq/0rxMUuurbQ/3j6l4IqQ2DKvELuv4DXIQoxSYQjYMEfYZ/4uHi0pzl40sl 9ijukMdqByKA9bSJEGIn9ncWllOrAp8kFtMPWZ7fS18RL/fLoZpbgt3EuLw6dMzoqWUA qvnhn2dyBWa9ccmZZ1rSyDHbUBHX4aKoKKJhS2RMU0aKJNcCS15TE8sRNPF4Fh1IOX4G y3Bk/kBeyebyKrt8eO6cf7f8FnCFOXtt41TgKxZIQNOe33A6xBPH40VlT3eoBTnrRvOz 9EcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784208315; x=1784813115; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=XYtTJL5eAFZnnWuFKWoGFz19hddL8Efr2YkMuA32iDk=; b=LFe6pkwNv7y4MqYn33E+3jmT6+MNTDBsFzJ4I/EXEZQnrZXHofTgYyi1T/7dDvb3FU Lk4ITVS8hcr0WBruM7c5mk43muw5T/3dpcooZbKj16Jbq9NnT3DlrWUsrwrkNGVMi9Dd ReDQ8mqXbxKxkv3NTfX2wU7wzrec9MG83qyvJgW4csa1XyALKkt98mRpyalYJXtoeCCk b5gZL5baUVJ4MrB/2SgEn+NOSc1YX6pWKUbX6M8N94bHNRo5GF8FXE7eN7lQWr/QDru5 wHS84PiUz9h8dYDE2rqwx63S9sY9iVMB8BrMa87yAwTqq/I33oFTH3zkK4HBloGDn08I d7dw== X-Gm-Message-State: AOJu0YwFvuncTSJaZ9901i3cvOcLafs7FRQayI7v8HjRxFfdoU8zBJ5r tBVkiCbAdjhe+vsC9/zb5jogz4grOaKu0Elf0uWZfg7KXBuv5axBH0KYiKXRF8NPZwaXn1a2Y6e mi/SUYsKzDxykV2ZkBZBzPlhXgGu9pTLSzaK2KF/DnmDp/rIrpRJn6R9yGg7B4m90+s3WnHmI1H mlQ0KpcvXAaLVDgrAy8Jg5urGaIQfZ+H/X35dtTzhMBVBD X-Gm-Gg: AfdE7cnULi0AWwNdwl5mF90VrGeH+zAhAed7lOsH2ivnc8Rva5fTW1ft7QK6MTBSavY VjQlHE0Q+ig5PO7h2GRQ9tgjATtGXpZripNRmynF7tCnswWiOraT3at68FjyrDYV3+zJ1SBSZUX GvLUMxNbJ89GCs1HJ1Zjs9DmcmdMKt0YxDyL8AeUM/zTgs2Rza98QVISRXiAayuPoygFsR8fjO1 Mgy+TBB1+oaZtz7pAC5qu0KjT311k2ObcLHRNDXUe2JkQzq3LV0mtylm9NgEMuvis9OgVVwUKCg TuRzicCC7QmXHGUQ1tPgbWP28alCNqVFD6VtmCoSRPtUn+6tiQHfKF2iYblVnPsFqaR+BZAJh8f RrN12/rrlKwBPGhxdprpfWw== X-Received: by 2002:a05:600c:6217:b0:492:4363:e7d6 with SMTP id 5b1f17b1804b1-49538cc1510mr118204265e9.37.1784208315663; Thu, 16 Jul 2026 06:25:15 -0700 (PDT) X-Received: by 2002:a05:600c:6217:b0:492:4363:e7d6 with SMTP id 5b1f17b1804b1-49538cc1510mr118203805e9.37.1784208315306; Thu, 16 Jul 2026 06:25:15 -0700 (PDT) From: Dorinda Bassey To: qemu-devel@nongnu.org Cc: mhrica@redhat.com, mst@redhat.com, sgarzare@redhat.com, manos.pitsidianakis@linaro.org, marcandre.lureau@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, aesteve@redhat.com, Dorinda Bassey Subject: [PATCH 2/3] vhost-user-gpu: Add shared memory region support Date: Thu, 16 Jul 2026 15:23:58 +0200 Message-ID: <20260716132359.96785-3-dbassey@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260716132359.96785-1-dbassey@redhat.com> References: <20260716132359.96785-1-dbassey@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: permerror client-ip=170.10.133.124; envelope-from=dbassey@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1784208334038158500 Content-Type: text/plain; charset="utf-8" From: Matej Hrica Add a 'hostmem' property to the vhost-user-gpu which enables the shared memory in the parent object. Register a container MR in the shmem_list for SHMEM_MAP/UNMAP operations. A container MR is used so that SHMEM_MAP FD-backed subregions each get their own KVM memory slot with the correct backing fd. Signed-off-by: Matej Hrica Signed-off-by: Dorinda Bassey --- hw/display/vhost-user-gpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 06549c98e07..7e4580aa895 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -655,6 +655,21 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error= **errp) } =20 g->vhost_gpu_fd =3D -1; + + /* + * If shared memory is enabled, register the hostmem region for + * SHMEM_MAP/UNMAP operations. + */ + if (virtio_gpu_hostmem_enabled(g->parent_obj.conf)) { + VirtioSharedMemory *shmem =3D g_new0(VirtioSharedMemory, 1); + shmem->shmid =3D VIRTIO_GPU_SHM_ID_HOST_VISIBLE; + memory_region_init(&shmem->mr, OBJECT(vdev), + "vhost-user-gpu-shmem", + g->parent_obj.conf.hostmem); + memory_region_add_subregion(&g->parent_obj.hostmem, 0, &shmem->mr); + QTAILQ_INIT(&shmem->mmaps); + QSIMPLEQ_INSERT_TAIL(&vdev->shmem_list, shmem, entry); + } } =20 static struct vhost_dev *vhost_user_gpu_get_vhost(VirtIODevice *vdev) @@ -665,6 +680,7 @@ static struct vhost_dev *vhost_user_gpu_get_vhost(VirtI= ODevice *vdev) =20 static const Property vhost_user_gpu_properties[] =3D { VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf), + DEFINE_PROP_SIZE("hostmem", VhostUserGPU, parent_obj.conf.hostmem, 0), }; =20 static void --=20 2.52.0 From nobody Sat Jul 25 15:52:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1784208332; cv=none; d=zohomail.com; s=zohoarc; b=BK2EEImlDZTf9LMCanVlMwkxI0Q9pG0+hyxNNGG2sfKoclHRyXx0hfvwiHEHsIE8NwTscT1SHoxTpsJfItJ7VJYmvF5sVR5JKBgc+mtkVADiY2zeTjA4xzixWxPpPlVnssoH5uu7/+eVyQ8B/o/3SkvQAp9+jbSk/cKGapu1kLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784208332; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DkSaJgTRZjIeqKLqjNNxLh08mWonj864Ai8oWoOsAdc=; b=RVrqkWjXJVWjsEkUhN0Q8GANoHa4IkFIEDUnbKQjkJwGN2tuuVSbQvF85yjS50mxZ1EngeFJ3hqig7/ydtx99gd64g1jTOafbqOxjLqWhBG/4iUtutwhgBn7Lrvlt5KsPysPuF1rSIUqypOS0e5/Jw6110kJvKJUGsFVc7gpveE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784208332895144.81338496392777; Thu, 16 Jul 2026 06:25:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wkM5h-0005fn-5f; Thu, 16 Jul 2026 09:25:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5f-0005XS-G4 for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wkM5d-0005D7-R9 for qemu-devel@nongnu.org; Thu, 16 Jul 2026 09:25:27 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-6MT1tnA-NQ253bCyq3FGLQ-1; Thu, 16 Jul 2026 09:25:23 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-472a798fc7cso2350838f8f.1 for ; Thu, 16 Jul 2026 06:25:23 -0700 (PDT) Received: from fedora (cst-prg-95-48.cust.vodafone.cz. [46.135.95.48]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49543e3afc2sm30347885e9.0.2026.07.16.06.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2026 06:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784208324; 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=DkSaJgTRZjIeqKLqjNNxLh08mWonj864Ai8oWoOsAdc=; b=g7efAc6fdYY5cQe/wTZWqFf5Ceq9Gb1oSkP5aj2Ml3wcQwFZ5htWnYvyCrgf73s0mJXr49 nBSIecTaQ31C1TDTu15TrGNnk6TW0N4lF0RtmxrT/7dGjUs6kg3W1b3ml6hy8fEgCdYx1u jE4cnQj79xtFxObSdmAxYRd3DF+MAlk= X-MC-Unique: 6MT1tnA-NQ253bCyq3FGLQ-1 X-Mimecast-MFC-AGG-ID: 6MT1tnA-NQ253bCyq3FGLQ_1784208322 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1784208322; x=1784813122; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DkSaJgTRZjIeqKLqjNNxLh08mWonj864Ai8oWoOsAdc=; b=IS+pmSfbLl/s+qAtSosMJGMQ+YeA1XRcmpNU/GTPsY7jBRANivewvDXJSh+jADVwQs bB7R63+KD1tJ5xxY6kiJ0dY0HYpd4ZCozIG394c97fpd1dhdiEWE7xVRoe5LUZAXijA3 x4RmQWi0DTJoJx8Y914kmMMP6f8qG1QTMMfM2qwNVKYGm5YZ6dU0XaI8cv+UieKG2dWd FQgaeO0RHoyETmgggpH/Inwgz2DGVsJWomtQC2JIrbQkvxlKmAT0xiZWuytELSeFqb5F C/Z29DetVisSiJTfx3LrESbG3cq7p3YmtrvR6KyZbJuYarYzm36P3TXcQ9DQcKfd/4QN WPrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784208322; x=1784813122; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=DkSaJgTRZjIeqKLqjNNxLh08mWonj864Ai8oWoOsAdc=; b=o75L5sFOMExXtkJhK9nqTDD7ZJqfwQM9IXU9zySUfw6h6TsZuRYcF138HiGuvjWEdU tmEO6HTSZFSCvGimmcTosnY1yRdufMqRwCAsJ/JVutAzgM0L7I5Tz8UCyEQmrd+4iAda Z8LHIpaw3dlrZyQqgmhetgk7g0CXAlPHQ/cgnf4oNn+P0Lj7gj4p4jdjxbY1xRIJcYFH OUJodC8n7rBawjMrgyRXXd+Ol0YPkN2QPpxlR/3+rQUcxctg3Z5Vx3iA6MaS9jnyf86R MNHumImzDCEqOOgp7DRJcaQISSzbXxKrf8nuHXoZ+mFUsi/+uzWfPtA8mupdSyVzzrOc BtyQ== X-Gm-Message-State: AOJu0Yxe7zAtZimVajga0bLbfVOLev9CRZRiBpbcWuJCl65hHGMbbBHx q+vTqEbKu8xR5GVnFaEoWGHxPkqBp1+CvyITpSafQ4jfrMp+atka0RKBVINgoQdAf9UyEJkBcxz 5mwH3SMbTN4E0hhb7KDuktCV7fcdhGJNEeRBd2klNdaFIGd7GwfSVC1of3DlitE/m+DJhECOBth BwWfw75nuVgAAEiMNVuqWNO6T9K7RTuk8OdC7OkhJEH5km X-Gm-Gg: AfdE7cnUy7nYBaza3OS9a+RrDMVXh12fKzo085rlMWPSNdU33vHingqBAlpGUWCpkUm SvYFbOTz2CiW5ZlIfe/Ho4pAlaHHL9VI86NLAS031WxAPgjldzyzNLNRrYmyM1kyXvmWDSsAH/Z 4IZ5C5j488g7M3qhYU7ux9sDm1PMtGlvz9P93+c3mUkBxOx+HsxmKGo8q0F3fCkY9+rwXY7YYua QMHC9V9/sV6MZxNy1n5tuCoBhEjNqrzJ87Lqv8P2HKVDNdOzEohIdmtfktDcLQrpzX2Ll321yRJ L/O6uhbWEoEp504YwG3CUgPtpI8xwCY6OwPwZ9ipI5JZad4upwmDXsrGTNY+7UDlDXCdl1b0Fte Ry1hs/BB8NHEQkNeVevjKIg== X-Received: by 2002:a05:600c:45c3:b0:495:3e08:ad19 with SMTP id 5b1f17b1804b1-4953e08adb6mr66789455e9.9.1784208322200; Thu, 16 Jul 2026 06:25:22 -0700 (PDT) X-Received: by 2002:a05:600c:45c3:b0:495:3e08:ad19 with SMTP id 5b1f17b1804b1-4953e08adb6mr66788635e9.9.1784208321285; Thu, 16 Jul 2026 06:25:21 -0700 (PDT) From: Dorinda Bassey To: qemu-devel@nongnu.org Cc: mhrica@redhat.com, mst@redhat.com, sgarzare@redhat.com, manos.pitsidianakis@linaro.org, marcandre.lureau@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, aesteve@redhat.com, Dorinda Bassey Subject: [PATCH 3/3] vhost: Fix SHMEM_MAP transaction ordering and resulting deadlock Date: Thu, 16 Jul 2026 15:23:59 +0200 Message-ID: <20260716132359.96785-4-dbassey@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260716132359.96785-1-dbassey@redhat.com> References: <20260716132359.96785-1-dbassey@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: permerror client-ip=170.10.129.124; envelope-from=dbassey@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.01, SPF_HELO_PASS=-0.001, T_SPF_PERMERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1784208334073158500 Content-Type: text/plain; charset="utf-8" Commit the memory region transaction before sending the SHMEM_MAP reply so the KVM memory slot exists before the guest can access the mapped region. This moves the commit to while the backend is still blocked waiting for the reply, which can trigger ADD_MEM_REG back to the backend and deadlock. Filter shmem mapping regions out of vhost_section() by checking the MR owner type to prevent this. Signed-off-by: Dorinda Bassey --- hw/virtio/vhost-user.c | 6 +++--- hw/virtio/vhost.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 517cc4ca716..8d0f463aab8 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1998,17 +1998,17 @@ vhost_user_backend_handle_shmem_map(struct vhost_de= v *dev, } =20 send_reply_commit: - /* Send reply and commit after transaction started */ + /* Commit before reply so the KVM memory slot exists before guest acce= ss */ + memory_region_transaction_commit(); + if (hdr->flags & VHOST_USER_NEED_REPLY_MASK) { payload->u64 =3D !!ret; hdr->size =3D sizeof(payload->u64); if (!vhost_user_send_resp(ioc, hdr, payload, &local_err)) { error_report_err(local_err); - memory_region_transaction_commit(); return -EFAULT; } } - memory_region_transaction_commit(); return 0; =20 send_reply: diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index af41841b529..e5c219be095 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -636,6 +636,16 @@ static bool vhost_section(struct vhost_dev *dev, Memor= yRegionSection *section) { MemoryRegion *mr =3D section->mr; =20 + /* + * Skip shmem mapping regions, they are managed via SHMEM_MAP/UNMAP. + * Including them triggers ADD_MEM_REG during the SHMEM_MAP transaction + * commit, deadlocking the backend. + */ + if (object_dynamic_cast(memory_region_owner(mr), + TYPE_VIRTIO_SHARED_MEMORY_MAPPING)) { + return false; + } + if (memory_region_is_ram(mr) && !memory_region_is_rom(mr)) { uint8_t dirty_mask =3D memory_region_get_dirty_log_mask(mr); uint8_t handled_dirty; --=20 2.52.0