Re: [Qemu-devel] [PATCH V6 3/5] target-i386: add rtc 0x70 port as coalesced_pio
>On 18/10/2018 10:03, peng.h...@zte.com.cn wrote: +/* register rtc 0x70 port as coalesced_pio */ +memory_region_set_flush_coalesced(>io); +memory_region_init_io(>coalesced_io, OBJECT(s), _ops, + s, "rtc1", 1); +isa_register_ioport(isadev, >coalesced_io, base); >>> I think instead of isa_register_ioport you can use >>> memory_region_add_subregion, so that s->coalesced_io is added below s->io? >>> >> isa_register_ioport also called memory_region_add_subregion. >> modify code like this: >> //isa_register_ioport(isadev, >coalesced_io, base); >> memory_region_add_subregion(get_system_io(),0x70,>coalesced_io); >> The regional distribution before and after code modification is consistent. > >Right, but I'd rather add s->coalesced_io subregion as a subregion of >s->io at offset 0. Ok, I will modify it and resubmit the patch. By the way , I find that when I adjusted the format of the patch "PATCH V6 1/5", I made a mistake to modify a code character. I also resubmit the patch. Thanks. > >Paolo > >>0070-0070 (prio 0, i/o): rtc1 >> 0070-0071 (prio 0, i/o): rtc
Re: [Qemu-devel] [PATCH V6 3/5] target-i386: add rtc 0x70 port as coalesced_pio
On 18/10/2018 10:03, peng.h...@zte.com.cn wrote: >>> +/* register rtc 0x70 port as coalesced_pio */ >>> +memory_region_set_flush_coalesced(>io); >>> +memory_region_init_io(>coalesced_io, OBJECT(s), _ops, >>> + s, "rtc1", 1); >>> +isa_register_ioport(isadev, >coalesced_io, base); >> I think instead of isa_register_ioport you can use >> memory_region_add_subregion, so that s->coalesced_io is added below s->io? >> > isa_register_ioport also called memory_region_add_subregion. > modify code like this: > //isa_register_ioport(isadev, >coalesced_io, base); > memory_region_add_subregion(get_system_io(),0x70,>coalesced_io); > The regional distribution before and after code modification is consistent. Right, but I'd rather add s->coalesced_io subregion as a subregion of s->io at offset 0. Paolo >0070-0070 (prio 0, i/o): rtc1 > 0070-0071 (prio 0, i/o): rtc
Re: [Qemu-devel] [PATCH V6 3/5] target-i386: add rtc 0x70 port as coalesced_pio
>On 17/10/2018 18:52, Peng Hao wrote: >> +/* register rtc 0x70 port as coalesced_pio */ >> +memory_region_set_flush_coalesced(>io); >> +memory_region_init_io(>coalesced_io, OBJECT(s), _ops, >> + s, "rtc1", 1); >> +isa_register_ioport(isadev, >coalesced_io, base); > >I think instead of isa_register_ioport you can use >memory_region_add_subregion, so that s->coalesced_io is added below s->io? > isa_register_ioport also called memory_region_add_subregion. modify code like this: //isa_register_ioport(isadev, >coalesced_io, base); memory_region_add_subregion(get_system_io(),0x70,>coalesced_io); The regional distribution before and after code modification is consistent. 0070-0070 (prio 0, i/o): rtc1 0070-0071 (prio 0, i/o): rtc >This way, you don't rely on the behavior of overlapping regions. > >Paolo > >> +memory_region_add_coalescing(>coalesced_io, 0, 1); >> +
Re: [Qemu-devel] [PATCH V6 3/5] target-i386: add rtc 0x70 port as coalesced_pio
On 17/10/2018 18:52, Peng Hao wrote: > +/* register rtc 0x70 port as coalesced_pio */ > +memory_region_set_flush_coalesced(>io); > +memory_region_init_io(>coalesced_io, OBJECT(s), _ops, > + s, "rtc1", 1); > +isa_register_ioport(isadev, >coalesced_io, base); I think instead of isa_register_ioport you can use memory_region_add_subregion, so that s->coalesced_io is added below s->io? This way, you don't rely on the behavior of overlapping regions. Paolo > +memory_region_add_coalescing(>coalesced_io, 0, 1); > +
[Qemu-devel] [PATCH V6 3/5] target-i386: add rtc 0x70 port as coalesced_pio
Signed-off-by: Peng Hao --- hw/timer/mc146818rtc.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index acee47d..808a212 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -70,6 +70,7 @@ typedef struct RTCState { ISADevice parent_obj; MemoryRegion io; +MemoryRegion coalesced_io; uint8_t cmos_data[128]; uint8_t cmos_index; int32_t base_year; @@ -990,6 +991,13 @@ static void rtc_realizefn(DeviceState *dev, Error **errp) memory_region_init_io(>io, OBJECT(s), _ops, s, "rtc", 2); isa_register_ioport(isadev, >io, base); +/* register rtc 0x70 port as coalesced_pio */ +memory_region_set_flush_coalesced(>io); +memory_region_init_io(>coalesced_io, OBJECT(s), _ops, + s, "rtc1", 1); +isa_register_ioport(isadev, >coalesced_io, base); +memory_region_add_coalescing(>coalesced_io, 0, 1); + qdev_set_legacy_instance_id(dev, base, 3); qemu_register_reset(rtc_reset, s); -- 1.8.3.1