From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Lucas Meneghel Rodrigues <lmr@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw: Add test device for unittests execution
Date: Mon, 29 Aug 2011 08:57:17 +0300 [thread overview]
Message-ID: <4E5B2A3D.3000905@redhat.com> (raw)
In-Reply-To: <CAAu8pHuN8qJ1seo=CxTFkCTGbXmaLnjZCT4VQMDfjWFK3g2znA@mail.gmail.com>
On 08/27/2011 07:22 PM, Blue Swirl wrote:
> > +
> > +static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
> > +{
> > + qemu_set_irq(isa_get_irq(addr - 0x2000), !!data);
>
> Where does 0x2000 come from?
The base address of this range.
> > +
> > +static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
> > +{
> > + return *(uint16_t*)(iomem_buf + addr);
> > +}
>
> This and the other functions assume that the memory is available and
> the guest and the host are of same endianness.
>
> This looks like pure RAM, so MMIO is not the best way to do this.
> Please just map more RAM.
The intent is to get the guest to fault and exercise kvm's instruction
emulator. That won't happen with RAM.
(well, with a sub-page mapping, it should)
> What's the use of this anyway, it doesn't affect QEMU in any way? Scratch space?
>
>
> > +static int init_test_device(ISADevice *isa)
> > +{
> > + struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
> > + int iomem;
> > +
> > + register_ioport_write(0xf1, 1, 1, test_device_serial_write, dev);
> > + register_ioport_write(0xf4, 1, 4, test_device_exit, dev);
> > + register_ioport_read(0xd1, 1, 4, test_device_memsize_read, dev);
> > + register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
> > + register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev);
> > + register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev);
> > + register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
> > + register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
> > + register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
> > + register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
> > + register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
>
> 24? Doesn't ISA have only 16? Enums for all constants would be more readable.
GSI space - the ioapic pins. It's really a motherboard device.
>
> > + iomem_buf = g_malloc0(0x10000);
> > + iomem = cpu_register_io_memory(test_iomem_read, test_iomem_write, NULL,
> > + DEVICE_NATIVE_ENDIAN);
> > + cpu_register_physical_memory(0xff000000, 0x10000, iomem);
>
> Devices may not map themselves, this should be done at board level.
> Doesn't this address also conflict with PCI for PC?
Probably. The whole thing is a hack!
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
next prev parent reply other threads:[~2011-08-29 5:57 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 20:04 [Qemu-devel] [PATCH] hw: Add test device for unittests execution Lucas Meneghel Rodrigues
2011-08-26 21:22 ` Anthony Liguori
2011-08-27 10:07 ` Edgar E. Iglesias
2011-08-27 16:44 ` Blue Swirl
2011-08-29 5:50 ` Avi Kivity
2011-08-29 5:47 ` Avi Kivity
2011-08-29 13:58 ` Lucas Meneghel Rodrigues
2011-08-26 22:26 ` Jan Kiszka
2011-08-29 5:52 ` Avi Kivity
2011-08-27 16:22 ` Blue Swirl
2011-08-29 5:57 ` Avi Kivity [this message]
2011-08-30 19:11 ` Blue Swirl
2011-08-30 19:36 ` Lluís
2011-08-30 19:54 ` Blue Swirl
2011-08-30 20:20 ` Lluís
-- strict thread matches above, loose matches on Subject: below --
2012-10-04 3:49 Lucas Meneghel Rodrigues
2012-10-04 4:24 ` Lucas Meneghel Rodrigues
2012-10-04 7:18 ` Paolo Bonzini
2012-10-04 8:02 ` Peter Maydell
2012-10-04 8:04 ` Paolo Bonzini
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=4E5B2A3D.3000905@redhat.com \
--to=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=kraxel@redhat.com \
--cc=lmr@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).