Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e37cb43
[ot] build: bazel: add BUILD.bazel and REPO.bazel for @qemu_opentitan
sasdf Sep 22, 2026
e1d5d74
[ot] build: meson: add qemu-system-riscv32-cov and gcno packaging
sasdf Sep 22, 2026
c807800
[ot] accel/tcg: icount: add exact freq, warp clamp, and idle check
sasdf Sep 22, 2026
93f2d34
[ot] accel/tcg: cputlb: support sub-page offsets and empty-TLB hit
sasdf Sep 22, 2026
225db86
[ot] system: memory: align sub-word accesses to access_size_min
sasdf Sep 22, 2026
f57e147
[ot] target/riscv: rvb: add Xdraft093b bitmanip instructions
sasdf Sep 22, 2026
45ec5ec
[ot] target/riscv: pmp: flush TB on CSR write and enforce sub-page TLB
sasdf Sep 22, 2026
f927619
[ot] target/riscv: pmu: align Ibex mcycle and mhpmcounter3..31 CSRs
sasdf Sep 22, 2026
e32cb0a
[ot] target/riscv: debug: align triggers, scontext, and debug reset
sasdf Sep 22, 2026
7b26b93
[ot] target/riscv: ibex: add NMI delivery and mstack CSR save/restore
sasdf Sep 22, 2026
505ed22
[ot] target/riscv: ibex: add double-fault alert, crash dump, and WFI
sasdf Sep 22, 2026
81182cc
[ot] target/riscv: ibex: support FENCE.I icache key inval in CPUCTRLST
sasdf Sep 22, 2026
238f658
[ot] hw/opentitan: otp_if: add late_debug_mb8 and set_lc_dft_en
sasdf Sep 22, 2026
125e857
[ot] hw/opentitan: ibex_wrapper: implement NMI, RND, alerts, and errs
sasdf Sep 22, 2026
bf30d7a
[ot] hw/opentitan: common: fix shadow reg phase reset and add mubi32
sasdf Sep 22, 2026
c93506e
[ot] hw/opentitan: common: add unclocked MMIO and load fault APIs
sasdf Sep 22, 2026
00bf8d3
[ot] hw/opentitan: vmapper: align virtual mapper translation rules
sasdf Sep 22, 2026
f0bc49b
[ot] hw/jtag: tap_ctrl_rbb: add TAP enable GPIO and property gating
sasdf Sep 22, 2026
7189b2d
[ot] hw/riscv: dm: align Debug Module and DTM with Earlgrey RTL
sasdf Sep 22, 2026
8e1861c
[ot] hw/misc: pulp_rv_dm: align debug_rom, late debug, and TL-UL fault
sasdf Sep 22, 2026
861c029
[ot] hw/intc: sifive_plic: align claim, level IRQ, and TL-UL with RTL
sasdf Sep 22, 2026
ee0ee4e
[ot] hw/opentitan: plic_ext: fix alert pulse, MSIP reset, and permit
sasdf Sep 22, 2026
56147aa
[ot] hw/block: m25p80: add SFDP table and quad/4-byte SPI flash ops
sasdf Sep 22, 2026
3f80cac
[ot] hw/opentitan: otp_eg: align DAI/SW_CFG locks, prim_tl, and PERMIT
sasdf Sep 22, 2026
a6a8b3c
[ot] hw/opentitan: flash: align MP/INFO perms, RMA wipe, and PERMIT
sasdf Sep 22, 2026
817e690
[ot] hw/opentitan: rom_ctrl: align digest window ECC, alerts, permit
sasdf Sep 22, 2026
e3ad724
[ot] hw/opentitan: aes: align ctrl, status, PRNG reseed, and lc_esc
sasdf Sep 22, 2026
f3d4271
[ot] hw/opentitan: hmac: implement SHA-2 256/384/512 and FIFO drain
sasdf Sep 22, 2026
2e57d9f
[ot] hw/opentitan: kmac: align entropy FSM, errchk, and escalation
sasdf Sep 22, 2026
b298b2a
[ot] hw/opentitan: otbn: align ALU, call stack, loop & lock with RTL
sasdf Sep 22, 2026
7356f92
[ot] hw/opentitan: entropy_src: implement health test and FW bypass
sasdf Sep 22, 2026
d2b2413
[ot] hw/opentitan: csrng: align alerts, state dump, and ERR_CODE_TEST
sasdf Sep 22, 2026
f355582
[ot] hw/opentitan: edn: implement boot request mode and auto FSM
sasdf Sep 22, 2026
c5f94c0
[ot] hw/opentitan: alert: implement escalation FSM, dump, and ping
sasdf Sep 22, 2026
024847f
[ot] hw/opentitan: timer: align active CFG0/mtime writes and permits
sasdf Sep 22, 2026
5b5f042
[ot] hw/opentitan: aon_timer: implement bark/bite wakeup and pause
sasdf Sep 22, 2026
a952ab8
[ot] hw/opentitan: ast_eg: align RNG noise rate and CSR access rules
sasdf Sep 22, 2026
a31e526
[ot] hw/opentitan: sensor_eg: implement alert and wake events
sasdf Sep 22, 2026
363d17e
[ot] hw/opentitan: rstmgr: align crash info, sw_reset, and PERMIT
sasdf Sep 22, 2026
9ae4da7
[ot] hw/opentitan: ot_pwrmgr: align FSM, wake_info, and NDM reset
sasdf Sep 22, 2026
8f43df7
[ot] hw/opentitan: keymgr: align seed checks, sideload, and regwen
sasdf Sep 22, 2026
e4eedfb
[ot] hw/opentitan: lc_ctrl: align mubi8 mutex, RMA/SCRAP, and alerts
sasdf Sep 22, 2026
e1cabb8
[ot] hw/opentitan: sram_ctrl: align key rotation, mubi4 W1C, and AON
sasdf Sep 22, 2026
79a73dc
[ot] hw/opentitan: clkmgr: implement clk hints, measure, and jitter
sasdf Sep 22, 2026
b74c09f
[ot] hw/opentitan: adc_ctrl: implement low-power filter and wakeup
sasdf Sep 22, 2026
05671b9
[ot] hw/opentitan: uart: fix baudrate timing, RX break, and irq
sasdf Sep 22, 2026
9738f9c
[ot] hw/opentitan: spi_host: implement dummy cycles, CSB, and stall
sasdf Sep 22, 2026
179ec18
[ot] hw/opentitan: pad_ring: support runtime qom-set & POR_N deassert
sasdf Sep 22, 2026
c647757
[ot] hw/opentitan: i2c: implement target mode, 64B FIFOs, and stretch
sasdf Sep 22, 2026
931abbc
[ot] hw/opentitan: i2c: add pmod-i2c-sensor QOM device and wiring
sasdf Sep 22, 2026
010cee9
[ot] hw/opentitan: pwm: implement Earlgrey PWM controller model
sasdf Sep 22, 2026
b4ae869
[ot] hw/opentitan: pattgen: implement 2-channel pattern generator IP
sasdf Sep 22, 2026
859091f
[ot] hw/opentitan: sysrst_ctrl: implement combo and pin control
sasdf Sep 22, 2026
1655cf8
[ot] hw/opentitan: pinmux_eg: implement pad attr and sleep mux
sasdf Sep 22, 2026
6c95fb0
[ot] hw/opentitan: gpio_eg: implement 63-pad muxing and pad monitor
sasdf Sep 22, 2026
c65d45b
[ot] hw/opentitan: usbdev: implement setup, bulk/iso, and framing
sasdf Sep 22, 2026
cf63a84
[ot] hw/opentitan: i2c_host_proxy: support target stretch and wakeup
sasdf Sep 22, 2026
deb0876
[ot] hw/opentitan: spi_device: implement passthru, TPM, and upload
sasdf Sep 22, 2026
1b080f6
[ot] hw/riscv: ot_earlgrey: wire PMOD I2C sensors and AT24C on board
sasdf Sep 22, 2026
55a3500
[ot] tests/opentitan: earlgrey-tests: update renamed mldsa test targets
siemen11 Oct 30, 2026
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
20 changes: 20 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright lowRISC contributors.
#
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

