git: 704d90845ce2 - stable/13 - bhyve: Fix cli regression with NVMe ram
John Baldwin
jhb at FreeBSD.org
Wed Aug 11 22:14:22 UTC 2021
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=704d90845ce2364b75a97aa69bc687d2cd9e236d
commit 704d90845ce2364b75a97aa69bc687d2cd9e236d
Author: Chuck Tuffli <chuck at FreeBSD.org>
AuthorDate: 2021-06-15 13:59:02 +0000
Commit: John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-08-11 22:13:04 +0000
bhyve: Fix cli regression with NVMe ram
The configuration management refactoring inadvertently removed support
for a RAM-backed NVMe Namespace (i.e. -s X,nvme,ram=16384). This adds it
back.
Reported by: andy at omniosce.org
Reviewed by: jhb, andy at omniosce.org
Fixes: 621b5090487d
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30717
(cherry picked from commit 3a4ab18377c86c4588d79c4ca91fe8f4530dc90c)
---
usr.sbin/bhyve/pci_nvme.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index adf49e1ff61f..9b3fece43fde 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -2800,11 +2800,32 @@ done:
return (error);
}
+static int
+pci_nvme_legacy_config(nvlist_t *nvl, const char *opts)
+{
+ char *cp, *ram;
+
+ if (opts == NULL)
+ return (0);
+
+ if (strncmp(opts, "ram=", 4) == 0) {
+ cp = strchr(opts, ',');
+ if (cp == NULL) {
+ set_config_value_node(nvl, "ram", opts + 4);
+ return (0);
+ }
+ ram = strndup(opts + 4, cp - opts - 4);
+ set_config_value_node(nvl, "ram", ram);
+ free(ram);
+ return (pci_parse_legacy_config(nvl, cp + 1));
+ } else
+ return (blockif_legacy_config(nvl, opts));
+}
struct pci_devemu pci_de_nvme = {
.pe_emu = "nvme",
.pe_init = pci_nvme_init,
- .pe_legacy_config = blockif_legacy_config,
+ .pe_legacy_config = pci_nvme_legacy_config,
.pe_barwrite = pci_nvme_write,
.pe_barread = pci_nvme_read
};
More information about the dev-commits-src-all
mailing list