qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bernhard Beschow <shentey@gmail.com>, qemu-devel@nongnu.org
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
	qemu-block@nongnu.org, "Sergio Lopez" <slp@redhat.com>,
	"Frédéric Barrat" <fbarrat@linux.ibm.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-ppc@nongnu.org, "Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"John Snow" <jsnow@redhat.com>,
	"Thomas Huth" <huth@tuxfamily.org>,
	"Peter Xu" <peterx@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v5 05/11] exec/ioport: Add portio_list_set_address()
Date: Tue, 30 Jul 2024 09:13:43 +0200	[thread overview]
Message-ID: <05446d09-d5f1-4a6a-a816-ed9c28f6e82c@linaro.org> (raw)
In-Reply-To: <C0822DF6-EA81-48BB-9102-887E66441EF2@gmail.com>

On 29/7/24 23:07, Bernhard Beschow wrote:
> 
> 
> Am 29. Juli 2024 09:26:19 UTC schrieb "Philippe Mathieu-Daudé" <philmd@linaro.org>:
>> On 14/1/24 13:39, Bernhard Beschow wrote:
>>> Some SuperI/O devices such as the VIA south bridges or the PC87312 controller
>>> are able to relocate their SuperI/O functions. Add a convenience function for
>>> implementing this in the VIA south bridges.
>>>
>>> This convenience function relies on previous simplifications in exec/ioport
>>> which avoids some duplicate synchronization of I/O port base addresses. The
>>> naming of the function is inspired by its memory_region_set_address() pendant.
>>>
>>> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>>> ---
>>>    docs/devel/migration.rst |  5 +++--
>>>    include/exec/ioport.h    |  2 ++
>>>    system/ioport.c          | 19 +++++++++++++++++++
>>>    3 files changed, 24 insertions(+), 2 deletions(-)
>>
>>
>>> +void portio_list_set_address(PortioList *piolist, uint32_t addr)
>>> +{
>>> +    MemoryRegionPortioList *mrpio;
>>> +    unsigned i, j;
>>> +
>>
>>        memory_region_transaction_begin();
>>
>>> +    for (i = 0; i < piolist->nr; ++i) {
>>> +        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
>>
>> Should we check mrpio->mr is disabled before changing its base address?
> 
> Isn't that the responsibility of the guest? What should we do if the check fails?

What says the datasheet? At least we should log a GUEST_ERROR here.

> 
>>
>>> +        memory_region_set_address(&mrpio->mr,
>>> +                                  mrpio->mr.addr - piolist->addr + addr);
>>> +        for (j = 0; mrpio->ports[j].size; ++j) {
>>> +            mrpio->ports[j].offset += addr - piolist->addr;
>>> +        }
>>
>>           memory_region_transaction_commit();
>>
>>> +    }
>>> +
>>> +    piolist->addr = addr;
>>> +}
>>> +
>>>    static void memory_region_portio_list_finalize(Object *obj)
>>>    {
>>>        MemoryRegionPortioList *mrpio = MEMORY_REGION_PORTIO_LIST(obj);
>>



  reply	other threads:[~2024-07-30  7:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-14 12:39 [PATCH v5 00/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 01/11] hw/block/fdc-isa: Move portio_list from FDCtrl to FDCtrlISABus Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 02/11] hw/block/fdc-sysbus: Move iomem from FDCtrl to FDCtrlSysBus Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 03/11] hw/char/parallel: Move portio_list from ParallelState to ISAParallelState Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 04/11] exec/ioport: Resolve redundant .base attribute in struct MemoryRegionPortio Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 05/11] exec/ioport: Add portio_list_set_address() Bernhard Beschow
2024-07-29  9:26   ` Philippe Mathieu-Daudé
2024-07-29 21:07     ` Bernhard Beschow
2024-07-30  7:13       ` Philippe Mathieu-Daudé [this message]
2024-07-30  9:54         ` BALATON Zoltan
2024-01-14 12:39 ` [PATCH v5 06/11] exec/ioport: Add portio_list_set_enabled() Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 07/11] hw/block/fdc-isa: Implement relocation and enabling/disabling for TYPE_ISA_FDC Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 08/11] hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 09/11] hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions Bernhard Beschow
2024-01-14 12:39 ` [PATCH v5 11/11] hw/isa/vt82c686: Implement relocation and toggling of " Bernhard Beschow
2024-07-29  9:27   ` Philippe Mathieu-Daudé
2024-07-30  9:58     ` BALATON Zoltan
2024-01-14 12:52 ` [PATCH v5 00/11] " Bernhard Beschow
2024-01-14 13:03   ` Michael S. Tsirkin
2024-01-14 14:03     ` 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=05446d09-d5f1-4a6a-a816-ed9c28f6e82c@linaro.org \
    --to=philmd@linaro.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=atar4qemu@gmail.com \
    --cc=balaton@eik.bme.hu \
    --cc=clg@kaod.org \
    --cc=david@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=fbarrat@linux.ibm.com \
    --cc=hpoussin@reactos.org \
    --cc=hreitz@redhat.com \
    --cc=huth@tuxfamily.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shentey@gmail.com \
    --cc=slp@redhat.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).