package(default_visibility = ["//visibility:public"])

exports_files(glob(["**"]))

filegroup(
name = "qemu_src",
srcs = glob(["**"]),
)

filegroup(
name = "ot",
srcs = glob([
"python/qemu/ot/**",
]),
)
4 changes: 4 additions & 0 deletions REPO.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright lowRISC contributors.
#
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
37 changes: 19 additions & 18 deletions accel/tcg/cputlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,23 @@ void tlb_flush_all_cpus_synced(CPUState *src_cpu)
tlb_flush_by_mmuidx_all_cpus_synced(src_cpu, ALL_MMUIDX_BITS);
}

/**
* tlb_entry_is_empty - return true if the entry is not in use
* @te: pointer to CPUTLBEntry
*/
static inline bool tlb_entry_is_empty(const CPUTLBEntry *te)
{
return te->addr_read == -1 && te->addr_write == -1 && te->addr_code == -1;
}

static bool tlb_hit_page_mask_anyprot(CPUTLBEntry *tlb_entry,
vaddr page, vaddr mask)
{
page &= mask;
mask &= TARGET_PAGE_MASK | TLB_INVALID_MASK;
if (tlb_entry_is_empty(tlb_entry)) {
return false;
}
page &= mask & TARGET_PAGE_MASK;
mask &= TARGET_PAGE_MASK;

return (page == (tlb_entry->addr_read & mask) ||
page == (tlb_addr_write(tlb_entry) & mask) ||
Expand All @@ -451,15 +463,6 @@ static inline bool tlb_hit_page_anyprot(CPUTLBEntry *tlb_entry, vaddr page)
return tlb_hit_page_mask_anyprot(tlb_entry, page, -1);
}

/**
* tlb_entry_is_empty - return true if the entry is not in use
* @te: pointer to CPUTLBEntry
*/
static inline bool tlb_entry_is_empty(const CPUTLBEntry *te)
{
return te->addr_read == -1 && te->addr_write == -1 && te->addr_code == -1;
}

/* Called with tlb_c.lock held */
static bool tlb_flush_entry_mask_locked(CPUTLBEntry *tlb_entry,
vaddr page,
Expand Down Expand Up @@ -1151,13 +1154,15 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
* subtract here is that of the page base, and not the same as the
* vaddr we add back in io_prepare()/get_page_addr_code().
*/
hwaddr ofs_diff = (full->phys_addr & ~TARGET_PAGE_MASK) -
(addr & ~TARGET_PAGE_MASK);
desc->fulltlb[index] = *full;
full = &desc->fulltlb[index];
full->xlat_section = iotlb - addr_page;
full->phys_addr = paddr_page;
full->phys_addr = paddr_page + ofs_diff;

/* Now calculate the new entry */
tn.addend = addend - addr_page;
tn.addend = addend - addr_page + ofs_diff;

tlb_set_compare(full, &tn, addr_page, read_flags,
MMU_INST_FETCH, prot & PAGE_EXEC);
Expand Down Expand Up @@ -1292,7 +1297,7 @@ static void io_failed(CPUState *cpu, CPUTLBEntryFull *full, vaddr addr,
{
if (!cpu->ignore_memory_transaction_failures
&& cpu->cc->tcg_ops->do_transaction_failed) {
hwaddr physaddr = full->phys_addr | (addr & ~TARGET_PAGE_MASK);
hwaddr physaddr = full->phys_addr + (addr & ~TARGET_PAGE_MASK);

cpu->cc->tcg_ops->do_transaction_failed(cpu, physaddr, addr, size,
access_type, mmu_idx,
Expand Down Expand Up @@ -1549,10 +1554,6 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, vaddr addr,
return -1;
}

if (full->lg_page_size < TARGET_PAGE_BITS) {
return -1;
}

if (hostp) {
*hostp = p;
}
Expand Down
42 changes: 42 additions & 0 deletions accel/tcg/icount-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,40 @@ int64_t icount_get(void)
return icount;
}

static uint64_t icount_freq_hz;

void icount_set_freq_hz(uint64_t freq_hz)
{
qatomic_set(&icount_freq_hz, freq_hz);
}

int64_t icount_to_ns(int64_t icount)
{
uint64_t freq = qatomic_read(&icount_freq_hz);
if (freq) {
return (int64_t)muldiv64(icount, NANOSECONDS_PER_SECOND, freq);
}
return icount << qatomic_read(&timers_state.icount_time_shift);
}

int64_t icount_get_cycles(void)
{
return icount_get_raw() +
icount_round(qatomic_read_i64(&timers_state.qemu_icount_bias));
}

void icount_advance_bias_ns(int64_t delta_ns)
{
if (delta_ns > 0 && icount_enabled()) {
seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
qatomic_set_i64(&timers_state.qemu_icount_bias,
timers_state.qemu_icount_bias + delta_ns);
seqlock_write_unlock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
}
}

/*
* Correlation between real and virtual time is always going to be
* fairly approximate, so ignore small variation.
Expand Down Expand Up @@ -225,6 +254,13 @@ static void icount_adjust_vm(void *opaque)

int64_t icount_round(int64_t count)
{
if (count <= 0) {
return 0;
}
uint64_t freq = qatomic_read(&icount_freq_hz);
if (freq) {
return (int64_t)muldiv64(count, freq, NANOSECONDS_PER_SECOND) ?: 1;
}
int shift = qatomic_read(&timers_state.icount_time_shift);
return (count + (1 << shift) - 1) >> shift;
}
Expand All @@ -247,6 +283,9 @@ static void icount_warp_rt(void)
return;
}

int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL,
~QEMU_TIMER_ATTR_EXTERNAL);

seqlock_write_lock(&timers_state.vm_clock_seqlock,
&timers_state.vm_clock_lock);
if (runstate_is_running()) {
Expand All @@ -255,6 +294,9 @@ static void icount_warp_rt(void)
int64_t warp_delta;

warp_delta = clock - timers_state.vm_clock_warp_start;
if (deadline >= 0) {
warp_delta = MIN(warp_delta, deadline);
}
if (icount_enabled() == ICOUNT_ADAPTATIVE) {
/*
* In adaptive mode, do not let QEMU_CLOCK_VIRTUAL run too far
Expand Down
30 changes: 24 additions & 6 deletions hw/block/m25p80.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ static const FlashPartInfo known_devices[] = {
/* GigaDevice */
{ INFO("gd25q32", 0xc84016, 0, 64 << 10, 64, ER_4K) },
{ INFO("gd25q64", 0xc84017, 0, 64 << 10, 128, ER_4K) },
{ INFO("gd25q256", 0xc84019, 0, 64 << 10, 512, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_gd25q256 },
{ INFO("gd25b01g", 0xc8401b, 0, 64 << 10, 2048, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_gd25b01g },

/* Intel/Numonyx -- xxxs33b */
{ INFO("160s33b", 0x898911, 0, 64 << 10, 32, 0) },
Expand All @@ -226,7 +230,7 @@ static const FlashPartInfo known_devices[] = {
{ INFO("is25wp064", 0x9d7017, 0, 64 << 10, 128, ER_4K) },
{ INFO("is25wp128", 0x9d7018, 0, 64 << 10, 256, ER_4K),
.sfdp_read = m25p80_sfdp_is25wp128 },
{ INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K),
{ INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_is25wp256 },

/* Macronix */
Expand All @@ -237,6 +241,8 @@ static const FlashPartInfo known_devices[] = {
{ INFO("mx25l3205d", 0xc22016, 0, 64 << 10, 64, 0) },
{ INFO("mx25l6405d", 0xc22017, 0, 64 << 10, 128, 0) },
{ INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) },
{ INFO("mx25l12835f", 0xc22018, 0, 64 << 10, 256, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_mx25l12835f },
{ INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) },
{ INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512,
ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635e },
Expand Down Expand Up @@ -267,7 +273,8 @@ static const FlashPartInfo known_devices[] = {
.sfdp_read = m25p80_sfdp_n25q256a },
{ INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) },
{ INFO("n25q512ax3", 0x20ba20, 0x1000, 64 << 10, 1024, ER_4K) },
{ INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) },
{ INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_mt25ql512ab },
{ INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024,
ER_4K | ER_32K, 2),
.sfdp_read = m25p80_sfdp_mt35xu01g },
Expand Down Expand Up @@ -363,7 +370,7 @@ static const FlashPartInfo known_devices[] = {
.sfdp_read = m25p80_sfdp_w25q256 },
{ INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K),
.sfdp_read = m25p80_sfdp_w25q512jv },
{ INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K),
{ INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_w25q01jvq },
{ INFO("w25q512nw", 0xef6020, 0, 64 << 10, 1024, ER_4K | ER_32K),
.sfdp_read = m25p80_sfdp_w25q512nw },
Expand Down Expand Up @@ -407,6 +414,7 @@ typedef enum {
QPP = 0x32,
QPP_4 = 0x34,
PP_4 = 0x38,
QPP_GD = 0xc2,
RDID_90 = 0x90,
RDID_AB = 0xab,
AAI_WP = 0xad,
Expand Down Expand Up @@ -546,6 +554,7 @@ static inline Manufacturer get_man(Flash *s)
case 0x20:
return MAN_NUMONYX;
case 0xEF:
case 0xC8:
return MAN_WINBOND;
case 0x01:
return MAN_SPANSION;
Expand Down Expand Up @@ -768,6 +777,7 @@ static void complete_collecting_data(Flash *s)
case PP4:
case PP4_4:
case PP_4:
case QPP_GD:
s->state = STATE_PAGE_PROGRAM;
break;
case AAI_WP:
Expand Down Expand Up @@ -815,6 +825,7 @@ static void complete_collecting_data(Flash *s)
s->quad_enable = !!(s->data[1] & 0x02);
break;
case MAN_ISSI:
case MAN_NUMONYX:
s->quad_enable = extract32(s->data[0], 6, 1);
break;
case MAN_MACRONIX:
Expand Down Expand Up @@ -1011,7 +1022,7 @@ static void decode_fast_read_cmd(Flash *s)
s->needed_bytes += 1;
break;
case MAN_NUMONYX:
s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
s->needed_bytes += numonyx_extract_cfg_num_dummies(s) / 8;
break;
case MAN_MACRONIX:
s->needed_bytes += 1;
Expand Down Expand Up @@ -1211,6 +1222,7 @@ static void decode_new_cmd(Flash *s, uint32_t value)
case QPP:
case QPP_4:
case PP4_4:
case QPP_GD:
if (get_man(s) != MAN_NUMONYX || numonyx_mode(s) != MODE_DIO) {
s->needed_bytes = get_addr_length(s);
s->pos = 0;
Expand Down Expand Up @@ -1347,15 +1359,21 @@ static void decode_new_cmd(Flash *s, uint32_t value)
s->data[0] |= (!!s->block_protect3) << 6;
}

if (get_man(s) == MAN_MACRONIX || get_man(s) == MAN_ISSI) {
if (get_man(s) == MAN_MACRONIX || get_man(s) == MAN_ISSI ||
get_man(s) == MAN_NUMONYX) {
s->data[0] |= (!!s->quad_enable) << 6;
}
if (get_man(s) == MAN_SST) {
s->data[0] |= (!!s->aai_enable) << 6;
}

s->pos = 0;
s->len = 1;
if (get_man(s) == MAN_WINBOND || get_man(s) == MAN_SPANSION) {
s->data[1] = (!!s->quad_enable) << 1;
s->len = 2;
} else {
s->len = 1;
}
s->data_read_loop = true;
s->state = STATE_READING_DATA;
break;
Expand Down
Loading
Loading