1

First: I've struggled with the question on which stackexchange to post this question since it involves OS knowledge, hardware knowledge but probably also other CS fields. Suggestions for a better stack site are welcome.

I've just had a sudden realization... I'm old enough to remember PIO; you know... where the CPU was involved in transferring pretty much every byte from an attached peripheral (harddisk, CD-rom, network adapter etc.) to memory. Which could be a very CPU intensive task at times. So then came along DMA which, essentially, just told a device: "here's a slice of memory for you, go put your stuff there and tell me when you're done". My realization came when I noticed the bitlocker icon on my drives... Whatever OS your computer (or NAS or phone or...) uses: your CPU is responsible for doing the encryption, right? Though we (usually) have multiple cores nowadays and specialized AES instructions in our CPU's and so on, all which might alleviate the load... aren't we basically back to, what essentially is, PIO?

We could still use DMA to put entire blocks of data into memory and back to the storage device again and won't have to stall the CPU during that operation but we still need our CPU to process each and every byte (en/decrypting it) before we can use it. It maybe very fast, negligible even. If, however, there was a dedicated circuit between the device and DMA that could handle doing the en/decryption that would free our CPU of that burden. Is there such a circuit in modern systems? Is it maybe in the Northbridge/Southbridge/ICH/FCH/whatchamacallit? I can imagine RAID controllers or other dedicated I/O controllers (maybe just the more expensive ones?) have dedicated circuitry but what about a 'common consumer computer'?

Though I also realise Bitlocker is maybe more of an OS-level construct I guess. But I'm not specifically interested in bitlocker; I'm curious about any means of volume, partition or blocklevel encryption.

RobIII
  • 139
  • 1
  • 1
  • 9

1 Answers1

1

aren't we basically back to, what essentially is, PIO?

No.

Even if the CPU does the encryption, accelerated or not, and can just do this reading from one part of memory, and writing into a different part of memory. Then it uses DMA to send this part of memory to disk.

This is very very different from PIO, because you don't have to wait for the next byte to become ready. And the CPU will have finished the encryption in most cases a lot faster than DMA will transfer this block.

If, however, there was a dedicated circuit between the device and DMA that could handle doing the en/decryption that would free our CPU of that burden.

Even better, if there was a dedicated piece of hardware that could just read one block of memory (via DMA), encrytpt or decrypt it, and write the result to a different location in memory (via DMA), then you wouldn't tie the enccryption to a particular storage method with a particular kind of DMA, and could use it for whatever you want.

Such coprocessors existed (and probably exist), but normal encryption is fast enough via CPU to not justify the extra cost.

dirkt
  • 17,461