[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/7] qga: Introduce NVMe disk bus type
From: |
marcandre . lureau |
Subject: |
[PULL 6/7] qga: Introduce NVMe disk bus type |
Date: |
Wed, 4 May 2022 14:01:00 +0400 |
From: zhenwei pi <pizhenwei@bytedance.com>
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é <f4bug@amsat.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
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' ] }
##
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;
}
@@ -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") == 0) {
+ disk->bus_type = GUEST_DISK_BUS_TYPE_NVME;
} else {
g_debug("unknown driver '%s' (sysfs path '%s')", driver, syspath);
goto cleanup;
--
2.36.0.44.g0f828332d5ac
- [PULL 0/7] QGA patches, marcandre . lureau, 2022/05/04
- [PULL 1/7] qga/commands-posix: Use getifaddrs when available, marcandre . lureau, 2022/05/04
- [PULL 2/7] qga/commands-posix: Fix iface hw address detection, marcandre . lureau, 2022/05/04
- [PULL 4/7] qga/commands-posix: Log all net stats failures, marcandre . lureau, 2022/05/04
- [PULL 3/7] qga/commands-posix: Fix listing ifaces for Solaris, marcandre . lureau, 2022/05/04
- [PULL 5/7] qga/commands-posix: 'guest-shutdown' for Solaris, marcandre . lureau, 2022/05/04
- [PULL 6/7] qga: Introduce NVMe disk bus type,
marcandre . lureau <=
- [PULL 7/7] qga: Introduce disk smart, marcandre . lureau, 2022/05/04
- Re: [PULL 0/7] QGA patches, Richard Henderson, 2022/05/04