All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: <shiju.jose@huawei.com>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>,
	<fan.ni@samsung.com>, <dave@stgolabs.net>, <linuxarm@huawei.com>
Subject: Re: [PATCH qemu v4 7/7] hw/cxl: Add emulation for memory sparing control feature
Date: Fri, 25 Jul 2025 14:31:20 +0100	[thread overview]
Message-ID: <20250725143120.00000eef@huawei.com> (raw)
In-Reply-To: <20250721172228.2118-8-shiju.jose@huawei.com>

On Mon, 21 Jul 2025 18:22:28 +0100
<shiju.jose@huawei.com> wrote:

> From: Shiju Jose <shiju.jose@huawei.com>
> 
> Memory sparing is defined as a repair function that replaces a portion of
> memory with a portion of functional memory at that same DPA. The
> subclasses for this operation vary in terms of the scope of the sparing
> being performed. The Cacheline sparing subclass refers to a sparing
> action that can replace a full cacheline. Row sparing is provided as an
> alternative to PPR sparing functions and its scope is that of a single
> DDR row. Bank sparing allows an entire bank to be replaced. Rank sparing
> is defined as an operation in which an entire DDR rank is replaced.
> 
> Memory sparing maintenance operations may be supported by CXL devices
> that implement CXL.mem protocol. A sparing maintenance operation requests
> the CXL device to perform a repair operation on its media.
> For example, a CXL device with DRAM components that support memory sparing
> features may implement sparing Maintenance operations.
> 
> The host may issue a query command by setting Query Resources flag in the
> Input Payload (CXL Spec 3.2 Table 8-120) to determine availability of
> sparing resources for a given address. In response to a query request,
> the device shall report the resource availability by producing the Memory
> Sparing Event Record (CXL Spec 3.2 Table 8-60) in which the Channel, Rank,
> Nibble Mask, Bank Group, Bank, Row, Column, Sub-Channel fields are a copy
> of the values specified in the request.
> 
> During the execution of a sparing maintenance operation, a CXL memory
> device:
> - May or may not retain data
> - May or may not be able to process CXL.mem requests correctly.
> These CXL memory device capabilities are specified by restriction flags
> in the memory sparing feature readable attributes.
> 
> When a CXL device identifies error on a memory component, the device
> may inform the host about the need for a memory sparing maintenance
> operation by using DRAM event record, where the 'maintenance needed' flag
> may set. The event record contains some of the DPA, Channel, Rank,
> Nibble Mask, Bank Group, Bank, Row, Column, Sub-Channel fields that
> should be repaired. The userspace tool requests for maintenance operation
> if the 'maintenance needed' flag set in the CXL DRAM error record.
> 
> CXL spec 3.2 section 8.2.10.7.2.3 describes the memory sparing feature
> discovery and configuration.
> 
> CXL spec 3.2 section 8.2.10.7.1.4 describes the device's memory sparing
> maintenance operation feature.
> 
> Add emulation for CXL memory device memory sparing control feature
> and memory sparing maintenance operation command.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>


