From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0120848986E for ; Tue, 4 Aug 2026 18:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785867179; cv=none; b=Io61sxfnS9BAR/4gblz92BQfUVraBJb1CvnwP250U5yNkba+RfephkH7HiFPlaU3oAXOQl5PigBFcyZYUouj7NVx+HGljzcLJRB/rv3M8YwhaabYUjyYEnUxwCBcvhAeHqL1Oahp0zYI/F9JrMm8/+MFJrJJwflHHAzNmummV60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785867179; c=relaxed/simple; bh=NT9Qi2eMGwG0QI/OnKkKdPaeDSMLaxRU32STllPny8s=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VPVlk8Pv6mYqLzIrnopAFL3DNWYcl5W1hwx6VFCIZGusA9qdn03xwN8T65fFX7e8i16xeXOUxjEkinmX8Ox0VZ75Mjxyu32FlcdR+BEsRQ0lwJIZ5kjR4nFIc7rRSit79ry1ut6gXz3pFJyrili2btH1oMCSK+hEfyMMTqb9jMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H2mBaNRA; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H2mBaNRA" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-38dc4553f62so130470a91.0 for ; Tue, 04 Aug 2026 11:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785867177; x=1786471977; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:date:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=yX7DTtC7q+PlU+NI840IY/UHNK94JJqd3SZG9x5s1lY=; b=H2mBaNRAu+Xg3occTorB+qRg5rO+KzDZt/mAcjHQmy+fe5aO1L8GZYFxuo6ksFGSIR wL4Ux+HE0wbNkKF8q+/MFo/PrbPs+grc8v9tGjNqVrQAFr3Z74izoibNvGPs3gYfvLUH SXAQwjng+XmiYvsuy7jMAUfW99e6mzvwModOvAPemgjngQi1tx00bESRpyNXt1r49975 IF38wLkGAZGM/q43OF4KeqafnyO8WWUZU2hNo5zULGiPm43XgZgZS0Fct3VL/NqX8tIc I/craB1RLyuTjZ21RrVp3vOxKqOJmedrgeixIjthzTnQ1JgXjPwhss1NS0T3zyV0hgnf +Qtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785867177; x=1786471977; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yX7DTtC7q+PlU+NI840IY/UHNK94JJqd3SZG9x5s1lY=; b=rYtgKFJDxYmPpUdklbtE25DHuKE2Kuv8QgTOxZJlXuOvTWbynRNqTOn0UXva9X87Ht SkZhU+a9B4j8yKPQYa1QjImzs0GxexzmrxSBwLp/mqQ6kz4x8HsfdSU87DsFpMWue/o/ xYFRenwuPa6TLA6ofZUj/HN3HJwgR6czcCg+1iPPxBo1q4FuMPFEyrDg/uSI4vuO4LXe OrhujohsTn+FWG4SlEF4Wjd19mukJ+FCprTXz82MQq+vnPlnHvAAShUpyFQfCOjiYmvo Dp8xIoRfxS/rvb7qLbKcR7lI7c62bKlkcnOhtm2v3kVyke08DAbNK7E3lvofWGcTGKu8 1o2g== X-Forwarded-Encrypted: i=1; AHgh+Rp2z1MnOyeKsN1uU/LHBA9aL2Ae75yqDJpLMP/SWjt+lgtqjcGOyyB+pIRHF0uy72M9orcHFrnIYd8iPOg=@vger.kernel.org X-Gm-Message-State: AOJu0YzXBly94hkWcavYzlSvh7psM9ZLf5s/2zgjyoEcQVuk7dzbm1PV gkjTfUCdzoxngQehukhK/ORk+4tgqVE+NTjhAkGJujF3WTBPU8IPTzPo X-Gm-Gg: AR+sD13B0kk/NkTL4y7pc4R6yjSvOUPoQu5z2zKDlAktMarDqC2S2RuHAl9FMIpHMku ZiKPeI+6Ui08o69yVsBERGjXALiPDuh44mTfA+DVb+A0vM1xs32KHb8M2CZQh+nbPI+JE8gs8Aj m2UYD8C2EbKMSGTRreY0k9KvCtGPGgboU3HRpU86niXbrdbdQovOmloAkSpjAm+1l3pXHoW6qoO XPO63uyC3z8BW6IFJTkIzFL8//dEQwuGpWt9LoufvLNU0irLpoKSTvTorrehug5x9uXqi8XVo4/ BigrZYdnwgDPjTytMFVBTP76xQwzn14RSz0THFkdVXF3qY2THJL3KxC628P9xLzGL7PQiMDyxBO JrHPnt3Oi/RgLh4t3yguuX+V+Yqaqzn/ZqhP1VaPOyOroICKPQL7Z6T+Ytpy3zkCPdbv/JAgXZW P0LGF5+GYaRrbzWegiTg/tSmutY8xJughCuFrU+6zRyXwEzx3IHwUdio/g X-Received: by 2002:a17:90b:51c2:b0:38f:23d6:b4b4 with SMTP id 98e67ed59e1d1-3903c6809f6mr725038a91.22.1785867177031; Tue, 04 Aug 2026 11:12:57 -0700 (PDT) Received: from cxlqual ([220.120.90.131]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-38febfdae85sm1787046a91.3.2026.08.04.11.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 11:12:56 -0700 (PDT) From: Anisa Su X-Google-Original-From: Anisa Su Date: Wed, 5 Aug 2026 03:13:25 +0900 To: Alison Schofield Cc: Anisa Su , linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, Dave Jiang , Jonathan Cameron , Fan Ni , Li Ming , Vishal Verma , Davidlohr Bueso , Ira Weiny , Benjamin Cheatham , Wonjae Lee , Junhee Park , Heesoo Kim Subject: Re: [PATCH v12 1/8] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD) Message-ID: References: <20260731084901.1512819-1-anisa.su@samsung.com> <20260731084901.1512819-2-anisa.su@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Aug 04, 2026 at 09:55:36AM -0700, Alison Schofield wrote: > On Fri, Jul 31, 2026 at 01:48:06AM -0700, Anisa Su wrote: > > From: Ira Weiny > > > > Per the CXL 4.0 specification software must check the Command Effects > > Log (CEL) for dynamic capacity command support. > > > > Detect support for the DCD commands while reading the CEL, including: > > > > Get DC Config > > Get DC Extent List > > Add DC Response > > Release DC > > > > Based on an original patch by Navneet Singh. > > > > Signed-off-by: Ira Weiny > > Signed-off-by: Anisa Su > > Tested-by: Wonjae Lee > > Tested-by: Junhee Park > > Tested-by: Heesoo Kim > > > > --- > > Changes: > > 1. mbox.c: leave mds->dcd_supported false so the hardware enablement > > patches can be upstreamed ahead of the extent and DAX work; the > > event handling patch re-enables it. > > --- > > drivers/cxl/core/mbox.c | 44 +++++++++++++++++++++++++++++++++++++++++ > > drivers/cxl/cxlmem.h | 20 +++++++++++++++++++ > > 2 files changed, 64 insertions(+) > > > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > > index 7c6c5b7450a5..4790524c32a7 100644 > > --- a/drivers/cxl/core/mbox.c > > +++ b/drivers/cxl/core/mbox.c > > @@ -165,6 +165,38 @@ static void cxl_set_security_cmd_enabled(struct cxl_security_state *security, > > } > > } > > > > +static bool cxl_is_dcd_command(u16 opcode) > > +{ > > +#define CXL_MBOX_OP_DCD_CMDS 0x48 > > + > > + return (opcode >> 8) == CXL_MBOX_OP_DCD_CMDS; > > +} > > + > > +static void cxl_set_dcd_cmd_enabled(u16 opcode, unsigned long *cmd_mask) > > +{ > > + switch (opcode) { > > + case CXL_MBOX_OP_GET_DC_CONFIG: > > + set_bit(CXL_DCD_ENABLED_GET_CONFIG, cmd_mask); > > + break; > > + case CXL_MBOX_OP_GET_DC_EXTENT_LIST: > > + set_bit(CXL_DCD_ENABLED_GET_EXTENT_LIST, cmd_mask); > > + break; > > + case CXL_MBOX_OP_ADD_DC_RESPONSE: > > + set_bit(CXL_DCD_ENABLED_ADD_RESPONSE, cmd_mask); > > + break; > > + case CXL_MBOX_OP_RELEASE_DC: > > + set_bit(CXL_DCD_ENABLED_RELEASE, cmd_mask); > > + break; > > + default: > > + break; > > + } > > +} > > + > > +static bool cxl_verify_dcd_cmds(unsigned long *cmds_seen) > > +{ > > + return bitmap_full(cmds_seen, CXL_DCD_ENABLED_MAX); > > +} > > + > > static bool cxl_is_poison_command(u16 opcode) > > { > > #define CXL_MBOX_OP_POISON_CMDS 0x43 > > @@ -757,6 +789,7 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel) > > struct cxl_mailbox *cxl_mbox = &mds->cxlds.cxl_mbox; > > struct cxl_cel_entry *cel_entry; > > const int cel_entries = size / sizeof(*cel_entry); > > + DECLARE_BITMAP(dcd_cmds, CXL_DCD_ENABLED_MAX) = {}; > > struct device *dev = mds->cxlds.dev; > > int i, ro_cmds = 0, wr_cmds = 0; > > > > @@ -785,11 +818,22 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel) > > enabled++; > > } > > > > + if (cxl_is_dcd_command(opcode)) { > > + cxl_set_dcd_cmd_enabled(opcode, dcd_cmds); > > + enabled++; > > + } > > + > > dev_dbg(dev, "Opcode 0x%04x %s\n", opcode, > > enabled ? "enabled" : "unsupported by driver"); > > } > > > > set_features_cap(cxl_mbox, ro_cmds, wr_cmds); > > + /* > > + * Disabled until event handling implemented. > > + */ > > + if (cxl_verify_dcd_cmds(dcd_cmds)) > > + dev_dbg(dev, "Device supports DCD; capability disabled\n"); > > + mds->dcd_supported = false; > > } > > Hi Anisa, > > I read and agree with the other reviewers that this does not need to > mirror the poison and security command handling. > > The one-use cxl_verify_dcd_cmds() helper still seems excessive. The > bitmap can be checked directly here: > > if (bitmap_full(dcd_cmds, CXL_DCD_ENABLED_MAX)) > dev_dbg(dev, "Device supports DCD; capability disabled\n"); > > And then once DCD is ready to be enabled, the assignment can become: > > mds->dcd_supported = > bitmap_full(dcd_cmds, CXL_DCD_ENABLED_MAX); > > -- Alison Applied :) Thanks Alison! - Anisa