Linux CXL
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Guixin Liu <kanie@linux.alibaba.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Dave Jiang <dave.jiang@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dan Williams <djbw@kernel.org>, Ira Weiny <iweiny@kernel.org>,
	Li Ming <ming.li@zohomail.com>,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH 3/3] cxl/pci: Update only the Port GPF timeout fields
Date: Sat, 26 Sep 2026 00:44:30 +0100	[thread overview]
Message-ID: <20260926004430.42e9cec3@jic23-hlaptop> (raw)
In-Reply-To: <20260922100026.3742401-4-kanie@linux.alibaba.com>

On Tue, 22 Sep 2026 18:00:13 +0800
Guixin Liu <kanie@linux.alibaba.com> wrote:

> update_gpf_port_dvsec() rebuilds the phase control register from just
> the timeout base and scale, so the rest of the register is cleared by
> the write. The other bits are reserved today and nothing is lost, but
> the full-register rewrite would clobber any field the spec defines
> there later.
> 
> Read-modify-write the register and change only the two timeout
> fields.
> 
> Fixes: a52b6a2c1c99 ("cxl/pci: Support Global Persistent Flush (GPF)")
> Assisted-by: LLM
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>  drivers/cxl/core/pci.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
> index 1f470ab0df3b..72e54facafe8 100644
> --- a/drivers/cxl/core/pci.c
> +++ b/drivers/cxl/core/pci.c
> @@ -846,8 +846,9 @@ static int update_gpf_port_dvsec(struct pci_dev *pdev, int dvsec, int phase)
>  	    FIELD_GET(scale, ctrl) == GPF_TIMEOUT_SCALE_MAX)
>  		return 0;
>  
> -	ctrl = FIELD_PREP(base, GPF_TIMEOUT_BASE_MAX);
> -	ctrl |= FIELD_PREP(scale, GPF_TIMEOUT_SCALE_MAX);
> +	ctrl &= ~(base | scale);
> +	ctrl |= FIELD_PREP(base, GPF_TIMEOUT_BASE_MAX) |
> +		FIELD_PREP(scale, GPF_TIMEOUT_SCALE_MAX);

I think a little nicer if you use a pair of FIELD_MODIFY() and let
the compiler figure out that it can combine things.

>  
>  	rc = pci_write_config_word(pdev, dvsec + offset, ctrl);
>  	if (rc) {


  reply	other threads:[~2026-09-25 23:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 10:00 [PATCH 0/3] cxl/pci: Fix the GPF DVSEC setup path Guixin Liu
2026-09-22 10:00 ` [PATCH 1/3] cxl/pci: Use the Device GPF DVSEC for restricted endpoints Guixin Liu
2026-09-25 23:36   ` Jonathan Cameron
2026-09-28 23:45   ` Dave Jiang
2026-09-22 10:00 ` [PATCH 2/3] cxl/pci: Program the Port GPF timeouts before caching the DVSEC Guixin Liu
2026-09-25 23:43   ` Jonathan Cameron
2026-09-28 23:46   ` Dave Jiang
2026-09-22 10:00 ` [PATCH 3/3] cxl/pci: Update only the Port GPF timeout fields Guixin Liu
2026-09-25 23:44   ` Jonathan Cameron [this message]
2026-10-08  3:15     ` Guixin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260926004430.42e9cec3@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=iweiny@kernel.org \
    --cc=kanie@linux.alibaba.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox