Date: Wed, 16 Jun 2021 21:22:39 GMT From: Chuck Tuffli <chuck@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3a4ab18377c8 - main - bhyve: Fix cli regression with NVMe ram Message-ID: <202106162122.15GLMdFa008779@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=3a4ab18377c86c4588d79c4ca91fe8f4530dc90c commit 3a4ab18377c86c4588d79c4ca91fe8f4530dc90c Author: Chuck Tuffli <chuck@FreeBSD.org> AuthorDate: 2021-06-15 13:59:02 +0000 Commit: Chuck Tuffli <chuck@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@omniosce.org Reviewed by: jhb, andy@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 };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106162122.15GLMdFa008779>