Re: [PATCH v2] KVM: Specify byte order for KVM_EXIT_MMIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26.01.2014, at 04:46, Victor Kamensky <victor.kamensky@xxxxxxxxxx> wrote:

> On 25 January 2014 10:31, Christoffer Dall <christoffer.dall@xxxxxxxxxx> wrote:
>> On Sat, Jan 25, 2014 at 04:23:00PM +0000, Peter Maydell wrote:
>>> On 25 January 2014 02:15, Alexander Graf <agraf@xxxxxxx> wrote:
>>>> Ok, let's go through the combinations for a 32-bit write of 0x01020304 on PPC and what data[] looks like
> 
> Alex, could you please for the clarification purpose, tell
> us what instructions BE guest and LE guest run in below
> cases. Suppose r0 register has device address, and r1
> register has word as 0x01020304. And suppose we have
> regular memory instead of io at r0 address. How do you
> see 'unsigned char data[4]' will look like if 'data'
> address is at r0.
> 
> For this, for a moment, I think, we can forget about KVM,
> just consider BE guest and LE guest running on regular
> h/w.
> 
> Next we will consider cases as below when the same
> BE guest and LE guest runs on top of BE host or LE
> host KVM in different proposals combinations. Effectively
> defining non-virtual examples first and consider how they
> will work under KVM.
> 
> I was thinking that that you consider
> 
> BE guest:
>   stw r1, 0, r0
> just write r1 at r0 address
> 
> LE guest
>   stwbrx r1, 0, r0
> stwbrx - word byteswap r1 value and write it at r0 address

LE guests also use "stw", but with MSR.LE=1.

Of course an OS that tries to access the same device on the same CPU with MSR.LE=1 that it used to access with stw may use stwbrx to swap the endianness of the resulting operation because the CPU will swap it again because of MSR.LE. But that's guest OS logic which we can't rely on in KVM. Maybe the guest was using stwbrx in the BE case and is using stw with LE. Maybe it uses stw in both cases and fetches the bytes it needs to write from a buffer it has prepared.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux