target-i386:add coalesced_pio API
Quoted 46 lines · Peng Hao
Quoted 17 lines
Signed-off-by Peng Hao <[email protected]>--- accel/kvm/kvm-all.c | 58 ++++++++++++++++++++++++++++++++++++++++++++----- include/exec/memattrs.h | 2 +- 2 files changed, 53 insertions(+), 7 deletions(-)(quoted diff) +1
-1@@ -536,7 +537,7 @@ static void kvm_coalesce_mmio_region(MemoryListener *listener, zone.addr = start; zone.size = size; - zone.pad = 0; + zone.pio = 0; (void)kvm_vm_ioctl(s, KVM_REGISTER_COALESCED_MMIO, &zone); }Review static void kvm_uncoalesce_mmio_region(MemoryListener *listener, · line 561
Quoted 9 lines
(quoted diff) +1
-1@@ -553,12 +554,51 @@ static void kvm_uncoalesce_mmio_region(MemoryListener *listener, zone.addr = start; zone.size = size; - zone.pad = 0; + zone.pio = 0; (void)kvm_vm_ioctl(s, KVM_UNREGISTER_COALESCED_MMIO, &zone); } }The 2 hunks above need to go to patch 1/4 to avoid breaking the build after applying 1/4.
However, patch 1/4 is just a header update and I don't think running
update-linux-headers.shwas supposed to break the build.Radim asked about this at:
Date: Wed, 18 Jul 2018 16:43:11 +0200
Subject: Re: [PATCH v2] KVM: Add coalesced PIO support
Message-ID: <20180718144311.GB6348@flask>
Paolo, do you have a suggestion on how to update the struct without making a header update break the build?Review static void kvm_uncoalesce_mmio_region(MemoryListener *listener, · line 564
Quoted 3 lines
(quoted diff) +3
-0+static MemoryListener kvm_coalesced_io_listener = { + .coalesced_mmio_add = kvm_coalesce_io_add, + .coalesced_mmio_del = kvm_coalesce_io_del,
Quoted 5 lines
Nit: I would rename the fields to "coalesced_mmio_{add,del}" to coalesced_io_*, because they are not specific to MMIO anymore.
I would also name the functions kvm_coalesce_pio_{add,del} because the are specific to pio.
I will modify in next patch.
Quoted 15 lines
Quoted 6 lines
(quoted diff) +2
-0+}; + int kvm_check_extension(KVMState *s, unsigned int extension) { int ret;Review static int kvm_init(MachineState *ms) · line 1660
Quoted 8 lines
(quoted diff) +3
-2@@ -1615,7 +1655,8 @@ static int kvm_init(MachineState *ms) ent = &ring->coalesced_mmio[ring->first]; - - cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len); + if (ent->pio == 1) { + address_space_rw(&address_space_io, ent->phys_addr, + MEMTXATTRS_NONE, ent->data, ent->len, true);
Quoted 2 lines
Why exactly
MEMTXATTRS_NONEis the right attrs argument here? WhyMEMTXATTRS_UNSPECIFIEDwouldn't work?
I didn't notice MEMTXATTRS_NONE is the same as MEMTXATTRS_UNSPECIFIED. MEMTXATTRS_NONE is redundant.
Quoted 16 lines
Quoted 16 lines
(quoted diff) +3
-0+ } else { + cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len); + } smp_wmb(); ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX; }include/exec/memattrs.h +1
-1@@ -45,7 +45,7 @@ typedef struct MemTxAttrs {* from "didn't specify" if necessary). */ #define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 }) - +#define MEMTXATTRS_NONE ((MemTxAttrs) { 0 })
On Fri, Aug 24, 2018 at 05:18:45PM +0800, [email protected] wrote:
[...]
Quoted 10 lines
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +3
-1- cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len); + if (ent->pio == 1) { + address_space_rw(&address_space_io, ent->phys_addr, + MEMTXATTRS_NONE, ent->data, ent->len, true);Why exactly
MEMTXATTRS_NONEis the right attrs argument here? WhyMEMTXATTRS_UNSPECIFIEDwouldn't work?I didn't notice
MEMTXATTRS_NONEis the same asMEMTXATTRS_UNSPECIFIED.MEMTXATTRS_NONEis redundant.
They are not exactly the same (see below), but in either case I'm not sure it would make any difference for PIO.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
(quoted diff) +3
-0+ } else { + cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len); + } smp_wmb(); ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX; }include/exec/memattrs.h +1
-1@@ -45,7 +45,7 @@ typedef struct MemTxAttrs {* from "didn't specify" if necessary). */ #define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 }) - +#define MEMTXATTRS_NONE ((MemTxAttrs) { 0 })
Signature · 1 line
Eduardo