qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, Avi Kivity <avi@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/6] qtest: add test framework
Date: Mon, 16 Jan 2012 11:08:58 -0600	[thread overview]
Message-ID: <4F1459AA.5070402@codemonkey.ws> (raw)
In-Reply-To: <CAJSP0QXMJv+n68n8fGY9GbA2210u3QoB6wXyCU16aq36GFaR8Q@mail.gmail.com>

On 01/16/2012 10:59 AM, Stefan Hajnoczi wrote:
> On Fri, Jan 13, 2012 at 6:32 PM, Anthony Liguori<aliguori@us.ibm.com>  wrote:
>> +    if (strcmp(words[0], "outb") == 0 ||
>> +        strcmp(words[0], "outw") == 0 ||
>> +        strcmp(words[0], "outl") == 0) {
>> +        uint16_t addr;
>> +        uint32_t value;
>> +
>> +        g_assert(words[1]&&  words[2]);
>> +        addr = strtol(words[1], NULL, 0);
>> +        value = strtol(words[2], NULL, 0);
>> +
>> +        if (words[0][3] == 'b') {
>> +            cpu_outb(addr, value);
>> +        } else if (words[0][3] == 'w') {
>> +            cpu_outw(addr, value);
>> +        } else if (words[0][3] == 'l') {
>> +            cpu_outl(addr, value);
>> +        }
>> +        qtest_send_prefix(chr);
>> +        qtest_send(chr, "OK\n");
>> +    } else if (strcmp(words[0], "inb") == 0 ||
>> +        strcmp(words[0], "inw") == 0 ||
>> +        strcmp(words[0], "inl") == 0) {
>> +        uint16_t addr;
>> +        uint32_t value = -1U;
>> +
>> +        g_assert(words[1]);
>> +        addr = strtol(words[1], NULL, 0);
>> +
>> +        if (words[0][2] == 'b') {
>> +            value = cpu_inb(addr);
>> +        } else if (words[0][2] == 'w') {
>> +            value = cpu_inw(addr);
>> +        } else if (words[0][2] == 'l') {
>> +            value = cpu_inl(addr);
>> +        }
>> +        qtest_send_prefix(chr);
>> +        qtest_send(chr, "OK 0x%04x\n", value);
>
> Endianness is a little weird here.  memory.c will byteswap if target
> and device endianness differ.
>
> Imagine the case where we're on an x86 host, running a ppc guest,
> reading from PCI configuration space (little-endian).

These functions expect to get host native endian.  The qtest wire protocol is a 
string (which has no endianness) and converts it to host native endian.

>  Since ppc
> (target endian) is big-endian and the device is little-endian the
> value read/written will be byteswapped.  However, our qtest runs on
> the host and therefore we don't want that automatic swap (or we need
> to neutralize it by performing another byteswap on top).

ppc wouldn't use outb/inb.  It would do mmio to the PIO region which would send 
it through the host controller (which would do byte swapping as necessary).

So a qtest test case would have to do little endian MMIO to interact with the 
PCI bus.

Regards,

Anthony Liguori

>
> Stefan
>

  parent reply	other threads:[~2012-01-16 17:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 18:32 [Qemu-devel] [PATCH 1/6] qtest: add test framework Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 2/6] qtest: add support for -M pc Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 3/6] qtest: add C version of test infrastructure Anthony Liguori
2012-01-17 11:33   ` Stefan Hajnoczi
2012-01-17 13:33     ` Paolo Bonzini
2012-01-17 13:39       ` Stefan Hajnoczi
2012-01-17 16:09   ` Paolo Bonzini
2012-01-18 16:00   ` Kevin Wolf
2012-01-18 16:02     ` Paolo Bonzini
2012-01-18 16:08     ` Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 4/6] make: add check targets based on gtester Anthony Liguori
2012-01-16 17:16   ` Paolo Bonzini
2012-01-16 18:14     ` Anthony Liguori
2012-01-17 10:42       ` Paolo Bonzini
2012-01-17 14:04   ` Paolo Bonzini
2012-01-17 14:22     ` Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 5/6] rtc: split out macros into a header file and use in test case Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 6/6] qtest: add rtc-test test-case Anthony Liguori
2012-01-16 16:59 ` [Qemu-devel] [PATCH 1/6] qtest: add test framework Stefan Hajnoczi
2012-01-16 17:08   ` Avi Kivity
2012-01-16 17:20     ` Anthony Liguori
2012-01-16 17:08   ` Anthony Liguori [this message]
2012-01-17 11:13     ` Stefan Hajnoczi
2012-01-18  9:05       ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2012-01-17 17:22 Michael Walle

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=4F1459AA.5070402@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).