781c67ca | 03-Mar-2020 |
Peter Maydell <peter.maydell@linaro.org> |
cpu: Use DeviceClass reset instead of a special CPUClass reset
The CPUClass has a 'reset' method. This is a legacy from when TYPE_CPU used not to inherit from TYPE_DEVICE. We don't need it any mor
cpu: Use DeviceClass reset instead of a special CPUClass reset
The CPUClass has a 'reset' method. This is a legacy from when TYPE_CPU used not to inherit from TYPE_DEVICE. We don't need it any more, as we can simply use the TYPE_DEVICE reset. The 'cpu_reset()' function is kept as the API which most places use to reset a CPU; it is now a wrapper which calls device_cold_reset() and then the tracepoint function.
This change should not cause CPU objects to be reset more often than they are at the moment, because: * nobody is directly calling device_cold_reset() or qdev_reset_all() on CPU objects * no CPU object is on a qbus, so they will not be reset either by somebody calling qbus_reset_all()/bus_cold_reset(), or by the main "reset sysbus and everything in the qbus tree" reset that most devices are reset by
Note that this does not change the need for each machine or whatever to use qemu_register_reset() to arrange to call cpu_reset() -- that is necessary because CPU objects are not on any qbus, so they don't get reset when the qbus tree rooted at the sysbus bus is reset, and this isn't being changed here.
All the changes to the files under target/ were made using the included Coccinelle script, except:
(1) the deletion of the now-inaccurate and not terribly useful "CPUClass::reset" comments was done with a perl one-liner afterwards: perl -n -i -e '/ CPUClass::reset/ or print' target/*/*.c
(2) this bit of the s390 change was done by hand, because the Coccinelle script is not sophisticated enough to handle the parent_reset call being inside another function:
| @@ -96,8 +96,9 @@ static void s390_cpu_reset(CPUState *s, cpu_reset_type type) | S390CPU *cpu = S390_CPU(s); | S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); | CPUS390XState *env = &cpu->env; |+ DeviceState *dev = DEVICE(s); | |- scc->parent_reset(s); |+ scc->parent_reset(dev); | cpu->env.sigp_order = 0; | s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20200303100511.5498-1-peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
show more ...
|
84969111 | 21-Feb-2020 |
Philippe Mathieu-Daudé <philmd@redhat.com> |
scripts/cocci: Patch to let devices own their MemoryRegions
When a device creates a MemoryRegion without setting its ownership, the MemoryRegion is added to the machine "/unattached" container in th
scripts/cocci: Patch to let devices own their MemoryRegions
When a device creates a MemoryRegion without setting its ownership, the MemoryRegion is added to the machine "/unattached" container in the QOM tree.
Example with the Samsung SMDKC210 board:
$ arm-softmmu/qemu-system-arm -M smdkc210 -S -monitor stdio (qemu) info qom-tree /machine (smdkc210-machine) /unattached (container) /io[0] (qemu:memory-region) /exynos4210.dram0[0] (qemu:memory-region) /exynos4210.irom[0] (qemu:memory-region) /exynos4210.iram[0] (qemu:memory-region) /exynos4210.chipid[0] (qemu:memory-region) ... /device[26] (exynos4210.uart) /exynos4210.uart[0] (qemu:memory-region) /soc (exynos4210) ^ \__ [*]
The irom/iram/chipid regions should go under 'soc' at [*].
Add a semantic patch to let the device own the memory region.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
bb2f4e8d | 24-Feb-2020 |
Philippe Mathieu-Daudé <philmd@redhat.com> |
scripts/cocci: Patch to remove unnecessary memory_region_set_readonly()
Add a semantic patch to remove memory_region_set_readonly() calls on ROM memory regions.
Signed-off-by: Philippe Mathieu-Daud
scripts/cocci: Patch to remove unnecessary memory_region_set_readonly()
Add a semantic patch to remove memory_region_set_readonly() calls on ROM memory regions.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
d3ec684d | 24-Feb-2020 |
Philippe Mathieu-Daudé <philmd@redhat.com> |
scripts/cocci: Patch to replace memory_region_init_{ram,readonly -> rom}
Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom().
Signed-off-by: Philippe Mathie
scripts/cocci: Patch to replace memory_region_init_{ram,readonly -> rom}
Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom().
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
adeefe01 | 19-Feb-2020 |
Philippe Mathieu-Daudé <philmd@redhat.com> |
Avoid cpu_physical_memory_rw() with a constant is_write argument
This commit was produced with the included Coccinelle script scripts/coccinelle/exec_rw_const.
Inspired-by: Peter Maydell <peter.may
Avoid cpu_physical_memory_rw() with a constant is_write argument
This commit was produced with the included Coccinelle script scripts/coccinelle/exec_rw_const.
Inspired-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
19f70347 | 18-Feb-2020 |
Peter Maydell <peter.maydell@linaro.org> |
Avoid address_space_rw() with a constant is_write argument
The address_space_rw() function allows either reads or writes depending on the is_write argument passed to it; this is useful when the dire
Avoid address_space_rw() with a constant is_write argument
The address_space_rw() function allows either reads or writes depending on the is_write argument passed to it; this is useful when the direction of the access is determined programmatically (as for instance when handling the KVM_EXIT_MMIO exit reason). Under the hood it just calls either address_space_write() or address_space_read_full().
We also use it a lot with a constant is_write argument, though, which has two issues: * when reading "address_space_rw(..., 1)" this is less immediately clear to the reader as being a write than "address_space_write(...)" * calling address_space_rw() bypasses the optimization in address_space_read() that fast-paths reads of a fixed length
This commit was produced with the included Coccinelle script scripts/coccinelle/exec_rw_const.cocci.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20200218112457.22712-1-peter.maydell@linaro.org> [PMD: Update macvm_set_cr0() reported by Laurent Vivier] Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|
4ef044cb | 20-Feb-2020 |
Philippe Mathieu-Daudé <philmd@redhat.com> |
hw/net: Avoid casting non-const pointer, use address_space_write()
The NetReceive prototype gets a const buffer:
typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
We alrea
hw/net: Avoid casting non-const pointer, use address_space_write()
The NetReceive prototype gets a const buffer:
typedef ssize_t (NetReceive)(NetClientState *, const uint8_t *, size_t);
We already have the address_space_write() method to write a const buffer to an address space. Use it to avoid:
hw/net/i82596.c: In function ‘i82596_receive’: hw/net/i82596.c:644:54: error: passing argument 4 of ‘address_space_rw’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
This commit was produced with the included Coccinelle script scripts/coccinelle/exec_rw_const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
show more ...
|