Skip to content
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

Prevent a serial RX overflow if the port is in FIFO mode #307

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

Conversation

DrChat
Copy link
Contributor

@DrChat DrChat commented Apr 16, 2024

  1. If the guest's serial port is in FIFO mode and is almost full, throttle new inputs so that an RX overflow error isn't triggered. This is necessary because a host process on the other end is much faster than the guest, so it can easily overflow the port and cause the guest to discard data.
  2. Open named pipes in an asynchronous mode, just so something is not required to connect to the pipe on startup. This has been a useful change for me, but if it is too problematic I can remove it.

if ((BX_SER_THIS s[port].line_status.rxdata_ready == 0) ||
(BX_SER_THIS s[port].fifo_cntl.enable)) {
((BX_SER_THIS s[port].fifo_cntl.enable) && (BX_SER_THIS s[port].rx_fifo_end < 15))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what your thoughts are on applying this to BX_SER_MODE_RAW - that's the only odd one out here.

Copy link
Contributor

@vruppert vruppert left a comment

Choose a reason for hiding this comment

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

I never tried the pipe-server / pipe-client mode, so I can only confirm that this code compiles without issues.

@DrChat
Copy link
Contributor Author

DrChat commented Apr 26, 2024

@vruppert I've confirmed that it all works locally, though I cannot confirm if it breaks anyone's expectations.
I'm happy to revert that part of this change if no-one is able to confirm that the change is okay.

@stlintel
Copy link
Contributor

is this PR still relevant or already should be dropped ?

@vruppert
Copy link
Contributor

I haven't worked with serial port for a long time and I never tried the "pipe" modes. At the moment I have no chance to test it.

@DrChat
Copy link
Contributor Author

DrChat commented Sep 6, 2024

The fix on line 1545 is definitely still relevant. Let me follow up and drop the other changes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants