Page MenuHomeFreeBSD

bhyve: when accessing non-backed gpa, emulate hw
AcceptedPublic

Authored by kib on Fri, May 2, 3:23 PM.

Details

Reviewers
markj
andrew
Group Reviewers
bhyve
Summary
which reads all bits one, and ignores writes.

PR:     286467

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Fri, May 2, 3:23 PM
markj added a subscriber: markj.
markj added inline comments.
usr.sbin/bhyve/mem.c
223

Maybe make this a global variable?

226
This revision is now accepted and ready to land.Sat, May 3, 10:01 PM
kib marked 2 inline comments as done.

Make fb_entry static. Reword the message.

This revision now requires review to proceed.Sun, May 4, 8:51 AM

Drop now unused string.h

One issue with this is that the code is MI, but the implemented behaviour is x86-specific -- I'm not sure what happens on arm64 when a non-existent GPA is accessed, maybe an serror is raised. Maybe @andrew could comment.

usr.sbin/bhyve/mem.c
226

I reworded as you suggested. But note that the address always exists, it is the backing memory that could not.

Restore original behavior on !x86.

Eliminate arch ifdefs, move code into mem_x86.c, mem_md.c.

Another stray change, sorry.

One issue with this is that the code is MI, but the implemented behaviour is x86-specific -- I'm not sure what happens on arm64 when a non-existent GPA is accessed, maybe an serror is raised. Maybe @andrew could comment.

On arm64 I would expect we implement it as a synchronous external abort. We should have all the information needed & it lets the guest recover, or at least report the precise location of the fault.

On armv8, generate simple-minded SError.

usr.sbin/bhyve/aarch64/mem_aarch64.c
48 ↗(On Diff #155174)

I don't think this is correct as it looks like this should only be raised for an SError exception. The kernel can currently only raise synchronous exceptions. I think the logic should be:

spsr = get(VM_REG_GUEST_CPSR);
if ((spsr & PSR_M_MASK) == PSR_M_EL0t)
    esr = EXCP_DATA_ABORT_L << ESR_ELx_EC_SHIFT;
else
    esr = EXCP_DATA_ABORT << ESR_ELx_EC_SHIFT;
esr |= ESR_ELx_IL | ISS_DATA_DFSC_EXT;

Add needed headers for mem_aarch64.c

Implement andrew' suggestion.

I'm ok with the arm64 parts

This revision is now accepted and ready to land.Fri, May 9, 2:29 PM