From: sashiko-bot@kernel.org
To: "Ahmed Tiba" <ahmed.tiba@arm.com>
Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org,
devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v8 13/22] ACPI: APEI: GHES: share macros via a private header
Date: Thu, 03 Dec 2026 14:00:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-247910@kernel.org> (raw)
In-Reply-To: <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-13-157aac88560b@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ACPI: APEI: driver-private GHES internals exposed in global
ghes_cper.h
--
commit ca14caa454315f863bdd0d79215b5663a8745fef
Author: Ahmed Tiba <ahmed.tiba@arm.com>
ACPI: APEI: GHES: share macros via a private header
This commit moves GHES CPER helper macros, struct ghes_vendor_record_entry,
and several estatus and lifecycle helper prototypes from
drivers/acpi/apei/ghes.c into a new header include/acpi/ghes_cper.h, dropping
static visibility on those functions in ghes.c.
> diff --git a/include/acpi/ghes_cper.h b/include/acpi/ghes_cper.h
> new file mode 100644
> index 0000000000000..fca7b55ab0148
> --- /dev/null
> +++ b/include/acpi/ghes_cper.h
> @@ -0,0 +1,103 @@
[ ... ]
> +#define GHES_ESOURCE_PREALLOC_MAX_SIZE 65536
> +
> +#define GHES_ESTATUS_POOL_MIN_ALLOC_ORDER 3
> +
> +/* This is just an estimation for memory pool allocation */
> +#define GHES_ESTATUS_CACHE_AVG_SIZE 512
> +
> +#define GHES_ESTATUS_CACHES_SIZE 4
> +
> +#define GHES_ESTATUS_IN_CACHE_MAX_NSEC 10000000000ULL
> +/* Prevent too many caches are allocated because of RCU */
> +#define GHES_ESTATUS_CACHE_ALLOCED_MAX (GHES_ESTATUS_CACHES_SIZE * 3 / 2)
> +
> +#define GHES_ESTATUS_CACHE_LEN(estatus_len) \
> + (sizeof(struct ghes_estatus_cache) + (estatus_len))
> +#define GHES_ESTATUS_FROM_CACHE(estatus_cache) \
> + ((struct acpi_hest_generic_status *) \
> + ((struct ghes_estatus_cache *)(estatus_cache) + 1))
> +
> +#define GHES_ESTATUS_NODE_LEN(estatus_len) \
> + (sizeof(struct ghes_estatus_node) + (estatus_len))
> +#define GHES_ESTATUS_FROM_NODE(estatus_node) \
> + ((struct acpi_hest_generic_status *) \
> + ((struct ghes_estatus_node *)(estatus_node) + 1))
> +
> +#define GHES_VENDOR_ENTRY_LEN(gdata_len) \
> + (sizeof(struct ghes_vendor_record_entry) + (gdata_len))
> +#define GHES_GDATA_FROM_VENDOR_ENTRY(vendor_entry) \
> + ((struct acpi_hest_generic_data *) \
> + ((struct ghes_vendor_record_entry *)(vendor_entry) + 1))
> +
> +static inline bool is_hest_type_generic_v2(struct ghes *ghes)
> +{
> + return ghes->generic->header.type == ACPI_HEST_TYPE_GENERIC_ERROR_V2;
> +}
> +
> +/*
> + * A platform may describe one error source for the handling of synchronous
> + * errors (e.g. MCE or SEA), or for handling asynchronous errors (e.g. SCI
> + * or External Interrupt). On x86, the HEST notifications are always
> + * asynchronous, so only SEA on ARM is delivered as a synchronous
> + * notification.
> + */
> +static inline bool is_hest_sync_notify(struct ghes *ghes)
> +{
> + u8 notify_type = ghes->generic->notify.type;
> +
> + return notify_type == ACPI_HEST_NOTIFY_SEA;
> +}
> +
> +struct ghes_vendor_record_entry {
> + struct work_struct work;
> + int error_severity;
> + char vendor_record[];
> +};
> +
> +#ifdef CONFIG_ACPI_APEI
> +struct ghes *ghes_new(struct acpi_hest_generic *generic);
> +void ghes_fini(struct ghes *ghes);
> +
> +int __ghes_peek_estatus(struct ghes *ghes,
> + struct acpi_hest_generic_status *estatus,
> + u64 *buf_paddr, enum fixed_addresses fixmap_idx);
> +int __ghes_check_estatus(struct ghes *ghes,
> + struct acpi_hest_generic_status *estatus);
> +int __ghes_read_estatus(struct acpi_hest_generic_status *estatus,
> + u64 buf_paddr, enum fixed_addresses fixmap_idx,
> + size_t buf_len);
> +int ghes_read_estatus(struct ghes *ghes,
> + struct acpi_hest_generic_status *estatus,
> + u64 *buf_paddr, enum fixed_addresses fixmap_idx);
> +void ghes_clear_estatus(struct ghes *ghes,
> + struct acpi_hest_generic_status *estatus,
> + u64 buf_paddr, enum fixed_addresses fixmap_idx);
> +#endif
[Severity: Low]
Should these driver-private declarations live in the global
include/acpi/ghes_cper.h header?
While drivers/ras/cper-esource.c (added in commit "RAS: add firmware-first
CPER provider") needs a shared header under include/acpi/ for GHES_PFX,
GHES_ESTATUS_MAX_SIZE, and the CPER reporting entry points, almost everything
added here is never used outside drivers/acpi/apei/.
GHES_ESTATUS_NODE_LEN(), GHES_ESTATUS_FROM_NODE(), and is_hest_sync_notify()
are only used in drivers/acpi/apei/ghes.c, while the pool/cache tuning macros,
vendor record definitions, and is_hest_type_generic_v2() are only used in
drivers/acpi/apei/ghes_cper.c.
The lifecycle and fixmap helpers (ghes_new() through ghes_clear_estatus()) are
shared only between ghes.c and ghes_cper.c, yet are exposed globally without
documenting their ownership or locking contracts: ghes_fini() does not free
the struct ghes allocated by ghes_new(), and the fixmap helpers require caller
serialization for fixmap_idx.
Keeping single-file internals local and placing the APEI-internal cross-file
prototypes in drivers/acpi/apei/apei-internal.h would keep
include/acpi/ghes_cper.h focused on the cross-subsystem API.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-0-157aac88560b@arm.com?part=13
next prev parent reply other threads:[~2026-12-03 14:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 13:40 [PATCH v8 00/22] ACPI: APEI: share GHES CPER helpers and add DT FFH provider Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 01/22] ACPI: APEI: GHES: wait for RCU readers before unmapping Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 02/22] EDAC: ghes: avoid traversing the GHES device list Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 03/22] ACPI: APEI: GHES: track error status pool allocation size Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 04/22] ACPI: APEI: GHES: drain deferred work before freeing a source Ahmed Tiba
2026-12-03 14:00 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 05/22] ACPI: APEI: GHES: apply read-acknowledge masks directly Ahmed Tiba
2026-12-03 13:58 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 06/22] ACPI: APEI: GHES: revalidate the error status length after copying Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 07/22] ACPI: APEI: GHES: free an estatus cache entry when no slot is found Ahmed Tiba
2026-12-03 13:53 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 08/22] efi/cper: include architecture ACPI declarations directly Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 09/22] ACPI: APEI: GHES: allow the error status pool to be extended Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 10/22] ACPI: APEI: GHES: keep task work valid through error reporting Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 11/22] ACPI: APEI: GHES: reset FRU metadata for each CPER section Ahmed Tiba
2026-12-03 13:54 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 12/22] efi/cper: validate the remaining length before reading a section Ahmed Tiba
2026-12-03 13:52 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 13/22] ACPI: APEI: GHES: share macros via a private header Ahmed Tiba
2026-12-03 14:00 ` sashiko-bot [this message]
2026-12-03 13:40 ` [PATCH v8 14/22] ACPI: APEI: GHES: move CPER read helpers Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 15/22] ACPI: APEI: GHES: move GHESv2 ack and alloc helpers Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 16/22] ACPI: APEI: GHES: move estatus cache helpers Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 17/22] ACPI: APEI: GHES: move vendor record helpers Ahmed Tiba
2026-12-03 14:04 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 18/22] ACPI: APEI: GHES: move CXL CPER helpers Ahmed Tiba
2026-12-03 14:09 ` sashiko-bot
2026-12-03 13:40 ` [PATCH v8 19/22] ACPI: APEI: introduce GHES CPER helper configuration Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 20/22] ACPI: APEI: share GHES CPER helpers Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 21/22] dt-bindings: firmware: add arm,ras-cper Ahmed Tiba
2026-12-03 13:40 ` [PATCH v8 22/22] RAS: add firmware-first CPER provider Ahmed Tiba
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=sashiko-outbox-247910@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ahmed.tiba@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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