diff --git a/nvme-cli.changes b/nvme-cli.changes index dd9be5f..9ca0c69 100644 --- a/nvme-cli.changes +++ b/nvme-cli.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 31 11:31:15 UTC 2016 - jthumshirn@suse.com + +- Don't map controller registers in 'list' command (boo#986891) + + remove-version-from-list.patch + ------------------------------------------------------------------- Tue Aug 9 12:19:35 UTC 2016 - jthumshirn@suse.com diff --git a/nvme-cli.spec b/nvme-cli.spec index ea3d8c1..5333724 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -24,6 +24,7 @@ License: GPL-2.0 Group: Hardware/Other Url: https://github.com/linux-nvme/nvme-cli Source: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz +Patch0: remove-version-from-list.patch BuildRequires: pkgconfig(libudev) BuildRoot: %{_tmppath}/%{name}-%{version}-build ExcludeArch: s390x @@ -34,6 +35,7 @@ cli rpm installs core management tools with minimal dependencies. %prep %setup -q +%patch0 -p1 %build echo %{version} > version diff --git a/remove-version-from-list.patch b/remove-version-from-list.patch new file mode 100644 index 0000000..b2fed58 --- /dev/null +++ b/remove-version-from-list.patch @@ -0,0 +1,83 @@ +From 6ab2e9ef204053d82c1eb40e514119286749cefe Mon Sep 17 00:00:00 2001 +From: Keith Busch +Date: Tue, 30 Aug 2016 08:49:19 -0600 +Subject: [PATCH] Remove version from list +Git-commit: 6ab2e9ef204053d82c1eb40e514119286749cefe +References: boo#986891 + +We can't reliably map controller registers due to kernel memory +protections added in kernel commit 90a545e98, so we are removing its +dependency for the 'list' command to run. + +Signed-off-by: Keith Busch +Acked-by: Johannes Thumshirn +--- + nvme.c | 30 ++++++------------------------ + 1 file changed, 6 insertions(+), 24 deletions(-) + +--- a/nvme.c ++++ b/nvme.c +@@ -710,23 +710,9 @@ struct list_item { + int nsid; + struct nvme_id_ns ns; + unsigned block; +- __le32 ver; + }; + + #ifdef LIBUDEV_EXISTS +-/* For pre NVMe 1.2 devices we must get the version from the BAR, not the +- * ctrl_id.*/ +-static void get_version(struct list_item* list_item) +-{ +- struct nvme_bar *bar; +- +- list_item->ver = list_item->ctrl.ver; +- if (list_item->ctrl.ver) +- return; +- get_registers(&bar); +- list_item->ver = bar->vs; +-} +- + static void print_list_item(struct list_item list_item) + { + +@@ -748,25 +734,22 @@ static void print_list_item(struct list_ + char format[128]; + sprintf(format,"%3.0f %2sB + %2d B", (double)lba, l_suffix, + list_item.ns.lbaf[(list_item.ns.flbas & 0x0f)].ms); +- char version[128]; +- sprintf(version,"%d.%d", (list_item.ver >> 16), +- (list_item.ver >> 8) & 0xff); + +- printf("%-16s %-*.*s %-*.*s %-8s %-9d %-26s %-16s %-.*s\n", list_item.node, ++ printf("%-16s %-*.*s %-*.*s %-9d %-26s %-16s %-.*s\n", list_item.node, + (int)sizeof(list_item.ctrl.sn), (int)sizeof(list_item.ctrl.sn), list_item.ctrl.sn, + (int)sizeof(list_item.ctrl.mn), (int)sizeof(list_item.ctrl.mn), list_item.ctrl.mn, +- version, list_item.nsid, usage, format, (int)sizeof(list_item.ctrl.fr), list_item.ctrl.fr); ++ list_item.nsid, usage, format, (int)sizeof(list_item.ctrl.fr), list_item.ctrl.fr); + } + + static void print_list_items(struct list_item *list_items, unsigned len) + { + unsigned i; + +- printf("%-16s %-20s %-40s %-8s %-9s %-26s %-16s %-8s\n", +- "Node", "SN", "Model", "Version", "Namespace", "Usage", "Format", "FW Rev"); +- printf("%-16s %-20s %-40s %-8s %-9s %-26s %-16s %-8s\n", ++ printf("%-16s %-20s %-40s %-9s %-26s %-16s %-8s\n", ++ "Node", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev"); ++ printf("%-16s %-20s %-40s %-9s %-26s %-16s %-8s\n", + "----------------", "--------------------", "----------------------------------------", +- "--------", "---------", "--------------------------", "----------------", "--------"); ++ "---------", "--------------------------", "----------------", "--------"); + for (i = 0 ; i < len ; i++) + print_list_item(list_items[i]); + +@@ -833,7 +816,6 @@ static int list(int argc, char **argv, s + return err; + strcpy(list_items[count].node, node); + list_items[count].block = S_ISBLK(nvme_stat.st_mode); +- get_version(&list_items[count]); + count++; + } + }