• Bug#1034756: dpkg: please add support for riscv32

    From Bo YU@1:229/2 to All on Sun Apr 23 17:30:01 2023
    XPost: linux.debian.bugs.dist
    From: tsu.yubo@gmail.com

    --lum52zgvqb5j2kfw
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    Package: dpkg
    Version: 1.21.21
    Severity: wishlist
    Tags: patch
    User: debian-riscv@lists.debian.org
    Usertags: riscv32

    Dear Maintainer,

    Currently riscv32 has been supported upstream for a while[0] and people
    can setup a riscv32 qemu with yocto[1], but it is time consuming.
    There is no distro to support riscv32 AFAIK until now however I think
    this will benefits users who want to setup riscv32 rootfs quickly if we
    support this.

    I thought the riscv32 has met the request[2] also.

    Please let me know if there is any issue.

    [0]: https://github.com/riscv-collab/riscv-gnu-toolchain#installation-linux [1]: https://github.com/riscv/meta-riscv
    [2]: https://wiki.debian.org/Teams/Dpkg/FAQ#Q._Can_we_add_support_for_new_dpkg_architectures.3F

    --
    Regards,
    --
    Bo YU


    --lum52zgvqb5j2kfw
    Content-Type: text/x-diff; charset=us-ascii
    Content-Disposition: attachment;
    filename="0001-add-support-for-riscv32.patch" Content-Transfer-Encoding: quoted-printable

    From 2e254fb802635742bb81f2e0a776e87c71360e1f Mon Sep 17 00:00:00 2001
    From: Bo YU <tsu.yubo@gmail.com>
    Date: Sun, 23 Apr 2023 22:22:47 +0800
    Subject: [PATCH] add support for riscv32

    Signed-off-by: Bo YU <tsu.yubo@gmail.com>
    ---
    data/cputable | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/data/cputable b/data/cputable
    index 7b1ee2c58..7c2c1c1c8 100644
    --- a/data/cputable
    +++ b/data/cputable
    @@ -45,6 +45,7 @@ powerpc powerpc (powerpc|ppc) 32 big
    powerpcel powerpcle powerpcle 32 little
    ppc64 powerpc64 (powerpc|ppc)64 64 big
    ppc64el powerpc64le powerpc64le 64 little +riscv32 riscv32 riscv32 32 little
    riscv64 riscv64 riscv64 64 little
    s390 s390 s390 32 big
    s390x s390x s390x 64 big
    --
    2.36.1


    --lum52zgvqb5j2kfw--

    -----BEGIN P
  • From Vagrant Cascadian@1:229/2 to Guillem Jover on Tue Apr 25 05:00:01 2023
    XPost: linux.debian.bugs.dist
    From: vagrant@debian.org

    On 2023-04-25, Guillem Jover wrote:
    On Sun, 2023-04-23 at 23:20:01 +0800, Bo YU wrote:
    Currently riscv32 has been supported upstream for a while[0] and people
    can setup a riscv32 qemu with yocto[1], but it is time consuming.
    There is no distro to support riscv32 AFAIK until now however I think
    this will benefits users who want to setup riscv32 rootfs quickly if we
    support this.
    ...
    I think at the time when we added riscv64 we didn't also add riscv32
    because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline
    to choose? (But I guess this would use the default baseline specified currently by the compiler.)

    FWIW, when I gave a short talk about Debian's riscv64 port a few years
    ago almost all the questions from the audience basically came down to
    "when are you going to do a riscv32 port?" ... I suspect it was at least
    partly because it is much easier to implement a riscv32 core in FPGA
    that riscv64.

    So there is *some* interest, even if a bit niche, though the landscape
    maybe has changed a bit since 2019 with more riscv64 silicon available?

    live well,
    vagrant

    -----BEGIN PGP SIGNATURE-----

    iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCZEdBFQAKCRDcUY/If5cW qgswAQDz1mLm5hj68fGp0xCMz6OwrnCn3EbOFIXniwPzWKHRrQD/dE2zZCAFKtYm kvn47kcvGF1OTj9vmYfjj7s6r6WAAQU=
    =5Z43
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Guillem Jover@1:229/2 to Bo YU on Tue Apr 25 04:30:02 2023
    XPost: linux.debian.bugs.dist
    From: guillem@debian.org

    Hi!

    On Sun, 2023-04-23 at 23:20:01 +0800, Bo YU wrote:
    Package: dpkg
    Version: 1.21.21
    Severity: wishlist
    Tags: patch
    User: debian-riscv@lists.debian.org
    Usertags: riscv32

    Currently riscv32 has been supported upstream for a while[0] and people
    can setup a riscv32 qemu with yocto[1], but it is time consuming.
    There is no distro to support riscv32 AFAIK until now however I think
    this will benefits users who want to setup riscv32 rootfs quickly if we support this.

    Is your intention to create such port (unofficially or officially in
    Debian)?

    I thought the riscv32 has met the request[2] also.

    I assume the ABI is set in stone and well defined.

    Please let me know if there is any issue.

    I think at the time when we added riscv64 we didn't also add riscv32
    because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline
    to choose? (But I guess this would use the default baseline specified
    currently by the compiler.)

    [0]: https://github.com/riscv-collab/riscv-gnu-toolchain#installation-linux [1]: https://github.com/riscv/meta-riscv
    [2]: https://wiki.debian.org/Teams/Dpkg/FAQ#Q._Can_we_add_support_for_new_dpkg_architectures.3F

    Thanks for the patch, I've adapted it slightly for the test suite (now
    it passes «make authorcheck», and added the missing ABI tracking support,
    but I think I'll split that into its own commit as that is affecting
    riscv64 too.

    (I'm in the process of preparing another upload to sid, ideally before
    the release, and if this looks all good, I'd be inclined to include
    part of this (probably not the ABI tracking bits) into that release,
    to make adding such port possible in the near future.)

    Thanks,
    Guillem

    From d71a98c23c43a06650e90480e864c0e3da344437 Mon Sep 17 00:00:00 2001
    From: Bo YU <tsu.yubo@gmail.com>
    Date: Tue, 25 Apr 2023 03:50:43 +0200
    Subject: [PATCH] arch: Add support for riscv32 CPU

    [guillem@debian.org:
    - Adapt the test suite.
    - Add ABI checking support. ]

    Closes: #1034756
    Signed-off-by: Guillem Jover <guillem@debian.org>
    ---
    data/cputable | 1 +
    scripts/Dpkg/Shlibs/Objdump.pm | 9 +++++++++
    scripts/t/Dpkg_Arch.t | 4 ++--
    3 files changed, 12 insertions(+), 2 deletions(-)

    diff --git a/data/cputable b/data/cputable
    index 7b1ee2c58..7c2c1c1c8 100644
    --- a/data/cputable
    +++ b/data/cputable
    @@ -45,6 +45,7 @@ powerpc powerpc (powerpc|ppc) 32 big
    powerpcel powerpcle powerpcle 32 little
    ppc64 powerpc64 (powerpc|ppc)64 64 big
    ppc64el powerpc64le powerpc64le 64 little +riscv32 riscv32 riscv32 32 little
    riscv64 riscv64 riscv64 64 little
    s390 s390 s390 32 big
    s390x s390x s390x 64 big
    diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index 5e27ec7f2..e30921b68 100644
    --- a/scripts/Dpkg/Shlibs/Objdump.pm
    +++ b/scripts/Dpkg/Shlibs/Objdump.pm
    @@ -118,6 +118,7 @@ use constant {
    EM_XTENSA => 94,
    EM_MICROBLAZE => 189,
    EM_ARCV2 => 195,
    + EM_RISCV => 243,
    EM_LO
  • From Darius Rad@1:229/2 to Bo YU on Tue Apr 25 20:20:01 2023
    XPost: linux.debian.bugs.dist
    From: darius@bluespec.com

    On Tue, Apr 25, 2023 at 10:52:52PM +0800, Bo YU wrote:
    On Tue, Apr 25, 2023 at 04:22:49AM +0200, Guillem Jover wrote:


    I thought the riscv32 has met the request[2] also.

    I assume the ABI is set in stone and well defined.


    There are three ABIs for 32-bit RISC-V. They are well defined, but it is
    not clear which ABI is being proposed for Debian here.

    Please let me know if there is any issue.

    I think at the time when we added riscv64 we didn't also add riscv32 because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline
    to choose? (But I guess this would use the default baseline specified currently by the compiler.)

    There is no doubt that the porting of riscv64 is our first priority and
    it's already in a good shape -- except for the official port.:(

    For riscv32 case, I think it'd be pretty helpful to let users to setup
    rv32 Debian rootfs or to let rv32 Debain run on RISC-V 32 bit hardware that will be emerged in the near future.

    Do you have any references for this hardware?


    Here I simply assume that rv32 compiler with `--with-arch=rv32gc --with-abi=ilp32d`[0] is enough?


    That is one choice, but not the only one.

    The argument in favor of a 32-bit port of RISC-V is typically motivated by
    the assumption that such processors will be smaller, in terms of the
    hardware (i.e., ASIC gates or FPGA LUTs). However, as compared to rv64gc, eliminating floating point typically provides a much more significant
    decrease in size. Thus, often when one is talking about smaller, 32-bit
    RISC-V processors, they *also* eliminate floating point. In other words,
    the processors are rv32imac, not rv32gc.

    In fact, I wouldn't be surprised if rv64imac processors were more common
    than rv32gc, given the minimal hardware resources for 64-bit versus 32-bit,
    all else being equal.

    // darius

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Bo YU@1:229/2 to Guillem Jover on Tue Apr 25 17:00:01 2023
    XPost: linux.debian.bugs.dist
    From: tsu.yubo@gmail.com

    Hi!
    On Tue, Apr 25, 2023 at 04:22:49AM +0200, Guillem Jover wrote:
    Hi!

    support this.

    Is your intention to create such port (unofficially or officially in
    Debian)?

    Yeah, I am trying to do such port and I guess riscv32 ends up in the debian-port given the troubles that 32-bit systems present to packages maintainer.


    I thought the riscv32 has met the request[2] also.

    I assume the ABI is set in stone and well defined.

    Please let me know if there is any issue.

    I think at the time when we added riscv64 we didn't also add riscv32
    because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline
    to choose? (But I guess this would use the default baseline specified >currently by the compiler.)

    There is no doubt that the porting of riscv64 is our first priority and
    it's already in a good shape -- except for the official port.:(

    For riscv32 case, I think it'd be pretty helpful to let users to setup
    rv32 Debian rootfs or to let rv32 Debain run on RISC-V 32 bit hardware
    that will be emerged in the near future.

    Here I simply assume that rv32 compiler with `--with-arch=rv32gc --with-abi=ilp32d`[0] is enough?



    Thanks for the patch, I've adapted it slightly for the test suite (now
    it passes «make authorcheck», and added the missing ABI tracking support,
    but I think I'll split that into its own commit as that is affecting
    riscv64 too.

    (I'm in the process of preparing another upload to sid, ideally before
    the release, and if this looks all good, I'd be inclined to include
    part of this (probably not the ABI tracking bits) into that release,
    to make adding such port possible in the near future.)

    Many thanks here. In fact in either case, the first step is to enable rebootstrap[1] work. This process will be accelerated if dpkg can
    support this I think.

    [0]: https://github.com/riscv-collab/riscv-gnu-toolchain#installation-linux [1]: https://salsa.debian.org/helmutg/rebootstrap

    Thanks,
    Guillem



    --
    Regards,
    --
    Bo YU


    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEIcmhjYVTlmab0tjp+RVP3hQ+S68FAmRH6T4ACgkQ+RVP3hQ+ S68F2Q/+Ln4Pkzm7ZslzxxDU0uIPB/PUaCl88Q1FYKXQN9dNr494d1bLnSewz225 oOkw2VahJiHhddkFFw5S/qoyMXDWmPjQWwBDkJnzhTPrxE7rIR4WCsp8Pqt6yozZ XBX6Ci/DH3GrtYdmL9/3BkbEOqQC1FS+vRC3+K8DQMej+0rf8e0eWjWjlUcTRdBl O/Bvf2xWCrqedvMOhIueZu3Ak/P561mw83MxrIg6vTApYC3yKHJlN1Qp0AGnmm7a crCWCJvpBfXYwJz+ASZYTvIc1ASk+7y4nwLORUB+TIA6tAX9HQ1GzKCM4BDvkqts mskFY1PNlQAcfQlU7ytUiCYCUesG0+GGoF3GSvpgKItvrawB8oTjDzLrJ0l4e3xw gZ3q7r6x2inea76Pc3zl80msL+PX6gt7/uA3CiFMLxOGU+uJEZ2KDOVi+wHBxZor tGHYdMVB8btIVkpVXUaGXCyZP1PPgKqHcxMs3xMMeSisdp6Zsaw6e/Jmfpu1LeDg pUgRS4P58Iv+dZORXMAomA0fUCfaz2coGO1hvdb1t27TAlxtKeT1XJH7lpQstAO/ trKOftisdL+Ezgqrh6I75Vc3nxhkcA01zij/oAt+Sg3r2dbwQ1j3P9gjKnA1NufT k0Npq2nb+6KZWujPYvcWaYoptEgXMX+xWWxArelQOsF1TDYlc8o=
    =ZUFI
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Bo YU@1:229/2 to Darius Rad on Wed Apr 26 18:30:01 2023
    XPost: linux.debian.bugs.dist
    From: tsu.yubo@gmail.com

    Hi,
    On Tue, Apr 25, 2023 at 02:08:33PM -0400, Darius Rad wrote:
    On Tue, Apr 25, 2023 at 10:52:52PM +0800, Bo YU wrote:
    On Tue, Apr 25, 2023 at 04:22:49AM +0200, Guillem Jover wrote:


    I thought the riscv32 has met the request[2] also.

    I assume the ABI is set in stone and well defined.


    There are three ABIs for 32-bit RISC-V. They are well defined, but it is
    not clear which ABI is being proposed for Debian here.

    Please let me know if there is any issue.

    I think at the time when we added riscv64 we didn't also add riscv32
    because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline
    to choose? (But I guess this would use the default baseline specified
    currently by the compiler.)

    There is no doubt that the porting of riscv64 is our first priority and
    it's already in a good shape -- except for the official port.:(

    For riscv32 case, I think it'd be pretty helpful to let users to setup
    rv32 Debian rootfs or to let rv32 Debain run on RISC-V 32 bit hardware that >> will be emerged in the near future.

    Do you have any references for this hardware?

    From my vague memory, there will be k230 fully support rv32 in userspace
    from canaan. Sorry, I was trying to find news or useful url but fail
    here.



    Here I simply assume that rv32 compiler with `--with-arch=rv32gc
    --with-abi=ilp32d`[0] is enough?


    That is one choice, but not the only one.

    The argument in favor of a 32-bit port of RISC-V is typically motivated by >the assumption that such processors will be smaller, in terms of the
    hardware (i.e., ASIC gates or FPGA LUTs). However, as compared to rv64gc, >eliminating floating point typically provides a much more significant >decrease in size. Thus, often when one is talking about smaller, 32-bit >RISC-V processors, they *also* eliminate floating point. In other words,
    the processors are rv32imac, not rv32gc.

    In fact, I wouldn't be surprised if rv64imac processors were more common
    than rv32gc, given the minimal hardware resources for 64-bit versus 32-bit, >all else being equal.

    Thanks for explaining this. Here are some of my thoughts about it.

    I think, as a distribution, we should provide a basic baseline of
    instruction set supported to cover most hardware vendors. We should not
    assume that hardware vendors will product their CPUs on a certain instruction set.

    In addition, refer to other 32-bit architectures, like armhf[1] and mips[2], They are also supporting floating point instructions(IIUC). Also, keep
    the same baseline with rv64, maybe it will reduce confusion for users.

    I am not sure how much would we benefit from dropping support for 'F' or
    'D', but maybe we can't lost something if we support full set(rv32gc)
    from port's view.

    [0]: https://www.canaan.io/
    [1]: https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2#L485
    [2]: https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2#L646


    // darius


    --
    Regards,
    --
    Bo YU


    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEEIcmhjYVTlmab0tjp+RVP3hQ+S68FAmRJT8QACgkQ+RVP3hQ+ S6+zjg/9EfI/bhcBiog0q25OgNvoZ63cVAs4iyMhqIXIXaiarAao3XRvSC/UGptk lJZ7f6doif9188PQU+wUAm6SbawThHG0YFmA94cU1zrbb40sEmgmv9Jw6c+HZQOJ /rtXqMRLLYGf3yx/Aj7jXVvDFvDXi3TvHLtvwMI06+rSRDU9HobgJXTY9q+AhrkZ saxbRyKNwddYpAJItnUW8yL21OIXGK2+r0Fd3RZghJAKTnbbxmk24wxZz2qbZD2f WFfvBI8dVjZBGcU+RGdEQzTM074iv9USA9jqTVXq5deULgSM/v83Hf7J8KG8ZAfz UaGtToFXUSJlBuiIhylZKMcVOCyL8k0B8IpaJsn/K91VkPEz5PMpZ7COqVhzaa40 rEsPCbcUZvBbdfJe16y40QG6qBc13MnyyqIbnuf9tkJtoVmvW7oirriCLyymMQCT VxiNJ3I7QQFNGafujK3bPgT8PJY85Gbydy5Z4w6zPPr7EdKJcJwlzmjqlO0KB/ga ZmFEqukq1htzpdvDWwIe7J/9BWWI54eMk5JRgUsIMQUGllfIjFx3rvvMluEq2x5i y15X4pPhaTwKpPfrtvquFqbvzJvnxqz+KHiAy3XgHga6L/aKoplM7biW784QRxFe VUdzJCYiZBCfMO15YXaImyrzx7yo47wyvc/m5HIHssCFnhYKWBY=
    =Z/JY
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Jessica Clarke@1:229/2 to Bo YU on Wed Apr 26 18:40:01 2023
    XPost: linux.debian.bugs.dist
    From: jrtc27@debian.org

    On 26 Apr 2023, at 17:22, Bo YU <tsu.yubo@gmail.com> wrote:

    Hi,
    On Tue, Apr 25, 2023 at 02:08:33PM -0400, Darius Rad wrote:
    On Tue, Apr 25, 2023 at 10:52:52PM +0800, Bo YU wrote:
    On Tue, Apr 25, 2023 at 04:22:49AM +0200, Guillem Jover wrote:


    I thought the riscv32 has met the request[2] also.

    I assume the ABI is set in stone and well defined.


    There are three ABIs for 32-bit RISC-V. They are well defined, but it is
    not clear which ABI is being proposed for Debian here.

    Please let me know if there is any issue.

    I think at the time when we added riscv64 we didn't also add riscv32
    because it was not clear whether there was then interest or demand,
    and I don't recall whether there were concerns about what ISA baseline >>> > to choose? (But I guess this would use the default baseline specified
    currently by the compiler.)

    There is no doubt that the porting of riscv64 is our first priority and
    it's already in a good shape -- except for the official port.:(

    For riscv32 case, I think it'd be pretty helpful to let users to setup
    rv32 Debian rootfs or to let rv32 Debain run on RISC-V 32 bit hardware that >>> will be emerged in the near future.

    Do you have any references for this hardware?

    From my vague memory, there will be k230 fully support rv32 in userspace
    from canaan. Sorry, I was trying to find news or useful url but fail
    here.

    From what I can see it’s using a C908 which is RV64. Maybe it can also
    do RV32 if you switch mode, but why would you, just as we don’t
    recommend people run i386 on amd64.

    RV32-only Unix-capable hardware would be more interesting, but seems
    like a foolish thing to build in this decade.

    Here I simply assume that rv32 compiler with `--with-arch=rv32gc
    --with-abi=ilp32d`[0] is enough?


    That is one choice, but not the only one.

    The argument in favor of a 32-bit port of RISC-V is typically motivated by >> the assumption that such processors will be smaller, in terms of the
    hardware (i.e., ASIC gates or FPGA LUTs). However, as compared to rv64gc, >> eliminating floating point typically provides a much more significant
    decrease in size. Thus, often when one is talking about smaller, 32-bit
    RISC-V processors, they *also* eliminate floating point. In other words,
    the processors are rv32imac, not rv32gc.

    In fact, I wouldn't be surprised if rv64imac processors were more common
    than rv32gc, given the minimal hardware resources for 64-bit versus 32-bit, >> all else being equal.

    Thanks for explaining this. Here are some of my thoughts about it.

    I think, as a distribution, we should provide a basic baseline of
    instruction set supported to cover most hardware vendors. We should not assume that hardware vendors will product their CPUs on a certain instruction
    set.

    We should support hardware that does exist, not hardware that might
    exist. So long as there is no RV32-only Unix-capable hardware out
    there, what is the point in Debian producing a distribution?

    In addition, refer to other 32-bit architectures, like armhf[1] and mips[2], They are also supporting floating point instructions(IIUC).

    Because they date back to when 32-bit computing was common practice,
    and wanted floating-point. These days, 64-bit is the standard, and
    there is little motivation for building a 32-bit core with
    floating-point given the tiny additional area needed to make it 64-bit (especially since you already need 64-bit data paths for the D
    extension).

    Also, keep
    the same baseline with rv64, maybe it will reduce confusion for users.
    I am not sure how much would we benefit from dropping support for 'F' or
    'D', but maybe we can't lost something if we support full set(rv32gc)
    from port's view.

    If you’re going to provide a distribution for RV32, dropping F and D
    seems like the right thing to do, since that’s the only sensible thing
    to build hardware for. But why commit to one now when nothing exists
    yet to motivate any of them.

    Jess

    [0]: https://www.canaan.io/
    [1]: https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2#L485
    [2]: https://salsa.debian.org/toolchain-team/gcc/-/blob/master/debian/rules2#L646


    // darius


    --
    Regards,
    --
    Bo YU

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)
  • From Guillem Jover@1:229/2 to Bo YU on Thu May 11 04:00:01 2023
    XPost: linux.debian.bugs.dist
    From: guillem@debian.org

    Hi!

    On Sun, 2023-04-30 at 10:12:01 +0800, Bo YU wrote:
    If you talk about the baseline ABI according to hardware, yeah, this
    is still open.

    Thanks for more background here. I thought this might lead to a wider discussion before solid ABI as pabs' suggestion.

    Given the ongoing discussion, where the ABI does not seem clear, and
    there is even concerns about the existence of the port at all, I'll
    defer this one for now, so that I can submit the current pending
    unblock request. Once things are more clear from the RISC-V porters
    side, then I'm happy to include this in git HEAD, and even propose
    updating dpkg in stable release branches to add it there if necessary.

    Thanks,
    Guillem

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)