From: Gleb Natapov <gleb@redhat.com>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Markus Armbruster" <armbru@redhat.com>,
"qemu-devel Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports
Date: Sun, 12 Jun 2011 20:14:53 +0300 [thread overview]
Message-ID: <20110612171453.GA31500@redhat.com> (raw)
In-Reply-To: <C5698021-CF75-4CA1-B870-6C5F504E78F4@web.de>
On Sun, Jun 12, 2011 at 05:32:57PM +0200, Andreas Färber wrote:
> Am 12.06.2011 um 15:48 schrieb Gleb Natapov:
>
> >On Sun, Jun 12, 2011 at 01:59:51PM +0200, Andreas Färber wrote:
> >>Am 09.06.2011 um 17:03 schrieb Markus Armbruster:
> >>
> >>>Andreas Färber <andreas.faerber@web.de> writes:
> >>>
> >>>>Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> >>>>---
> >>>>hw/isa-bus.c | 14 ++++++++++++++
> >>>>hw/isa.h | 1 +
> >>>>2 files changed, 15 insertions(+), 0 deletions(-)
> >>>>
> >>>>diff --git a/hw/isa-bus.c b/hw/isa-bus.c
> >>>>index d258932..1f64673 100644
> >>>>--- a/hw/isa-bus.c
> >>>>+++ b/hw/isa-bus.c
> >>>>@@ -105,6 +105,20 @@ void isa_init_ioport(ISADevice *dev,
> >>>>uint16_t ioport)
> >>>> isa_init_ioport_range(dev, ioport, 1);
> >>>>}
> >>>>
> >>>>+void isa_discard_ioport_range(ISADevice *dev, uint16_t start,
> >>>>uint16_t length)
> >>>>+{
> >>>>+ int i, j;
> >>>>+ for (i = 0; i < dev->nioports; i++) {
> >>>>+ if (dev->ioports[i] == start) {
> >>>>+ for (j = 0; j < dev->nioports - i; j++) {
> >>>>+ dev->ioports[i + j] = dev->ioports[i +
> >>>>length + j];
> >>>>+ }
> >>>>+ dev->nioports -= length;
> >>>>+ break;
> >>>>+ }
> >>>>+ }
> >>>>+}
> >>>>+
> >>>
> >>>"discard"? It's the opposite of isa_init_ioport_range(), name
> >>>should
> >>>make that obvious. "uninit"?
> >>
> >>"uninit" felt wrong.
> >>
> >>>Note: this only affects the I/O-port bookkeeping within
> >>>ISADevice, not
> >>>the actual I/O port handler registration. Any use must be
> >>>accompanied
> >>>by a matching handler de-registration. Just like any use of
> >>>isa_init_ioport_range() must be accompanied by matching
> >>>register_ioport_FOO()s. You can thank Gleb for this mess.
> >>
> >>Right, I didn't spot any wrong usage though.
> >>
> >>So what about cleaning up the mess and doing
> >>isa_[un]assign_ioport_range(), wrapping the ioport.c functions?
> >>The overhead of calling it up to six times for the different widths
> >>and read/write would seem negligible as a startup cost. And for
> >>pc87312 we don't seriously have to care about performance imo.
> >>
> >Ideally every ioport registration should be moved to use IORange. I
> >tried to move all isa devices to it, but it is complicated for two
> >reasons. First not every device is qdevified and second some devises
> >can be instantiated as isa device and non-isa device and they do
> >ioport
> >registration in a common code. With your approach you will have to
> >duplicate ioport registration code for isa and non-isa case for such
> >devices and code duplication is not good.
>
> I'm not trying to duplicate anything! What I've been seeing is that
> many of the ISA devices I've touched in this series first register
> the I/O ports and then associate them with the ISADevice, in
> ISA-only code. So the numbers *are* duplicated and I'm proposing to
> consolidate this into one call.
>
> The existing "init" would stay, so that code with disseparate ISA
> and common parts (like IDE) remains unaffected.
>
OK, if you think that it is less of a "mess" this way. In a perfect
world you would have something like:
void init_ioport(DeviceState *dev, IORange *r, const IORangeOps *ops,
uint64_t base, uint64_t len)
And it will do correct thing for each device type.
--
Gleb.
next prev parent reply other threads:[~2011-06-12 17:14 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 16:20 [Qemu-devel] [RFC 00/10] ISA reconfigurability Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 01/10] isa: Allow to un-assign I/O ports Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 02/10] isa: Allow to un-associate an IRQ Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 03/10] parallel: Allow to reconfigure ISA I/O base Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 04/10] parallel: Allow to reconfigure ISA IRQ Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 05/10] serial: Allow to reconfigure ISA I/O base Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 06/10] serial: Allow to reconfigure ISA IRQ Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [PATCH v2 07/10] fdc: Parametrize ISA base, IRQ and DMA Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 08/10] fdc: Allow to reconfigure ISA I/O base Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 09/10] ide: " Andreas Färber
2011-06-06 16:20 ` [Qemu-devel] [RFC 10/10] prep: Add pc87312 Super I/O emulation Andreas Färber
2011-06-06 20:08 ` [Qemu-devel] [RFC 05/10] serial: Allow to reconfigure ISA I/O base Richard Henderson
2011-06-06 20:25 ` Andreas Färber
2011-06-07 7:18 ` [Qemu-devel] [RFC 00/10] ISA reconfigurability Gerd Hoffmann
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2 Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 01/10] isa: Provide set_state callback Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 02/10] isa: Allow to un-assign I/O ports Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 03/10] isa: Allow to un-associate an IRQ Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 04/10] parallel: Implement ISA set_state callback Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 05/10] serial: Implement ISA set_state() callback Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [PATCH v2 06/10] fdc: Parametrize ISA base, IRQ and DMA Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 07/10] fdc: Implement ISA set_state() callback Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 08/10] ide: Allow to discard I/O ports Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 09/10] ide: Implement ISA set_state() callback Andreas Färber
2011-06-07 15:02 ` [Qemu-devel] [RFC v2 10/10] prep: Add pc87312 Super I/O emulation Andreas Färber
2011-06-07 15:16 ` [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2 Gerd Hoffmann
2011-06-07 22:36 ` Andreas Färber
2011-06-08 8:13 ` Gerd Hoffmann
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 00/12] ISA reconfigurability v4 Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [PATCH v4 01/12] qdev: Add support for property type bool Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [PATCH v4 02/12] qdev: Add helpers for reading properties Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 03/12] isa: Provide set_state callback Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 05/12] isa: Allow to un-associate an IRQ Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 06/12] parallel: Implement ISA set_state callback Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 07/12] serial: Implement ISA set_state() callback Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [PATCH v4 08/12] fdc: Parametrize ISA base, IRQ and DMA Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 09/12] fdc: Implement ISA set_state() callback Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 10/12] ide: Allow to discard I/O ports Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 11/12] ide: Implement ISA set_state() callback Andreas Färber
2011-06-08 18:55 ` [Qemu-devel] [RFC v4 12/12] prep: Add pc87312 Super I/O emulation Andreas Färber
2011-06-09 7:56 ` [Qemu-devel] [RFC v4 09/12] fdc: Implement ISA set_state() callback Gerd Hoffmann
2011-06-09 9:23 ` Andreas Färber
2011-06-09 15:35 ` [Qemu-devel] [RFC v4 07/12] serial: " Markus Armbruster
2011-06-09 16:08 ` Andreas Färber
2011-06-09 15:04 ` [Qemu-devel] [RFC v4 05/12] isa: Allow to un-associate an IRQ Markus Armbruster
2011-06-09 15:12 ` Markus Armbruster
2011-06-12 12:05 ` Andreas Färber
2011-06-09 15:03 ` [Qemu-devel] [RFC v4 04/12] isa: Allow to un-assign I/O ports Markus Armbruster
2011-06-12 11:59 ` Andreas Färber
2011-06-12 13:48 ` Gleb Natapov
2011-06-12 15:32 ` Andreas Färber
2011-06-12 17:14 ` Gleb Natapov [this message]
2011-06-09 10:39 ` [Qemu-devel] [RFC v4 03/12] isa: Provide set_state callback Gerd Hoffmann
2011-06-09 11:37 ` Andreas Färber
2011-06-09 12:23 ` Gerd Hoffmann
2011-06-09 14:07 ` Andreas Färber
2011-06-09 14:19 ` Gerd Hoffmann
2011-06-09 16:04 ` Markus Armbruster
2011-06-12 12:48 ` Andreas Färber
2011-06-09 14:53 ` Markus Armbruster
2011-06-12 11:46 ` Andreas Färber
2011-06-09 14:45 ` [Qemu-devel] [PATCH v4 01/12] qdev: Add support for property type bool Markus Armbruster
2011-06-12 11:44 ` Andreas Färber
2011-06-13 20:08 ` [Qemu-devel] [RFC v4 00/12] ISA reconfigurability v4 Blue Swirl
2011-06-13 21:09 ` Andreas Färber
2011-06-15 18:24 ` Blue Swirl
2011-06-07 23:32 ` [Qemu-devel] [RFC v3 10/11] qdev: Add helpers for reading properties Andreas Färber
2011-06-07 23:32 ` [Qemu-devel] [RFC v3 11/11] prep: Add pc87312 Super I/O emulation Andreas Färber
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=20110612171453.GA31500@redhat.com \
--to=gleb@redhat.com \
--cc=andreas.faerber@web.de \
--cc=armbru@redhat.com \
--cc=hpoussin@reactos.org \
--cc=kraxel@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).