qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: BALATON Zoltan <balaton@eik.bme.hu>,
	Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "John Snow" <jsnow@redhat.com>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	qemu-ppc@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>
Subject: Re: [PATCH v3 03/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15
Date: Fri, 28 Apr 2023 16:09:20 +0000	[thread overview]
Message-ID: <15A0B143-8323-4D4F-B95A-078B29D77B5E@gmail.com> (raw)
In-Reply-To: <a7c88b4d-2ffa-60b8-c37a-b993ad79ca40@eik.bme.hu>



Am 27. April 2023 13:04:15 UTC schrieb BALATON Zoltan <balaton@eik.bme.hu>:
>On Thu, 27 Apr 2023, Mark Cave-Ayland wrote:
>> On 27/04/2023 08:58, Bernhard Beschow wrote:
>>> Am 26. April 2023 12:50:08 UTC schrieb Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>:
>>>> On 02/03/2023 22:40, Philippe Mathieu-Daudé wrote:
>>>> 
>>>>> Since pc_init1() has access to the ISABus*, retrieve the
>>>>> ISA IRQs with isa_bus_get_irq().
>>>>> 
>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>> ---
>>>>>    hw/i386/pc_piix.c | 8 +++++++-
>>>>>    1 file changed, 7 insertions(+), 1 deletion(-)
>>>>> 
>>>>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
>>>>> index 126b6c11df..1e90b9ff0d 100644
>>>>> --- a/hw/i386/pc_piix.c
>>>>> +++ b/hw/i386/pc_piix.c
>>>>> @@ -277,7 +277,13 @@ static void pc_init1(MachineState *machine,
>>>>>        if (pcmc->pci_enabled) {
>>>>>            PCIDevice *dev;
>>>>>    -        dev = pci_create_simple(pci_bus, piix3_devfn + 1, TYPE_PIIX3_IDE);
>>>>> +        dev = pci_new_multifunction(piix3_devfn + 1, false, TYPE_PIIX3_IDE);
>>>>> +        qdev_connect_gpio_out_named(DEVICE(dev), "ide-irq", 0,
>>>>> +                                    isa_bus_get_irq(isa_bus, 14));
>>>>> +        qdev_connect_gpio_out_named(DEVICE(dev), "ide-irq", 1,
>>>>> +                                    isa_bus_get_irq(isa_bus, 15));
>>>>> +        pci_realize_and_unref(dev, pci_bus, &error_fatal);
>>>>> +
>>>>>            pci_ide_create_devs(dev);
>>>>>            idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
>>>>>            idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
>>>> 
>>>> Another reason this probably isn't a good idea: you're having to call qdev_connect_gpio_*() before realizing the device :(
>>> 
>>> Just curious: Resources like memory regions are assigned before realization, see e.g. i440fx or q35. Interrupts are also resources. What makes them special?
>> 
>> I think I've covered the .instance_init() vs. realize() part in my reply to Zoltan, but in terms of qdev_connect_gpio_out_named() the reasoning here is
>
>Well, not quite I'm afaid as I still have questions as it's not clear what should be in init and in realize.
>
>I've looked at i440fx and it has no init just realize which does what init method shoulc do anf the i440fx_init there is a legacy init function which should probably be realize so this does not look to be a good example. The q35 model is more complex and I proably don't understand it fully but still has a realize where most of the memory regions are created and an init method where some tweaks are done that are mentioned in a comment as needed but not the norm so it may also not be the best example so I'm not even getting why Bernhard's cited these in the first place.

Let's not confuse the topics ".instance_init() vs. .realize()" and "resources". I440fx seems to be very old code -- so old that it still uses legacy init methods (not to be confused with .instance_init()" methods). I've chosen the examples in context of the "resources" topic.

Best regards,
Bernhard

>
>Maybe some QOM/qdev experts could give some advice here.
>
>Regards,
>BALATON Zoltan
>
>> that a device shouldn't change it's internal behaviour depending upon how it is wired. In other words a standalone device will behave exactly the same as a device connected into a machine.
>> 
>>> I'm asking since this issue seems to be the main blocker for the piix consolidation to be merged.
>> 
>> I did have a brief catch-up with Phil at the start of the week, and he's tagged your series for review but he is really busy at the moment. As before I repeat my offer to help out if needed as I think it's a good series, but for now we're waiting for Phil to let us know what the next steps are...
>> 
>> 
>> ATB,
>> 
>> Mark.
>> 
>>


  reply	other threads:[~2023-04-28 16:10 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 22:40 [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Philippe Mathieu-Daudé
2023-03-02 22:40 ` [PATCH v3 01/18] hw/ide/piix: Expose output IRQ as properties for late object population Philippe Mathieu-Daudé
2023-04-26 10:35   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 02/18] hw/ide/piix: Allow using PIIX3-IDE as standalone PCI function Philippe Mathieu-Daudé
2023-04-26 12:48   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 03/18] hw/i386/pc_piix: Wire PIIX3 IDE ouput IRQs to ISA bus IRQs 14/15 Philippe Mathieu-Daudé
2023-04-26 12:50   ` Mark Cave-Ayland
2023-04-27  7:54     ` Bernhard Beschow
2023-04-27  7:58     ` Bernhard Beschow
2023-04-27 11:23       ` Mark Cave-Ayland
2023-04-27 13:04         ` BALATON Zoltan
2023-04-28 16:09           ` Bernhard Beschow [this message]
2023-03-02 22:40 ` [PATCH v3 04/18] hw/isa/piix4: Wire PIIX4 " Philippe Mathieu-Daudé
2023-04-26 12:51   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 05/18] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa Philippe Mathieu-Daudé
2023-04-26 13:05   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 06/18] hw/ide/piix: Ensure IDE output IRQs are wired at realization Philippe Mathieu-Daudé
2023-04-26 13:10   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 07/18] hw/isa: Deprecate isa_get_irq() in favor of isa_bus_get_irq() Philippe Mathieu-Daudé
2023-04-26 13:12   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 08/18] hw/ide: Introduce generic ide_init_ioport() Philippe Mathieu-Daudé
2023-04-26 13:15   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 09/18] hw/ide/piix: Use generic ide_bus_init_ioport() Philippe Mathieu-Daudé
2023-03-02 22:40 ` [PATCH v3 10/18] hw/isa: Ensure isa_register_portio_list() do not get NULL ISA device Philippe Mathieu-Daudé
2023-04-26 13:16   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 11/18] hw/isa: Simplify isa_address_space[_io]() Philippe Mathieu-Daudé
2023-04-26 13:18   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 12/18] hw/isa: Reduce 'isabus' singleton scope to isa_bus_new() Philippe Mathieu-Daudé
2023-04-26 13:19   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 13/18] exec/ioport: Factor portio_list_register_flush_coalesced() out Philippe Mathieu-Daudé
2023-04-26 13:26   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 14/18] exec/ioport: Factor portio_list_register() out Philippe Mathieu-Daudé
2023-04-26 13:28   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 15/18] hw/southbridge/piix: Use OBJECT_DECLARE_SIMPLE_TYPE() macro Philippe Mathieu-Daudé
2023-04-26 13:29   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 16/18] hw/isa/piix: Batch register QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-04-26 13:30   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 17/18] hw/isa/piix: Unify QOM type name of PIIX ISA function Philippe Mathieu-Daudé
2023-04-26 13:33   ` Mark Cave-Ayland
2023-03-02 22:40 ` [PATCH v3 18/18] hw/isa/piix: Unify PIIX-ISA QOM type names using qdev aliases Philippe Mathieu-Daudé
2023-04-26 13:35   ` Mark Cave-Ayland
2023-03-03  0:09 ` [PATCH v3 00/18] hw/ide: Untangle ISA/PCI abuses of ide_init_ioport() Michael S. Tsirkin
2023-03-03  6:58 ` David Woodhouse
2023-03-03  7:46   ` Mark Cave-Ayland
2023-03-03 12:50     ` Philippe Mathieu-Daudé
2023-03-03 12:57       ` BALATON Zoltan
2023-03-04 11:52     ` Bernhard Beschow
2023-03-03 12:47   ` BALATON Zoltan
2023-03-03 14:59   ` BALATON Zoltan
2023-04-21  8:25 ` Michael S. Tsirkin
2023-04-26 13:49   ` Mark Cave-Ayland
2023-04-22 15:25 ` Bernhard Beschow

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=15A0B143-8323-4D4F-B95A-078B29D77B5E@gmail.com \
    --to=shentey@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=dwmw2@infradead.org \
    --cc=eduardo@habkost.net \
    --cc=hpoussin@reactos.org \
    --cc=jsnow@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.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).