Page MenuHomeFreeBSD

Allow byte reads of AHCI registers.
ClosedPublic

Authored by neel on May 7 2015, 1:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 17, 5:34 AM
Unknown Object (File)
Dec 23 2023, 11:09 AM
Unknown Object (File)
Dec 15 2023, 9:40 PM
Unknown Object (File)
Oct 12 2023, 4:57 PM
Unknown Object (File)
Oct 12 2023, 4:57 PM
Unknown Object (File)
Aug 26 2023, 3:37 PM
Unknown Object (File)
Aug 13 2023, 11:00 AM
Unknown Object (File)
Jun 27 2023, 5:22 PM
Subscribers

Details

Reviewers
mav
rgrimes
Group Reviewers
bhyve
Summary

This is needed to support Windows guests that use byte reads to access certain
AHCI registers (e.g. PxTFD.Status and PxTFD.Error).

Test Plan

Verified with the following guests:
FreeBSD 11.0 amd64 ahci-hd
FreeBSD 10.1 i386 ahci-hd
FreeBSD 10.1 amd64 ahci-cd
Centos 7 amd64 ahci-hd
Ubuntu 13.10 amd64 ahci-cd
OpenBSD 5.6 amd64 ahci-cd
OpenBSD 5.6 i386 ahci-hd ahci-cd
Windows 7 amd64 ahci-hd

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

neel retitled this revision from to Allow byte reads of AHCI registers..
neel updated this object.
neel added reviewers: grehan, mav.
neel edited the test plan for this revision. (Show Details)

As I see, reading single byte at offset multiple to 4 this function still return 32-bit value, at next -- 24-bit, etc. Is this expected/acceptable behavior?

grehan edited edge metadata.

The PCI common code could probably enforce some of this (and others, such as unaligned or natural boundary crossings in accesses), but this is fine for now.

This revision is now accepted and ready to land.May 7 2015, 9:34 AM
In D2469#45441, @mav wrote:

As I see, reading single byte at offset multiple to 4 this function still return 32-bit value, at next -- 24-bit, etc. Is this expected/acceptable behavior?

I am not sure that I understand the comment but here is an explanation of how it behaves after the patch:

Assuming that the AHCI register at offset 0x20 contains the value 0xDEADBEEF.

regoff size return pci_ahci_read()
0x20 1 0x00000000DEADBEEF
0x21 1 0x0000000000DEADBE
0x22 1 0x000000000000DEAD
0x23 1 0x00000000000000DE

  • least significant 8-bits used by instruction emulation

0x20 2 0x00000000DEADBEEF
0x22 2 0x000000000000DEAD

  • least significant 16-bits used by instruction emulation

0x20 4 0x00000000DEADBEEF

  • least significant 32-bits used by instruction emulation
neel edited edge metadata.

Assert that AHCI reads are naturally aligned and do not straddle a 32-bit
boundary.

This revision now requires review to proceed.May 7 2015, 6:01 PM
In D2469#45544, @neel wrote:

I am not sure that I understand the comment but here is an explanation of how it behaves after the patch:

I understand the behavior. Just was not sure what will trim extra bits. If all the consumers (instruction emulation code) do it correctly, then OK.

mav edited edge metadata.
This revision is now accepted and ready to land.May 7 2015, 6:29 PM
markj added a subscriber: markj.

This was committed in r282595.