From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (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 B84E1189BB3 for ; Tue, 7 Jan 2025 16:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736268690; cv=none; b=lh63J+9JRE4EVT/R7hOdU7sKHwBlgml2jvhuyjR7Z0iavaP4ms33wVxU8x7NK+UrcAq3mE4JNFgq2EGX2SvoMl5WHeMfiqpICDT1jyoSngoSc7NuG+dm5FtmTTr09pcDK3xKLUc4C2/66Li/DlUVHGUKFpsLFeV7hahHcLqzJJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736268690; c=relaxed/simple; bh=D9TpQtY/D6zTzmvezWBG88w5175KxBu8gJ6iCiap530=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Msg0C7EsUjUQD1bXU0UjkiUTNX4U+JPJg9FeUt0U82CnM+f1QJHSbDhy4EZI6LArU/RoP2Nx3xxeNiEwinp0z8YuypjEOyozE1r9ZQ7qBS7zE0BWm9LNyCDpH/M7onFKkidLtxzw2O/3ARqYN683x97Ynpoonh9NsQj5mfudlFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=u2N3dO7B; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="u2N3dO7B" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7b6ea711805so1762865785a.1 for ; Tue, 07 Jan 2025 08:51:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1736268685; x=1736873485; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wZCgda5/+PgmZz+oMEy39UXN258VdBQY9TXt0VyacJg=; b=u2N3dO7BKY3SBHRfvXrxMqU356Bbvz9tkNbdi9WXglSY3GItz35Ej8ECf0mlzjkniD wxjO+lztB8qwZQ0fN5lSGXpyF7HxH2ZDF+4lVeIcxGuvxVVEnpDD9g2VXwzo9OPi2hM7 Lj+XGvy5jbX5R51w/2VfGpLUeeJiQh8HZ9ZbrgXs2dVLUITfFzh4LAGT83/8MthsMS70 zyOFjyRS5Sijggg2YSEw8BC4rAIr+363zbKTFA++IWmKTOveAgAyHaTFnwUsgm1vmpQK O7ichOp+7U8NSQ6ai2hoLe6k65TyPGhhQnKf45QOKE+MRZoTCMWVcxWRcqWl6E2XPi+/ oEnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736268685; x=1736873485; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wZCgda5/+PgmZz+oMEy39UXN258VdBQY9TXt0VyacJg=; b=ZVMXYK1aOiFtm88Tg9xaGwZuCfhaAgxSzYjfpe8tZSkKbiaIISXdKAT7h4dJ2MEr1Q X3TqmMXyqHkzbqkbv0AI45YOEz2qF6dBo+/gi7m5VPiO0DnhYh6TXnqDUKtZXdfgN5cR wPTTgJ0bgXwoF8BIxY7B3MUlG/IQf3MSUF38GvA2O/teiebmV3DCrSc9QZfXVrstNMV+ S0ANHBj6yXXy1I8eUcA07fRb6u7dkezdWkKxqiANLqPKHVbff4G4hb/fJRrL3p41btcK wm4aa9L6/OdW8p2Y65xGcQO975rEs1Z+1f/c1yvl059rXZMKzndV4XOQgqFR542LTh23 lOGA== X-Forwarded-Encrypted: i=1; AJvYcCUY75geuRzLj/KIrohFvze7tOlH3hfRB7QkwqWA0IMJgPv6LFYuEntb72hdw9gwXWVhryelSbon8LmzAqY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1RLBDweB7bm+9hQHB0xCLv9pLKHvEUAbO+PuXlfbRWmwsZ4H6 DLzZttLsJ+MRa33zDnr4q/rHkelvEJNLjTzMJXAnJCshx+iDGVBG2+HMBGXco4o= X-Gm-Gg: ASbGncuH8jSfUVMqfyprrlInLOHiwUYsLtL2n+P7499Eke4SFl56byCuXjZHbPQhH0X Wj9r4r2JhdiqRkK8DfY42+htiJvchdEfI2QlcXbgWOgFXBAR66AVxLBr2hnpiz8F5/fmRK0da6T VUjS6EgUV78Ya+MPpsKpkVWeuvY9sGHtOBjcVxnDEWnDavsJUq1PwHSMpTDp2bEBxv1EKJxbhbM wcvdEOZmaTPnktyk7VOL/5TRZ8MLmlHGblbpcwqHd2WTdowVNjUM7k8TltdzQG6QBCUhJMnA340 KCXyK8Lb/fT98CPSZmL5eYPu3eYKxvb1IiwrCqI= X-Google-Smtp-Source: AGHT+IFoLbnJvnZUTCjrmSfS98Fm9uoyXS2ITYDQ+HhfMS8Bu5tFyZB+sD7gg0Xw+k/wMILWltmUNg== X-Received: by 2002:a05:620a:260b:b0:7b6:d4a2:f11f with SMTP id af79cd13be357-7b9ba5edeafmr11233954085a.0.1736268685507; Tue, 07 Jan 2025 08:51:25 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b9ac4ef0f6sm1609817885a.123.2025.01.07.08.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 08:51:25 -0800 (PST) Date: Tue, 7 Jan 2025 11:51:23 -0500 From: Gregory Price To: Robert Richter Cc: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, "Fabio M. De Francesco" , Terry Bowman Subject: Re: [PATCH v1 04/29] cxl/pci: Add comments to cxl_hdm_decode_init() Message-ID: References: <20250107141015.3367194-1-rrichter@amd.com> <20250107141015.3367194-5-rrichter@amd.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: <20250107141015.3367194-5-rrichter@amd.com> On Tue, Jan 07, 2025 at 03:09:50PM +0100, Robert Richter wrote: > There are various configuration cases of HDM decoder registers causing > different code paths. Add comments to cxl_hdm_decode_init() to better > explain them. > > Signed-off-by: Robert Richter > --- > drivers/cxl/core/pci.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > This addresses some of my prior questions, but I still think this function is worth some extra scrutiny. Reviewed-by: Gregory Price > diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c > index c7050c13f71a..4d2154457efb 100644 > --- a/drivers/cxl/core/pci.c > +++ b/drivers/cxl/core/pci.c > @@ -416,9 +416,17 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm, > if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm && info->mem_enabled)) > return devm_cxl_enable_mem(&port->dev, cxlds); > > + /* > + * If the HDM Decoder Capability does not exist and DVSEC was > + * not setup, the DVSEC based emulation cannot be used. > + */ > if (!hdm) > return -ENODEV; > > + /* > + * The HDM Decoder Capability exists but is globally disabled. > + */ > + > /* > * Per CXL 2.0 Section 8.1.3.8.3 and 8.1.3.8.4 DVSEC CXL Range 1 Base > * [High,Low] when HDM operation is enabled the range register values > @@ -426,7 +434,8 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm, > * DVSEC Range 1,2 to HDM Decoder Range 0,1. So, non-zero info->ranges > * are expected even though Linux does not require or maintain that > * match. If at least one DVSEC range is enabled and allowed, skip HDM > - * Decoder Capability Enable. > + * Decoder Capability Enable. Else, use the HDM Decoder Capability and > + * enable it. > */ > if (!info->mem_enabled) { > rc = devm_cxl_enable_hdm(&port->dev, cxlhdm); > -- > 2.39.5 >