qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Liu Ping Fan" <pingfank@linux.vnet.ibm.com>,
	"Andreas Färber" <afaerber@suse.de>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC][PATCH 08/15] isa: implement isa_is_ioport_assigned via memory_region_find
Date: Mon, 06 May 2013 17:10:45 +0200	[thread overview]
Message-ID: <5187C7F5.90807@redhat.com> (raw)
In-Reply-To: <5187C5F5.1090500@siemens.com>

Il 06/05/2013 17:02, Jan Kiszka ha scritto:
> On 2013-05-06 16:59, Paolo Bonzini wrote:
>> Il 06/05/2013 16:55, Andreas Färber ha scritto:
>>> Am 06.05.2013 16:26, schrieb Jan Kiszka:
>>>> Move isa_is_ioport_assigned to the ISA core and implement it via a
>>>> memory region lookup. As all IO ports are now directly or indirectly
>>>> registered via the memory API, this becomes possible and will finally
>>>> allow us to drop the ioport tables.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>> ---
>>>>  hw/acpi/piix4.c       |    6 +++---
>>>>  hw/isa/isa-bus.c      |   11 +++++++++++
>>>>  hw/isa/lpc_ich9.c     |    8 ++++----
>>>>  include/exec/ioport.h |    1 -
>>>>  include/hw/isa/isa.h  |    2 ++
>>>>  ioport.c              |    7 -------
>>>>  6 files changed, 20 insertions(+), 15 deletions(-)
>>>>
>>>> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
>>>> index c4af1cc..5955217 100644
>>>> --- a/hw/acpi/piix4.c
>>>> +++ b/hw/acpi/piix4.c
>>>> @@ -386,10 +386,10 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
>>>>      uint8_t *pci_conf;
>>>>  
>>>>      pci_conf = s->dev.config;
>>>> -    pci_conf[0x5f] = (isa_is_ioport_assigned(0x378) ? 0x80 : 0) | 0x10;
>>>> +    pci_conf[0x5f] = (isa_is_ioport_assigned(NULL, 0x378) ? 0x80 : 0) | 0x10;
>>>>      pci_conf[0x63] = 0x60;
>>>> -    pci_conf[0x67] = (isa_is_ioport_assigned(0x3f8) ? 0x08 : 0) |
>>>> -	(isa_is_ioport_assigned(0x2f8) ? 0x90 : 0);
>>>> +    pci_conf[0x67] = (isa_is_ioport_assigned(NULL, 0x3f8) ? 0x08 : 0) |
>>>> +        (isa_is_ioport_assigned(NULL, 0x2f8) ? 0x90 : 0);
>>>>  
>>>>  }
>>>>  
>>>
>>> Is there really no way to access the ISABus from this device? Would be
>>> nice to get rid of global ISA variables and not introduce more
>>> dependencies. :)
>>
>> There's always a way to find the ISABus via QOM:
>>
>>     ISABus *isa_bus = (ISABus *) object_resolve_path_type("", TYPE_ISA_BUS, NULL);
> 
> Err, in what way is this better? It also assumes that there is only one.

I didn't say it is better. :)  Unfortunately, the PIIX4 has these
register on the "wrong" function, ICH9 fixed it.

You could make this take an AddressSpace instead of an ISABus, and use
pci_address_space_io.  The assumption then becomes that the ISA and PM
devices have the same address spaces, which is somewhat hackish but
reasonable.

In fact, with the other new API I have added (address_space_valid), this
would become address_space_valid(pci_address_space_io(dev), 0x2f8, 1)
and similar.  I need to check, but you could remove
isa_is_ioport_assigned completely.

Paolo

  reply	other threads:[~2013-05-06 15:11 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-06 14:26 [Qemu-devel] [RFC][PATCH 00/15] Refactor portio dispatching Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 01/15] adlib: replace register_ioport* Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 02/15] applesmc: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 03/15] wdt_ib700: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 04/15] i82374: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 05/15] prep: " Jan Kiszka
2013-05-06 14:43   ` Andreas Färber
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 06/15] vt82c686: " Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 07/15] Privatize register_ioport_read/write Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 08/15] isa: implement isa_is_ioport_assigned via memory_region_find Jan Kiszka
2013-05-06 14:55   ` Andreas Färber
2013-05-06 14:59     ` Paolo Bonzini
2013-05-06 15:02       ` Jan Kiszka
2013-05-06 15:10         ` Paolo Bonzini [this message]
2013-05-06 14:59     ` Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 09/15] memory: Introduce address_space_lookup_region Jan Kiszka
2013-05-06 14:39   ` Paolo Bonzini
2013-05-06 14:51     ` Jan Kiszka
2013-05-06 14:54       ` Paolo Bonzini
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 10/15] memory: Rework sub-page handling Jan Kiszka
2013-05-06 20:09   ` Paolo Bonzini
2013-05-06 20:46   ` Peter Maydell
2013-05-07  9:48     ` Paolo Bonzini
2013-05-07 12:35     ` Paolo Bonzini
2013-05-07 17:26       ` Jan Kiszka
2013-05-07 18:23         ` Jan Kiszka
2013-05-08  8:41           ` Paolo Bonzini
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 11/15] memory: Allow unaligned address_space_rw Jan Kiszka
2013-05-06 14:55   ` Paolo Bonzini
2013-05-06 14:58     ` Jan Kiszka
2013-05-06 15:01       ` Paolo Bonzini
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 12/15] vmware-vga: Accept unaligned I/O accesses Jan Kiszka
2013-05-06 14:40   ` Paolo Bonzini
2013-05-06 14:45     ` Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 13/15] ioport: Switch dispatching to memory core layer Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 14/15] ioport: Remove unused old dispatching services Jan Kiszka
2013-05-06 14:26 ` [Qemu-devel] [RFC][PATCH 15/15] ioport: Move IOPortRead/WriteFunc typedefs to memory.h Jan Kiszka
2013-05-06 14:50 ` [Qemu-devel] [RFC][PATCH 00/15] Refactor portio dispatching Andreas Färber
2013-05-06 14:54   ` Jan Kiszka

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=5187C7F5.90807@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=jan.kiszka@siemens.com \
    --cc=pingfank@linux.vnet.ibm.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).