Re: [PATCH v3 2/2] nvme: prevent admin controller from smart log fetch (LID 2)

From: Hannes Reinecke
Date: Tue Jul 22 2025 - 03:08:09 EST


On 7/18/25 02:14, Kamaljit Singh wrote:
Similar to a discovery ctrl, prevent an admin-ctrl from getting a smart
log. LID 2 is optional for admin controllers to support.

In the future when support for LID=0 (supported log pages) is added,
GLP accesses can be made smarter by basing such calls on response
from LID=0 reads.

Reference: NVMe Base rev 2.2, sec 3.1.3.5, fig 31.
Signed-off-by: Kamaljit Singh <kamaljit.singh1@xxxxxxx>
---
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 105127638c31..6e5c9871b76d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3705,7 +3705,7 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
nvme_configure_opal(ctrl, was_suspended);
- if (!ctrl->identified && !nvme_discovery_ctrl(ctrl)) {
+ if (!ctrl->identified && !nvme_discovery_ctrl(ctrl) && !nvme_admin_ctrl(ctrl)) {
/*
* Do not return errors unless we are in a controller reset,
* the controller works perfectly fine without hwmon.

And to go with my suggestion for the previous patch, maybe it's
an idea to have a helper 'nvme_io_queues_supported()' which could be
used here (and in the previous patch)?

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich