[From nobody Sun May  3 21:33:05 2026
Received: (at submit) by bugs.debian.org; 7 Jul 2025 09:43:17 +0000
X-Spam-Checker-Version: SpamAssassin 4.0.1-bugs.debian.org_2005_01_02
 (2024-03-25) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-15.1 required=4.0 tests=BAYES_00,
 BODY_INCLUDES_PACKAGE,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,
 DKIM_VALID_EF,FOURLA,FREEMAIL_FROM,HAS_PACKAGE,MD5_SHA1_SUM,
 RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,WORD_WITHOUT_VOWELS
 autolearn=ham autolearn_force=no
 version=4.0.1-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 37; hammy, 150; neutral, 163; spammy,
 0. spammytokens: hammytokens:0.000-+--XDebbugsCc,
 0.000-+--X-Debbugs-Cc, 0.000-+--riscv64, 0.000-+--virtio,
 0.000-+--sk:qemu-sy
Return-path: &lt;rabenda.cn@gmail.com&gt;
Received: from mail-ua1-x92b.google.com ([2607:f8b0:4864:20::92b]:43230)
 by buxtehude.debian.org with esmtps
 (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128)
 (Exim 4.96) (envelope-from &lt;rabenda.cn@gmail.com&gt;)
 id 1uYiNZ-001ZF9-0G for submit@bugs.debian.org;
 Mon, 07 Jul 2025 09:43:17 +0000
Received: by mail-ua1-x92b.google.com with SMTP id
 a1e0cc1a2514c-88173565536so3106645241.0
 for &lt;submit@bugs.debian.org&gt;; Mon, 07 Jul 2025 02:43:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1751881394; x=1752486194; darn=bugs.debian.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=NK2Kzt4jReXRQIYH9nqKwRohkDzm66vwChJmGvFMCqY=;
 b=Lc5qSzCK1YwigW6F3TPWpEnIudRatuDiXjaboAE43R04I2FcUQQkOD/olhGuwywsxy
 GhJUd2jJVakEt+rzzLvGSzHG0wQnobIkgOvky0PNdrldtCg/rGe4D2MNkHNAWPCULSEm
 0+NqjLsu57Tm/zYKvlR4Y5hU0gPWVmRD279KcdJW+keM20tkZacukruRCZ01sURZILre
 mXdfK7C23tvK/8KpsEe1vuCq4+YZe8YH1/uTYB4BzXoQQjqcUy+FDKglDOlYgbCxpy0K
 TzzNN9fMEQ29Xck9EA4KKjhLsoDHCtyggsnz2OLvooDf7kdn5VbNhGuftnaYnQQmP5d9
 d/0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1751881394; x=1752486194;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=NK2Kzt4jReXRQIYH9nqKwRohkDzm66vwChJmGvFMCqY=;
 b=oEwLDrgbzdYJliLnEyDw8KA0Uz3MAPoOrOST6y5j/9XTEl94SM6gWeBO5BcN8pSH82
 iQbic6rLjojH+A/itgQ6+KVIX/PV9PIueVwJBQ/Pe8hLcPXx1bquiyGbY/2Vv/mpbcOS
 VGbRSwlEk819gL9gPlELBhgAka++1gii2HkzmItLJWyxvbH3FXTyMtVhEj6U/MYaOE0U
 SbVow69Zy4u1aks02YeSH2aMut3a8GwsJyry8yXbfZMVCMl1UuDYvQDFQsu0pxnjjoGx
 I1cr9L+kkht/zTGHt3RG3sfzPDSuVnF4HLSBfPWfE/RA2PDywuLD6EN41awxTMEYY8GN
 PLZQ==
X-Gm-Message-State: AOJu0YwgQMtUg9ASnbrOBf9WsShvO6OdnjakGuZTyTjyOwMY5n6akZB0
 6ZrtfCp1XdVSPxDUQ27/O7zjtnYNtENolecqb+UEYbhomDIFAGAuFu8vpgyOWWyqqtvJmpmcmBO
 HiDAmQRxFN5m9VZfDwKgg0LYnS5Jxs2j8o3vaUuSP9w==
X-Gm-Gg: ASbGnct3WcKup2sguYLJxR4MYg8+fRqNwieRfsSWQJLTmZIZoLOsro0/abgFlec3Aj4
 ce1Mbf3Nq1ImvHNkIjz7hNU3UfFylNaqMrwCS7HltoAWzBubvDfA7WG4xIo/TvSPSpDngP//rIz
 j7ABHNo43SeCgQYFpKzIh66haHuMSrdK3o49vZUR2GR72NWAr4MxB/UiI=
X-Google-Smtp-Source: AGHT+IH4D4CCHXwX116GHPPGhP3qUFz0X/lez0GJJ9dxyzGHdsLExwMRQFjBaU4WXdzyb0iDulHI28d8VadUk7GD8xg=
X-Received: by 2002:a05:6102:2923:b0:4eb:e0ca:6aba with SMTP id
 ada2fe7eead31-4f2ee1d44ffmr8296203137.8.1751881394065; Mon, 07 Jul 2025
 02:43:14 -0700 (PDT)
MIME-Version: 1.0
From: Han Gao &lt;rabenda.cn@gmail.com&gt;
Date: Mon, 7 Jul 2025 17:43:03 +0800
X-Gm-Features: Ac12FXxTemQvTm5yt-JtpRBvdNw0TaguC1qMVdL_CVdYkhFLaWzMUhYW5_65RuI
Message-ID: &lt;CAAT7Ki_9z_sWQeGtFP1RpMczypX6Ten5UQO3yfnE22fBBGVLFQ@mail.gmail.com&gt;
Subject: riscv64: Illegal instruction appears when using rdcycle in grub
To: submit@bugs.debian.org
Content-Type: text/plain; charset=&quot;UTF-8&quot;
Delivered-To: submit@bugs.debian.org

Package: grub-efi-riscv64-unsigned
User: debian-riscv@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv@lists.debian.org
X-Debbugs-Cc: rabenda.cn@gmail.com
Version: 2.12-8
Severity: normal
Tags: upstream

Dear Maintainer,

Illegal instructions will occur when debian riscv64 iso boots to grub.efi.

Because grub uses the rdcycle instruction.

Upstream[1] has fixed this issue and hopes to backport to 2.12.

[1]: https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/grub-core/kern/riscv/efi/init.c?id=c5ae124e11f28f637cbd38cb4d6c1b9817baa135

sudo qemu-system-riscv64 --enable-kvm -M virt -cpu host -m 2048 -smp 2
-nographic \
-boot d -cdrom debian-testing-riscv64-netinst.iso \
-device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \
-device virtio-rng-pci \
-kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \
-drive file=debian.qcow2,format=qcow2,if=virtio
U-Boot 2025.01-3 (Apr 08 2025 - 23:07:41 +0000)
CPU: riscv
Model: riscv-virtio,qemu
DRAM: 2 GiB
Core: 28 devices, 13 uclasses, devicetree: board
Flash: 32 MiB
Loading Environment from nowhere... OK
In: serial,usbkbd
Out: serial,vidconsole
Err: serial,vidconsole
No USB controllers found
Net: eth0: virtio-net#0
Working FDT set to feee6c60
Hit any key to stop autoboot: 0
Device 0: unknown device
Device 0: 1af4 VirtIO Block Device
Type: Hard Disk
Capacity: 610.2 MB = 0.5 GB (1249880 x 512)
... is now current device
Scanning virtio 0:2...
Failed to load '/'
Failed to load '/dtb/'
Failed to load EFI variables
Error: writing contents
** Unable to write file ubootefi.var **
Failed to persist EFI variables
Error: writing contents
** Unable to write file ubootefi.var **
Failed to persist EFI variables
Error: writing contents
** Unable to write file ubootefi.var **
Failed to persist EFI variables
Error: writing contents
** Unable to write file ubootefi.var **
Failed to persist EFI variables
Error: writing contents
** Unable to write file ubootefi.var **
Failed to persist EFI variables
Booting: virtio 0
Unhandled exception: Illegal instruction
EPC: 00000000fdc7a0b8 RA: 00000000fdc7a0fa TVAL: 00000000c0002573
EPC: 000000007e7720b8 RA: 000000007e7720fa reloc adjusted
SP: 00000000feee5050 GP: 0000000000000000 TP: 0000000000000000
T0: 00000000000000e0 T1: 00000000fdc6efe8 T2: 00000000000000f0
S0: 00000000feee5160 S1: 00000000feee52b0 A0: 00000000fdc6efa0
A1: 0000000000000000 A2: 00000000fdc6efe8 A3: fffffffffffffff8
A4: ffffffffffffffb8 A5: 0000000000000001 A6: 0000000000000007
A7: 0000000000000000 S2: 00000000fdc7f528 S3: 00000000fdc7f478
S4: 0000000000000000 S5: 00000000ff7f782c S6: 0000000000000000
S7: 00000000fef2fa70 S8: 0000000000000000 S9: 0000000000000001
S10: 0000000000000001 S11: 0000000000000000 T3: 000000000000001f
T4: 0000000000010000 T5: ffffffffffffffff T6: 00000000000000c0
Code: 7d42 7da2 6149 8082 1141 e022 e406 0800 (2573 c000)
UEFI image [0x00000000fdc6f000:0x00000000fdd8efff] pc=0xb0b8
'/\EFI\BOOT\BOOTRISCV64.EFI'

Thanks,
Han
]