Skip to content

[ot] hw/opentitan: gpio: report host pin status on query - #341

Merged
sasdf merged 1 commit into
lowRISC:ot-10.2.0-devfrom
sasdf:mjTlwzyyuvo
Nov 4, 2026
Merged

sasdf merged 1 commit into
lowRISC:ot-10.2.0-devfrom
sasdf:mjTlwzyyuvo

Conversation

@sasdf

@sasdf sasdf commented Nov 3, 2026

Copy link
Copy Markdown

Previously, the OpenTitan GPIO monitor sent an unsolicited query command (Q:) upon socket connection in ot_gpio_eg_chr_event_hander and ot_gpio_dj_chr_event_hander. This required external host tools to cache GPIO state across connections to answer QEMU's query.

This behavior makes it difficult to interact with QEMU across multiple opentitantool invocations and differs from other platforms using the HyperDebug board.

Update the GPIO monitor to report host pin status on demand:

  • Remove unsolicited Q: frame transmission on CHR_EVENT_OPENED.
  • In ot_gpio_eg_chr_receive and ot_gpio_dj_chr_receive, handle cmd == 'Q'
    by replying with the current host pin configuration frames:
    • M:%08x\r\n (host output disable mask s->data_bi)
    • I:%08x\r\n (host driven input data s->data_ib)
    • H:%08x\r\n (host pull-up mask s->host_pull in ot_gpio_eg, 0 in ot_gpio_dj)

This allows host tools to actively query and synchronize the current host pin status across connections.

Previously, the OpenTitan GPIO monitor sent an unsolicited query command
(`Q:`) upon socket connection in `ot_gpio_eg_chr_event_hander` and
`ot_gpio_dj_chr_event_hander`. This required external host tools to cache
GPIO state across connections to answer QEMU's query.

This behavior makes it difficult to interact with QEMU across multiple
opentitantool invocations and differs from other platforms using the
HyperDebug board.

Update the GPIO monitor to report host pin status on demand:
- Remove unsolicited `Q:` frame transmission on `CHR_EVENT_OPENED`.
- In `ot_gpio_eg_chr_receive` and `ot_gpio_dj_chr_receive`, handle `cmd == 'Q'`
  by replying with the current host pin configuration frames:
  - `M:%08x\r\n` (host output disable mask `s->data_bi`)
  - `I:%08x\r\n` (host driven input data `s->data_ib`)
  - `H:%08x\r\n` (host pull-up mask `s->host_pull` in `ot_gpio_eg`, `0` in `ot_gpio_dj`)

This allows host tools to actively query and synchronize the current host
pin status across connections.

Signed-off-by: Yi-Hsuan Deng <yhdeng@google.com>
Change-Id: I8b5cd78ce6a62afafa1c70b379d1845ba4dd1527
@sasdf
sasdf requested a review from siemen11 November 3, 2026 18:22
@sasdf
sasdf merged commit 873488f into lowRISC:ot-10.2.0-dev Nov 4, 2026
10 checks passed
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.

2 participants