Skip to content

espi/it8xxx2: waiting till completion of VW send to host #89703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Dino-Li
Copy link
Collaborator

@Dino-Li Dino-Li commented May 9, 2025

On it8xxx2, there are VW transmitted registers indicating that VW signal has been transmitted to host.
This patch checks the register to ensure successful transmission of VW state change.

Copy link

sonarqubecloud bot commented May 9, 2025

VW_CHAN(ESPI_VWIRE_SIGNAL_SLP_LAN, 0x42, BIT(0), BIT(4), 0),
VW_CHAN(ESPI_VWIRE_SIGNAL_HOST_C10, 0x47, BIT(0), BIT(4), 0),
VW_CHAN(ESPI_VWIRE_SIGNAL_DNX_WARN, 0x4a, BIT(1), BIT(5), 0),
VW_CHAN(ESPI_VWIRE_SIGNAL_PME, 0x04, BIT(3), BIT(7), 0xe1),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please define register names for these offsets.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 729 to 1322
while ((vw_reg->VW_INDEX[vw_index] !=
sys_read8(config->base_espi_vw + vw_sent)) &&
timeout < IT8XXX2_ESPI_VW_SEND_TIMEOUT_MS) {
k_busy_wait(10);
timeout += 10;
}

if (timeout >= IT8XXX2_ESPI_VW_SEND_TIMEOUT_MS) {
LOG_WRN("VW send to host has timed out vw[0x%x] = 0x%x",
vw_index, vw_reg->VW_INDEX[vw_index]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while ((vw_reg->VW_INDEX[vw_index] !=
sys_read8(config->base_espi_vw + vw_sent)) &&
timeout < IT8XXX2_ESPI_VW_SEND_TIMEOUT_MS) {
k_busy_wait(10);
timeout += 10;
}
if (timeout >= IT8XXX2_ESPI_VW_SEND_TIMEOUT_MS) {
LOG_WRN("VW send to host has timed out vw[0x%x] = 0x%x",
vw_index, vw_reg->VW_INDEX[vw_index]);
}
if (!WAIT_FOR(vw_reg->VW_INDEX[vw_index] == sys_read8(config->base_espi_vw + vw_sent),
IT8XXX2_ESPI_VW_SEND_TIMEOUT_US, k_busy_wait(10))) {
LOG_WRN("VW send to host has timed out vw[0x%x] = 0x%x",
vw_index, vw_reg->VW_INDEX[vw_index]);
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

keith-zephyr
keith-zephyr previously approved these changes May 19, 2025
sys_read8(config->base_espi_vw + vw_sent),
IT8XXX2_ESPI_VW_SEND_TIMEOUT_US, k_busy_wait(10))) {
LOG_WRN("VW send to host has timed out vw[0x%x] = 0x%x",
vw_index, vw_reg->VW_INDEX[vw_index]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please return -ETIMEDOUT upon failure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dino-Li this is still relevant

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

albertofloyd
albertofloyd previously approved these changes May 21, 2025
@fabiobaltieri
Copy link
Member

heya, this needs a rebase

@Dino-Li
Copy link
Collaborator Author

Dino-Li commented Jul 11, 2025

heya, this needs a rebase

Done.

@Dino-Li
Copy link
Collaborator Author

Dino-Li commented Jul 11, 2025

@albertofloyd @keith-zephyr please revisit.

On it8xxx2, there are VW transmitted registers indicating that VW signal
has been transmitted to host. This patch checks the register to ensure
successful transmission of VW state change.

fixes: zephyrproject-rtos#89298

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Copy link

@dkalowsk dkalowsk added this to the v4.3.0 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants