qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 27/36] sysbus: add a sysbus_mmio_unmap() help


From: Cédric Le Goater
Subject: Re: [Qemu-devel] [PATCH v5 27/36] sysbus: add a sysbus_mmio_unmap() helper
Date: Tue, 4 Dec 2018 13:33:16 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0

Hello Peter,

On 12/3/18 6:48 PM, Peter Maydell wrote:
> On Thu, 29 Nov 2018 at 04:55, David Gibson <address@hidden> wrote:
>>
>> On Fri, Nov 16, 2018 at 11:57:20AM +0100, Cédric Le Goater wrote:
>>> This will be used to remove the MMIO regions of the POWER9 XIVE
>>> interrupt controller when the sPAPR machine is reseted.
>>>
>>> Signed-off-by: Cédric Le Goater <address@hidden>
>>
>> Reviewed-by: David Gibson <address@hidden>
>>
>> Since the code looks sane.
>>
>> Hoever, I think using memory_region_set_enabled() would be a better
>> idea for our purposes than actually adding/deleting the subregion.
> 
> The other approach I've used in the past is to use
> sysbus_mmio_get_region() and then just map and unmap
> that directly, rather than using the sysbus_mmio_map()
> convenience function. (Often the kind of device that's
> doing complicated things like this will be working in
> a setup where it doesn't necessarily want to be mapping
> directly into system memory rather than an SoC or similar
> container MemoryRegion anyway.)

Thanks for chiming in on that patch. Here is some background on 
what we are trying to model. May be you have some suggestions.

A completely new interrupt controller was introduced on the POWER9 
processor and it uses MMIO regions for interrupt management. These
regions are backed by simple MRs in QEMU, when using TCG, and backed
by ram_device_ptr MRs under KVM.

Difficulties arise with the fact that POWER9 pseries guests need
to support the old mode (XICS, no MMIOs) and the new mode XIVE.
The interrupt mode is negotiated at boot between the hypervisor
and the guest and a reset is generated to take into account 
the changes. Which means that, at reset, we may need to disconnect 
from a KVM IC device and reconnect to another. 

When switching from XICS to XIVE mode : 

  if kvm
    - destroy KVM XICS device
    - create KVM XIVE device 
    - get fd, mmap, init ram_device_ptr MRs
    - map mmio
  - enable MMIOs

When switching from XIVE to XICS  : 
  
  - disable MMIOs 
  if kvm
    - delete MRs
    - munmap
    - destroy KVM XIVE device
    - create KVM XICS device 


Thanks,

C.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]