Skip to content

Commit 0598cd6

Browse files
committed
nvme: extend help message when mmap regs fails
Newer kernels enable the lockdown feature when secure boot is enabled. This feature also prevents the register mapping into userspace. Thus it is not enough to have CONFIG_IO_STRICT_DEVMEM disabled. Extend the message with the hint also to disable secure boot. While at it, also lower the reporting level to INFO, so that one single '-v' is enough to get this information. Signed-off-by: Daniel Wagner <dwagner@suse.de>
1 parent 8259e8f commit 0598cd6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

nvme.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -5353,17 +5353,20 @@ static void *mmap_registers(struct nvme_dev *dev, bool writable)
53535353
sprintf(path, "/sys/class/nvme/%s/device/resource0", dev->name);
53545354
fd = open(path, writable ? O_RDWR : O_RDONLY);
53555355
if (fd < 0) {
5356-
if (log_level >= LOG_DEBUG)
5356+
if (log_level >= LOG_INFO)
53575357
nvme_show_error("%s did not find a pci resource, open failed %s",
53585358
dev->name, strerror(errno));
53595359
return NULL;
53605360
}
53615361

53625362
membase = mmap(NULL, getpagesize(), prot, MAP_SHARED, fd, 0);
53635363
if (membase == MAP_FAILED) {
5364-
if (log_level >= LOG_DEBUG) {
5365-
fprintf(stderr, "%s failed to map. ", dev->name);
5366-
fprintf(stderr, "Did your kernel enable CONFIG_IO_STRICT_DEVMEM?\n");
5364+
if (log_level >= LOG_INFO) {
5365+
fprintf(stderr, "Failed to map registers to userspace.\n\n"
5366+
"Did your kernel enable CONFIG_IO_STRICT_DEVMEM?\n"
5367+
"You can disable this feature with command line argument\n\n"
5368+
"\tio_memory=relaxed\n\n"
5369+
"Also ensure secure boot is disabled.\n\n");
53675370
}
53685371
membase = NULL;
53695372
}

0 commit comments

Comments
 (0)