From 08ddb2d74f269236a1d4adf017a719217beac1a2 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Wed, 24 Sep 2025 13:02:16 +0930 Subject: [PATCH 1/2] nvme-mi-dev: Update for improved Admin and PCIe command support Pick up implementations of Admin Identify CNS 11h (Identify Namespace for Allocated Namespace ID) and 12h (Namespace Attached Controller List), along with PCIe / Configuration {Read,Write}. Signed-off-by: Andrew Jeffery --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 088382e..f10751a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -859,7 +859,7 @@ dependencies = [ [[package]] name = "nvme-mi-dev" version = "0.1.0" -source = "git+https://github.com/CodeConstruct/nvme-mi-dev?branch=main#421cd454dc53763d991df0fe748965ea07002527" +source = "git+https://github.com/CodeConstruct/nvme-mi-dev?branch=main#8b38ed3ab4e7189e7ed667a662fbd191d0a80e4b" dependencies = [ "crc", "deku 0.19.1 (git+https://github.com/sharksforarms/deku.git?rev=e5363bc11e123bfcfd3467a2a90aeef8b588f432)", From 42def4f68e6b500bc2bd41d163df192dbe986074 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Wed, 17 Sep 2025 13:28:52 +0930 Subject: [PATCH 2/2] nvme-mi: Accept command effects that maintain current state Further, warn if the values deviate, as this indicates that the model's supported values have changed. Signed-off-by: Andrew Jeffery --- src/main.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 339ff50..5871dca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -220,8 +220,30 @@ async fn nvme_mi(router: &Router<'_>) -> std::io::Result<()> { }; debug!("Handling NVMe-MI message: {msg:x?}"); - mep.handle_async(&mut subsys, msg, ic, resp, async |_| { - Err(CommandEffectError::Unsupported) + mep.handle_async(&mut subsys, msg, ic, resp, async |ce| match ce { + nvme_mi_dev::CommandEffect::SetMtu { port_id, mtus } => { + if port_id != twpid { + warn!("NVMe-MI: Bad Port ID for Set MTU: {port_id:?}"); + return Err(CommandEffectError::InternalError); + } + + if mtus != 64 { + warn!("NVMe-MI: Application lacks support for MTU ({mtus}) != BTU (64)"); + return Err(CommandEffectError::Unsupported); + } + + Ok(()) + } + nvme_mi_dev::CommandEffect::SetSmbusFreq { port_id: _, freq } => { + use nvme_mi_dev::nvme::mi::SmbusFrequency; + + if freq != SmbusFrequency::Freq100Khz { + warn!("NVMe-MI: Application lacks support for I2C bus frequency {:?}", freq); + return Err(CommandEffectError::Unsupported); + } + + Ok(()) + } }) .await; }