git: 3a4ab18377c8 - main - bhyve: Fix cli regression with NVMe ram
Chuck Tuffli
chuck at FreeBSD.org
Wed Jun 16 21:22:40 UTC 2021
The branch main has been updated by chuck:
URL: https://cgit.FreeBSD.org/src/commit/?id=3a4ab18377c86c4588d79c4ca91fe8f4530dc90c
commit 3a4ab18377c86c4588d79c4ca91fe8f4530dc90c
Author: Chuck Tuffli <chuck at FreeBSD.org>
AuthorDate: 2021-06-15 13:59:02 +0000
Commit: Chuck Tuffli <chuck at FreeBSD.org>
CommitDate: 2021-06-16 21:19:01 +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
---
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 0abc0415a1d8..7d472830a40e 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-main
mailing list