All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Graf <agraf@suse.de>,
	Frank Blaschka <blaschka@linux.vnet.ibm.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	Frank Blaschka <frank.blaschka@de.ibm.com>,
	"james.hogan@imgtec.com" <james.hogan@imgtec.com>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"borntraeger@de.ibm.com" <borntraeger@de.ibm.com>,
	"cornelia.huck@de.ibm.com" <cornelia.huck@de.ibm.com>,
	"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 2/3] s390: implement pci instructions
Date: Wed, 12 Nov 2014 10:36:03 +0100	[thread overview]
Message-ID: <54632A03.6050403@redhat.com> (raw)
In-Reply-To: <546326E8.1000909@suse.de>



On 12/11/2014 10:22, Alexander Graf wrote:
>>>> Absolutely lets make an example for qemu running on BE and LE
>>>>
>>>> byte order    config space backing   pci_default_read_config   pcilg (with cpu_to_le)
>>>> BE            0x78563412             0x12345678                0x78563412
>>>> LE            0x78563412             0x78563412                0x78563412
>>>
>>> No, pci_default_read_config() always returns 0x12345678 because it
>>> returns a register, not memory.
>>>
>>
>> You mean implementation of pci_default_read_config is broken?
>> If it should return a register it should not do "return le32_to_cpu(val);"
> 
> It has to, to convert from memory (after memcpy) to an actual register
> value. Look at the value list in Paolo's email - I really have no idea
> how to explain it any better.

pci_default_read_config is reading from a *device* register, and has
absolutely zero knowledge of the host CPU endianness.

Another way to explain that the result of pci_default_read_config is
independent of the host endianness, is that the function is basically
doing this:

switch (len) {
    case 1: return d->config[address];
    case 2: return ldw_le_p(&d->config[address)]);
    case 4: return ldl_le_p(&d->config[address)]);
    default: abort();
}

So if you want to make the outcome big endian, you have to swap
unconditionally.

Paolo

  reply	other threads:[~2014-11-12  9:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 14:20 [Qemu-devel] [PATCH 0/3] add PCI support for the s390 platform Frank Blaschka
2014-11-10 14:20 ` [Qemu-devel] [PATCH 1/3] s390: Add PCI bus support Frank Blaschka
2014-11-10 15:14   ` Alexander Graf
2014-11-18 12:50     ` Frank Blaschka
2014-11-18 17:00       ` Alexander Graf
2014-11-25 10:11         ` Frank Blaschka
2014-11-25 12:14           ` Alexander Graf
2014-11-25 12:43             ` Frank Blaschka
2014-11-10 14:20 ` [Qemu-devel] [PATCH 2/3] s390: implement pci instructions Frank Blaschka
2014-11-10 15:56   ` Alexander Graf
2014-11-11 12:10     ` Frank Blaschka
2014-11-11 12:16       ` Alexander Graf
2014-11-11 12:39         ` Frank Blaschka
2014-11-11 12:51           ` Alexander Graf
2014-11-11 14:08             ` Frank Blaschka
2014-11-11 15:24               ` Alexander Graf
2014-11-12  8:49                 ` Frank Blaschka
2014-11-12  9:08                   ` Alexander Graf
2014-11-12  9:11                     ` Paolo Bonzini
2014-11-12  9:13                       ` Alexander Graf
2014-11-12  9:19                     ` Frank Blaschka
2014-11-12  9:22                       ` Alexander Graf
2014-11-12  9:36                         ` Paolo Bonzini [this message]
2014-11-12 14:34                           ` Frank Blaschka
2014-11-11 12:17       ` Peter Maydell
2014-11-11 12:40         ` Frank Blaschka
2014-11-10 14:20 ` [Qemu-devel] [PATCH 3/3] kvm: extend kvm_irqchip_add_msi_route to work on s390 Frank Blaschka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54632A03.6050403@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=blaschka@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=frank.blaschka@de.ibm.com \
    --cc=james.hogan@imgtec.com \
    --cc=mtosatti@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.