• David S. Miller's avatar
    sparc64: Unroll ECB encryption loops in AES driver. · 03d168ad
    David S. Miller authored
    The AES opcodes have a 3 cycle latency, so by doing 32-bytes at a
    time we avoid a pipeline bubble in between every round.
    
    For the 256-bit key case, it looks like we're doing more work in
    order to reload the KEY registers during the loop to make space
    for scarce temporaries.  But the load dual issues with the AES
    operations so we get the KEY reloads essentially for free.
    
    Before:
    
    testing speed of ecb(aes) encryption
    test 0 (128 bit key, 16 byte blocks): 1 operation in 264 cycles (16 bytes)
    test 1 (128 bit key, 64 byte blocks): 1 operation in 231 cycles (64 bytes)
    test 2 (128 bit key, 256 byte blocks): 1 operation in 329 cycles (256 bytes)
    test 3 (128 bit key, 1024 byte blocks): 1 operation in 715 cycles (1024 bytes)
    test 4 (128 bit key, 8192 byte blocks): 1 operation in 4248 cycles (8192 bytes)
    test 5 (192 bit key, 16 byte blocks): 1 operation in 221 cycles (16 bytes)
    test 6 (192 bit key, 64 byte blocks): 1 operation in 234 cycles (64 bytes)
    test 7 (192 bit key, 256 byte blocks): 1 operation in 359 cycles (256 bytes)
    test 8 (192 bit key, 1024 byte blocks): 1 operation in 803 cycles (1024 bytes)
    test 9 (192 bit key, 8192 byte blocks): 1 operation in 5366 cycles (8192 bytes)
    test 10 (256 bit key, 16 byte blocks): 1 operation in 209 cycles (16 bytes)
    test 11 (256 bit key, 64 byte blocks): 1 operation in 255 cycles (64 bytes)
    test 12 (256 bit key, 256 byte blocks): 1 operation in 379 cycles (256 bytes)
    test 13 (256 bit key, 1024 byte blocks): 1 operation in 938 cycles (1024 bytes)
    test 14 (256 bit key, 8192 byte blocks): 1 operation in 6041 cycles (8192 bytes)
    
    After:
    
    testing speed of ecb(aes) encryption
    test 0 (128 bit key, 16 byte blocks): 1 operation in 266 cycles (16 bytes)
    test 1 (128 bit key, 64 byte blocks): 1 operation in 256 cycles (64 bytes)
    test 2 (128 bit key, 256 byte blocks): 1 operation in 305 cycles (256 bytes)
    test 3 (128 bit key, 1024 byte blocks): 1 operation in 676 cycles (1024 bytes)
    test 4 (128 bit key, 8192 byte blocks): 1 operation in 3981 cycles (8192 bytes)
    test 5 (192 bit key, 16 byte blocks): 1 operation in 210 cycles (16 bytes)
    test 6 (192 bit key, 64 byte blocks): 1 operation in 233 cycles (64 bytes)
    test 7 (192 bit key, 256 byte blocks): 1 operation in 340 cycles (256 bytes)
    test 8 (192 bit key, 1024 byte blocks): 1 operation in 766 cycles (1024 bytes)
    test 9 (192 bit key, 8192 byte blocks): 1 operation in 5136 cycles (8192 bytes)
    test 10 (256 bit key, 16 byte blocks): 1 operation in 206 cycles (16 bytes)
    test 11 (256 bit key, 64 byte blocks): 1 operation in 268 cycles (64 bytes)
    test 12 (256 bit key, 256 byte blocks): 1 operation in 368 cycles (256 bytes)
    test 13 (256 bit key, 1024 byte blocks): 1 operation in 890 cycles (1024 bytes)
    test 14 (256 bit key, 8192 byte blocks): 1 operation in 5718 cycles (8192 bytes)
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    03d168ad
aes_asm.S 33.3 KB