From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: <qemu-devel@nongnu.org>, Michael Tsirkin <mst@redhat.com>,
Ben Widawsky <bwidawsk@kernel.org>, <linuxarm@huawei.com>,
<linux-cxl@vger.kernel.org>, "Dave Jiang" <dave.jiang@intel.com>,
<alison.schofield@intel.com>, <ira.weiny@intel.com>,
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Subject: Re: [PATCH 7/7] hw/mem/cxl_type3: Add CXL RAS Error Injection Support.
Date: Mon, 16 Jan 2023 11:04:02 +0000 [thread overview]
Message-ID: <20230116110402.00003294@Huawei.com> (raw)
In-Reply-To: <CAL77WPBFT5Ty56bOQR4aQqxi=GZYbwZELiZhkWzB4F-Wn0pZGg@mail.gmail.com>
Hi Mike,
> > +static int ct3d_qmp_uncor_err_to_cxl(CxlUncorErrorType qmp_err)
> > +{
> > + switch (qmp_err) {
> > + case CXL_UNCOR_ERROR_TYPE_CACHE_DATA_PARITY:
> > + return CXL_RAS_UNC_ERR_CACHE_DATA_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_CACHE_ADDRESS_PARITY:
> > + return CXL_RAS_UNC_ERR_CACHE_ADDRESS_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_CACHE_BE_PARITY:
> > + return CXL_RAS_UNC_ERR_CACHE_BE_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_CACHE_DATA_ECC:
> > + return CXL_RAS_UNC_ERR_CACHE_DATA_ECC;
> > + case CXL_UNCOR_ERROR_TYPE_MEM_DATA_PARITY:
> > + return CXL_RAS_UNC_ERR_MEM_DATA_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_MEM_ADDRESS_PARITY:
> > + return CXL_RAS_UNC_ERR_MEM_ADDRESS_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_MEM_BE_PARITY:
> > + return CXL_RAS_UNC_ERR_MEM_BE_PARITY;
> > + case CXL_UNCOR_ERROR_TYPE_MEM_DATA_ECC:
> > + return CXL_RAS_UNC_ERR_MEM_DATA_ECC;
> > + case CXL_UNCOR_ERROR_TYPE_REINIT_THRESHOLD:
> > + return CXL_RAS_UNC_ERR_REINIT_THRESHOLD;
> > + case CXL_UNCOR_ERROR_TYPE_RSVD_ENCODING:
> > + return CXL_RAS_UNC_ERR_RSVD_ENCODING;
> > + case CXL_UNCOR_ERROR_TYPE_POISON_RECEIVED:
> > + return CXL_RAS_UNC_ERR_POISON_RECEIVED;
> > + case CXL_UNCOR_ERROR_TYPE_RECEIVER_OVERFLOW:
> > + return CXL_RAS_UNC_ERR_RECEIVER_OVERFLOW;
> > + case CXL_UNCOR_ERROR_TYPE_INTERNAL:
> > + return CXL_RAS_UNC_ERR_INTERNAL;
> > + case CXL_UNCOR_ERROR_TYPE_CXL_IDE_TX:
> > + return CXL_RAS_UNC_ERR_CXL_IDE_TX;
> > + case CXL_UNCOR_ERROR_TYPE_CXL_IDE_RX:
> > + return CXL_RAS_UNC_ERR_CXL_IDE_RX;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
> > +static int ct3d_qmp_cor_err_to_cxl(CxlUncorErrorType qmp_err)
>
> CxlCorErrorType type is required.
>
> Compiler warns here:
> ../hw/mem/cxl_type3.c:1263:44: error: implicit conversion from
> enumeration type 'CxlCorErrorType' (aka 'enum CxlCorErrorType') to
> different enumeration type 'CxlUncorErrorType' (aka 'enum
> CxlUncorErrorType') [-Werror,-Wenum-conversion]
>
> cxl_err_type = ct3d_qmp_cor_err_to_cxl(type);
>
> ~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
> 1 error generated.
Yikes. Not sure how I missed that!
>
> > +{
> > + switch (qmp_err) {
> > + case CXL_COR_ERROR_TYPE_CACHE_DATA_ECC:
> > + return CXL_RAS_COR_ERR_CACHE_DATA_ECC;
> > + case CXL_COR_ERROR_TYPE_MEM_DATA_ECC:
> > + return CXL_RAS_COR_ERR_MEM_DATA_ECC;
> > + case CXL_COR_ERROR_TYPE_CRC_THRESHOLD:
> > + return CXL_RAS_COR_ERR_CRC_THRESHOLD;
> > + case CXL_COR_ERROR_TYPE_RETRY_THRESHOLD:
> > + return CXL_RAS_COR_ERR_RETRY_THRESHOLD;
> > + case CXL_COR_ERROR_TYPE_CACHE_POISON_RECEIVED:
> > + return CXL_RAS_COR_ERR_CACHE_POISON_RECEIVED;
> > + case CXL_COR_ERROR_TYPE_MEM_POISON_RECEIVED:
> > + return CXL_RAS_COR_ERR_MEM_POISON_RECEIVED;
> > + case CXL_COR_ERROR_TYPE_PHYSICAL:
> > + return CXL_RAS_COR_ERR_PHYSICAL;
> > + default:
> > + return -EINVAL;
> > + }
> > +}
> > +
> > static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value,
> > unsigned size)
> > {
> > @@ -341,6 +402,84 @@ static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value,
> > should_commit = FIELD_EX32(value, CXL_HDM_DECODER0_CTRL, COMMIT);
> > which_hdm = 0;
> > break;
> > + case A_CXL_RAS_UNC_ERR_STATUS:
> > + {
> > + uint32_t capctrl = ldl_le_p(cache_mem + R_CXL_RAS_ERR_CAP_CTRL);
> > + uint32_t fe = FIELD_EX32(capctrl, CXL_RAS_ERR_CAP_CTRL, FIRST_ERROR_POINTER);
> > + CXLError *cxl_err;
> > + uint32_t unc_err;
> > +
> > + /*
> > + * If single bit written that corresponds to the first error
> > + * pointer being cleared, update the status and header log.
> > + */
> > + if (!QTAILQ_EMPTY(&ct3d->error_list)) {
> > + CXLError *cxl_err = QTAILQ_FIRST(&ct3d->error_list);
>
> Is it ok that "CXLError *cxl_err" definition clobbers previous one above?
It isn't a bug as the external one is only used much later in a QTAILQ_FOREACH()
to build the resulting error status register, but it's certainly inelegant
and there is no need for the internal definition so I'll drop it.
I also moved the assignment to the else leg which is the only place that
specific assignment is used.
Thanks for quick review! I'll hold off sending a v2 out for a day or two
to let any other early comments come in.
Jonathan
prev parent reply other threads:[~2023-01-16 11:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 16:17 [PATCH 0/7] hw/cxl: RAS error emulation and injection Jonathan Cameron
2023-01-13 16:17 ` [PATCH 1/7] hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register Jonathan Cameron
2023-01-13 16:17 ` [PATCH 2/7] hw/pci/aer: Add missing routing for AER errors Jonathan Cameron
2023-01-13 16:17 ` [PATCH 3/7] hw/pci-bridge/cxl_root_port: Wire up AER Jonathan Cameron
2023-01-13 16:17 ` [PATCH 4/7] hw/pci-bridge/cxl_root_port: Wire up MSI Jonathan Cameron
2023-01-13 16:17 ` [PATCH 5/7] hw/mem/cxl-type3: Add AER extended capability Jonathan Cameron
2023-01-13 16:17 ` [PATCH 6/7] hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use Jonathan Cameron
2023-01-13 16:17 ` [PATCH 7/7] hw/mem/cxl_type3: Add CXL RAS Error Injection Support Jonathan Cameron
2023-01-15 20:06 ` Mike Maslenkin
2023-01-16 11:04 ` 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=20230116110402.00003294@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=bwidawsk@kernel.org \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mike.maslenkin@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shameerali.kolothum.thodi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox