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

Darjeeling updates #71

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f4ce129
[ot] hw/opentitan: ot_otp_dj: secret partition should be DAI-readable…
rivos-eblot Jun 28, 2024
6dbbac5
[ot] .gitlab-ci.d: update OTP DJ unit test
rivos-eblot Jun 28, 2024
1f17b52
[ot] system: memory.c: add flatview and address space simplified prin…
rivos-eblot Jun 12, 2024
714a844
[ot] scripts/opentitan: pyot.py: add a machine 'variant' option.
rivos-eblot Jun 7, 2024
29de782
[ot] scripts/opentitan: pyot.py: specify the MTD bus instance for SPI…
rivos-eblot Jun 10, 2024
025096b
[ot] hw/riscv: ibex_common: add an optional offset to memmap functions
rivos-eblot Jun 10, 2024
4394547
[ot] hw/riscv: ibex_common: add ibex_get_current_cpu helper
rivos-eblot Jun 10, 2024
9b96403
[ot] scripts/opentitan: ot.util.log: fix color management for sub log…
rivos-eblot Jun 12, 2024
8c298de
[ot] scripts/opentitan: pyot.py: rework support for multiple QEMU VCP
rivos-eblot Jul 1, 2024
a3e3d89
[ot] scripts/opentitan: pyot.py: colorize each QEMU VCP with a distin…
rivos-eblot Jul 1, 2024
2a7aab9
[ot] scripts/opentitan: ot.util.misc: add a sequence group helper
rivos-eblot Jun 17, 2024
64d88e2
[ot] hw/opentitan: dev_proxy: add device friendly name to trace messages
rivos-eblot Jun 17, 2024
885bd70
[ot] scripts/opentitan: pyot.py: discard QEMU sync messages
rivos-eblot Jun 18, 2024
f8ff057
[ot] scripts/opentitan: pyot.py: rework log message classification
rivos-eblot Jun 18, 2024
396d983
[ot] hw/riscv: ibex_common: use a bitfield rather special address for…
rivos-eblot Jun 18, 2024
8a064c6
[ot] hw/opentitan: ot_dev_proxy: enable interception of disconnected …
rivos-eblot Jun 18, 2024
80ebd38
[ot] scripts/opentitan: pyot.py: add shortcuts for QEMU log messages
rivos-eblot Jun 18, 2024
e871e7e
[ot] hw/opentitan: ot_dma: use int128_getlo to convert MRS size to 64…
loiclefort Jul 1, 2024
a12caae
[ot] hw/opentitan: use memory_region_size instead of int128_getlo
loiclefort Jul 1, 2024
bddd4bb
[ot] .gitlab-ci.d: update baremetal tests
rivos-eblot Jun 6, 2024
3f52cbd
[ot] target/riscv: set MISA.U for Ibex CPUs
loiclefort Jul 2, 2024
4b76e1c
[ot] target/riscv: add support for MISA.X
loiclefort Jul 2, 2024
1a3b87e
[ot] hw/riscv: enable MISA.X for OpenTitan CPU
loiclefort Jul 2, 2024
0aee7c2
[ot] hw/opentitan: fix SPI device busy bit calculation
nmoroze Jun 14, 2024
3f38edf
[ot] hw/opentitan: ot_spi_device: clear out payload length
rivos-eblot Jun 28, 2024
099278f
[ot] scripts/opentitan: ot.spi: add a new Python module for the SPI d…
rivos-eblot Jun 28, 2024
cf11157
[ot] scripts/opentitan: ot.util.log: add a quiet logger mode
rivos-eblot Jul 2, 2024
ad36a3a
[ot] scripts/opentitan: spidevflash: add a new Python script to flash…
rivos-eblot Jun 28, 2024
3c458d1
[ot] docs/opentitan: add documentation for the spidevflash.py tool
rivos-eblot Jul 2, 2024
b80ee68
[ot] hw/riscv: ot_darjeeling, ot_earlgrey: simplify SPI device config…
rivos-eblot Jul 2, 2024
6ac35e9
[ot] .gitlab-ci.d: update baremetal tests
rivos-eblot Jul 2, 2024
4877522
[ot] scripts/opentitan: let dtm.py access memory without halting hart
rivos-eblot Jun 27, 2024
de0a39a
[ot] .gitlab-ci.d: update baremetal tests
rivos-eblot Jul 3, 2024
0935784
[ot] hw/opentitan: ot_otp_dj: update OTP definitions
rivos-eblot Jul 3, 2024
cd134c3
[ot] scripts/opentitan: otptool.py: fix a bug that hid some fields wi…
rivos-eblot Jul 3, 2024
0b2125b
[ot] hw/opentitan: ot_rstmgr: add a debug property to shutdown the VM…
rivos-eblot Jul 3, 2024
6f91842
[ot] hw/opentitan: ot_otp_dj: DAI WRITE data are now committed to the…
rivos-eblot Jul 3, 2024
a2ceca7
[ot] hw/opentitan: ot_csrng: fix handling of flag0 multibitbool value
rivos-eblot Jul 4, 2024
3dce340
[ot] scripts/opentitan: spidevflash.py: decrease trace level
rivos-eblot Jul 4, 2024
63b2c3b
[ot] hw/opentitan: ot_rstmgr, ot_pwrmgr: replace dedicated API with I…
rivos-eblot Jul 4, 2024
5777b97
[ot] hw/riscv: ot_darjeeling, ot_earlgrey: connect PWRMGR reset reque…
rivos-eblot Jul 4, 2024
185fccb
[ot] hw/opentitan: ot_rstmgr: replace platform reset with IRQ line
rivos-eblot Jul 4, 2024
efd8f6c
[ot] hw/riscv: ot_darjeeling, ot_earlgrey: connect RSTMGR reset reque…
rivos-eblot Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.d/opentitan/qemu-ot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
BAREMETAL_REF: "240606-1"
BAREMETAL_REF: "240703-1"
QEMU_BUILD_OPTS: ""

include:
Expand Down
7 changes: 6 additions & 1 deletion docs/opentitan/darjeeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ See [`tools.md`](tools.md)
is set to 10 MHz. This option is very useful/mandatory to run many OpenTitan tests that rely on
time or CPU cycle to validate features. Using `-icount` option slows down execution speed though,
so it is not recommended to use it when the main goal is to develop SW to run on the virtual
machine.
machine. An alternative is to use `-icount shift=auto`, which offers fatest emulation execution,
while preserving an accurate ratio between the vCPU clock and the virtual devices.

* `no_epmp_cfg=true` can be appended to the machine option switch, _i.e._
`-M ot-darjeeeling,no_epmp_cfg=true` to disable the initial ePMP configuration, which can be very
Expand All @@ -162,6 +163,10 @@ See [`tools.md`](tools.md)
* `-cpu lowrisc-ibex,x-zbr=false` can be used to force disable the Zbr experimental-and-deprecated
RISC-V bitmap extension for CRC32 extension.

* `-global ot-rstmgr.fatal_reset=N`, where `N` is an unsigned integer. Force QEMU VM to exit the
N^th^ time the reset manager received a reset request, rather than rebooting the whole machine as
the default behavior.

### AES

* `-global ot-aes.fast-mode=false` can be used to better emulate AES HW IP, as some OT tests expect
Expand Down
20 changes: 10 additions & 10 deletions docs/opentitan/dtm.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# `dtm.py`

`dtm.py` checks that the JTAG/DTM/DM stack is up and running and demonstrates how to use the
Debug Module to access the Ibex core.
`dtm.py` checks that the JTAG/DTM/DM stack is up and running and demonstrates how to use the Debug
Module to access the Ibex core.

## Usage

````text
usage: dtm.py [-h] [-H HOST] [-P PORT] [-Q] [-l IR_LENGTH] [-b BASE] [-I] [-c]
[-C MISA_CHECK] [-x] [-X] [-a ADDRESS] [-m {read,write}]
[-s SIZE] [-f FILE] [-e ELF] [-v] [-d]
usage: dtm.py [-h] [-H HOST] [-P PORT] [-Q] [-t] [-l IR_LENGTH] [-b BASE] [-I]
[-c CSR] [-C CSR_CHECK] [-x] [-X] [-a ADDRESS] [-m {read,write}]
[-s SIZE] [-f FILE] [-e ELF] [-F] [-v] [-d]

Debug Transport Module tiny demo

Expand All @@ -18,12 +18,12 @@ options:
Virtual machine:
-H HOST, --host HOST JTAG host (default: localhost)
-P PORT, --port PORT JTAG port, default: 3335
-Q, --no-quit do not ask the QEMU to quit on exit
-t, --terminate terminate QEMU when done

DMI:
-l IR_LENGTH, --ir-length IR_LENGTH
bit length of the IR register
-b BASE, --base BASE define DMI base address
bit length of the IR register (default: 5)
-b BASE, --base BASE define DMI base address (default: 0x0)

Info:
-I, --info report JTAG ID code and DTM configuration
Expand Down Expand Up @@ -85,13 +85,13 @@ Extras:
* `-P` specify the TCP port of the JTAG server in the QEMU VM, should follow the TCP setting of the
`-chardev socket,id=taprbb,...` option for invoking QEMU.

* `-Q` do not send QEMU a request for termination when this script exits.

* `-s` specify the number of bytes to read from or write to memory. Useful with the `--mem` option.
See also the `--address` option. This option may be omitted for the `write` memory operation, in
which case the size of the specified file is used. Note that only sizes multiple of 4-byte are
supported for now.

* `-t` send QEMU a request for termination when this script exits.

* `-v` can be repeated to increase verbosity of the script, mostly for debug purpose.

* `-X` do not attempt to resume normal execution of the hart once DTM operation have been completed.
Expand Down
39 changes: 25 additions & 14 deletions docs/opentitan/pyot.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
## Usage

````text
usage: pyot.py [-h] [-D DELAY] [-i ICOUNT] [-L LOG_FILE] [-M LOG] [-m MACHINE]
[-Q OPTS] [-q QEMU] [-p DEVICE] [-t TRACE] [-S FIRST_SOC] [-s]
[-U] [-b file] [-c JSON] [-e] [-f RAW] [-K] [-l file] [-O RAW]
[-o VMEM] [-r ELF] [-w CSV] [-x file] [-X] [-F TEST]
[-k SECONDS] [-z] [-R] [-T FACTOR] [-Z] [-v] [-d] [--log-time]
[--debug LOGGER] [--info LOGGER] [--warn LOGGER]
usage: pyot.py [-h] [-D DELAY] [-i ICOUNT] [-L LOG_FILE] [-M VARIANT] [-N LOG]
[-m MACHINE] [-Q OPTS] [-q QEMU] [-P VCP] [-p DEVICE]
[-t TRACE] [-S FIRST_SOC] [-s] [-U] [-b file] [-c JSON] [-e]
[-f RAW] [-K] [-l file] [-O RAW] [-o VMEM] [-r ELF] [-w CSV]
[-x file] [-X] [-F TEST] [-k SECONDS] [-z] [-R] [-T FACTOR]
[-Z] [-v] [-V] [-d] [--log-time] [--debug LOGGER]
[--info LOGGER] [--warn LOGGER]

OpenTitan QEMU unit test sequencer.

Expand All @@ -25,14 +26,18 @@ Virtual machine:
per inst. or 'auto'
-L LOG_FILE, --log_file LOG_FILE
log file for trace and log messages
-M LOG, --log LOG log message types
-M VARIANT, --variant VARIANT
machine variant (machine specific)
-N LOG, --log LOG log message types
-m MACHINE, --machine MACHINE
virtual machine (default to ot-earlgrey)
-Q OPTS, --opts OPTS QEMU verbatim option (can be repeated)
-q QEMU, --qemu QEMU path to qemu application (default: build/qemu-system-
riscv32)
-P VCP, --vcp VCP serial port devices (default: use serial0)
-p DEVICE, --device DEVICE
serial port device name (default to localhost:8000)
serial port device name / template name (default to
localhost:8000)
-t TRACE, --trace TRACE
trace event definition file
-S FIRST_SOC, --first-soc FIRST_SOC
Expand Down Expand Up @@ -73,6 +78,7 @@ Execution:

Extras:
-v, --verbose increase verbosity
-V, --vcp-verbose increase verbosity of QEMU virtual comm ports
-d enable debug mode
--log-time show local time in log messages
--debug LOGGER assign debug level to logger(s)
Expand All @@ -95,12 +101,16 @@ This tool may be used in two ways, which can be combined:
Use 'auto' to enable QEMU adaptive icount counter. Note that this option slows down the execution
of guest applications.
* `-L` / `--log_file` specify the log file for trace and log messages from QEMU.
* `-M` / `--log` specify which log message types should be logged; most useful types are:
* `in_asm` for guest instruction disassembly,
* `unimp` for uimplemented guest features,
* `int` for guest interrupts and exceptions,
* `guest_errors` for unexpected guest behavior,
* `exec` for guest execution stream (caution: highly verbose).
* `-N` / `--log` specify which log message types should be logged; most useful types are:
* `in_asm`/`A` for guest instruction disassembly,
* `unimp`/`U` for uimplemented guest features,
* `int`/`I` for guest interrupts and exceptions,
* `guest_errors`/`G` for unexpected guest behavior,
* `exec`/`E` for guest execution stream (caution: highly verbose).
These definitions may be abbreviated using their upper case, single char variants, _e.g._
`-N GIU` would enable _guest_errors_, _interruptions_ and _unimplemented features_ logs.
* `-M` / `--variant` specify a variant of the selected machine. The accepted values depend on the
machine, see `-m` option.
* `-m` / `--machine` specify the kind of virtual machine to run.
* `-q` / `--qemu` specify an alternative path to the QEMU application.
* `-Q` / `--opts` add a single QEMU option forwarded verbatim to QEMU (no check is performed)
Expand Down Expand Up @@ -165,6 +175,7 @@ This tool may be used in two ways, which can be combined:

### Extras

* `-V` / `--vcp-verbose` can be repeated to increase verbosity of the QEMU virtual comm ports
* `-v` / `--verbose` can be repeated to increase verbosity of the script, mostly for debug purpose.
* `-d` only useful to debug the script, reports any Python traceback to the standard error stream.
* `--log-time` show local time before each logged message
Expand Down
4 changes: 3 additions & 1 deletion docs/opentitan/spi_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ instanciated this way from the command line:

````
-chardev socket,id=spidev,host=localhost,port=8004,server=on,wait=off
-global ot-spi_device.chardev=spidev
````

Note that `opentitantool` and association library do support this protocol when the `qemu` backend
Expand All @@ -57,6 +56,9 @@ Commands:
--qemu-spidev-port <QEMU_SPIDEV_PORT> [default: 8004]
````

IT is also possible to use [`spidevflash.py`](spidevflash.md) tool to upload a binary using the same
protocol.

### SPI device CharDev protocol

SPI clock is not emulated, but each byte exchanged over the communication channel represent 8-bit
Expand Down
47 changes: 47 additions & 0 deletions docs/opentitan/spidevflash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# `spidevflash.py`

`spidevflash.py` is a tiny script to upload bootstrap image using the SPI device virtual device.

## Usage

````text
usage: spidevflash.py [-h] -f FILE [-a ADDRESS] [-r HOST] [-p PORT] [-v] [-d]

SPI device flasher tool.

options:
-h, --help show this help message and exit
-f FILE, --file FILE Binary file to flash
-a ADDRESS, --address ADDRESS
Address in the SPI flash (default to 0)
-r HOST, --host HOST remote host name (default: localhost)
-p PORT, --port PORT remote host TCP port (defaults to 8004)
-v, --verbose increase verbosity
-d, --debug enable debug mode
````

### Arguments

* `-a` specify an alernative start address

* `-d` only useful to debug the script, reports any Python traceback to the standard error stream.

* `-f` specify the binary file to upload

* `-p` specify an alternative port for the TCP connection on the QEMU instance

* `-r` specify the name or address of the remote host running the QEMU instance

* `-v` can be repeated to increase verbosity of the script, mostly for debug purpose.

### Examples

With the following examples:

`-chardev socket,id=spidev,host=localhost,port=8004,server=on,wait=off -global ot-spi_device.chardev=spidev` has been
added to the QEMU command line to create a TCP chardev and connect it the SPI Device backend. See the [SPI Device](spi_device.md) documentation for details.

* Upload a bootstrap binary
````sh
./scripts/opentitan/spidevflash.py -f test_bootstrap_virtual_sim_dv+manifest.bin
````
1 change: 1 addition & 0 deletions docs/opentitan/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ directory to help with these tasks.
* `ot-tidy.sh` is a simple shell wrapper to run clang-tidy (C linter) on OpenTitan files
* `present.py` implements the Present 128-bit scrambler/descrambler used in OTP image files for
HW digest verification.
* [spidevice.py](spidevice.md) is a tiny script to upload a binary using the SPI device.
* `treillis/` directory contains the test application to test the [GPIO](gpio.md) device.
* [`uartmux.py`](uartmux.md) is a tiny stream wrapper to help dealing with multiple QEMU output
streams, typically multiple virtual UARTs.
Expand Down
6 changes: 2 additions & 4 deletions hw/opentitan/ot_csrng.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,7 @@ ot_csrng_handle_instantiate(OtCSRNGState *s, unsigned slot)
uint32_t command = ot_fifo32_peek(&inst->cmd_fifo);
uint32_t clen = FIELD_EX32(command, OT_CSNRG_CMD, CLEN);
bool flag0 =
ot_csrng_check_multibitboot(s, FIELD_EX32(command, OT_CSNRG_CMD, FLAG0),
ALERT_STATUS_BIT(FLAG0));
FIELD_EX32(command, OT_CSNRG_CMD, FLAG0) == OT_MULTIBITBOOL4_TRUE;

uint32_t num;
const uint32_t *buffer =
Expand Down Expand Up @@ -1124,8 +1123,7 @@ static OtCSRNDCmdResult ot_csrng_handle_reseed(OtCSRNGState *s, unsigned slot)

uint32_t command = ot_fifo32_peek(&inst->cmd_fifo);
bool flag0 =
ot_csrng_check_multibitboot(s, FIELD_EX32(command, OT_CSNRG_CMD, FLAG0),
ALERT_STATUS_BIT(FLAG0));
FIELD_EX32(command, OT_CSNRG_CMD, FLAG0) == OT_MULTIBITBOOL4_TRUE;

xtrace_ot_csrng_info("reseed", flag0);

Expand Down
Loading
Loading