Accepting request 424317 from Base:System

- Don't map controller registers in 'list' command (boo#986891)
  + remove-version-from-list.patch (forwarded request 424189 from morbidrsa)

OBS-URL: https://build.opensuse.org/request/show/424317
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nvme-cli?expand=0&rev=8
This commit is contained in:
Dominique Leuenberger 2016-09-07 09:44:40 +00:00 committed by Git OBS Bridge
commit d49b766591
3 changed files with 91 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,83 @@
From 6ab2e9ef204053d82c1eb40e514119286749cefe Mon Sep 17 00:00:00 2001
From: Keith Busch <keith.busch@intel.com>
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 <keith.busch@intel.com>
Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
---
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++;
}
}