On Mon, Dec 15, 2025 at 03:36:28PM -0600, Ben Cheatham wrote:
snip
> static int poison_action(struct cxl_ctx *ctx, const char *filter,
> - const char *addr_str)
> + const char *addr_str, bool clear)
> {
> struct cxl_memdev *memdev;
> size_t addr;
> @@ -129,12 +142,18 @@ static int poison_action(struct cxl_ctx *ctx, const
> char *filter,
> return -EINVAL;
> }
>
> - rc = cxl_memdev_inject_poison(memdev, addr);
> + if (clear)
> + rc = cxl_memdev_clear_poison(memdev, addr);
> + else
> + rc = cxl_memdev_inject_poison(memdev, addr);
> +
> if (rc)
> - log_err(&iel, "failed to inject poison at %s:%s: %s\n",
> + log_err(&iel, "failed to %s %s:%s: %s\n",
> + clear ? "clear poison at" : "inject point at",
s/point/poison
snip
> +static int clear_action(int argc, const char **argv, struct cxl_ctx *ctx,
> + const struct option *options, const char *usage)
> +{
> + const char * const u[] = {
> + usage,
> + NULL
> + };
> + int rc = -EINVAL;
> +
> + log_init(&iel, "cxl clear-error", "CXL_CLEAR_LOG");
> + argc = parse_options(argc, argv, options, u, 0);
> +
> + if (debug) {
> + cxl_set_log_priority(ctx, LOG_DEBUG);
> + iel.log_priority = LOG_DEBUG;
> + } else {
> + iel.log_priority = LOG_INFO;
> + }
> +
> + if (argc != 1) {
> + usage_with_options(u, options);
> + return rc;
> + }
> +
> + rc = poison_action(ctx, argv[0], clear_param.address, true);
> + if (rc) {
> + log_err(&iel, "Failed to inject poison into %s: %s\n",
s/inject/clear
> + argv[0], strerror(-rc));
> + return rc;
> + }
> +
> + return rc;
> +}
snip