Linux CXL
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-acpi@vger.kernel.org, bhelgaas@google.com,
	ilpo.jarvinen@linux.intel.com, rafael@kernel.org,
	lenb@kernel.org, bp@alien8.de, guohanjun@huawei.com,
	mchehab@kernel.org, xueshuai@linux.alibaba.com,
	terry.bowman@amd.com, sashiko-bot@kernel.org
Subject: Re: [PATCH v3] PCI/AER: Map a raw AER Capability image field by field
Date: Sat, 12 Sep 2026 00:13:29 +0100	[thread overview]
Message-ID: <20260912001329.6db3222b@jic23-hlaptop> (raw)
In-Reply-To: <20260911164705.841407-1-dave.jiang@intel.com>

On Fri, 11 Sep 2026 09:47:05 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> struct aer_capability_regs is not the hardware layout: the embedded
> struct pcie_tlp_log spans 60 bytes where the Header Log it stands in for
> is 16, so a flat copy misplaces everything behind it.
> 
> extlog_print_pcie(), ghes_handle_aer() and cxl_rch_get_aer_info() work
> around that by stopping at the Header Log, dropping everything past
> offset 44. Flit mode is never decoded either: the Flit bit and Logged
> TLP Size sit at offset 0x18, unread, so the Flit DWORDs at 0x38 are lost
> and the log prints as non-Flit.
> 
> Add aer_cap_regs_unpack() to map the registers individually, taking the
> TLP Log layout from the Flit bit as pcie_read_tlp_log() does. Clamp the
> logged length: Logged TLP Size is 5 bits wide, so an untrusted value
> reaches 31 where dw[] holds 14 and pcie_print_tlp_log() walks
> header_len unbounded.
> 
> Take the image little-endian, as both sources are: CPER by definition,
> PCIe registers on the wire. Read it with get_unaligned_le32(), since a
> CPER section sits wherever firmware put it, and take the two source IDs
> out of the Error Source Identification register by bit position rather
> than byte offset. cxl_rch_get_aer_info() uses readl(), so it hands back
> __le32.
> 
> Convert all three callers. cxl_rch_get_aer_info() now reads the whole
> MMIO block, so size its ioremap by the hardware registers (96 bytes)
> rather than by sizeof(struct aer_capability_regs) (100). Shrinking the
> mapping is safe: the read it replaces stopped at 44 bytes.
> 
> Reported-by: sashiko-bot@kernel.org
> Closes: https://sashiko.dev/#/patchset/20260904172337.1409775-1-dave.jiang@intel.com?part=5
> Link: https://lore.kernel.org/linux-cxl/CAJZ5v0hDv11cPuztPZsaDd7uwD_49KznJy=tzuRO+dZc=CnAEQ@mail.gmail.com/
> Assisted-by: LLM
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Nice.
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

      parent reply	other threads:[~2026-09-11 23:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 16:47 [PATCH v3] PCI/AER: Map a raw AER Capability image field by field Dave Jiang
2026-09-11 16:57 ` sashiko-bot
2026-09-11 23:13 ` Jonathan Cameron [this message]

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=20260912001329.6db3222b@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=dave.jiang@intel.com \
    --cc=guohanjun@huawei.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=terry.bowman@amd.com \
    --cc=xueshuai@linux.alibaba.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