From: Li Zhijian via <qemu-devel@nongnu.org>
To: Jonathan Cameron <jonathan.cameron@huawei.com>,
Fan Ni <fan.ni@samsung.com>
Cc: qemu-devel@nongnu.org, Li Zhijian <lizhijian@fujitsu.com>
Subject: [PATCH 2/2] CXL/cxl_type3: reset DVSEC CXL Control in ct3d_reset
Date: Tue, 2 Apr 2024 09:46:47 +0800 [thread overview]
Message-ID: <20240402014647.3733839-2-lizhijian@fujitsu.com> (raw)
In-Reply-To: <20240402014647.3733839-1-lizhijian@fujitsu.com>
After the kernel commit
0cab68720598 ("cxl/pci: Fix disabling memory if DVSEC CXL Range does not match a CFMWS window")
CXL type3 devices cannot be enabled again after the reboot because this
flag was not reset.
This flag could be changed by the firmware or OS, let it have a
reset(default) value in reboot so that the OS can read its clean status.
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
hw/mem/cxl_type3.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
index ad2fe7d463fb..3fe136053390 100644
--- a/hw/mem/cxl_type3.c
+++ b/hw/mem/cxl_type3.c
@@ -305,7 +305,8 @@ static void build_dvsecs(CXLType3Dev *ct3d)
dvsec = (uint8_t *)&(CXLDVSECDevice){
.cap = 0x1e,
- .ctrl = 0x2,
+#define CT3D_DEVSEC_CXL_CTRL 0x2
+ .ctrl = CT3D_DEVSEC_CXL_CTRL,
.status2 = 0x2,
.range1_size_hi = range1_size_hi,
.range1_size_lo = range1_size_lo,
@@ -906,6 +907,16 @@ MemTxResult cxl_type3_write(PCIDevice *d, hwaddr host_addr, uint64_t data,
return address_space_write(as, dpa_offset, attrs, &data, size);
}
+/* Reset DVSEC CXL Control */
+static void ct3d_dvsec_cxl_ctrl_reset(CXLType3Dev *ct3d)
+{
+ uint16_t offset = first_dvsec_offset(ct3d);
+ CXLDVSECDevice *dvsec;
+
+ dvsec = (CXLDVSECDevice *)(ct3d->cxl_cstate.pdev->config + offset);
+ dvsec->ctrl = CT3D_DEVSEC_CXL_CTRL;
+}
+
static void ct3d_reset(DeviceState *dev)
{
CXLType3Dev *ct3d = CXL_TYPE3(dev);
@@ -914,6 +925,7 @@ static void ct3d_reset(DeviceState *dev)
cxl_component_register_init_common(reg_state, write_msk, CXL2_TYPE3_DEVICE);
cxl_device_register_init_t3(ct3d);
+ ct3d_dvsec_cxl_ctrl_reset(ct3d);
/*
* Bring up an endpoint to target with MCTP over VDM.
--
2.29.2
next prev parent reply other threads:[~2024-04-02 1:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 1:46 [PATCH 1/2] CXL/cxl_type3: add first_dvsec_offset() helper Li Zhijian via
2024-04-02 1:46 ` Li Zhijian via [this message]
2024-04-02 9:17 ` [PATCH 2/2] CXL/cxl_type3: reset DVSEC CXL Control in ct3d_reset Jonathan Cameron via
2024-04-03 3:42 ` Zhijian Li (Fujitsu) via
2024-04-03 9:17 ` Zhijian Li (Fujitsu) via
2024-04-02 4:09 ` [PATCH 1/2] CXL/cxl_type3: add first_dvsec_offset() helper fan
2024-04-02 5:18 ` Zhijian Li (Fujitsu) via
2024-04-02 9:14 ` 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=20240402014647.3733839-2-lizhijian@fujitsu.com \
--to=qemu-devel@nongnu.org \
--cc=fan.ni@samsung.com \
--cc=jonathan.cameron@huawei.com \
--cc=lizhijian@fujitsu.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.