From nobody Fri Dec 19 22:03:00 2025 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=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651663628; cv=none; d=zohomail.com; s=zohoarc; b=Avjy4EkoSldoOToaKMZl8sEo9UzhZk+67WwsoN47Lh7IvcGs22wHICdjy/9+x5rYQm+uPzirG/aKh7P+bWrCzeP3IB+Fu/L+kkmxAKkfGS2YrTSc5gODkwizw2AU8pEEHjQBDM8CHzwHiaG85yR4gUPp91uXYDyzmFvpQgXod2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651663628; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FBGmOd+ztf6Fw/4X0tGkERuaGl13ZSRfvCTVQ/ZlYFA=; b=KQOYuUb69F22hTDeQ0SQTyMv7pgdjObfZvkiZALhfAijOFOQBUvfV/igE51ok3kftL038tZUzxI6tSYG/upSJy6TJgzBM36oNj0b905ZL2S+i38faqFrvNp0oiLS4QnUV9fS9jB+W/0IdGKaMYcNJDUtdVWlH0Jdm9XMaFgcVjQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651663628077160.1417583191909; Wed, 4 May 2022 04:27:08 -0700 (PDT) Received: from localhost ([::1]:36220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nmD9t-0002XA-R7 for importer@patchew.org; Wed, 04 May 2022 07:27:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmBpD-0000Ql-6h for qemu-devel@nongnu.org; Wed, 04 May 2022 06:01:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nmBpA-0006HN-IO for qemu-devel@nongnu.org; Wed, 04 May 2022 06:01:37 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-227-hfw1pr6tP8OGeSdDOoN40A-1; Wed, 04 May 2022 06:01:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31081811E78; Wed, 4 May 2022 10:01:34 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CD3840CFD32; Wed, 4 May 2022 10:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651658495; 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: in-reply-to:in-reply-to:references:references; bh=FBGmOd+ztf6Fw/4X0tGkERuaGl13ZSRfvCTVQ/ZlYFA=; b=BEeBMhTUX/qiYZfLCYh+2fBM11byf2MhcVRqfT1r3rcSUfBFWCQxDsUFiJY/DfPirMkGKE ge5J9LO4t/2d97uuuBpHqAUqWuhiMvEvXvkUwrf9xADYxbvmjLJn6EuqxchcriZiopLBwH 3MMNXGvw8qyzN0Tn2u4pkGTGvgWclj4= X-MC-Unique: hfw1pr6tP8OGeSdDOoN40A-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Richard Henderson , Michael Roth , Peter Maydell , zhenwei pi Subject: [PULL 6/7] qga: Introduce NVMe disk bus type Date: Wed, 4 May 2022 14:01:00 +0400 Message-Id: <20220504100101.564747-7-marcandre.lureau@redhat.com> In-Reply-To: <20220504100101.564747-1-marcandre.lureau@redhat.com> References: <20220504100101.564747-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651663628543100001 From: zhenwei pi Assigning a NVMe disk by VFIO or emulating a NVMe controller by QEMU, a NVMe disk get exposed in guest side. Support NVMe disk bus type and implement posix version. Test PCI passthrough case: ~#virsh qemu-agent-command buster '{"execute":"guest-get-disks"}' | jq ... { "name": "/dev/nvme0n1", "dependencies": [], "partition": false, "address": { "serial": "SAMSUNG MZQL23T8HCLS-00A07_S64HNE0N500076", "bus-type": "nvme", "bus": 0, "unit": 0, "pci-controller": { "bus": 0, "slot": 22, "domain": 0, "function": 0 }, "dev": "/dev/nvme0n1", "target": 0 } ... Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: zhenwei pi Message-Id: <20220420022610.418052-2-pizhenwei@bytedance.com> --- qga/qapi-schema.json | 3 ++- qga/commands-posix.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qga/qapi-schema.json b/qga/qapi-schema.json index 94e4aacdcc65..5ea76cfd1d73 100644 --- a/qga/qapi-schema.json +++ b/qga/qapi-schema.json @@ -827,13 +827,14 @@ # @mmc: Win multimedia card (MMC) bus type # @virtual: Win virtual bus type # @file-backed-virtual: Win file-backed bus type +# @nvme: NVMe disks (since 7.1) # # Since: 2.2; 'Unknown' and all entries below since 2.4 ## { 'enum': 'GuestDiskBusType', 'data': [ 'ide', 'fdc', 'scsi', 'virtio', 'xen', 'usb', 'uml', 'sata', 'sd', 'unknown', 'ieee1394', 'ssa', 'fibre', 'raid', 'iscsi', - 'sas', 'mmc', 'virtual', 'file-backed-virtual' ] } + 'sas', 'mmc', 'virtual', 'file-backed-virtual', 'nvme' ] } =20 =20 ## diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 7ab8d5eb3c69..a5fbae00e90c 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -890,7 +890,8 @@ static bool build_guest_fsinfo_for_pci_dev(char const *= syspath, if (driver && (g_str_equal(driver, "ata_piix") || g_str_equal(driver, "sym53c8xx") || g_str_equal(driver, "virtio-pci") || - g_str_equal(driver, "ahci"))) { + g_str_equal(driver, "ahci") || + g_str_equal(driver, "nvme"))) { break; } =20 @@ -985,6 +986,8 @@ static bool build_guest_fsinfo_for_pci_dev(char const *= syspath, g_debug("no host for '%s' (driver '%s')", syspath, driver); goto cleanup; } + } else if (strcmp(driver, "nvme") =3D=3D 0) { + disk->bus_type =3D GUEST_DISK_BUS_TYPE_NVME; } else { g_debug("unknown driver '%s' (sysfs path '%s')", driver, syspath); goto cleanup; --=20 2.36.0.44.g0f828332d5ac