[GIT PULL] RISC-V Patches for the 4.20 Merge Window, Part 1

Paul Walmsley paul.walmsley at sifive.com
Thu Oct 25 18:35:38 PDT 2018

+ Zong Li


On 10/25/18 6:12 PM, Linus Torvalds wrote:
> On Wed, Oct 24, 2018 at 1:42 PM Palmer Dabbelt <palmer at sifive.com> wrote:
>> I'm pretty sure this is our largest patch set since the original kernel
>> contribution, and it's certainly the one with the most contributors.
>> While I don't have anything else I know I'm going to submit for the
>> merge window, I would be somewhat surprised if I didn't screw anything
>> up.
> So I'm not entirely sure this is a screw-up, but it does have some
> signs of being one:
>>        lib: Add umoddi3 and udivmoddi4 of GCC library routines
> We have *actively* tried to avoid needing umoddi3 and friends, and
> have so far succceeded in doing that across many different
> architectures, and many many years.
> And when we _have_ added it, we've added it as architecture-specific
> optimized routines when people really need it.
> The reason to avoid a full 64-by-64 divide is that
>   (a) it is really expensive
>   (b) code that needs it is almost always actually wrong
> Almost always, the 64-bit divide turns out to be entirely pointless,
> and the code can be written as a (much cheaper) 64-by-32 divide
> instead using the functions in <asm/div.h> instead.
> Does RISC-V _really_ need that disgusting full 64-bit divide, or was
> the addition of that simply a "we didn't know better, and didn't
> realize just how expensive and wrong it is"?

I believe the request for those routines came from you:


Do you in fact need a full 64-by-64 bit divide in your DMA driver, or 
can you

get away with using div_u64() et al.?


- Paul

More information about the linux-riscv mailing list