> +    } else if (qemu_uuid_is_equal(&hdr->uuid, &rank_sparing_uuid)) {
> +        CXLMemSparingSetFeature *mem_sparing_set_feature = (void *)payload_in;
> +        CXLMemSparingWriteAttrs *mem_sparing_write_attrs =
> +                            &mem_sparing_set_feature->feat_data;
> +
> +        if (hdr->version != CXL_MEMDEV_SPARING_SET_FEATURE_VERSION) {
> +            return CXL_MBOX_UNSUPPORTED;
> +        }
> +
> +        memcpy((uint8_t *)&ct3d->rank_sparing_wr_attrs + hdr->offset,
> +               mem_sparing_write_attrs,
> +               bytes_to_copy);

Trivial but no need for the wrap.  There were some of these in previous patch as
well.

> +        set_feat_info->data_size += bytes_to_copy;
> +
> +        if (data_transfer_flag == CXL_SET_FEATURE_FLAG_FULL_DATA_TRANSFER ||
> +            data_transfer_flag == CXL_SET_FEATURE_FLAG_FINISH_DATA_TRANSFER) {
> +            ct3d->rank_sparing_attrs.op_mode =
> +                             ct3d->rank_sparing_wr_attrs.op_mode;
> +        }



WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: <shiju.jose@huawei.com>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>,
	<fan.ni@samsung.com>, <dave@stgolabs.net>, <linuxarm@huawei.com>
Subject: Re: [PATCH qemu v4 7/7] hw/cxl: Add emulation for memory sparing control feature
Date: Fri, 25 Jul 2025 14:31:20 +0100	[thread overview]
Message-ID: <20250725143120.00000eef@huawei.com> (raw)
In-Reply-To: <20250721172228.2118-8-shiju.jose@huawei.com>

On Mon, 21 Jul 2025 18:22:28 +0100
<shiju.jose@huawei.com> wrote:

> From: Shiju Jose <shiju.jose@huawei.com>
> 
> Memory sparing is defined as a repair function that replaces a portion of
> memory with a portion of functional memory at that same DPA. The
> subclasses for this operation vary in terms of the scope of the sparing
> being performed. The Cacheline sparing subclass refers to a sparing
> action that can replace a full cacheline. Row sparing is provided as an
> alternative to PPR sparing functions and its scope is that of a single
> DDR row. Bank sparing allows an entire bank to be replaced. Rank sparing
> is defined as an operation in which an entire DDR rank is replaced.
> 
> Memory sparing maintenance operations may be supported by CXL devices
> that implement CXL.mem protocol. A sparing maintenance operation requests
> the CXL device to perform a repair operation on its media.
> For example, a CXL device with DRAM components that support memory sparing
> features may implement sparing Maintenance operations.
> 
> The host may issue a query command by setting Query Resources flag in the
> Input Payload (CXL Spec 3.2 Table 8-120) to determine availability of
> sparing resources for a given address. In response to a query request,
> the device shall report the resource availability by producing the Memory
> Sparing Event Record (CXL Spec 3.2 Table 8-60) in which the Channel, Rank,
> Nibble Mask, Bank Group, Bank, Row, Column, Sub-Channel fields are a copy
> of the values specified in the request.
> 
> During the execution of a sparing maintenance operation, a CXL memory
> device:
> - May or may not retain data
> - May or may not be able to process CXL.mem requests correctly.
> These CXL memory device capabilities are specified by restriction flags
> in the memory sparing feature readable attributes.
> 
> When a CXL device identifies error on a memory component, the device
> may inform the host about the need for a memory sparing maintenance
> operation by using DRAM event record, where the 'maintenance needed' flag
> may set. The event record contains some of the DPA, Channel, Rank,
> Nibble Mask, Bank Group, Bank, Row, Column, Sub-Channel fields that
> should be repaired. The userspace tool requests for maintenance operation
> if the 'maintenance needed' flag set in the CXL DRAM error record.
> 
> CXL spec 3.2 section 8.2.10.7.2.3 describes the memory sparing feature
> discovery and configuration.
> 
> CXL spec 3.2 section 8.2.10.7.1.4 describes the device's memory sparing
> maintenance operation feature.
> 
> Add emulation for CXL memory device memory sparing control feature
> and memory sparing maintenance operation command.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>


> +    } else if (qemu_uuid_is_equal(&hdr->uuid, &rank_sparing_uuid)) {
> +        CXLMemSparingSetFeature *mem_sparing_set_feature = (void *)payload_in;
> +        CXLMemSparingWriteAttrs *mem_sparing_write_attrs =
> +                            &mem_sparing_set_feature->feat_data;
> +
> +        if (hdr->version != CXL_MEMDEV_SPARING_SET_FEATURE_VERSION) {
> +            return CXL_MBOX_UNSUPPORTED;
> +        }
> +
> +        memcpy((uint8_t *)&ct3d->rank_sparing_wr_attrs + hdr->offset,
> +               mem_sparing_write_attrs,
> +               bytes_to_copy);

Trivial but no need for the wrap.  There were some of these in previous patch as
well.

> +        set_feat_info->data_size += bytes_to_copy;
> +
> +        if (data_transfer_flag == CXL_SET_FEATURE_FLAG_FULL_DATA_TRANSFER ||
> +            data_transfer_flag == CXL_SET_FEATURE_FLAG_FINISH_DATA_TRANSFER) {
> +            ct3d->rank_sparing_attrs.op_mode =
> +                             ct3d->rank_sparing_wr_attrs.op_mode;
> +        }




  reply	other threads:[~2025-07-25 13:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 17:22 [PATCH qemu v4 0/7] hw/cxl: Update CXL events to rev3.2 and add maintenance support for memory repair features shiju.jose
2025-07-21 17:22 ` shiju.jose--- via
2025-07-21 17:22 ` [PATCH qemu v4 1/7] hw/cxl/events: Update for rev3.2 common event record format shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-07-25 12:45   ` Jonathan Cameron
2025-07-25 12:45     ` Jonathan Cameron via
2025-08-06  7:45   ` Markus Armbruster
2025-07-21 17:22 ` [PATCH qemu v4 2/7] hw/cxl/events: Updates for rev3.2 general media event record shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-08-06  7:57   ` Markus Armbruster
2025-08-06  9:21     ` Shiju Jose
2025-08-06  9:21       ` Shiju Jose via
2025-08-06 10:23       ` Markus Armbruster
2025-07-21 17:22 ` [PATCH qemu v4 3/7] hw/cxl/events: Updates for rev3.2 DRAM " shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-08-06  8:05   ` Markus Armbruster
2025-07-21 17:22 ` [PATCH qemu v4 4/7] hw/cxl/events: Updates for rev3.2 memory module " shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-08-06  8:08   ` Markus Armbruster
2025-07-21 17:22 ` [PATCH qemu v4 5/7] hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in cmd_features_set_feature() shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-07-21 17:22 ` [PATCH qemu v4 6/7] hw/cxl: Add Maintenance support shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-07-25 13:26   ` Jonathan Cameron
2025-07-25 13:26     ` Jonathan Cameron via
2025-07-21 17:22 ` [PATCH qemu v4 7/7] hw/cxl: Add emulation for memory sparing control feature shiju.jose
2025-07-21 17:22   ` shiju.jose--- via
2025-07-25 13:31   ` Jonathan Cameron [this message]
2025-07-25 13:31     ` Jonathan Cameron via

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=20250725143120.00000eef@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shiju.jose@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.