1 | First target-arm pullreq of the 4.0 series; most of this | 1 | Almost nothing in here is arm-related, but the target-arm |
---|---|---|---|
2 | is Mao's cleanups that finally let us drop sysbus::init; | 2 | queue was convenient for these last minute bits and pieces |
3 | the most interesting user-visible feature is RTH's patches | 3 | for 5.0... |
4 | adding some v8.1 and v8.2 architecture features. | ||
5 | 4 | ||
6 | thanks | 5 | thanks |
7 | -- PMM | 6 | -- PMM |
8 | 7 | ||
9 | The following changes since commit 6145a6d84b3bf0f25935b88543febe076c61b0f4: | 8 | The following changes since commit 14e5526b51910efd62cd31cd95b49baca975c83f: |
10 | 9 | ||
11 | Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging (2018-12-13 13:06:09 +0000) | 10 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2020-04-13 15:42:51 +0100) |
12 | 11 | ||
13 | are available in the Git repository at: | 12 | are available in the Git repository at: |
14 | 13 | ||
15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20181213 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200414 |
16 | 15 | ||
17 | for you to fetch changes up to 2d7137c10fafefe40a0a049ff8a7bd78b66e661f: | 16 | for you to fetch changes up to 84f82ddcbb4ac4ed04c8675e85155329f23184f0: |
18 | 17 | ||
19 | target/arm: Implement the ARMv8.1-LOR extension (2018-12-13 14:41:24 +0000) | 18 | Deprecate KVM support for AArch32 (2020-04-14 17:20:22 +0100) |
20 | 19 | ||
21 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
22 | target-arm queue: | 21 | patch queue: |
23 | * Convert various devices from sysbus init to instance_init | 22 | * Fix some problems that trip up Coverity's scanner |
24 | * Remove the now unused sysbus init support entirely | 23 | * run-coverity-scan: New script automating the scan-and-upload process |
25 | * Allow AArch64 processors to boot from a kernel placed over 4GB | 24 | * docs: Improve our gdbstub documentation |
26 | * hw: arm: musicpal: drop TYPE_WM8750 in object_property_set_link() | 25 | * configure: Honour --disable-werror for Sphinx |
27 | * versal: minor fixes to virtio-mmio instantation | 26 | * docs: Fix errors produced when building with Sphinx 3.0 |
28 | * arm: Implement the ARMv8.1-HPD extension | 27 | * docs: Require Sphinx 1.6 or better |
29 | * arm: Implement the ARMv8.2-AA32HPD extension | 28 | * Add deprecation notice for KVM support on AArch32 hosts |
30 | * arm: Implement the ARMv8.1-LOR extension (as the trivial | ||
31 | "no limited ordering regions provided" minimum) | ||
32 | 29 | ||
33 | ---------------------------------------------------------------- | 30 | ---------------------------------------------------------------- |
34 | Edgar E. Iglesias (4): | 31 | Peter Maydell (12): |
35 | hw/arm: versal: Remove bogus virtio-mmio creation | 32 | osdep.h: Drop no-longer-needed Coverity workarounds |
36 | hw/arm: versal: Reduce number of virtio-mmio instances | 33 | thread.h: Fix Coverity version of qemu_cond_timedwait() |
37 | hw/arm: versal: Use IRQs 111 - 118 for virtio-mmio | 34 | thread.h: Remove trailing semicolons from Coverity qemu_mutex_lock() etc |
38 | hw/arm: versal: Correct the nr of IRQs to 192 | 35 | linux-user/flatload.c: Use "" for include of QEMU header target_flat.h |
36 | scripts/run-coverity-scan: Script to run Coverity Scan build | ||
37 | scripts/coverity-scan: Add Docker support | ||
38 | docs: Improve our gdbstub documentation | ||
39 | configure: Honour --disable-werror for Sphinx | ||
40 | scripts/kernel-doc: Add missing close-paren in c:function directives | ||
41 | kernel-doc: Use c:struct for Sphinx 3.0 and later | ||
42 | docs: Require Sphinx 1.6 or better | ||
43 | Deprecate KVM support for AArch32 | ||
39 | 44 | ||
40 | Li Qiang (1): | 45 | configure | 9 +- |
41 | hw: arm: musicpal: drop TYPE_WM8750 in object_property_set_link() | 46 | Makefile | 2 +- |
47 | include/qemu/osdep.h | 14 - | ||
48 | include/qemu/thread.h | 12 +- | ||
49 | linux-user/flatload.c | 2 +- | ||
50 | MAINTAINERS | 5 + | ||
51 | docs/conf.py | 6 +- | ||
52 | docs/sphinx/kerneldoc.py | 1 + | ||
53 | docs/system/deprecated.rst | 8 + | ||
54 | docs/system/gdb.rst | 22 +- | ||
55 | qemu-options.hx | 24 +- | ||
56 | scripts/coverity-scan/coverity-scan.docker | 131 ++++++++++ | ||
57 | scripts/coverity-scan/run-coverity-scan | 401 +++++++++++++++++++++++++++++ | ||
58 | scripts/kernel-doc | 18 +- | ||
59 | 14 files changed, 615 insertions(+), 40 deletions(-) | ||
60 | create mode 100644 scripts/coverity-scan/coverity-scan.docker | ||
61 | create mode 100755 scripts/coverity-scan/run-coverity-scan | ||
42 | 62 | ||
43 | Mao Zhongyi (21): | ||
44 | musicpal: Convert sysbus init function to realize function | ||
45 | block/noenand: Convert sysbus init function to realize function | ||
46 | char/grlib_apbuart: Convert sysbus init function to realize function | ||
47 | core/empty_slot: Convert sysbus init function to realize function | ||
48 | display/g364fb: Convert sysbus init function to realize function | ||
49 | dma/puv3_dma: Convert sysbus init function to realize function | ||
50 | gpio/puv3_gpio: Convert sysbus init function to realize function | ||
51 | milkymist-softusb: Convert sysbus init function to realize function | ||
52 | input/pl050: Convert sysbus init function to realize function | ||
53 | intc/puv3_intc: Convert sysbus init function to realize function | ||
54 | milkymist-hpdmc: Convert sysbus init function to realize function | ||
55 | milkymist-pfpu: Convert sysbus init function to realize function | ||
56 | puv3_pm.c: Convert sysbus init function to realize function | ||
57 | nvram/ds1225y: Convert sysbus init function to realize function | ||
58 | pci-bridge/dec: Convert sysbus init function to realize function | ||
59 | timer/etraxfs_timer: Convert sysbus init function to realize function | ||
60 | timer/grlib_gptimer: Convert sysbus init function to realize function | ||
61 | timer/puv3_ost: Convert sysbus init function to realize function | ||
62 | usb/tusb6010: Convert sysbus init function to realize function | ||
63 | xen_backend: remove xen_sysdev_init() function | ||
64 | core/sysbus: remove the SysBusDeviceClass::init path | ||
65 | |||
66 | Peter Maydell (1): | ||
67 | target/arm: Move id_aa64mmfr* to ARMISARegisters | ||
68 | |||
69 | Ricardo Perez Blanco (1): | ||
70 | Allow AArch64 processors to boot from a kernel placed over 4GB | ||
71 | |||
72 | Richard Henderson (9): | ||
73 | target/arm: Add HCR_EL2 bits up to ARMv8.5 | ||
74 | target/arm: Add SCR_EL3 bits up to ARMv8.5 | ||
75 | target/arm: Fix HCR_EL2.TGE check in arm_phys_excp_target_el | ||
76 | target/arm: Tidy scr_write | ||
77 | target/arm: Implement the ARMv8.1-HPD extension | ||
78 | target/arm: Implement the ARMv8.2-AA32HPD extension | ||
79 | target/arm: Introduce arm_hcr_el2_eff | ||
80 | target/arm: Use arm_hcr_el2_eff more places | ||
81 | target/arm: Implement the ARMv8.1-LOR extension | ||
82 | |||
83 | include/hw/arm/xlnx-versal.h | 8 +- | ||
84 | include/hw/sysbus.h | 3 - | ||
85 | target/arm/cpu.h | 141 ++++++++++++++++----------- | ||
86 | target/arm/internals.h | 3 +- | ||
87 | hw/arm/boot.c | 35 ++++--- | ||
88 | hw/arm/musicpal.c | 11 +-- | ||
89 | hw/arm/xlnx-versal-virt.c | 7 +- | ||
90 | hw/block/onenand.c | 16 ++-- | ||
91 | hw/char/grlib_apbuart.c | 12 +-- | ||
92 | hw/core/empty_slot.c | 9 +- | ||
93 | hw/core/sysbus.c | 15 +-- | ||
94 | hw/display/g364fb.c | 9 +- | ||
95 | hw/dma/puv3_dma.c | 10 +- | ||
96 | hw/gpio/puv3_gpio.c | 29 +++--- | ||
97 | hw/input/milkymist-softusb.c | 16 ++-- | ||
98 | hw/input/pl050.c | 11 +-- | ||
99 | hw/intc/arm_gicv3_cpuif.c | 21 ++-- | ||
100 | hw/intc/puv3_intc.c | 11 +-- | ||
101 | hw/misc/milkymist-hpdmc.c | 9 +- | ||
102 | hw/misc/milkymist-pfpu.c | 12 +-- | ||
103 | hw/misc/puv3_pm.c | 10 +- | ||
104 | hw/nvram/ds1225y.c | 12 +-- | ||
105 | hw/pci-bridge/dec.c | 12 +-- | ||
106 | hw/timer/etraxfs_timer.c | 14 +-- | ||
107 | hw/timer/grlib_gptimer.c | 11 +-- | ||
108 | hw/timer/puv3_ost.c | 13 ++- | ||
109 | hw/usb/tusb6010.c | 8 +- | ||
110 | hw/xen/xen_backend.c | 7 -- | ||
111 | target/arm/cpu.c | 4 + | ||
112 | target/arm/cpu64.c | 11 ++- | ||
113 | target/arm/helper.c | 222 ++++++++++++++++++++++++++++++++++++------- | ||
114 | target/arm/kvm64.c | 4 + | ||
115 | target/arm/op_helper.c | 14 ++- | ||
116 | target/arm/translate-a64.c | 12 +++ | ||
117 | 34 files changed, 456 insertions(+), 286 deletions(-) | ||
118 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Li Qiang <liq3ea@gmail.com> | ||
2 | 1 | ||
3 | The third argument of object_property_set_link() is the name of | ||
4 | property, not related with the QOM type name, using the constant | ||
5 | string instead. | ||
6 | |||
7 | Signed-off-by: Li Qiang <liq3ea@gmail.com> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Message-id: 1542880825-2604-1-git-send-email-liq3ea@gmail.com | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/arm/musicpal.c | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/arm/musicpal.c | ||
19 | +++ b/hw/arm/musicpal.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static void musicpal_init(MachineState *machine) | ||
21 | dev = qdev_create(NULL, TYPE_MV88W8618_AUDIO); | ||
22 | s = SYS_BUS_DEVICE(dev); | ||
23 | object_property_set_link(OBJECT(dev), OBJECT(wm8750_dev), | ||
24 | - TYPE_WM8750, NULL); | ||
25 | + "wm8750", NULL); | ||
26 | qdev_init_nofail(dev); | ||
27 | sysbus_mmio_map(s, 0, MP_AUDIO_BASE); | ||
28 | sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]); | ||
29 | -- | ||
30 | 2.19.2 | ||
31 | |||
32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Ricardo Perez Blanco <ricardo.perez_blanco@nokia.com> | ||
2 | 1 | ||
3 | Architecturally, it's possible for an AArch64 machine to have | ||
4 | all of its RAM over the 4GB mark, but our kernel/initrd loading | ||
5 | code in boot.c assumes that the upper half of the addresses | ||
6 | to load these images to is always zero. Write the whole 64 bit | ||
7 | address into the bootloader code fragment, not just the low half. | ||
8 | |||
9 | Note that, currently, none of the existing QEMU machines have | ||
10 | their main memory over 4GBs, so this was not a user-visible bug. | ||
11 | |||
12 | Signed-off-by: Ricardo Perez Blanco <ricardo.perez_blanco@nokia.com> | ||
13 | [PMM: revised commit message and tweaked some long lines] | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | hw/arm/boot.c | 35 ++++++++++++++++++++++------------- | ||
18 | 1 file changed, 22 insertions(+), 13 deletions(-) | ||
19 | |||
20 | diff --git a/hw/arm/boot.c b/hw/arm/boot.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/arm/boot.c | ||
23 | +++ b/hw/arm/boot.c | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
25 | FIXUP_TERMINATOR, /* end of insns */ | ||
26 | FIXUP_BOARDID, /* overwrite with board ID number */ | ||
27 | FIXUP_BOARD_SETUP, /* overwrite with board specific setup code address */ | ||
28 | - FIXUP_ARGPTR, /* overwrite with pointer to kernel args */ | ||
29 | - FIXUP_ENTRYPOINT, /* overwrite with kernel entry point */ | ||
30 | + FIXUP_ARGPTR_LO, /* overwrite with pointer to kernel args */ | ||
31 | + FIXUP_ARGPTR_HI, /* overwrite with pointer to kernel args (high half) */ | ||
32 | + FIXUP_ENTRYPOINT_LO, /* overwrite with kernel entry point */ | ||
33 | + FIXUP_ENTRYPOINT_HI, /* overwrite with kernel entry point (high half) */ | ||
34 | FIXUP_GIC_CPU_IF, /* overwrite with GIC CPU interface address */ | ||
35 | FIXUP_BOOTREG, /* overwrite with boot register address */ | ||
36 | FIXUP_DSB, /* overwrite with correct DSB insn for cpu */ | ||
37 | @@ -XXX,XX +XXX,XX @@ static const ARMInsnFixup bootloader_aarch64[] = { | ||
38 | { 0xaa1f03e3 }, /* mov x3, xzr */ | ||
39 | { 0x58000084 }, /* ldr x4, entry ; Load the lower 32-bits of kernel entry */ | ||
40 | { 0xd61f0080 }, /* br x4 ; Jump to the kernel entry point */ | ||
41 | - { 0, FIXUP_ARGPTR }, /* arg: .word @DTB Lower 32-bits */ | ||
42 | - { 0 }, /* .word @DTB Higher 32-bits */ | ||
43 | - { 0, FIXUP_ENTRYPOINT }, /* entry: .word @Kernel Entry Lower 32-bits */ | ||
44 | - { 0 }, /* .word @Kernel Entry Higher 32-bits */ | ||
45 | + { 0, FIXUP_ARGPTR_LO }, /* arg: .word @DTB Lower 32-bits */ | ||
46 | + { 0, FIXUP_ARGPTR_HI}, /* .word @DTB Higher 32-bits */ | ||
47 | + { 0, FIXUP_ENTRYPOINT_LO }, /* entry: .word @Kernel Entry Lower 32-bits */ | ||
48 | + { 0, FIXUP_ENTRYPOINT_HI }, /* .word @Kernel Entry Higher 32-bits */ | ||
49 | { 0, FIXUP_TERMINATOR } | ||
50 | }; | ||
51 | |||
52 | @@ -XXX,XX +XXX,XX @@ static const ARMInsnFixup bootloader[] = { | ||
53 | { 0xe59f2004 }, /* ldr r2, [pc, #4] */ | ||
54 | { 0xe59ff004 }, /* ldr pc, [pc, #4] */ | ||
55 | { 0, FIXUP_BOARDID }, | ||
56 | - { 0, FIXUP_ARGPTR }, | ||
57 | - { 0, FIXUP_ENTRYPOINT }, | ||
58 | + { 0, FIXUP_ARGPTR_LO }, | ||
59 | + { 0, FIXUP_ENTRYPOINT_LO }, | ||
60 | { 0, FIXUP_TERMINATOR } | ||
61 | }; | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ static void write_bootloader(const char *name, hwaddr addr, | ||
64 | break; | ||
65 | case FIXUP_BOARDID: | ||
66 | case FIXUP_BOARD_SETUP: | ||
67 | - case FIXUP_ARGPTR: | ||
68 | - case FIXUP_ENTRYPOINT: | ||
69 | + case FIXUP_ARGPTR_LO: | ||
70 | + case FIXUP_ARGPTR_HI: | ||
71 | + case FIXUP_ENTRYPOINT_LO: | ||
72 | + case FIXUP_ENTRYPOINT_HI: | ||
73 | case FIXUP_GIC_CPU_IF: | ||
74 | case FIXUP_BOOTREG: | ||
75 | case FIXUP_DSB: | ||
76 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | ||
77 | /* Place the DTB after the initrd in memory with alignment. */ | ||
78 | info->dtb_start = QEMU_ALIGN_UP(info->initrd_start + initrd_size, | ||
79 | align); | ||
80 | - fixupcontext[FIXUP_ARGPTR] = info->dtb_start; | ||
81 | + fixupcontext[FIXUP_ARGPTR_LO] = info->dtb_start; | ||
82 | + fixupcontext[FIXUP_ARGPTR_HI] = info->dtb_start >> 32; | ||
83 | } else { | ||
84 | - fixupcontext[FIXUP_ARGPTR] = info->loader_start + KERNEL_ARGS_ADDR; | ||
85 | + fixupcontext[FIXUP_ARGPTR_LO] = | ||
86 | + info->loader_start + KERNEL_ARGS_ADDR; | ||
87 | + fixupcontext[FIXUP_ARGPTR_HI] = | ||
88 | + (info->loader_start + KERNEL_ARGS_ADDR) >> 32; | ||
89 | if (info->ram_size >= (1ULL << 32)) { | ||
90 | error_report("RAM size must be less than 4GB to boot" | ||
91 | " Linux kernel using ATAGS (try passing a device tree" | ||
92 | @@ -XXX,XX +XXX,XX @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) | ||
93 | exit(1); | ||
94 | } | ||
95 | } | ||
96 | - fixupcontext[FIXUP_ENTRYPOINT] = entry; | ||
97 | + fixupcontext[FIXUP_ENTRYPOINT_LO] = entry; | ||
98 | + fixupcontext[FIXUP_ENTRYPOINT_HI] = entry >> 32; | ||
99 | |||
100 | write_bootloader("bootloader", info->loader_start, | ||
101 | primary_loader, fixupcontext, as); | ||
102 | -- | ||
103 | 2.19.2 | ||
104 | |||
105 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | mv88w8618_wlan_class_init(). | ||
5 | |||
6 | Cc: jan.kiszka@web.de | ||
7 | Cc: peter.maydell@linaro.org | ||
8 | Cc: qemu-arm@nongnu.org | ||
9 | |||
10 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
11 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20181130093852.20739-2-maozhongyi@cmss.chinamobile.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/arm/musicpal.c | 9 ++++----- | ||
17 | 1 file changed, 4 insertions(+), 5 deletions(-) | ||
18 | |||
19 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/arm/musicpal.c | ||
22 | +++ b/hw/arm/musicpal.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps mv88w8618_wlan_ops = { | ||
24 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
25 | }; | ||
26 | |||
27 | -static int mv88w8618_wlan_init(SysBusDevice *dev) | ||
28 | +static void mv88w8618_wlan_realize(DeviceState *dev, Error **errp) | ||
29 | { | ||
30 | MemoryRegion *iomem = g_new(MemoryRegion, 1); | ||
31 | |||
32 | memory_region_init_io(iomem, OBJECT(dev), &mv88w8618_wlan_ops, NULL, | ||
33 | "musicpal-wlan", MP_WLAN_SIZE); | ||
34 | - sysbus_init_mmio(dev, iomem); | ||
35 | - return 0; | ||
36 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), iomem); | ||
37 | } | ||
38 | |||
39 | /* GPIO register offsets */ | ||
40 | @@ -XXX,XX +XXX,XX @@ DEFINE_MACHINE("musicpal", musicpal_machine_init) | ||
41 | |||
42 | static void mv88w8618_wlan_class_init(ObjectClass *klass, void *data) | ||
43 | { | ||
44 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
45 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
46 | |||
47 | - sdc->init = mv88w8618_wlan_init; | ||
48 | + dc->realize = mv88w8618_wlan_realize; | ||
49 | } | ||
50 | |||
51 | static const TypeInfo mv88w8618_wlan_info = { | ||
52 | -- | ||
53 | 2.19.2 | ||
54 | |||
55 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | onenand_class_init(). | ||
5 | |||
6 | Cc: kwolf@redhat.com | ||
7 | Cc: mreitz@redhat.com | ||
8 | Cc: qemu-block@nongnu.org | ||
9 | |||
10 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
11 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20181130093852.20739-3-maozhongyi@cmss.chinamobile.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/block/onenand.c | 16 +++++++--------- | ||
17 | 1 file changed, 7 insertions(+), 9 deletions(-) | ||
18 | |||
19 | diff --git a/hw/block/onenand.c b/hw/block/onenand.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/block/onenand.c | ||
22 | +++ b/hw/block/onenand.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps onenand_ops = { | ||
24 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
25 | }; | ||
26 | |||
27 | -static int onenand_initfn(SysBusDevice *sbd) | ||
28 | +static void onenand_realize(DeviceState *dev, Error **errp) | ||
29 | { | ||
30 | - DeviceState *dev = DEVICE(sbd); | ||
31 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
32 | OneNANDState *s = ONE_NAND(dev); | ||
33 | uint32_t size = 1 << (24 + ((s->id.dev >> 4) & 7)); | ||
34 | void *ram; | ||
35 | @@ -XXX,XX +XXX,XX @@ static int onenand_initfn(SysBusDevice *sbd) | ||
36 | 0xff, size + (size >> 5)); | ||
37 | } else { | ||
38 | if (blk_is_read_only(s->blk)) { | ||
39 | - error_report("Can't use a read-only drive"); | ||
40 | - return -1; | ||
41 | + error_setg(errp, "Can't use a read-only drive"); | ||
42 | + return; | ||
43 | } | ||
44 | blk_set_perm(s->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE, | ||
45 | BLK_PERM_ALL, &local_err); | ||
46 | if (local_err) { | ||
47 | - error_report_err(local_err); | ||
48 | - return -1; | ||
49 | + error_propagate(errp, local_err); | ||
50 | + return; | ||
51 | } | ||
52 | s->blk_cur = s->blk; | ||
53 | } | ||
54 | @@ -XXX,XX +XXX,XX @@ static int onenand_initfn(SysBusDevice *sbd) | ||
55 | | ((s->id.dev & 0xff) << 8) | ||
56 | | (s->id.ver & 0xff), | ||
57 | &vmstate_onenand, s); | ||
58 | - return 0; | ||
59 | } | ||
60 | |||
61 | static Property onenand_properties[] = { | ||
62 | @@ -XXX,XX +XXX,XX @@ static Property onenand_properties[] = { | ||
63 | static void onenand_class_init(ObjectClass *klass, void *data) | ||
64 | { | ||
65 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
66 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
67 | |||
68 | - k->init = onenand_initfn; | ||
69 | + dc->realize = onenand_realize; | ||
70 | dc->reset = onenand_system_reset; | ||
71 | dc->props = onenand_properties; | ||
72 | } | ||
73 | -- | ||
74 | 2.19.2 | ||
75 | |||
76 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | grlib_apbuart_class_init(). | ||
5 | |||
6 | Cc: chouteau@adacore.com | ||
7 | Cc: marcandre.lureau@redhat.com | ||
8 | Cc: pbonzini@redhat.com | ||
9 | |||
10 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
11 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20181130093852.20739-4-maozhongyi@cmss.chinamobile.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/char/grlib_apbuart.c | 12 +++++------- | ||
17 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
18 | |||
19 | diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/hw/char/grlib_apbuart.c | ||
22 | +++ b/hw/char/grlib_apbuart.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps grlib_apbuart_ops = { | ||
24 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
25 | }; | ||
26 | |||
27 | -static int grlib_apbuart_init(SysBusDevice *dev) | ||
28 | +static void grlib_apbuart_realize(DeviceState *dev, Error **errp) | ||
29 | { | ||
30 | UART *uart = GRLIB_APB_UART(dev); | ||
31 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
32 | |||
33 | qemu_chr_fe_set_handlers(&uart->chr, | ||
34 | grlib_apbuart_can_receive, | ||
35 | @@ -XXX,XX +XXX,XX @@ static int grlib_apbuart_init(SysBusDevice *dev) | ||
36 | grlib_apbuart_event, | ||
37 | NULL, uart, NULL, true); | ||
38 | |||
39 | - sysbus_init_irq(dev, &uart->irq); | ||
40 | + sysbus_init_irq(sbd, &uart->irq); | ||
41 | |||
42 | memory_region_init_io(&uart->iomem, OBJECT(uart), &grlib_apbuart_ops, uart, | ||
43 | "uart", UART_REG_SIZE); | ||
44 | |||
45 | - sysbus_init_mmio(dev, &uart->iomem); | ||
46 | - | ||
47 | - return 0; | ||
48 | + sysbus_init_mmio(sbd, &uart->iomem); | ||
49 | } | ||
50 | |||
51 | static void grlib_apbuart_reset(DeviceState *d) | ||
52 | @@ -XXX,XX +XXX,XX @@ static Property grlib_apbuart_properties[] = { | ||
53 | static void grlib_apbuart_class_init(ObjectClass *klass, void *data) | ||
54 | { | ||
55 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
56 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
57 | |||
58 | - k->init = grlib_apbuart_init; | ||
59 | + dc->realize = grlib_apbuart_realize; | ||
60 | dc->reset = grlib_apbuart_reset; | ||
61 | dc->props = grlib_apbuart_properties; | ||
62 | } | ||
63 | -- | ||
64 | 2.19.2 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | empty_slot_class_init(). | ||
5 | |||
6 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
7 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Message-id: 20181130093852.20739-5-maozhongyi@cmss.chinamobile.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/core/empty_slot.c | 9 ++++----- | ||
14 | 1 file changed, 4 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/core/empty_slot.c | ||
19 | +++ b/hw/core/empty_slot.c | ||
20 | @@ -XXX,XX +XXX,XX @@ void empty_slot_init(hwaddr addr, uint64_t slot_size) | ||
21 | } | ||
22 | } | ||
23 | |||
24 | -static int empty_slot_init1(SysBusDevice *dev) | ||
25 | +static void empty_slot_realize(DeviceState *dev, Error **errp) | ||
26 | { | ||
27 | EmptySlot *s = EMPTY_SLOT(dev); | ||
28 | |||
29 | memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s, | ||
30 | "empty-slot", s->size); | ||
31 | - sysbus_init_mmio(dev, &s->iomem); | ||
32 | - return 0; | ||
33 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | ||
34 | } | ||
35 | |||
36 | static void empty_slot_class_init(ObjectClass *klass, void *data) | ||
37 | { | ||
38 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
39 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
40 | |||
41 | - k->init = empty_slot_init1; | ||
42 | + dc->realize = empty_slot_realize; | ||
43 | } | ||
44 | |||
45 | static const TypeInfo empty_slot_info = { | ||
46 | -- | ||
47 | 2.19.2 | ||
48 | |||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | g364fb_sysbus_class_init(). | ||
5 | |||
6 | Cc: pbonzini@redhat.com | ||
7 | Cc: kraxel@redhat.com | ||
8 | Cc: f4bug@amsat.org | ||
9 | Cc: alistair.francis@wdc.com | ||
10 | |||
11 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
12 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
13 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20181130093852.20739-6-maozhongyi@cmss.chinamobile.com | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | --- | ||
18 | hw/display/g364fb.c | 9 +++------ | ||
19 | 1 file changed, 3 insertions(+), 6 deletions(-) | ||
20 | |||
21 | diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/display/g364fb.c | ||
24 | +++ b/hw/display/g364fb.c | ||
25 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
26 | G364State g364; | ||
27 | } G364SysBusState; | ||
28 | |||
29 | -static int g364fb_sysbus_init(SysBusDevice *sbd) | ||
30 | +static void g364fb_sysbus_realize(DeviceState *dev, Error **errp) | ||
31 | { | ||
32 | - DeviceState *dev = DEVICE(sbd); | ||
33 | G364SysBusState *sbs = G364(dev); | ||
34 | G364State *s = &sbs->g364; | ||
35 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
36 | |||
37 | g364fb_init(dev, s); | ||
38 | sysbus_init_irq(sbd, &s->irq); | ||
39 | sysbus_init_mmio(sbd, &s->mem_ctrl); | ||
40 | sysbus_init_mmio(sbd, &s->mem_vram); | ||
41 | - | ||
42 | - return 0; | ||
43 | } | ||
44 | |||
45 | static void g364fb_sysbus_reset(DeviceState *d) | ||
46 | @@ -XXX,XX +XXX,XX @@ static Property g364fb_sysbus_properties[] = { | ||
47 | static void g364fb_sysbus_class_init(ObjectClass *klass, void *data) | ||
48 | { | ||
49 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
50 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
51 | |||
52 | - k->init = g364fb_sysbus_init; | ||
53 | + dc->realize = g364fb_sysbus_realize; | ||
54 | set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); | ||
55 | dc->desc = "G364 framebuffer"; | ||
56 | dc->reset = g364fb_sysbus_reset; | ||
57 | -- | ||
58 | 2.19.2 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | puv3_dma_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-7-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/dma/puv3_dma.c | 10 ++++------ | ||
16 | 1 file changed, 4 insertions(+), 6 deletions(-) | ||
17 | |||
18 | diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/dma/puv3_dma.c | ||
21 | +++ b/hw/dma/puv3_dma.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps puv3_dma_ops = { | ||
23 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
24 | }; | ||
25 | |||
26 | -static int puv3_dma_init(SysBusDevice *dev) | ||
27 | +static void puv3_dma_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | PUV3DMAState *s = PUV3_DMA(dev); | ||
30 | int i; | ||
31 | @@ -XXX,XX +XXX,XX @@ static int puv3_dma_init(SysBusDevice *dev) | ||
32 | |||
33 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_dma_ops, s, "puv3_dma", | ||
34 | PUV3_REGS_OFFSET); | ||
35 | - sysbus_init_mmio(dev, &s->iomem); | ||
36 | - | ||
37 | - return 0; | ||
38 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | ||
39 | } | ||
40 | |||
41 | static void puv3_dma_class_init(ObjectClass *klass, void *data) | ||
42 | { | ||
43 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
44 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
45 | |||
46 | - sdc->init = puv3_dma_init; | ||
47 | + dc->realize = puv3_dma_realize; | ||
48 | } | ||
49 | |||
50 | static const TypeInfo puv3_dma_info = { | ||
51 | -- | ||
52 | 2.19.2 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | puv3_gpio_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | Cc: peter.maydell@linaro.org | ||
8 | |||
9 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
10 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-8-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/gpio/puv3_gpio.c | 29 ++++++++++++++--------------- | ||
16 | 1 file changed, 14 insertions(+), 15 deletions(-) | ||
17 | |||
18 | diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/gpio/puv3_gpio.c | ||
21 | +++ b/hw/gpio/puv3_gpio.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps puv3_gpio_ops = { | ||
23 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
24 | }; | ||
25 | |||
26 | -static int puv3_gpio_init(SysBusDevice *dev) | ||
27 | +static void puv3_gpio_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | PUV3GPIOState *s = PUV3_GPIO(dev); | ||
30 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
31 | |||
32 | s->reg_GPLR = 0; | ||
33 | s->reg_GPDR = 0; | ||
34 | |||
35 | /* FIXME: these irqs not handled yet */ | ||
36 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW0]); | ||
37 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW1]); | ||
38 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW2]); | ||
39 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW3]); | ||
40 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW4]); | ||
41 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW5]); | ||
42 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW6]); | ||
43 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW7]); | ||
44 | - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOHIGH]); | ||
45 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW0]); | ||
46 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW1]); | ||
47 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW2]); | ||
48 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW3]); | ||
49 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW4]); | ||
50 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW5]); | ||
51 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW6]); | ||
52 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW7]); | ||
53 | + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOHIGH]); | ||
54 | |||
55 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_gpio_ops, s, "puv3_gpio", | ||
56 | PUV3_REGS_OFFSET); | ||
57 | - sysbus_init_mmio(dev, &s->iomem); | ||
58 | - | ||
59 | - return 0; | ||
60 | + sysbus_init_mmio(sbd, &s->iomem); | ||
61 | } | ||
62 | |||
63 | static void puv3_gpio_class_init(ObjectClass *klass, void *data) | ||
64 | { | ||
65 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
66 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
67 | |||
68 | - sdc->init = puv3_gpio_init; | ||
69 | + dc->realize = puv3_gpio_realize; | ||
70 | } | ||
71 | |||
72 | static const TypeInfo puv3_gpio_info = { | ||
73 | -- | ||
74 | 2.19.2 | ||
75 | |||
76 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | milkymist_softusb_class_init(). | ||
5 | |||
6 | Cc: michael@walle.cc | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20181130093852.20739-9-maozhongyi@cmss.chinamobile.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/input/milkymist-softusb.c | 16 +++++++--------- | ||
15 | 1 file changed, 7 insertions(+), 9 deletions(-) | ||
16 | |||
17 | diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/input/milkymist-softusb.c | ||
20 | +++ b/hw/input/milkymist-softusb.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void milkymist_softusb_reset(DeviceState *d) | ||
22 | s->regs[R_CTRL] = CTRL_RESET; | ||
23 | } | ||
24 | |||
25 | -static int milkymist_softusb_init(SysBusDevice *dev) | ||
26 | +static void milkymist_softusb_realize(DeviceState *dev, Error **errp) | ||
27 | { | ||
28 | MilkymistSoftUsbState *s = MILKYMIST_SOFTUSB(dev); | ||
29 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
30 | |||
31 | - sysbus_init_irq(dev, &s->irq); | ||
32 | + sysbus_init_irq(sbd, &s->irq); | ||
33 | |||
34 | memory_region_init_io(&s->regs_region, OBJECT(s), &softusb_mmio_ops, s, | ||
35 | "milkymist-softusb", R_MAX * 4); | ||
36 | - sysbus_init_mmio(dev, &s->regs_region); | ||
37 | + sysbus_init_mmio(sbd, &s->regs_region); | ||
38 | |||
39 | /* register pmem and dmem */ | ||
40 | memory_region_init_ram_nomigrate(&s->pmem, OBJECT(s), "milkymist-softusb.pmem", | ||
41 | s->pmem_size, &error_fatal); | ||
42 | vmstate_register_ram_global(&s->pmem); | ||
43 | s->pmem_ptr = memory_region_get_ram_ptr(&s->pmem); | ||
44 | - sysbus_init_mmio(dev, &s->pmem); | ||
45 | + sysbus_init_mmio(sbd, &s->pmem); | ||
46 | memory_region_init_ram_nomigrate(&s->dmem, OBJECT(s), "milkymist-softusb.dmem", | ||
47 | s->dmem_size, &error_fatal); | ||
48 | vmstate_register_ram_global(&s->dmem); | ||
49 | s->dmem_ptr = memory_region_get_ram_ptr(&s->dmem); | ||
50 | - sysbus_init_mmio(dev, &s->dmem); | ||
51 | + sysbus_init_mmio(sbd, &s->dmem); | ||
52 | |||
53 | hid_init(&s->hid_kbd, HID_KEYBOARD, softusb_kbd_hid_datain); | ||
54 | hid_init(&s->hid_mouse, HID_MOUSE, softusb_mouse_hid_datain); | ||
55 | - | ||
56 | - return 0; | ||
57 | } | ||
58 | |||
59 | static const VMStateDescription vmstate_milkymist_softusb = { | ||
60 | @@ -XXX,XX +XXX,XX @@ static Property milkymist_softusb_properties[] = { | ||
61 | static void milkymist_softusb_class_init(ObjectClass *klass, void *data) | ||
62 | { | ||
63 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
64 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
65 | |||
66 | - k->init = milkymist_softusb_init; | ||
67 | + dc->realize = milkymist_softusb_realize; | ||
68 | dc->reset = milkymist_softusb_reset; | ||
69 | dc->vmsd = &vmstate_milkymist_softusb; | ||
70 | dc->props = milkymist_softusb_properties; | ||
71 | -- | ||
72 | 2.19.2 | ||
73 | |||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | pl050_class_init(). | ||
5 | |||
6 | Cc: peter.maydell@linaro.org | ||
7 | Cc: qemu-arm@nongnu.org | ||
8 | |||
9 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
10 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-10-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/input/pl050.c | 11 +++++------ | ||
16 | 1 file changed, 5 insertions(+), 6 deletions(-) | ||
17 | |||
18 | diff --git a/hw/input/pl050.c b/hw/input/pl050.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/input/pl050.c | ||
21 | +++ b/hw/input/pl050.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps pl050_ops = { | ||
23 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
24 | }; | ||
25 | |||
26 | -static int pl050_initfn(SysBusDevice *dev) | ||
27 | +static void pl050_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | PL050State *s = PL050(dev); | ||
30 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
31 | |||
32 | memory_region_init_io(&s->iomem, OBJECT(s), &pl050_ops, s, "pl050", 0x1000); | ||
33 | - sysbus_init_mmio(dev, &s->iomem); | ||
34 | - sysbus_init_irq(dev, &s->irq); | ||
35 | + sysbus_init_mmio(sbd, &s->iomem); | ||
36 | + sysbus_init_irq(sbd, &s->irq); | ||
37 | if (s->is_mouse) { | ||
38 | s->dev = ps2_mouse_init(pl050_update, s); | ||
39 | } else { | ||
40 | s->dev = ps2_kbd_init(pl050_update, s); | ||
41 | } | ||
42 | - return 0; | ||
43 | } | ||
44 | |||
45 | static void pl050_keyboard_init(Object *obj) | ||
46 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo pl050_mouse_info = { | ||
47 | static void pl050_class_init(ObjectClass *oc, void *data) | ||
48 | { | ||
49 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
50 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(oc); | ||
51 | |||
52 | - sdc->init = pl050_initfn; | ||
53 | + dc->realize = pl050_realize; | ||
54 | dc->vmsd = &vmstate_pl050; | ||
55 | } | ||
56 | |||
57 | -- | ||
58 | 2.19.2 | ||
59 | |||
60 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | puv3_intc_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20181130093852.20739-11-maozhongyi@cmss.chinamobile.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/intc/puv3_intc.c | 11 ++++------- | ||
15 | 1 file changed, 4 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/intc/puv3_intc.c | ||
20 | +++ b/hw/intc/puv3_intc.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps puv3_intc_ops = { | ||
22 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
23 | }; | ||
24 | |||
25 | -static int puv3_intc_init(SysBusDevice *sbd) | ||
26 | +static void puv3_intc_realize(DeviceState *dev, Error **errp) | ||
27 | { | ||
28 | - DeviceState *dev = DEVICE(sbd); | ||
29 | PUV3INTCState *s = PUV3_INTC(dev); | ||
30 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
31 | |||
32 | qdev_init_gpio_in(dev, puv3_intc_handler, PUV3_IRQS_NR); | ||
33 | sysbus_init_irq(sbd, &s->parent_irq); | ||
34 | @@ -XXX,XX +XXX,XX @@ static int puv3_intc_init(SysBusDevice *sbd) | ||
35 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_intc_ops, s, "puv3_intc", | ||
36 | PUV3_REGS_OFFSET); | ||
37 | sysbus_init_mmio(sbd, &s->iomem); | ||
38 | - | ||
39 | - return 0; | ||
40 | } | ||
41 | |||
42 | static void puv3_intc_class_init(ObjectClass *klass, void *data) | ||
43 | { | ||
44 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
45 | - | ||
46 | - sdc->init = puv3_intc_init; | ||
47 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
48 | + dc->realize = puv3_intc_realize; | ||
49 | } | ||
50 | |||
51 | static const TypeInfo puv3_intc_info = { | ||
52 | -- | ||
53 | 2.19.2 | ||
54 | |||
55 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | milkymist_hpdmc_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | Cc: michael@walle.cc | ||
8 | |||
9 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
10 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-12-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/misc/milkymist-hpdmc.c | 9 +++------ | ||
16 | 1 file changed, 3 insertions(+), 6 deletions(-) | ||
17 | |||
18 | diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/misc/milkymist-hpdmc.c | ||
21 | +++ b/hw/misc/milkymist-hpdmc.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static void milkymist_hpdmc_reset(DeviceState *d) | ||
23 | | IODELAY_PLL2_LOCKED; | ||
24 | } | ||
25 | |||
26 | -static int milkymist_hpdmc_init(SysBusDevice *dev) | ||
27 | +static void milkymist_hpdmc_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | MilkymistHpdmcState *s = MILKYMIST_HPDMC(dev); | ||
30 | |||
31 | memory_region_init_io(&s->regs_region, OBJECT(dev), &hpdmc_mmio_ops, s, | ||
32 | "milkymist-hpdmc", R_MAX * 4); | ||
33 | - sysbus_init_mmio(dev, &s->regs_region); | ||
34 | - | ||
35 | - return 0; | ||
36 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->regs_region); | ||
37 | } | ||
38 | |||
39 | static const VMStateDescription vmstate_milkymist_hpdmc = { | ||
40 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_milkymist_hpdmc = { | ||
41 | static void milkymist_hpdmc_class_init(ObjectClass *klass, void *data) | ||
42 | { | ||
43 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
44 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
45 | |||
46 | - k->init = milkymist_hpdmc_init; | ||
47 | + dc->realize = milkymist_hpdmc_realize; | ||
48 | dc->reset = milkymist_hpdmc_reset; | ||
49 | dc->vmsd = &vmstate_milkymist_hpdmc; | ||
50 | } | ||
51 | -- | ||
52 | 2.19.2 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | milkymist_pfpu_class_init(). | ||
5 | |||
6 | Cc: michael@walle.cc | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20181130093852.20739-13-maozhongyi@cmss.chinamobile.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/misc/milkymist-pfpu.c | 12 +++++------- | ||
15 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/misc/milkymist-pfpu.c | ||
20 | +++ b/hw/misc/milkymist-pfpu.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void milkymist_pfpu_reset(DeviceState *d) | ||
22 | } | ||
23 | } | ||
24 | |||
25 | -static int milkymist_pfpu_init(SysBusDevice *dev) | ||
26 | +static void milkymist_pfpu_realize(DeviceState *dev, Error **errp) | ||
27 | { | ||
28 | MilkymistPFPUState *s = MILKYMIST_PFPU(dev); | ||
29 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
30 | |||
31 | - sysbus_init_irq(dev, &s->irq); | ||
32 | + sysbus_init_irq(sbd, &s->irq); | ||
33 | |||
34 | memory_region_init_io(&s->regs_region, OBJECT(dev), &pfpu_mmio_ops, s, | ||
35 | "milkymist-pfpu", MICROCODE_END * 4); | ||
36 | - sysbus_init_mmio(dev, &s->regs_region); | ||
37 | - | ||
38 | - return 0; | ||
39 | + sysbus_init_mmio(sbd, &s->regs_region); | ||
40 | } | ||
41 | |||
42 | static const VMStateDescription vmstate_milkymist_pfpu = { | ||
43 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_milkymist_pfpu = { | ||
44 | static void milkymist_pfpu_class_init(ObjectClass *klass, void *data) | ||
45 | { | ||
46 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
47 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
48 | |||
49 | - k->init = milkymist_pfpu_init; | ||
50 | + dc->realize = milkymist_pfpu_realize; | ||
51 | dc->reset = milkymist_pfpu_reset; | ||
52 | dc->vmsd = &vmstate_milkymist_pfpu; | ||
53 | } | ||
54 | -- | ||
55 | 2.19.2 | ||
56 | |||
57 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | puv3_pm_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-14-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/misc/puv3_pm.c | 10 ++++------ | ||
16 | 1 file changed, 4 insertions(+), 6 deletions(-) | ||
17 | |||
18 | diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/misc/puv3_pm.c | ||
21 | +++ b/hw/misc/puv3_pm.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps puv3_pm_ops = { | ||
23 | .endianness = DEVICE_NATIVE_ENDIAN, | ||
24 | }; | ||
25 | |||
26 | -static int puv3_pm_init(SysBusDevice *dev) | ||
27 | +static void puv3_pm_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | PUV3PMState *s = PUV3_PM(dev); | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ static int puv3_pm_init(SysBusDevice *dev) | ||
32 | |||
33 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_pm_ops, s, "puv3_pm", | ||
34 | PUV3_REGS_OFFSET); | ||
35 | - sysbus_init_mmio(dev, &s->iomem); | ||
36 | - | ||
37 | - return 0; | ||
38 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | ||
39 | } | ||
40 | |||
41 | static void puv3_pm_class_init(ObjectClass *klass, void *data) | ||
42 | { | ||
43 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
44 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
45 | |||
46 | - sdc->init = puv3_pm_init; | ||
47 | + dc->realize = puv3_pm_realize; | ||
48 | } | ||
49 | |||
50 | static const TypeInfo puv3_pm_info = { | ||
51 | -- | ||
52 | 2.19.2 | ||
53 | |||
54 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | nvram_sysbus_class_init(). | ||
5 | |||
6 | Cc: pbonzini@redhat.com | ||
7 | Cc: marcandre.lureau@redhat.com | ||
8 | |||
9 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
10 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20181130093852.20739-15-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/nvram/ds1225y.c | 12 +++++------- | ||
16 | 1 file changed, 5 insertions(+), 7 deletions(-) | ||
17 | |||
18 | diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/nvram/ds1225y.c | ||
21 | +++ b/hw/nvram/ds1225y.c | ||
22 | @@ -XXX,XX +XXX,XX @@ | ||
23 | #include "qemu/osdep.h" | ||
24 | #include "hw/sysbus.h" | ||
25 | #include "trace.h" | ||
26 | +#include "qemu/error-report.h" | ||
27 | |||
28 | typedef struct { | ||
29 | MemoryRegion iomem; | ||
30 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
31 | NvRamState nvram; | ||
32 | } SysBusNvRamState; | ||
33 | |||
34 | -static int nvram_sysbus_initfn(SysBusDevice *dev) | ||
35 | +static void nvram_sysbus_realize(DeviceState *dev, Error **errp) | ||
36 | { | ||
37 | SysBusNvRamState *sys = DS1225Y(dev); | ||
38 | NvRamState *s = &sys->nvram; | ||
39 | @@ -XXX,XX +XXX,XX @@ static int nvram_sysbus_initfn(SysBusDevice *dev) | ||
40 | |||
41 | memory_region_init_io(&s->iomem, OBJECT(s), &nvram_ops, s, | ||
42 | "nvram", s->chip_size); | ||
43 | - sysbus_init_mmio(dev, &s->iomem); | ||
44 | + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | ||
45 | |||
46 | /* Read current file */ | ||
47 | file = s->filename ? fopen(s->filename, "rb") : NULL; | ||
48 | if (file) { | ||
49 | /* Read nvram contents */ | ||
50 | if (fread(s->contents, s->chip_size, 1, file) != 1) { | ||
51 | - printf("nvram_sysbus_initfn: short read\n"); | ||
52 | + error_report("nvram_sysbus_realize: short read"); | ||
53 | } | ||
54 | fclose(file); | ||
55 | } | ||
56 | nvram_post_load(s, 0); | ||
57 | - | ||
58 | - return 0; | ||
59 | } | ||
60 | |||
61 | static Property nvram_sysbus_properties[] = { | ||
62 | @@ -XXX,XX +XXX,XX @@ static Property nvram_sysbus_properties[] = { | ||
63 | static void nvram_sysbus_class_init(ObjectClass *klass, void *data) | ||
64 | { | ||
65 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
66 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
67 | |||
68 | - k->init = nvram_sysbus_initfn; | ||
69 | + dc->realize = nvram_sysbus_realize; | ||
70 | dc->vmsd = &vmstate_nvram; | ||
71 | dc->props = nvram_sysbus_properties; | ||
72 | } | ||
73 | -- | ||
74 | 2.19.2 | ||
75 | |||
76 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | In commit a1a98357e3fd in 2018 we added some workarounds for Coverity |
---|---|---|---|
2 | not being able to handle the _Float* types introduced by recent | ||
3 | glibc. Newer versions of the Coverity scan tools have support for | ||
4 | these types, and will fail with errors about duplicate typedefs if we | ||
5 | have our workaround. Remove our copy of the typedefs. | ||
2 | 6 | ||
3 | Since arm_hcr_el2_eff includes a check against | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | arm_is_secure_below_el3, we can often remove a | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | nearby check against secure state. | 9 | Message-id: 20200319193323.2038-2-peter.maydell@linaro.org |
10 | --- | ||
11 | include/qemu/osdep.h | 14 -------------- | ||
12 | 1 file changed, 14 deletions(-) | ||
6 | 13 | ||
7 | In some cases, sort the call to arm_hcr_el2_eff | 14 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h |
8 | to the end of a short-circuit logical sequence. | ||
9 | |||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Message-id: 20181210150501.7990-3-richard.henderson@linaro.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | target/arm/helper.c | 12 +++++------- | ||
16 | target/arm/op_helper.c | 14 ++++++-------- | ||
17 | 2 files changed, 11 insertions(+), 15 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 16 | --- a/include/qemu/osdep.h |
22 | +++ b/target/arm/helper.c | 17 | +++ b/include/qemu/osdep.h |
23 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tdosa(CPUARMState *env, const ARMCPRegInfo *ri, | 18 | @@ -XXX,XX +XXX,XX @@ |
24 | int el = arm_current_el(env); | 19 | #else |
25 | bool mdcr_el2_tdosa = (env->cp15.mdcr_el2 & MDCR_TDOSA) || | 20 | #include "exec/poison.h" |
26 | (env->cp15.mdcr_el2 & MDCR_TDE) || | 21 | #endif |
27 | - (env->cp15.hcr_el2 & HCR_TGE); | 22 | -#ifdef __COVERITY__ |
28 | + (arm_hcr_el2_eff(env) & HCR_TGE); | 23 | -/* Coverity does not like the new _Float* types that are used by |
29 | 24 | - * recent glibc, and croaks on every single file that includes | |
30 | if (el < 2 && mdcr_el2_tdosa && !arm_is_secure_below_el3(env)) { | 25 | - * stdlib.h. These typedefs are enough to please it. |
31 | return CP_ACCESS_TRAP_EL2; | 26 | - * |
32 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tdra(CPUARMState *env, const ARMCPRegInfo *ri, | 27 | - * Note that these fix parse errors so they cannot be placed in |
33 | int el = arm_current_el(env); | 28 | - * scripts/coverity-model.c. |
34 | bool mdcr_el2_tdra = (env->cp15.mdcr_el2 & MDCR_TDRA) || | 29 | - */ |
35 | (env->cp15.mdcr_el2 & MDCR_TDE) || | 30 | -typedef float _Float32; |
36 | - (env->cp15.hcr_el2 & HCR_TGE); | 31 | -typedef double _Float32x; |
37 | + (arm_hcr_el2_eff(env) & HCR_TGE); | 32 | -typedef double _Float64; |
38 | 33 | -typedef __float80 _Float64x; | |
39 | if (el < 2 && mdcr_el2_tdra && !arm_is_secure_below_el3(env)) { | 34 | -typedef __float128 _Float128; |
40 | return CP_ACCESS_TRAP_EL2; | 35 | -#endif |
41 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tda(CPUARMState *env, const ARMCPRegInfo *ri, | 36 | |
42 | int el = arm_current_el(env); | 37 | #include "qemu/compiler.h" |
43 | bool mdcr_el2_tda = (env->cp15.mdcr_el2 & MDCR_TDA) || | ||
44 | (env->cp15.mdcr_el2 & MDCR_TDE) || | ||
45 | - (env->cp15.hcr_el2 & HCR_TGE); | ||
46 | + (arm_hcr_el2_eff(env) & HCR_TGE); | ||
47 | |||
48 | if (el < 2 && mdcr_el2_tda && !arm_is_secure_below_el3(env)) { | ||
49 | return CP_ACCESS_TRAP_EL2; | ||
50 | @@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el) | ||
51 | if (disabled) { | ||
52 | /* route_to_el2 */ | ||
53 | return (arm_feature(env, ARM_FEATURE_EL2) | ||
54 | - && !arm_is_secure(env) | ||
55 | - && (env->cp15.hcr_el2 & HCR_TGE) ? 2 : 1); | ||
56 | + && (arm_hcr_el2_eff(env) & HCR_TGE) ? 2 : 1); | ||
57 | } | ||
58 | |||
59 | /* Check CPACR.FPEN. */ | ||
60 | @@ -XXX,XX +XXX,XX @@ static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type) | ||
61 | * and CPS are treated as illegal mode changes. | ||
62 | */ | ||
63 | if (write_type == CPSRWriteByInstr && | ||
64 | - (env->cp15.hcr_el2 & HCR_TGE) && | ||
65 | (env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_MON && | ||
66 | - !arm_is_secure_below_el3(env)) { | ||
67 | + (arm_hcr_el2_eff(env) & HCR_TGE)) { | ||
68 | return 1; | ||
69 | } | ||
70 | return 0; | ||
71 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
72 | index XXXXXXX..XXXXXXX 100644 | ||
73 | --- a/target/arm/op_helper.c | ||
74 | +++ b/target/arm/op_helper.c | ||
75 | @@ -XXX,XX +XXX,XX @@ void raise_exception(CPUARMState *env, uint32_t excp, | ||
76 | { | ||
77 | CPUState *cs = CPU(arm_env_get_cpu(env)); | ||
78 | |||
79 | - if ((env->cp15.hcr_el2 & HCR_TGE) && | ||
80 | - target_el == 1 && !arm_is_secure(env)) { | ||
81 | + if (target_el == 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { | ||
82 | /* | ||
83 | * Redirect NS EL1 exceptions to NS EL2. These are reported with | ||
84 | * their original syndrome register value, with the exception of | ||
85 | @@ -XXX,XX +XXX,XX @@ static inline int check_wfx_trap(CPUARMState *env, bool is_wfe) | ||
86 | * No need for ARM_FEATURE check as if HCR_EL2 doesn't exist the | ||
87 | * bits will be zero indicating no trap. | ||
88 | */ | ||
89 | - if (cur_el < 2 && !arm_is_secure(env)) { | ||
90 | - mask = (is_wfe) ? HCR_TWE : HCR_TWI; | ||
91 | - if (env->cp15.hcr_el2 & mask) { | ||
92 | + if (cur_el < 2) { | ||
93 | + mask = is_wfe ? HCR_TWE : HCR_TWI; | ||
94 | + if (arm_hcr_el2_eff(env) & mask) { | ||
95 | return 2; | ||
96 | } | ||
97 | } | ||
98 | @@ -XXX,XX +XXX,XX @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome) | ||
99 | exception_target_el(env)); | ||
100 | } | ||
101 | |||
102 | - if (!secure && cur_el == 1 && (env->cp15.hcr_el2 & HCR_TSC)) { | ||
103 | + if (cur_el == 1 && (arm_hcr_el2_eff(env) & HCR_TSC)) { | ||
104 | /* In NS EL1, HCR controlled routing to EL2 has priority over SMD. | ||
105 | * We also want an EL2 guest to be able to forbid its EL1 from | ||
106 | * making PSCI calls into QEMU's "firmware" via HCR.TSC. | ||
107 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_return)(CPUARMState *env) | ||
108 | goto illegal_return; | ||
109 | } | ||
110 | |||
111 | - if (new_el == 1 && (env->cp15.hcr_el2 & HCR_TGE) | ||
112 | - && !arm_is_secure_below_el3(env)) { | ||
113 | + if (new_el == 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { | ||
114 | goto illegal_return; | ||
115 | } | ||
116 | 38 | ||
117 | -- | 39 | -- |
118 | 2.19.2 | 40 | 2.20.1 |
119 | 41 | ||
120 | 42 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | For Coverity's benefit, we provide simpler versions of functions like |
---|---|---|---|
2 | qemu_mutex_lock(), qemu_cond_wait() and qemu_cond_timedwait(). When | ||
3 | we added qemu_cond_timedwait() in commit 3dcc9c6ec4ea, a cut and | ||
4 | paste error meant that the Coverity version of qemu_cond_timedwait() | ||
5 | was using the wrong _impl function, which makes the Coverity parser | ||
6 | complain: | ||
2 | 7 | ||
3 | Correct the nr of IRQs to 192. | 8 | "/qemu/include/qemu/thread.h", line 159: warning #140: too many arguments in |
9 | function call | ||
10 | return qemu_cond_timedwait(cond, mutex, ms); | ||
11 | ^ | ||
4 | 12 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 13 | "/qemu/include/qemu/thread.h", line 159: warning #120: return value type does |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 14 | not match the function type |
7 | Message-id: 20181129163655.20370-5-edgar.iglesias@gmail.com | 15 | return qemu_cond_timedwait(cond, mutex, ms); |
16 | ^ | ||
17 | |||
18 | "/qemu/include/qemu/thread.h", line 156: warning #1563: function | ||
19 | "qemu_cond_timedwait" not emitted, consider modeling it or review | ||
20 | parse diagnostics to improve fidelity | ||
21 | static inline bool (qemu_cond_timedwait)(QemuCond *cond, QemuMutex *mutex, | ||
22 | ^ | ||
23 | |||
24 | These aren't fatal, but reduce the scope of the analysis. Fix the error. | ||
25 | |||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
29 | Message-id: 20200319193323.2038-3-peter.maydell@linaro.org | ||
9 | --- | 30 | --- |
10 | include/hw/arm/xlnx-versal.h | 2 +- | 31 | include/qemu/thread.h | 2 +- |
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | 32 | 1 file changed, 1 insertion(+), 1 deletion(-) |
12 | 33 | ||
13 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 34 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h |
14 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/arm/xlnx-versal.h | 36 | --- a/include/qemu/thread.h |
16 | +++ b/include/hw/arm/xlnx-versal.h | 37 | +++ b/include/qemu/thread.h |
17 | @@ -XXX,XX +XXX,XX @@ | 38 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; |
18 | #define XLNX_VERSAL_NR_ACPUS 2 | 39 | #define qemu_cond_wait(c, m) \ |
19 | #define XLNX_VERSAL_NR_UARTS 2 | 40 | qemu_cond_wait_impl(c, m, __FILE__, __LINE__); |
20 | #define XLNX_VERSAL_NR_GEMS 2 | 41 | #define qemu_cond_timedwait(c, m, ms) \ |
21 | -#define XLNX_VERSAL_NR_IRQS 256 | 42 | - qemu_cond_wait_impl(c, m, ms, __FILE__, __LINE__); |
22 | +#define XLNX_VERSAL_NR_IRQS 192 | 43 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); |
23 | 44 | #else | |
24 | typedef struct Versal { | 45 | #define qemu_mutex_lock(m) ({ \ |
25 | /*< private >*/ | 46 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ |
26 | -- | 47 | -- |
27 | 2.19.2 | 48 | 2.20.1 |
28 | 49 | ||
29 | 50 | diff view generated by jsdifflib |
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | 1 | All the Coverity-specific definitions of qemu_mutex_lock() and friends |
---|---|---|---|
2 | have a trailing semicolon. This works fine almost everywhere because | ||
3 | of QEMU's mandatory-braces coding style and because most callsites are | ||
4 | simple, but target/s390x/sigp.c has a use of qemu_mutex_trylock() as | ||
5 | an if() statement, which makes the ';' a syntax error: | ||
6 | "../target/s390x/sigp.c", line 461: warning #18: expected a ")" | ||
7 | if (qemu_mutex_trylock(&qemu_sigp_mutex)) { | ||
8 | ^ | ||
2 | 9 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | 10 | Remove the bogus semicolons from the macro definitions. |
4 | pci_dec_21154_device_class_init(). | ||
5 | 11 | ||
6 | Cc: david@gibson.dropbear.id.au | ||
7 | Cc: mst@redhat.com | ||
8 | Cc: marcel.apfelbaum@gmail.com | ||
9 | Cc: qemu-ppc@nongnu.org | ||
10 | |||
11 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
12 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
13 | Reviewed-by: David Gibson <david@gibson.dropbear.id.au> | ||
14 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | ||
15 | Message-id: 20181130093852.20739-16-maozhongyi@cmss.chinamobile.com | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
15 | Message-id: 20200319193323.2038-4-peter.maydell@linaro.org | ||
17 | --- | 16 | --- |
18 | hw/pci-bridge/dec.c | 12 ++++++------ | 17 | include/qemu/thread.h | 12 ++++++------ |
19 | 1 file changed, 6 insertions(+), 6 deletions(-) | 18 | 1 file changed, 6 insertions(+), 6 deletions(-) |
20 | 19 | ||
21 | diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c | 20 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h |
22 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/pci-bridge/dec.c | 22 | --- a/include/qemu/thread.h |
24 | +++ b/hw/pci-bridge/dec.c | 23 | +++ b/include/qemu/thread.h |
25 | @@ -XXX,XX +XXX,XX @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn) | 24 | @@ -XXX,XX +XXX,XX @@ extern QemuCondTimedWaitFunc qemu_cond_timedwait_func; |
26 | return pci_bridge_get_sec_bus(br); | 25 | * hide them. |
27 | } | 26 | */ |
28 | 27 | #define qemu_mutex_lock(m) \ | |
29 | -static int pci_dec_21154_device_init(SysBusDevice *dev) | 28 | - qemu_mutex_lock_impl(m, __FILE__, __LINE__); |
30 | +static void pci_dec_21154_device_realize(DeviceState *dev, Error **errp) | 29 | + qemu_mutex_lock_impl(m, __FILE__, __LINE__) |
31 | { | 30 | #define qemu_mutex_trylock(m) \ |
32 | PCIHostState *phb; | 31 | - qemu_mutex_trylock_impl(m, __FILE__, __LINE__); |
33 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 32 | + qemu_mutex_trylock_impl(m, __FILE__, __LINE__) |
34 | 33 | #define qemu_rec_mutex_lock(m) \ | |
35 | phb = PCI_HOST_BRIDGE(dev); | 34 | - qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__); |
36 | 35 | + qemu_rec_mutex_lock_impl(m, __FILE__, __LINE__) | |
37 | @@ -XXX,XX +XXX,XX @@ static int pci_dec_21154_device_init(SysBusDevice *dev) | 36 | #define qemu_rec_mutex_trylock(m) \ |
38 | dev, "pci-conf-idx", 0x1000); | 37 | - qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__); |
39 | memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_ops, | 38 | + qemu_rec_mutex_trylock_impl(m, __FILE__, __LINE__) |
40 | dev, "pci-data-idx", 0x1000); | 39 | #define qemu_cond_wait(c, m) \ |
41 | - sysbus_init_mmio(dev, &phb->conf_mem); | 40 | - qemu_cond_wait_impl(c, m, __FILE__, __LINE__); |
42 | - sysbus_init_mmio(dev, &phb->data_mem); | 41 | + qemu_cond_wait_impl(c, m, __FILE__, __LINE__) |
43 | - return 0; | 42 | #define qemu_cond_timedwait(c, m, ms) \ |
44 | + sysbus_init_mmio(sbd, &phb->conf_mem); | 43 | - qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__); |
45 | + sysbus_init_mmio(sbd, &phb->data_mem); | 44 | + qemu_cond_timedwait_impl(c, m, ms, __FILE__, __LINE__) |
46 | } | 45 | #else |
47 | 46 | #define qemu_mutex_lock(m) ({ \ | |
48 | static void dec_21154_pci_host_realize(PCIDevice *d, Error **errp) | 47 | QemuMutexLockFunc _f = atomic_read(&qemu_mutex_lock_func); \ |
49 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo dec_21154_pci_host_info = { | ||
50 | |||
51 | static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data) | ||
52 | { | ||
53 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
54 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
55 | |||
56 | - sdc->init = pci_dec_21154_device_init; | ||
57 | + dc->realize = pci_dec_21154_device_realize; | ||
58 | } | ||
59 | |||
60 | static const TypeInfo pci_dec_21154_device_info = { | ||
61 | -- | 48 | -- |
62 | 2.19.2 | 49 | 2.20.1 |
63 | 50 | ||
64 | 51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | etraxfs_timer_class_init(). | ||
5 | |||
6 | Cc: edgar.iglesias@gmail.com | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
12 | Message-id: 20181130093852.20739-17-maozhongyi@cmss.chinamobile.com | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/timer/etraxfs_timer.c | 14 +++++++------- | ||
16 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
17 | |||
18 | diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/hw/timer/etraxfs_timer.c | ||
21 | +++ b/hw/timer/etraxfs_timer.c | ||
22 | @@ -XXX,XX +XXX,XX @@ static void etraxfs_timer_reset(void *opaque) | ||
23 | qemu_irq_lower(t->irq); | ||
24 | } | ||
25 | |||
26 | -static int etraxfs_timer_init(SysBusDevice *dev) | ||
27 | +static void etraxfs_timer_realize(DeviceState *dev, Error **errp) | ||
28 | { | ||
29 | ETRAXTimerState *t = ETRAX_TIMER(dev); | ||
30 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
31 | |||
32 | t->bh_t0 = qemu_bh_new(timer0_hit, t); | ||
33 | t->bh_t1 = qemu_bh_new(timer1_hit, t); | ||
34 | @@ -XXX,XX +XXX,XX @@ static int etraxfs_timer_init(SysBusDevice *dev) | ||
35 | t->ptimer_t1 = ptimer_init(t->bh_t1, PTIMER_POLICY_DEFAULT); | ||
36 | t->ptimer_wd = ptimer_init(t->bh_wd, PTIMER_POLICY_DEFAULT); | ||
37 | |||
38 | - sysbus_init_irq(dev, &t->irq); | ||
39 | - sysbus_init_irq(dev, &t->nmi); | ||
40 | + sysbus_init_irq(sbd, &t->irq); | ||
41 | + sysbus_init_irq(sbd, &t->nmi); | ||
42 | |||
43 | memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, | ||
44 | "etraxfs-timer", 0x5c); | ||
45 | - sysbus_init_mmio(dev, &t->mmio); | ||
46 | + sysbus_init_mmio(sbd, &t->mmio); | ||
47 | qemu_register_reset(etraxfs_timer_reset, t); | ||
48 | - return 0; | ||
49 | } | ||
50 | |||
51 | static void etraxfs_timer_class_init(ObjectClass *klass, void *data) | ||
52 | { | ||
53 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
54 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
55 | |||
56 | - sdc->init = etraxfs_timer_init; | ||
57 | + dc->realize = etraxfs_timer_realize; | ||
58 | } | ||
59 | |||
60 | static const TypeInfo etraxfs_timer_info = { | ||
61 | -- | ||
62 | 2.19.2 | ||
63 | |||
64 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | grlib_gptimer_class_init(). | ||
5 | |||
6 | Cc: chouteau@adacore.com | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20181130093852.20739-18-maozhongyi@cmss.chinamobile.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/timer/grlib_gptimer.c | 11 +++++------ | ||
15 | 1 file changed, 5 insertions(+), 6 deletions(-) | ||
16 | |||
17 | diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/timer/grlib_gptimer.c | ||
20 | +++ b/hw/timer/grlib_gptimer.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void grlib_gptimer_reset(DeviceState *d) | ||
22 | } | ||
23 | } | ||
24 | |||
25 | -static int grlib_gptimer_init(SysBusDevice *dev) | ||
26 | +static void grlib_gptimer_realize(DeviceState *dev, Error **errp) | ||
27 | { | ||
28 | GPTimerUnit *unit = GRLIB_GPTIMER(dev); | ||
29 | unsigned int i; | ||
30 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
31 | |||
32 | assert(unit->nr_timers > 0); | ||
33 | assert(unit->nr_timers <= GPTIMER_MAX_TIMERS); | ||
34 | @@ -XXX,XX +XXX,XX @@ static int grlib_gptimer_init(SysBusDevice *dev) | ||
35 | timer->id = i; | ||
36 | |||
37 | /* One IRQ line for each timer */ | ||
38 | - sysbus_init_irq(dev, &timer->irq); | ||
39 | + sysbus_init_irq(sbd, &timer->irq); | ||
40 | |||
41 | ptimer_set_freq(timer->ptimer, unit->freq_hz); | ||
42 | } | ||
43 | @@ -XXX,XX +XXX,XX @@ static int grlib_gptimer_init(SysBusDevice *dev) | ||
44 | unit, "gptimer", | ||
45 | UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers); | ||
46 | |||
47 | - sysbus_init_mmio(dev, &unit->iomem); | ||
48 | - return 0; | ||
49 | + sysbus_init_mmio(sbd, &unit->iomem); | ||
50 | } | ||
51 | |||
52 | static Property grlib_gptimer_properties[] = { | ||
53 | @@ -XXX,XX +XXX,XX @@ static Property grlib_gptimer_properties[] = { | ||
54 | static void grlib_gptimer_class_init(ObjectClass *klass, void *data) | ||
55 | { | ||
56 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
57 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
58 | |||
59 | - k->init = grlib_gptimer_init; | ||
60 | + dc->realize = grlib_gptimer_realize; | ||
61 | dc->reset = grlib_gptimer_reset; | ||
62 | dc->props = grlib_gptimer_properties; | ||
63 | } | ||
64 | -- | ||
65 | 2.19.2 | ||
66 | |||
67 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | puv3_ost_class_init(). | ||
5 | |||
6 | Cc: gxt@mprc.pku.edu.cn | ||
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
11 | Message-id: 20181130093852.20739-19-maozhongyi@cmss.chinamobile.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/timer/puv3_ost.c | 13 ++++++------- | ||
15 | 1 file changed, 6 insertions(+), 7 deletions(-) | ||
16 | |||
17 | diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/hw/timer/puv3_ost.c | ||
20 | +++ b/hw/timer/puv3_ost.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static void puv3_ost_tick(void *opaque) | ||
22 | } | ||
23 | } | ||
24 | |||
25 | -static int puv3_ost_init(SysBusDevice *dev) | ||
26 | +static void puv3_ost_realize(DeviceState *dev, Error **errp) | ||
27 | { | ||
28 | PUV3OSTState *s = PUV3_OST(dev); | ||
29 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
30 | |||
31 | s->reg_OIER = 0; | ||
32 | s->reg_OSSR = 0; | ||
33 | s->reg_OSMR0 = 0; | ||
34 | s->reg_OSCR = 0; | ||
35 | |||
36 | - sysbus_init_irq(dev, &s->irq); | ||
37 | + sysbus_init_irq(sbd, &s->irq); | ||
38 | |||
39 | s->bh = qemu_bh_new(puv3_ost_tick, s); | ||
40 | s->ptimer = ptimer_init(s->bh, PTIMER_POLICY_DEFAULT); | ||
41 | @@ -XXX,XX +XXX,XX @@ static int puv3_ost_init(SysBusDevice *dev) | ||
42 | |||
43 | memory_region_init_io(&s->iomem, OBJECT(s), &puv3_ost_ops, s, "puv3_ost", | ||
44 | PUV3_REGS_OFFSET); | ||
45 | - sysbus_init_mmio(dev, &s->iomem); | ||
46 | - | ||
47 | - return 0; | ||
48 | + sysbus_init_mmio(sbd, &s->iomem); | ||
49 | } | ||
50 | |||
51 | static void puv3_ost_class_init(ObjectClass *klass, void *data) | ||
52 | { | ||
53 | - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); | ||
54 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
55 | |||
56 | - sdc->init = puv3_ost_init; | ||
57 | + dc->realize = puv3_ost_realize; | ||
58 | } | ||
59 | |||
60 | static const TypeInfo puv3_ost_info = { | ||
61 | -- | ||
62 | 2.19.2 | ||
63 | |||
64 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The target_flat.h file is a QEMU header, so we should include it using |
---|---|---|---|
2 | quotes, not angle brackets. | ||
2 | 3 | ||
3 | Replace arm_hcr_el2_{fmo,imo,amo} with a more general routine | 4 | Coverity otherwise is unable to find the header: |
4 | that also takes SCR_EL3.NS (aka arm_is_secure_below_el3) into | ||
5 | account, as documented for the plethora of bits in HCR_EL2. | ||
6 | 5 | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | "../linux-user/flatload.c", line 40: error #1712: cannot open source file |
8 | Message-id: 20181210150501.7990-2-richard.henderson@linaro.org | 7 | "target_flat.h" |
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | #include <target_flat.h> |
9 | ^ | ||
10 | |||
11 | because the relevant directory is only on the -iquote path, not the -I path. | ||
12 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200319193323.2038-5-peter.maydell@linaro.org | ||
11 | --- | 17 | --- |
12 | target/arm/cpu.h | 67 +++++++++------------------------------ | 18 | linux-user/flatload.c | 2 +- |
13 | hw/intc/arm_gicv3_cpuif.c | 21 ++++++------ | 19 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | target/arm/helper.c | 66 ++++++++++++++++++++++++++++++++------ | ||
15 | 3 files changed, 83 insertions(+), 71 deletions(-) | ||
16 | 20 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 21 | diff --git a/linux-user/flatload.c b/linux-user/flatload.c |
18 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/target/arm/cpu.h | 23 | --- a/linux-user/flatload.c |
20 | +++ b/target/arm/cpu.h | 24 | +++ b/linux-user/flatload.c |
21 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_is_secure(CPUARMState *env) | 25 | @@ -XXX,XX +XXX,XX @@ |
22 | } | 26 | |
23 | #endif | 27 | #include "qemu.h" |
24 | 28 | #include "flat.h" | |
25 | +/** | 29 | -#include <target_flat.h> |
26 | + * arm_hcr_el2_eff(): Return the effective value of HCR_EL2. | 30 | +#include "target_flat.h" |
27 | + * E.g. when in secure state, fields in HCR_EL2 are suppressed, | 31 | |
28 | + * "for all purposes other than a direct read or write access of HCR_EL2." | 32 | //#define DEBUG |
29 | + * Not included here is HCR_RW. | ||
30 | + */ | ||
31 | +uint64_t arm_hcr_el2_eff(CPUARMState *env); | ||
32 | + | ||
33 | /* Return true if the specified exception level is running in AArch64 state. */ | ||
34 | static inline bool arm_el_is_aa64(CPUARMState *env, int el) | ||
35 | { | ||
36 | @@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu); | ||
37 | # define TARGET_VIRT_ADDR_SPACE_BITS 32 | ||
38 | #endif | ||
39 | |||
40 | -/** | ||
41 | - * arm_hcr_el2_imo(): Return the effective value of HCR_EL2.IMO. | ||
42 | - * Depending on the values of HCR_EL2.E2H and TGE, this may be | ||
43 | - * "behaves as 1 for all purposes other than direct read/write" or | ||
44 | - * "behaves as 0 for all purposes other than direct read/write" | ||
45 | - */ | ||
46 | -static inline bool arm_hcr_el2_imo(CPUARMState *env) | ||
47 | -{ | ||
48 | - switch (env->cp15.hcr_el2 & (HCR_TGE | HCR_E2H)) { | ||
49 | - case HCR_TGE: | ||
50 | - return true; | ||
51 | - case HCR_TGE | HCR_E2H: | ||
52 | - return false; | ||
53 | - default: | ||
54 | - return env->cp15.hcr_el2 & HCR_IMO; | ||
55 | - } | ||
56 | -} | ||
57 | - | ||
58 | -/** | ||
59 | - * arm_hcr_el2_fmo(): Return the effective value of HCR_EL2.FMO. | ||
60 | - */ | ||
61 | -static inline bool arm_hcr_el2_fmo(CPUARMState *env) | ||
62 | -{ | ||
63 | - switch (env->cp15.hcr_el2 & (HCR_TGE | HCR_E2H)) { | ||
64 | - case HCR_TGE: | ||
65 | - return true; | ||
66 | - case HCR_TGE | HCR_E2H: | ||
67 | - return false; | ||
68 | - default: | ||
69 | - return env->cp15.hcr_el2 & HCR_FMO; | ||
70 | - } | ||
71 | -} | ||
72 | - | ||
73 | -/** | ||
74 | - * arm_hcr_el2_amo(): Return the effective value of HCR_EL2.AMO. | ||
75 | - */ | ||
76 | -static inline bool arm_hcr_el2_amo(CPUARMState *env) | ||
77 | -{ | ||
78 | - switch (env->cp15.hcr_el2 & (HCR_TGE | HCR_E2H)) { | ||
79 | - case HCR_TGE: | ||
80 | - return true; | ||
81 | - case HCR_TGE | HCR_E2H: | ||
82 | - return false; | ||
83 | - default: | ||
84 | - return env->cp15.hcr_el2 & HCR_AMO; | ||
85 | - } | ||
86 | -} | ||
87 | - | ||
88 | static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
89 | unsigned int target_el) | ||
90 | { | ||
91 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
92 | bool secure = arm_is_secure(env); | ||
93 | bool pstate_unmasked; | ||
94 | int8_t unmasked = 0; | ||
95 | + uint64_t hcr_el2; | ||
96 | |||
97 | /* Don't take exceptions if they target a lower EL. | ||
98 | * This check should catch any exceptions that would not be taken but left | ||
99 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
100 | return false; | ||
101 | } | ||
102 | |||
103 | + hcr_el2 = arm_hcr_el2_eff(env); | ||
104 | + | ||
105 | switch (excp_idx) { | ||
106 | case EXCP_FIQ: | ||
107 | pstate_unmasked = !(env->daif & PSTATE_F); | ||
108 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
109 | break; | ||
110 | |||
111 | case EXCP_VFIQ: | ||
112 | - if (secure || !arm_hcr_el2_fmo(env) || (env->cp15.hcr_el2 & HCR_TGE)) { | ||
113 | + if (secure || !(hcr_el2 & HCR_FMO) || (hcr_el2 & HCR_TGE)) { | ||
114 | /* VFIQs are only taken when hypervized and non-secure. */ | ||
115 | return false; | ||
116 | } | ||
117 | return !(env->daif & PSTATE_F); | ||
118 | case EXCP_VIRQ: | ||
119 | - if (secure || !arm_hcr_el2_imo(env) || (env->cp15.hcr_el2 & HCR_TGE)) { | ||
120 | + if (secure || !(hcr_el2 & HCR_IMO) || (hcr_el2 & HCR_TGE)) { | ||
121 | /* VIRQs are only taken when hypervized and non-secure. */ | ||
122 | return false; | ||
123 | } | ||
124 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
125 | * to the CPSR.F setting otherwise we further assess the state | ||
126 | * below. | ||
127 | */ | ||
128 | - hcr = arm_hcr_el2_fmo(env); | ||
129 | + hcr = hcr_el2 & HCR_FMO; | ||
130 | scr = (env->cp15.scr_el3 & SCR_FIQ); | ||
131 | |||
132 | /* When EL3 is 32-bit, the SCR.FW bit controls whether the | ||
133 | @@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, | ||
134 | * when setting the target EL, so it does not have a further | ||
135 | * affect here. | ||
136 | */ | ||
137 | - hcr = arm_hcr_el2_imo(env); | ||
138 | + hcr = hcr_el2 & HCR_IMO; | ||
139 | scr = false; | ||
140 | break; | ||
141 | default: | ||
142 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | ||
143 | index XXXXXXX..XXXXXXX 100644 | ||
144 | --- a/hw/intc/arm_gicv3_cpuif.c | ||
145 | +++ b/hw/intc/arm_gicv3_cpuif.c | ||
146 | @@ -XXX,XX +XXX,XX @@ static bool icv_access(CPUARMState *env, int hcr_flags) | ||
147 | * * access if NS EL1 and either IMO or FMO == 1: | ||
148 | * CTLR, DIR, PMR, RPR | ||
149 | */ | ||
150 | - bool flagmatch = ((hcr_flags & HCR_IMO) && arm_hcr_el2_imo(env)) || | ||
151 | - ((hcr_flags & HCR_FMO) && arm_hcr_el2_fmo(env)); | ||
152 | + uint64_t hcr_el2 = arm_hcr_el2_eff(env); | ||
153 | + bool flagmatch = hcr_el2 & hcr_flags & (HCR_IMO | HCR_FMO); | ||
154 | |||
155 | return flagmatch && arm_current_el(env) == 1 | ||
156 | && !arm_is_secure_below_el3(env); | ||
157 | @@ -XXX,XX +XXX,XX @@ static void icc_dir_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
158 | /* No need to include !IsSecure in route_*_to_el2 as it's only | ||
159 | * tested in cases where we know !IsSecure is true. | ||
160 | */ | ||
161 | - route_fiq_to_el2 = arm_hcr_el2_fmo(env); | ||
162 | - route_irq_to_el2 = arm_hcr_el2_imo(env); | ||
163 | + uint64_t hcr_el2 = arm_hcr_el2_eff(env); | ||
164 | + route_fiq_to_el2 = hcr_el2 & HCR_FMO; | ||
165 | + route_irq_to_el2 = hcr_el2 & HCR_IMO; | ||
166 | |||
167 | switch (arm_current_el(env)) { | ||
168 | case 3: | ||
169 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_irqfiq_access(CPUARMState *env, | ||
170 | if ((env->cp15.scr_el3 & (SCR_FIQ | SCR_IRQ)) == (SCR_FIQ | SCR_IRQ)) { | ||
171 | switch (el) { | ||
172 | case 1: | ||
173 | - if (arm_is_secure_below_el3(env) || | ||
174 | - (arm_hcr_el2_imo(env) == 0 && arm_hcr_el2_fmo(env) == 0)) { | ||
175 | + /* Note that arm_hcr_el2_eff takes secure state into account. */ | ||
176 | + if ((arm_hcr_el2_eff(env) & (HCR_IMO | HCR_FMO)) == 0) { | ||
177 | r = CP_ACCESS_TRAP_EL3; | ||
178 | } | ||
179 | break; | ||
180 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_dir_access(CPUARMState *env, | ||
181 | static CPAccessResult gicv3_sgi_access(CPUARMState *env, | ||
182 | const ARMCPRegInfo *ri, bool isread) | ||
183 | { | ||
184 | - if ((arm_hcr_el2_imo(env) || arm_hcr_el2_fmo(env)) && | ||
185 | - arm_current_el(env) == 1 && !arm_is_secure_below_el3(env)) { | ||
186 | + if (arm_current_el(env) == 1 && | ||
187 | + (arm_hcr_el2_eff(env) & (HCR_IMO | HCR_FMO)) != 0) { | ||
188 | /* Takes priority over a possible EL3 trap */ | ||
189 | return CP_ACCESS_TRAP_EL2; | ||
190 | } | ||
191 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_fiq_access(CPUARMState *env, | ||
192 | if (env->cp15.scr_el3 & SCR_FIQ) { | ||
193 | switch (el) { | ||
194 | case 1: | ||
195 | - if (arm_is_secure_below_el3(env) || !arm_hcr_el2_fmo(env)) { | ||
196 | + if ((arm_hcr_el2_eff(env) & HCR_FMO) == 0) { | ||
197 | r = CP_ACCESS_TRAP_EL3; | ||
198 | } | ||
199 | break; | ||
200 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_irq_access(CPUARMState *env, | ||
201 | if (env->cp15.scr_el3 & SCR_IRQ) { | ||
202 | switch (el) { | ||
203 | case 1: | ||
204 | - if (arm_is_secure_below_el3(env) || !arm_hcr_el2_imo(env)) { | ||
205 | + if ((arm_hcr_el2_eff(env) & HCR_IMO) == 0) { | ||
206 | r = CP_ACCESS_TRAP_EL3; | ||
207 | } | ||
208 | break; | ||
209 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
210 | index XXXXXXX..XXXXXXX 100644 | ||
211 | --- a/target/arm/helper.c | ||
212 | +++ b/target/arm/helper.c | ||
213 | @@ -XXX,XX +XXX,XX @@ static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
214 | static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
215 | { | ||
216 | CPUState *cs = ENV_GET_CPU(env); | ||
217 | + uint64_t hcr_el2 = arm_hcr_el2_eff(env); | ||
218 | uint64_t ret = 0; | ||
219 | |||
220 | - if (arm_hcr_el2_imo(env)) { | ||
221 | + if (hcr_el2 & HCR_IMO) { | ||
222 | if (cs->interrupt_request & CPU_INTERRUPT_VIRQ) { | ||
223 | ret |= CPSR_I; | ||
224 | } | ||
225 | @@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
226 | } | ||
227 | } | ||
228 | |||
229 | - if (arm_hcr_el2_fmo(env)) { | ||
230 | + if (hcr_el2 & HCR_FMO) { | ||
231 | if (cs->interrupt_request & CPU_INTERRUPT_VFIQ) { | ||
232 | ret |= CPSR_F; | ||
233 | } | ||
234 | @@ -XXX,XX +XXX,XX @@ static void hcr_writelow(CPUARMState *env, const ARMCPRegInfo *ri, | ||
235 | hcr_write(env, NULL, value); | ||
236 | } | ||
237 | |||
238 | +/* | ||
239 | + * Return the effective value of HCR_EL2. | ||
240 | + * Bits that are not included here: | ||
241 | + * RW (read from SCR_EL3.RW as needed) | ||
242 | + */ | ||
243 | +uint64_t arm_hcr_el2_eff(CPUARMState *env) | ||
244 | +{ | ||
245 | + uint64_t ret = env->cp15.hcr_el2; | ||
246 | + | ||
247 | + if (arm_is_secure_below_el3(env)) { | ||
248 | + /* | ||
249 | + * "This register has no effect if EL2 is not enabled in the | ||
250 | + * current Security state". This is ARMv8.4-SecEL2 speak for | ||
251 | + * !(SCR_EL3.NS==1 || SCR_EL3.EEL2==1). | ||
252 | + * | ||
253 | + * Prior to that, the language was "In an implementation that | ||
254 | + * includes EL3, when the value of SCR_EL3.NS is 0 the PE behaves | ||
255 | + * as if this field is 0 for all purposes other than a direct | ||
256 | + * read or write access of HCR_EL2". With lots of enumeration | ||
257 | + * on a per-field basis. In current QEMU, this is condition | ||
258 | + * is arm_is_secure_below_el3. | ||
259 | + * | ||
260 | + * Since the v8.4 language applies to the entire register, and | ||
261 | + * appears to be backward compatible, use that. | ||
262 | + */ | ||
263 | + ret = 0; | ||
264 | + } else if (ret & HCR_TGE) { | ||
265 | + /* These bits are up-to-date as of ARMv8.4. */ | ||
266 | + if (ret & HCR_E2H) { | ||
267 | + ret &= ~(HCR_VM | HCR_FMO | HCR_IMO | HCR_AMO | | ||
268 | + HCR_BSU_MASK | HCR_DC | HCR_TWI | HCR_TWE | | ||
269 | + HCR_TID0 | HCR_TID2 | HCR_TPCP | HCR_TPU | | ||
270 | + HCR_TDZ | HCR_CD | HCR_ID | HCR_MIOCNCE); | ||
271 | + } else { | ||
272 | + ret |= HCR_FMO | HCR_IMO | HCR_AMO; | ||
273 | + } | ||
274 | + ret &= ~(HCR_SWIO | HCR_PTW | HCR_VF | HCR_VI | HCR_VSE | | ||
275 | + HCR_FB | HCR_TID1 | HCR_TID3 | HCR_TSC | HCR_TACR | | ||
276 | + HCR_TSW | HCR_TTLB | HCR_TVM | HCR_HCD | HCR_TRVM | | ||
277 | + HCR_TLOR); | ||
278 | + } | ||
279 | + | ||
280 | + return ret; | ||
281 | +} | ||
282 | + | ||
283 | static const ARMCPRegInfo el2_cp_reginfo[] = { | ||
284 | { .name = "HCR_EL2", .state = ARM_CP_STATE_AA64, | ||
285 | .type = ARM_CP_IO, | ||
286 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | ||
287 | uint32_t cur_el, bool secure) | ||
288 | { | ||
289 | CPUARMState *env = cs->env_ptr; | ||
290 | - int rw; | ||
291 | - int scr; | ||
292 | - int hcr; | ||
293 | + bool rw; | ||
294 | + bool scr; | ||
295 | + bool hcr; | ||
296 | int target_el; | ||
297 | /* Is the highest EL AArch64? */ | ||
298 | - int is64 = arm_feature(env, ARM_FEATURE_AARCH64); | ||
299 | + bool is64 = arm_feature(env, ARM_FEATURE_AARCH64); | ||
300 | + uint64_t hcr_el2; | ||
301 | |||
302 | if (arm_feature(env, ARM_FEATURE_EL3)) { | ||
303 | rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW); | ||
304 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | ||
305 | rw = is64; | ||
306 | } | ||
307 | |||
308 | + hcr_el2 = arm_hcr_el2_eff(env); | ||
309 | switch (excp_idx) { | ||
310 | case EXCP_IRQ: | ||
311 | scr = ((env->cp15.scr_el3 & SCR_IRQ) == SCR_IRQ); | ||
312 | - hcr = arm_hcr_el2_imo(env); | ||
313 | + hcr = hcr_el2 & HCR_IMO; | ||
314 | break; | ||
315 | case EXCP_FIQ: | ||
316 | scr = ((env->cp15.scr_el3 & SCR_FIQ) == SCR_FIQ); | ||
317 | - hcr = arm_hcr_el2_fmo(env); | ||
318 | + hcr = hcr_el2 & HCR_FMO; | ||
319 | break; | ||
320 | default: | ||
321 | scr = ((env->cp15.scr_el3 & SCR_EA) == SCR_EA); | ||
322 | - hcr = arm_hcr_el2_amo(env); | ||
323 | + hcr = hcr_el2 & HCR_AMO; | ||
324 | break; | ||
325 | }; | ||
326 | 33 | ||
327 | -- | 34 | -- |
328 | 2.19.2 | 35 | 2.20.1 |
329 | 36 | ||
330 | 37 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Add a new script to automate the process of running the Coverity |
---|---|---|---|
2 | 2 | Scan build tools and uploading the resulting tarball to the | |
3 | Provide a trivial implementation with zero limited ordering regions, | 3 | website. |
4 | which causes the LDLAR and STLLR instructions to devolve into the | 4 | |
5 | LDAR and STLR instructions from the base ARMv8.0 instruction set. | 5 | This is intended eventually to be driven from Travis, |
6 | 6 | but it can be run locally, if you are a maintainer of the | |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | QEMU project on the Coverity Scan website and have the secret |
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | upload token. |
9 | Message-id: 20181210150501.7990-4-richard.henderson@linaro.org | 9 | |
10 | The script must be run on a Fedora 30 system. Support for using a | ||
11 | Docker container is added in a following commit. | ||
12 | |||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | Message-id: 20200319193323.2038-6-peter.maydell@linaro.org | ||
11 | --- | 16 | --- |
12 | target/arm/cpu.h | 5 +++ | 17 | MAINTAINERS | 5 + |
13 | target/arm/cpu64.c | 1 + | 18 | scripts/coverity-scan/run-coverity-scan | 311 ++++++++++++++++++++++++ |
14 | target/arm/helper.c | 75 ++++++++++++++++++++++++++++++++++++++ | 19 | 2 files changed, 316 insertions(+) |
15 | target/arm/translate-a64.c | 12 ++++++ | 20 | create mode 100755 scripts/coverity-scan/run-coverity-scan |
16 | 4 files changed, 93 insertions(+) | 21 | |
17 | 22 | diff --git a/MAINTAINERS b/MAINTAINERS | |
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 24 | --- a/MAINTAINERS |
21 | +++ b/target/arm/cpu.h | 25 | +++ b/MAINTAINERS |
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | 26 | @@ -XXX,XX +XXX,XX @@ M: Markus Armbruster <armbru@redhat.com> |
23 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | 27 | S: Supported |
24 | } | 28 | F: scripts/coverity-model.c |
25 | 29 | ||
26 | +static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | 30 | +Coverity Scan integration |
27 | +{ | 31 | +M: Peter Maydell <peter.maydell@linaro.org> |
28 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | 32 | +S: Maintained |
33 | +F: scripts/coverity-scan/ | ||
34 | + | ||
35 | Device Tree | ||
36 | M: Alistair Francis <alistair.francis@wdc.com> | ||
37 | R: David Gibson <david@gibson.dropbear.id.au> | ||
38 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | ||
39 | new file mode 100755 | ||
40 | index XXXXXXX..XXXXXXX | ||
41 | --- /dev/null | ||
42 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
43 | @@ -XXX,XX +XXX,XX @@ | ||
44 | +#!/bin/sh -e | ||
45 | + | ||
46 | +# Upload a created tarball to Coverity Scan, as per | ||
47 | +# https://scan.coverity.com/projects/qemu/builds/new | ||
48 | + | ||
49 | +# This work is licensed under the terms of the GNU GPL version 2, | ||
50 | +# or (at your option) any later version. | ||
51 | +# See the COPYING file in the top-level directory. | ||
52 | +# | ||
53 | +# Copyright (c) 2017-2020 Linaro Limited | ||
54 | +# Written by Peter Maydell | ||
55 | + | ||
56 | +# Note that this script will automatically download and | ||
57 | +# run the (closed-source) coverity build tools, so don't | ||
58 | +# use it if you don't trust them! | ||
59 | + | ||
60 | +# This script assumes that you're running it from a QEMU source | ||
61 | +# tree, and that tree is a fresh clean one, because we do an in-tree | ||
62 | +# build. (This is necessary so that the filenames that the Coverity | ||
63 | +# Scan server sees are relative paths that match up with the component | ||
64 | +# regular expressions it uses; an out-of-tree build won't work for this.) | ||
65 | +# The host machine should have as many of QEMU's dependencies | ||
66 | +# installed as possible, for maximum coverity coverage. | ||
67 | + | ||
68 | +# To do an upload you need to be a maintainer in the Coverity online | ||
69 | +# service, and you will need to know the "Coverity token", which is a | ||
70 | +# secret 8 digit hex string. You can find that from the web UI in the | ||
71 | +# project settings, if you have maintainer access there. | ||
72 | + | ||
73 | +# Command line options: | ||
74 | +# --dry-run : run the tools, but don't actually do the upload | ||
75 | +# --update-tools-only : update the cached copy of the tools, but don't run them | ||
76 | +# --tokenfile : file to read Coverity token from | ||
77 | +# --version ver : specify version being analyzed (default: ask git) | ||
78 | +# --description desc : specify description of this version (default: ask git) | ||
79 | +# --srcdir : QEMU source tree to analyze (default: current working dir) | ||
80 | +# --results-tarball : path to copy the results tarball to (default: don't | ||
81 | +# copy it anywhere, just upload it) | ||
82 | +# | ||
83 | +# User-specifiable environment variables: | ||
84 | +# COVERITY_TOKEN -- Coverity token | ||
85 | +# COVERITY_EMAIL -- the email address to use for uploads (default: | ||
86 | +# looks at your git user.email config) | ||
87 | +# COVERITY_BUILD_CMD -- make command (default: 'make -jN' where N is | ||
88 | +# number of CPUs as determined by 'nproc') | ||
89 | +# COVERITY_TOOL_BASE -- set to directory to put coverity tools | ||
90 | +# (default: /tmp/coverity-tools) | ||
91 | +# | ||
92 | +# You must specify the token, either by environment variable or by | ||
93 | +# putting it in a file and using --tokenfile. Everything else has | ||
94 | +# a reasonable default if this is run from a git tree. | ||
95 | + | ||
96 | +check_upload_permissions() { | ||
97 | + # Check whether we can do an upload to the server; will exit the script | ||
98 | + # with status 1 if the check failed (usually a bad token); | ||
99 | + # will exit the script with status 0 if the check indicated that we | ||
100 | + # can't upload yet (ie we are at quota) | ||
101 | + # Assumes that PROJTOKEN, PROJNAME and DRYRUN have been initialized. | ||
102 | + | ||
103 | + echo "Checking upload permissions..." | ||
104 | + | ||
105 | + if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$PROJTOKEN&project=$PROJNAME" -q -O -)"; then | ||
106 | + echo "Coverity Scan API access denied: bad token?" | ||
107 | + exit 1 | ||
108 | + fi | ||
109 | + | ||
110 | + # Really up_perm is a JSON response with either | ||
111 | + # {upload_permitted:true} or {next_upload_permitted_at:<date>} | ||
112 | + # We do some hacky string parsing instead of properly parsing it. | ||
113 | + case "$up_perm" in | ||
114 | + *upload_permitted*true*) | ||
115 | + echo "Coverity Scan: upload permitted" | ||
116 | + ;; | ||
117 | + *next_upload_permitted_at*) | ||
118 | + if [ "$DRYRUN" = yes ]; then | ||
119 | + echo "Coverity Scan: upload quota reached, continuing dry run" | ||
120 | + else | ||
121 | + echo "Coverity Scan: upload quota reached; stopping here" | ||
122 | + # Exit success as this isn't a build error. | ||
123 | + exit 0 | ||
124 | + fi | ||
125 | + ;; | ||
126 | + *) | ||
127 | + echo "Coverity Scan upload check: unexpected result $up_perm" | ||
128 | + exit 1 | ||
129 | + ;; | ||
130 | + esac | ||
29 | +} | 131 | +} |
30 | + | 132 | + |
31 | /* | 133 | + |
32 | * Forward to the above feature tests given an ARMCPU pointer. | 134 | +update_coverity_tools () { |
33 | */ | 135 | + # Check for whether we need to download the Coverity tools |
34 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 136 | + # (either because we don't have a copy, or because it's out of date) |
35 | index XXXXXXX..XXXXXXX 100644 | 137 | + # Assumes that COVERITY_TOOL_BASE, PROJTOKEN and PROJNAME are set. |
36 | --- a/target/arm/cpu64.c | 138 | + |
37 | +++ b/target/arm/cpu64.c | 139 | + mkdir -p "$COVERITY_TOOL_BASE" |
38 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 140 | + cd "$COVERITY_TOOL_BASE" |
39 | 141 | + | |
40 | t = cpu->isar.id_aa64mmfr1; | 142 | + echo "Checking for new version of coverity build tools..." |
41 | t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | 143 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME&md5=1" -O coverity_tool.md5.new |
42 | + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | 144 | + |
43 | cpu->isar.id_aa64mmfr1 = t; | 145 | + if ! cmp -s coverity_tool.md5 coverity_tool.md5.new; then |
44 | 146 | + # out of date md5 or no md5: download new build tool | |
45 | /* Replicate the same data to the 32-bit id registers. */ | 147 | + # blow away the old build tool |
46 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 148 | + echo "Downloading coverity build tools..." |
47 | index XXXXXXX..XXXXXXX 100644 | 149 | + rm -rf coverity_tool coverity_tool.tgz |
48 | --- a/target/arm/helper.c | 150 | + wget https://scan.coverity.com/download/linux64 --post-data "token=$PROJTOKEN&project=$PROJNAME" -O coverity_tool.tgz |
49 | +++ b/target/arm/helper.c | 151 | + if ! (cat coverity_tool.md5.new; echo " coverity_tool.tgz") | md5sum -c --status; then |
50 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 152 | + echo "Downloaded tarball didn't match md5sum!" |
51 | { | 153 | + exit 1 |
52 | /* Begin with base v8.0 state. */ | 154 | + fi |
53 | uint32_t valid_mask = 0x3fff; | 155 | + # extract the new one, keeping it corralled in a 'coverity_tool' directory |
54 | + ARMCPU *cpu = arm_env_get_cpu(env); | 156 | + echo "Unpacking coverity build tools..." |
55 | 157 | + mkdir -p coverity_tool | |
56 | if (arm_el_is_aa64(env, 3)) { | 158 | + cd coverity_tool |
57 | value |= SCR_FW | SCR_AW; /* these two bits are RES1. */ | 159 | + tar xf ../coverity_tool.tgz |
58 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | 160 | + cd .. |
59 | valid_mask &= ~SCR_SMD; | 161 | + mv coverity_tool.md5.new coverity_tool.md5 |
60 | } | 162 | + fi |
61 | } | 163 | + |
62 | + if (cpu_isar_feature(aa64_lor, cpu)) { | 164 | + rm -f coverity_tool.md5.new |
63 | + valid_mask |= SCR_TLOR; | ||
64 | + } | ||
65 | |||
66 | /* Clear all-context RES0 bits. */ | ||
67 | value &= valid_mask; | ||
68 | @@ -XXX,XX +XXX,XX @@ static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
69 | */ | ||
70 | valid_mask &= ~HCR_TSC; | ||
71 | } | ||
72 | + if (cpu_isar_feature(aa64_lor, cpu)) { | ||
73 | + valid_mask |= HCR_TLOR; | ||
74 | + } | ||
75 | |||
76 | /* Clear RES0 bits. */ | ||
77 | value &= valid_mask; | ||
78 | @@ -XXX,XX +XXX,XX @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) | ||
79 | return pfr0; | ||
80 | } | ||
81 | |||
82 | +/* Shared logic between LORID and the rest of the LOR* registers. | ||
83 | + * Secure state has already been delt with. | ||
84 | + */ | ||
85 | +static CPAccessResult access_lor_ns(CPUARMState *env) | ||
86 | +{ | ||
87 | + int el = arm_current_el(env); | ||
88 | + | ||
89 | + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_TLOR)) { | ||
90 | + return CP_ACCESS_TRAP_EL2; | ||
91 | + } | ||
92 | + if (el < 3 && (env->cp15.scr_el3 & SCR_TLOR)) { | ||
93 | + return CP_ACCESS_TRAP_EL3; | ||
94 | + } | ||
95 | + return CP_ACCESS_OK; | ||
96 | +} | 165 | +} |
97 | + | 166 | + |
98 | +static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri, | 167 | + |
99 | + bool isread) | 168 | +# Check user-provided environment variables and arguments |
100 | +{ | 169 | +DRYRUN=no |
101 | + if (arm_is_secure_below_el3(env)) { | 170 | +UPDATE_ONLY=no |
102 | + /* Access ok in secure mode. */ | 171 | + |
103 | + return CP_ACCESS_OK; | 172 | +while [ "$#" -ge 1 ]; do |
104 | + } | 173 | + case "$1" in |
105 | + return access_lor_ns(env); | 174 | + --dry-run) |
106 | +} | 175 | + shift |
107 | + | 176 | + DRYRUN=yes |
108 | +static CPAccessResult access_lor_other(CPUARMState *env, | 177 | + ;; |
109 | + const ARMCPRegInfo *ri, bool isread) | 178 | + --update-tools-only) |
110 | +{ | 179 | + shift |
111 | + if (arm_is_secure_below_el3(env)) { | 180 | + UPDATE_ONLY=yes |
112 | + /* Access denied in secure mode. */ | 181 | + ;; |
113 | + return CP_ACCESS_TRAP; | 182 | + --version) |
114 | + } | 183 | + shift |
115 | + return access_lor_ns(env); | 184 | + if [ $# -eq 0 ]; then |
116 | +} | 185 | + echo "--version needs an argument" |
117 | + | 186 | + exit 1 |
118 | void register_cp_regs_for_features(ARMCPU *cpu) | 187 | + fi |
119 | { | 188 | + VERSION="$1" |
120 | /* Register all the coprocessor registers based on feature bits */ | 189 | + shift |
121 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 190 | + ;; |
122 | define_one_arm_cp_reg(cpu, &sctlr); | 191 | + --description) |
123 | } | 192 | + shift |
124 | 193 | + if [ $# -eq 0 ]; then | |
125 | + if (cpu_isar_feature(aa64_lor, cpu)) { | 194 | + echo "--description needs an argument" |
126 | + /* | 195 | + exit 1 |
127 | + * A trivial implementation of ARMv8.1-LOR leaves all of these | 196 | + fi |
128 | + * registers fixed at 0, which indicates that there are zero | 197 | + DESCRIPTION="$1" |
129 | + * supported Limited Ordering regions. | 198 | + shift |
130 | + */ | 199 | + ;; |
131 | + static const ARMCPRegInfo lor_reginfo[] = { | 200 | + --tokenfile) |
132 | + { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | 201 | + shift |
133 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, | 202 | + if [ $# -eq 0 ]; then |
134 | + .access = PL1_RW, .accessfn = access_lor_other, | 203 | + echo "--tokenfile needs an argument" |
135 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 204 | + exit 1 |
136 | + { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, | 205 | + fi |
137 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, | 206 | + COVERITY_TOKEN="$(cat "$1")" |
138 | + .access = PL1_RW, .accessfn = access_lor_other, | 207 | + shift |
139 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 208 | + ;; |
140 | + { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | 209 | + --srcdir) |
141 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | 210 | + shift |
142 | + .access = PL1_RW, .accessfn = access_lor_other, | 211 | + if [ $# -eq 0 ]; then |
143 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 212 | + echo "--srcdir needs an argument" |
144 | + { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | 213 | + exit 1 |
145 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | 214 | + fi |
146 | + .access = PL1_RW, .accessfn = access_lor_other, | 215 | + SRCDIR="$1" |
147 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 216 | + shift |
148 | + { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | 217 | + ;; |
149 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | 218 | + --results-tarball) |
150 | + .access = PL1_R, .accessfn = access_lorid, | 219 | + shift |
151 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | 220 | + if [ $# -eq 0 ]; then |
152 | + REGINFO_SENTINEL | 221 | + echo "--results-tarball needs an argument" |
153 | + }; | 222 | + exit 1 |
154 | + define_arm_cp_regs(cpu, lor_reginfo); | 223 | + fi |
155 | + } | 224 | + RESULTSTARBALL="$1" |
156 | + | 225 | + shift |
157 | if (cpu_isar_feature(aa64_sve, cpu)) { | 226 | + ;; |
158 | define_one_arm_cp_reg(cpu, &zcr_el1_reginfo); | 227 | + *) |
159 | if (arm_feature(env, ARM_FEATURE_EL2)) { | 228 | + echo "Unexpected argument '$1'" |
160 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 229 | + exit 1 |
161 | index XXXXXXX..XXXXXXX 100644 | 230 | + ;; |
162 | --- a/target/arm/translate-a64.c | 231 | + esac |
163 | +++ b/target/arm/translate-a64.c | 232 | +done |
164 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | 233 | + |
165 | } | 234 | +if [ -z "$COVERITY_TOKEN" ]; then |
166 | return; | 235 | + echo "COVERITY_TOKEN environment variable not set" |
167 | 236 | + exit 1 | |
168 | + case 0x8: /* STLLR */ | 237 | +fi |
169 | + if (!dc_isar_feature(aa64_lor, s)) { | 238 | + |
170 | + break; | 239 | +if [ -z "$COVERITY_BUILD_CMD" ]; then |
171 | + } | 240 | + NPROC=$(nproc) |
172 | + /* StoreLORelease is the same as Store-Release for QEMU. */ | 241 | + COVERITY_BUILD_CMD="make -j$NPROC" |
173 | + /* fall through */ | 242 | + echo "COVERITY_BUILD_CMD: using default '$COVERITY_BUILD_CMD'" |
174 | case 0x9: /* STLR */ | 243 | +fi |
175 | /* Generate ISS for non-exclusive accesses including LASR. */ | 244 | + |
176 | if (rn == 31) { | 245 | +if [ -z "$COVERITY_TOOL_BASE" ]; then |
177 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | 246 | + echo "COVERITY_TOOL_BASE: using default /tmp/coverity-tools" |
178 | disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | 247 | + COVERITY_TOOL_BASE=/tmp/coverity-tools |
179 | return; | 248 | +fi |
180 | 249 | + | |
181 | + case 0xc: /* LDLAR */ | 250 | +if [ -z "$SRCDIR" ]; then |
182 | + if (!dc_isar_feature(aa64_lor, s)) { | 251 | + SRCDIR="$PWD" |
183 | + break; | 252 | +fi |
184 | + } | 253 | + |
185 | + /* LoadLOAcquire is the same as Load-Acquire for QEMU. */ | 254 | +PROJTOKEN="$COVERITY_TOKEN" |
186 | + /* fall through */ | 255 | +PROJNAME=QEMU |
187 | case 0xd: /* LDAR */ | 256 | +TARBALL=cov-int.tar.xz |
188 | /* Generate ISS for non-exclusive accesses including LASR. */ | 257 | + |
189 | if (rn == 31) { | 258 | + |
259 | +if [ "$UPDATE_ONLY" = yes ]; then | ||
260 | + # Just do the tools update; we don't need to check whether | ||
261 | + # we are in a source tree or have upload rights for this, | ||
262 | + # so do it before some of the command line and source tree checks. | ||
263 | + update_coverity_tools | ||
264 | + exit 0 | ||
265 | +fi | ||
266 | + | ||
267 | +cd "$SRCDIR" | ||
268 | + | ||
269 | +echo "Checking this is a QEMU source tree..." | ||
270 | +if ! [ -e "$SRCDIR/VERSION" ]; then | ||
271 | + echo "Not in a QEMU source tree?" | ||
272 | + exit 1 | ||
273 | +fi | ||
274 | + | ||
275 | +# Fill in defaults used by the non-update-only process | ||
276 | +if [ -z "$VERSION" ]; then | ||
277 | + VERSION="$(git describe --always HEAD)" | ||
278 | +fi | ||
279 | + | ||
280 | +if [ -z "$DESCRIPTION" ]; then | ||
281 | + DESCRIPTION="$(git rev-parse HEAD)" | ||
282 | +fi | ||
283 | + | ||
284 | +if [ -z "$COVERITY_EMAIL" ]; then | ||
285 | + COVERITY_EMAIL="$(git config user.email)" | ||
286 | +fi | ||
287 | + | ||
288 | +check_upload_permissions | ||
289 | + | ||
290 | +update_coverity_tools | ||
291 | + | ||
292 | +TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)" | ||
293 | + | ||
294 | +if ! test -x "$TOOLBIN/cov-build"; then | ||
295 | + echo "Couldn't find cov-build in the coverity build-tool directory??" | ||
296 | + exit 1 | ||
297 | +fi | ||
298 | + | ||
299 | +export PATH="$TOOLBIN:$PATH" | ||
300 | + | ||
301 | +cd "$SRCDIR" | ||
302 | + | ||
303 | +echo "Doing make distclean..." | ||
304 | +make distclean | ||
305 | + | ||
306 | +echo "Configuring..." | ||
307 | +# We configure with a fixed set of enables here to ensure that we don't | ||
308 | +# accidentally reduce the scope of the analysis by doing the build on | ||
309 | +# the system that's missing a dependency that we need to build part of | ||
310 | +# the codebase. | ||
311 | +./configure --disable-modules --enable-sdl --enable-gtk \ | ||
312 | + --enable-opengl --enable-vte --enable-gnutls \ | ||
313 | + --enable-nettle --enable-curses --enable-curl \ | ||
314 | + --audio-drv-list=oss,alsa,sdl,pa --enable-virtfs \ | ||
315 | + --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png \ | ||
316 | + --enable-xen --enable-brlapi \ | ||
317 | + --enable-linux-aio --enable-attr \ | ||
318 | + --enable-cap-ng --enable-trace-backends=log --enable-spice --enable-rbd \ | ||
319 | + --enable-xfsctl --enable-libusb --enable-usb-redir \ | ||
320 | + --enable-libiscsi --enable-libnfs --enable-seccomp \ | ||
321 | + --enable-tpm --enable-libssh --enable-lzo --enable-snappy --enable-bzip2 \ | ||
322 | + --enable-numa --enable-rdma --enable-smartcard --enable-virglrenderer \ | ||
323 | + --enable-mpath --enable-libxml2 --enable-glusterfs \ | ||
324 | + --enable-virtfs --enable-zstd | ||
325 | + | ||
326 | +echo "Making libqemustub.a..." | ||
327 | +make libqemustub.a | ||
328 | + | ||
329 | +echo "Running cov-build..." | ||
330 | +rm -rf cov-int | ||
331 | +mkdir cov-int | ||
332 | +cov-build --dir cov-int $COVERITY_BUILD_CMD | ||
333 | + | ||
334 | +echo "Creating results tarball..." | ||
335 | +tar cvf - cov-int | xz > "$TARBALL" | ||
336 | + | ||
337 | +if [ ! -z "$RESULTSTARBALL" ]; then | ||
338 | + echo "Copying results tarball to $RESULTSTARBALL..." | ||
339 | + cp "$TARBALL" "$RESULTSTARBALL" | ||
340 | +fi | ||
341 | + | ||
342 | +echo "Uploading results tarball..." | ||
343 | + | ||
344 | +if [ "$DRYRUN" = yes ]; then | ||
345 | + echo "Dry run only, not uploading $TARBALL" | ||
346 | + exit 0 | ||
347 | +fi | ||
348 | + | ||
349 | +curl --form token="$PROJTOKEN" --form email="$COVERITY_EMAIL" \ | ||
350 | + --form file=@"$TARBALL" --form version="$VERSION" \ | ||
351 | + --form description="$DESCRIPTION" \ | ||
352 | + https://scan.coverity.com/builds?project="$PROJNAME" | ||
353 | + | ||
354 | +echo "Done." | ||
190 | -- | 355 | -- |
191 | 2.19.2 | 356 | 2.20.1 |
192 | 357 | ||
193 | 358 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Add support for running the Coverity Scan tools inside a Docker |
---|---|---|---|
2 | 2 | container rather than directly on the host system. | |
3 | The bulk of the work here, beyond base HPD, is defining the | 3 | |
4 | TTBCR2 register. In addition we must check TTBCR.T2E, which | 4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
5 | is not present (RES0) for AArch64. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20181203203839.757-11-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Message-id: 20200319193323.2038-7-peter.maydell@linaro.org | ||
11 | --- | 7 | --- |
12 | target/arm/cpu.h | 9 +++++++++ | 8 | scripts/coverity-scan/coverity-scan.docker | 131 +++++++++++++++++++++ |
13 | target/arm/cpu.c | 4 ++++ | 9 | scripts/coverity-scan/run-coverity-scan | 90 ++++++++++++++ |
14 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++-------- | 10 | 2 files changed, 221 insertions(+) |
15 | 3 files changed, 42 insertions(+), 8 deletions(-) | 11 | create mode 100644 scripts/coverity-scan/coverity-scan.docker |
16 | 12 | ||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 13 | diff --git a/scripts/coverity-scan/coverity-scan.docker b/scripts/coverity-scan/coverity-scan.docker |
18 | index XXXXXXX..XXXXXXX 100644 | 14 | new file mode 100644 |
19 | --- a/target/arm/cpu.h | 15 | index XXXXXXX..XXXXXXX |
20 | +++ b/target/arm/cpu.h | 16 | --- /dev/null |
21 | @@ -XXX,XX +XXX,XX @@ FIELD(ID_ISAR6, FHM, 8, 4) | 17 | +++ b/scripts/coverity-scan/coverity-scan.docker |
22 | FIELD(ID_ISAR6, SB, 12, 4) | 18 | @@ -XXX,XX +XXX,XX @@ |
23 | FIELD(ID_ISAR6, SPECRES, 16, 4) | 19 | +# syntax=docker/dockerfile:1.0.0-experimental |
24 | 20 | +# | |
25 | +FIELD(ID_MMFR4, SPECSEI, 0, 4) | 21 | +# Docker setup for running the "Coverity Scan" tools over the source |
26 | +FIELD(ID_MMFR4, AC2, 4, 4) | 22 | +# tree and uploading them to the website, as per |
27 | +FIELD(ID_MMFR4, XNX, 8, 4) | 23 | +# https://scan.coverity.com/projects/qemu/builds/new |
28 | +FIELD(ID_MMFR4, CNP, 12, 4) | 24 | +# We do this on a fixed config (currently Fedora 30 with a known |
29 | +FIELD(ID_MMFR4, HPDS, 16, 4) | 25 | +# set of dependencies and a configure command that enables a specific |
30 | +FIELD(ID_MMFR4, LSM, 20, 4) | 26 | +# set of options) so that random changes don't result in our accidentally |
31 | +FIELD(ID_MMFR4, CCIDX, 24, 4) | 27 | +# dropping some files from the scan. |
32 | +FIELD(ID_MMFR4, EVT, 28, 4) | 28 | +# |
33 | + | 29 | +# We don't build on top of the fedora.docker file because we don't |
34 | FIELD(ID_AA64ISAR0, AES, 4, 4) | 30 | +# want to accidentally change or break the scan config when that |
35 | FIELD(ID_AA64ISAR0, SHA1, 8, 4) | 31 | +# is updated. |
36 | FIELD(ID_AA64ISAR0, SHA2, 12, 4) | 32 | + |
37 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 33 | +# The work of actually doing the build is handled by the |
38 | index XXXXXXX..XXXXXXX 100644 | 34 | +# run-coverity-scan script. |
39 | --- a/target/arm/cpu.c | 35 | + |
40 | +++ b/target/arm/cpu.c | 36 | +FROM fedora:30 |
41 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | 37 | +ENV PACKAGES \ |
42 | t = cpu->isar.id_isar6; | 38 | + alsa-lib-devel \ |
43 | t = FIELD_DP32(t, ID_ISAR6, DP, 1); | 39 | + bc \ |
44 | cpu->isar.id_isar6 = t; | 40 | + bison \ |
45 | + | 41 | + brlapi-devel \ |
46 | + t = cpu->id_mmfr4; | 42 | + bzip2 \ |
47 | + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | 43 | + bzip2-devel \ |
48 | + cpu->id_mmfr4 = t; | 44 | + ccache \ |
49 | } | 45 | + clang \ |
50 | #endif | 46 | + curl \ |
51 | } | 47 | + cyrus-sasl-devel \ |
52 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 48 | + dbus-daemon \ |
53 | index XXXXXXX..XXXXXXX 100644 | 49 | + device-mapper-multipath-devel \ |
54 | --- a/target/arm/helper.c | 50 | + findutils \ |
55 | +++ b/target/arm/helper.c | 51 | + flex \ |
56 | @@ -XXX,XX +XXX,XX @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 52 | + gcc \ |
57 | uint64_t value) | 53 | + gcc-c++ \ |
58 | { | 54 | + gettext \ |
59 | ARMCPU *cpu = arm_env_get_cpu(env); | 55 | + git \ |
60 | + TCR *tcr = raw_ptr(env, ri); | 56 | + glib2-devel \ |
61 | 57 | + glusterfs-api-devel \ | |
62 | if (arm_feature(env, ARM_FEATURE_LPAE)) { | 58 | + gnutls-devel \ |
63 | /* With LPAE the TTBCR could result in a change of ASID | 59 | + gtk3-devel \ |
64 | @@ -XXX,XX +XXX,XX @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 60 | + hostname \ |
65 | */ | 61 | + libaio-devel \ |
66 | tlb_flush(CPU(cpu)); | 62 | + libasan \ |
67 | } | 63 | + libattr-devel \ |
68 | + /* Preserve the high half of TCR_EL1, set via TTBCR2. */ | 64 | + libblockdev-mpath-devel \ |
69 | + value = deposit64(tcr->raw_tcr, 0, 32, value); | 65 | + libcap-devel \ |
70 | vmsa_ttbcr_raw_write(env, ri, value); | 66 | + libcap-ng-devel \ |
71 | } | 67 | + libcurl-devel \ |
72 | 68 | + libepoxy-devel \ | |
73 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { | 69 | + libfdt-devel \ |
74 | REGINFO_SENTINEL | 70 | + libgbm-devel \ |
75 | }; | 71 | + libiscsi-devel \ |
76 | 72 | + libjpeg-devel \ | |
77 | +/* Note that unlike TTBCR, writing to TTBCR2 does not require flushing | 73 | + libpmem-devel \ |
78 | + * qemu tlbs nor adjusting cached masks. | 74 | + libnfs-devel \ |
79 | + */ | 75 | + libpng-devel \ |
80 | +static const ARMCPRegInfo ttbcr2_reginfo = { | 76 | + librbd-devel \ |
81 | + .name = "TTBCR2", .cp = 15, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 3, | 77 | + libseccomp-devel \ |
82 | + .access = PL1_RW, .type = ARM_CP_ALIAS, | 78 | + libssh-devel \ |
83 | + .bank_fieldoffsets = { offsetofhigh32(CPUARMState, cp15.tcr_el[3]), | 79 | + libubsan \ |
84 | + offsetofhigh32(CPUARMState, cp15.tcr_el[1]) }, | 80 | + libudev-devel \ |
85 | +}; | 81 | + libusbx-devel \ |
86 | + | 82 | + libxml2-devel \ |
87 | static void omap_ticonfig_write(CPUARMState *env, const ARMCPRegInfo *ri, | 83 | + libzstd-devel \ |
88 | uint64_t value) | 84 | + llvm \ |
89 | { | 85 | + lzo-devel \ |
90 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | 86 | + make \ |
91 | } else { | 87 | + mingw32-bzip2 \ |
92 | define_arm_cp_regs(cpu, vmsa_pmsa_cp_reginfo); | 88 | + mingw32-curl \ |
93 | define_arm_cp_regs(cpu, vmsa_cp_reginfo); | 89 | + mingw32-glib2 \ |
94 | + /* TTCBR2 is introduced with ARMv8.2-A32HPD. */ | 90 | + mingw32-gmp \ |
95 | + if (FIELD_EX32(cpu->id_mmfr4, ID_MMFR4, HPDS) != 0) { | 91 | + mingw32-gnutls \ |
96 | + define_one_arm_cp_reg(cpu, &ttbcr2_reginfo); | 92 | + mingw32-gtk3 \ |
97 | + } | 93 | + mingw32-libjpeg-turbo \ |
98 | } | 94 | + mingw32-libpng \ |
99 | if (arm_feature(env, ARM_FEATURE_THUMB2EE)) { | 95 | + mingw32-libtasn1 \ |
100 | define_arm_cp_regs(cpu, t2ee_cp_reginfo); | 96 | + mingw32-nettle \ |
101 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 97 | + mingw32-nsis \ |
102 | if (tg == 2) { /* 16KB pages */ | 98 | + mingw32-pixman \ |
103 | stride = 11; | 99 | + mingw32-pkg-config \ |
104 | } | 100 | + mingw32-SDL2 \ |
105 | - if (aarch64) { | 101 | + mingw64-bzip2 \ |
106 | - if (el > 1) { | 102 | + mingw64-curl \ |
107 | - hpd = extract64(tcr->raw_tcr, 24, 1); | 103 | + mingw64-glib2 \ |
108 | - } else { | 104 | + mingw64-gmp \ |
109 | - hpd = extract64(tcr->raw_tcr, 41, 1); | 105 | + mingw64-gnutls \ |
110 | - } | 106 | + mingw64-gtk3 \ |
111 | + if (aarch64 && el > 1) { | 107 | + mingw64-libjpeg-turbo \ |
112 | + hpd = extract64(tcr->raw_tcr, 24, 1); | 108 | + mingw64-libpng \ |
113 | + } else { | 109 | + mingw64-libtasn1 \ |
114 | + hpd = extract64(tcr->raw_tcr, 41, 1); | 110 | + mingw64-nettle \ |
115 | + } | 111 | + mingw64-pixman \ |
116 | + if (!aarch64) { | 112 | + mingw64-pkg-config \ |
117 | + /* For aarch32, hpd0 is not enabled without t2e as well. */ | 113 | + mingw64-SDL2 \ |
118 | + hpd &= extract64(tcr->raw_tcr, 6, 1); | 114 | + ncurses-devel \ |
119 | } | 115 | + nettle-devel \ |
120 | } else { | 116 | + nss-devel \ |
121 | /* We should only be here if TTBR1 is valid */ | 117 | + numactl-devel \ |
122 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 118 | + perl \ |
123 | if (tg == 1) { /* 16KB pages */ | 119 | + perl-Test-Harness \ |
124 | stride = 11; | 120 | + pixman-devel \ |
125 | } | 121 | + pulseaudio-libs-devel \ |
126 | - if (aarch64) { | 122 | + python3 \ |
127 | - hpd = extract64(tcr->raw_tcr, 42, 1); | 123 | + python3-sphinx \ |
128 | + hpd = extract64(tcr->raw_tcr, 42, 1); | 124 | + PyYAML \ |
129 | + if (!aarch64) { | 125 | + rdma-core-devel \ |
130 | + /* For aarch32, hpd1 is not enabled without t2e as well. */ | 126 | + SDL2-devel \ |
131 | + hpd &= extract64(tcr->raw_tcr, 6, 1); | 127 | + snappy-devel \ |
132 | } | 128 | + sparse \ |
133 | } | 129 | + spice-server-devel \ |
134 | 130 | + systemd-devel \ | |
131 | + systemtap-sdt-devel \ | ||
132 | + tar \ | ||
133 | + texinfo \ | ||
134 | + usbredir-devel \ | ||
135 | + virglrenderer-devel \ | ||
136 | + vte291-devel \ | ||
137 | + wget \ | ||
138 | + which \ | ||
139 | + xen-devel \ | ||
140 | + xfsprogs-devel \ | ||
141 | + zlib-devel | ||
142 | +ENV QEMU_CONFIGURE_OPTS --python=/usr/bin/python3 | ||
143 | + | ||
144 | +RUN dnf install -y $PACKAGES | ||
145 | +RUN rpm -q $PACKAGES | sort > /packages.txt | ||
146 | +ENV PATH $PATH:/usr/libexec/python3-sphinx/ | ||
147 | +ENV COVERITY_TOOL_BASE=/coverity-tools | ||
148 | +COPY run-coverity-scan run-coverity-scan | ||
149 | +RUN --mount=type=secret,id=coverity.token,required ./run-coverity-scan --update-tools-only --tokenfile /run/secrets/coverity.token | ||
150 | diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan | ||
151 | index XXXXXXX..XXXXXXX 100755 | ||
152 | --- a/scripts/coverity-scan/run-coverity-scan | ||
153 | +++ b/scripts/coverity-scan/run-coverity-scan | ||
154 | @@ -XXX,XX +XXX,XX @@ | ||
155 | |||
156 | # Command line options: | ||
157 | # --dry-run : run the tools, but don't actually do the upload | ||
158 | +# --docker : create and work inside a docker container | ||
159 | # --update-tools-only : update the cached copy of the tools, but don't run them | ||
160 | # --tokenfile : file to read Coverity token from | ||
161 | # --version ver : specify version being analyzed (default: ask git) | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | # --srcdir : QEMU source tree to analyze (default: current working dir) | ||
164 | # --results-tarball : path to copy the results tarball to (default: don't | ||
165 | # copy it anywhere, just upload it) | ||
166 | +# --src-tarball : tarball to untar into src dir (default: none); this | ||
167 | +# is intended mainly for internal use by the Docker support | ||
168 | # | ||
169 | # User-specifiable environment variables: | ||
170 | # COVERITY_TOKEN -- Coverity token | ||
171 | @@ -XXX,XX +XXX,XX @@ update_coverity_tools () { | ||
172 | # Check user-provided environment variables and arguments | ||
173 | DRYRUN=no | ||
174 | UPDATE_ONLY=no | ||
175 | +DOCKER=no | ||
176 | |||
177 | while [ "$#" -ge 1 ]; do | ||
178 | case "$1" in | ||
179 | @@ -XXX,XX +XXX,XX @@ while [ "$#" -ge 1 ]; do | ||
180 | RESULTSTARBALL="$1" | ||
181 | shift | ||
182 | ;; | ||
183 | + --src-tarball) | ||
184 | + shift | ||
185 | + if [ $# -eq 0 ]; then | ||
186 | + echo "--src-tarball needs an argument" | ||
187 | + exit 1 | ||
188 | + fi | ||
189 | + SRCTARBALL="$1" | ||
190 | + shift | ||
191 | + ;; | ||
192 | + --docker) | ||
193 | + DOCKER=yes | ||
194 | + shift | ||
195 | + ;; | ||
196 | *) | ||
197 | echo "Unexpected argument '$1'" | ||
198 | exit 1 | ||
199 | @@ -XXX,XX +XXX,XX @@ PROJTOKEN="$COVERITY_TOKEN" | ||
200 | PROJNAME=QEMU | ||
201 | TARBALL=cov-int.tar.xz | ||
202 | |||
203 | +if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then | ||
204 | + echo "Combining --docker and --update-only is not supported" | ||
205 | + exit 1 | ||
206 | +fi | ||
207 | |||
208 | if [ "$UPDATE_ONLY" = yes ]; then | ||
209 | # Just do the tools update; we don't need to check whether | ||
210 | @@ -XXX,XX +XXX,XX @@ if [ "$UPDATE_ONLY" = yes ]; then | ||
211 | exit 0 | ||
212 | fi | ||
213 | |||
214 | +if [ ! -e "$SRCDIR" ]; then | ||
215 | + mkdir "$SRCDIR" | ||
216 | +fi | ||
217 | + | ||
218 | cd "$SRCDIR" | ||
219 | |||
220 | +if [ ! -z "$SRCTARBALL" ]; then | ||
221 | + echo "Untarring source tarball into $SRCDIR..." | ||
222 | + tar xvf "$SRCTARBALL" | ||
223 | +fi | ||
224 | + | ||
225 | echo "Checking this is a QEMU source tree..." | ||
226 | if ! [ -e "$SRCDIR/VERSION" ]; then | ||
227 | echo "Not in a QEMU source tree?" | ||
228 | @@ -XXX,XX +XXX,XX @@ if [ -z "$COVERITY_EMAIL" ]; then | ||
229 | COVERITY_EMAIL="$(git config user.email)" | ||
230 | fi | ||
231 | |||
232 | +# Run ourselves inside docker if that's what the user wants | ||
233 | +if [ "$DOCKER" = yes ]; then | ||
234 | + # build docker container including the coverity-scan tools | ||
235 | + # Put the Coverity token into a temporary file that only | ||
236 | + # we have read access to, and then pass it to docker build | ||
237 | + # using --secret. This requires at least Docker 18.09. | ||
238 | + # Mostly what we are trying to do here is ensure we don't leak | ||
239 | + # the token into the Docker image. | ||
240 | + umask 077 | ||
241 | + SECRETDIR=$(mktemp -d) | ||
242 | + if [ -z "$SECRETDIR" ]; then | ||
243 | + echo "Failed to create temporary directory" | ||
244 | + exit 1 | ||
245 | + fi | ||
246 | + trap 'rm -rf "$SECRETDIR"' INT TERM EXIT | ||
247 | + echo "Created temporary directory $SECRETDIR" | ||
248 | + SECRET="$SECRETDIR/token" | ||
249 | + echo "$COVERITY_TOKEN" > "$SECRET" | ||
250 | + echo "Building docker container..." | ||
251 | + # TODO: This re-downloads the tools every time, rather than | ||
252 | + # caching and reusing the image produced with the downloaded tools. | ||
253 | + # Not sure why. | ||
254 | + # TODO: how do you get 'docker build' to print the output of the | ||
255 | + # commands it is running to its stdout? This would be useful for debug. | ||
256 | + DOCKER_BUILDKIT=1 docker build -t coverity-scanner \ | ||
257 | + --secret id=coverity.token,src="$SECRET" \ | ||
258 | + -f scripts/coverity-scan/coverity-scan.docker \ | ||
259 | + scripts/coverity-scan | ||
260 | + echo "Archiving sources to be analyzed..." | ||
261 | + ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" | ||
262 | + if [ "$DRYRUN" = yes ]; then | ||
263 | + DRYRUNARG=--dry-run | ||
264 | + fi | ||
265 | + echo "Running scanner..." | ||
266 | + # If we need to capture the output tarball, get the inner run to | ||
267 | + # save it to the secrets directory so we can copy it out before the | ||
268 | + # directory is cleaned up. | ||
269 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
270 | + RTARGS="--results-tarball /work/cov-int.tar.xz" | ||
271 | + else | ||
272 | + RTARGS="" | ||
273 | + fi | ||
274 | + # Arrange for this docker run to get access to the sources with -v. | ||
275 | + # We pass through all the configuration from the outer script to the inner. | ||
276 | + export COVERITY_EMAIL COVERITY_BUILD_CMD | ||
277 | + docker run -it --env COVERITY_EMAIL --env COVERITY_BUILD_CMD \ | ||
278 | + -v "$SECRETDIR:/work" coverity-scanner \ | ||
279 | + ./run-coverity-scan --version "$VERSION" \ | ||
280 | + --description "$DESCRIPTION" $DRYRUNARG --tokenfile /work/token \ | ||
281 | + --srcdir /qemu --src-tarball /work/qemu-sources.tgz $RTARGS | ||
282 | + if [ ! -z "$RESULTSTARBALL" ]; then | ||
283 | + echo "Copying results tarball to $RESULTSTARBALL..." | ||
284 | + cp "$SECRETDIR/cov-int.tar.xz" "$RESULTSTARBALL" | ||
285 | + fi | ||
286 | + echo "Docker work complete." | ||
287 | + exit 0 | ||
288 | +fi | ||
289 | + | ||
290 | +# Otherwise, continue with the full build and upload process. | ||
291 | + | ||
292 | check_upload_permissions | ||
293 | |||
294 | update_coverity_tools | ||
135 | -- | 295 | -- |
136 | 2.19.2 | 296 | 2.20.1 |
137 | 297 | ||
138 | 298 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The documentation of our -s and -gdb options is quite old; in |
---|---|---|---|
2 | particular it still claims that it will cause QEMU to stop and wait | ||
3 | for the gdb connection, when this has not been true for some time: | ||
4 | you also need to pass -S if you want to make QEMU not launch the | ||
5 | guest on startup. | ||
2 | 6 | ||
3 | The enable for TGE has already occurred within arm_hcr_el2_amo | 7 | Improve the documentation to mention this requirement in the |
4 | and friends. Moreover, when E2H is also set, the sense is | 8 | executable's --help output, the documentation of the -gdb option in |
5 | supposed to be reversed, which has also already occurred within | 9 | the manual, and in the "GDB usage" chapter. |
6 | the helpers. | ||
7 | 10 | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Includes some minor tweaks to these paragraphs of documentation |
9 | Message-id: 20181203203839.757-5-richard.henderson@linaro.org | 12 | since I was editing them anyway (such as dropping the description |
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 13 | of our gdb support as "primitive"). |
14 | |||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
18 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
19 | Message-id: 20200403094014.9589-1-peter.maydell@linaro.org | ||
12 | --- | 20 | --- |
13 | target/arm/helper.c | 3 --- | 21 | docs/system/gdb.rst | 22 +++++++++++++++------- |
14 | 1 file changed, 3 deletions(-) | 22 | qemu-options.hx | 24 ++++++++++++++++++------ |
23 | 2 files changed, 33 insertions(+), 13 deletions(-) | ||
15 | 24 | ||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 25 | diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst |
17 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/helper.c | 27 | --- a/docs/system/gdb.rst |
19 | +++ b/target/arm/helper.c | 28 | +++ b/docs/system/gdb.rst |
20 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, | 29 | @@ -XXX,XX +XXX,XX @@ |
21 | break; | 30 | GDB usage |
22 | }; | 31 | --------- |
23 | 32 | ||
24 | - /* If HCR.TGE is set then HCR is treated as being 1 */ | 33 | -QEMU has a primitive support to work with gdb, so that you can do |
25 | - hcr |= ((env->cp15.hcr_el2 & HCR_TGE) == HCR_TGE); | 34 | -'Ctrl-C' while the virtual machine is running and inspect its state. |
26 | - | 35 | +QEMU supports working with gdb via gdb's remote-connection facility |
27 | /* Perform a table-lookup for the target EL given the current state */ | 36 | +(the "gdbstub"). This allows you to debug guest code in the same |
28 | target_el = target_el_table[is64][scr][rw][hcr][secure][cur_el]; | 37 | +way that you might with a low-level debug facility like JTAG |
38 | +on real hardware. You can stop and start the virtual machine, | ||
39 | +examine state like registers and memory, and set breakpoints and | ||
40 | +watchpoints. | ||
41 | |||
42 | -In order to use gdb, launch QEMU with the '-s' option. It will wait for | ||
43 | -a gdb connection: | ||
44 | +In order to use gdb, launch QEMU with the ``-s`` and ``-S`` options. | ||
45 | +The ``-s`` option will make QEMU listen for an incoming connection | ||
46 | +from gdb on TCP port 1234, and ``-S`` will make QEMU not start the | ||
47 | +guest until you tell it to from gdb. (If you want to specify which | ||
48 | +TCP port to use or to use something other than TCP for the gdbstub | ||
49 | +connection, use the ``-gdb dev`` option instead of ``-s``.) | ||
50 | |||
51 | .. parsed-literal:: | ||
52 | |||
53 | - |qemu_system| -s -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" | ||
54 | - Connected to host network interface: tun0 | ||
55 | - Waiting gdb connection on port 1234 | ||
56 | + |qemu_system| -s -S -kernel bzImage -hda rootdisk.img -append "root=/dev/hda" | ||
57 | + | ||
58 | +QEMU will launch but will silently wait for gdb to connect. | ||
59 | |||
60 | Then launch gdb on the 'vmlinux' executable:: | ||
61 | |||
62 | diff --git a/qemu-options.hx b/qemu-options.hx | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/qemu-options.hx | ||
65 | +++ b/qemu-options.hx | ||
66 | @@ -XXX,XX +XXX,XX @@ SRST | ||
67 | ERST | ||
68 | |||
69 | DEF("gdb", HAS_ARG, QEMU_OPTION_gdb, \ | ||
70 | - "-gdb dev wait for gdb connection on 'dev'\n", QEMU_ARCH_ALL) | ||
71 | + "-gdb dev accept gdb connection on 'dev'. (QEMU defaults to starting\n" | ||
72 | + " the guest without waiting for gdb to connect; use -S too\n" | ||
73 | + " if you want it to not start execution.)\n", | ||
74 | + QEMU_ARCH_ALL) | ||
75 | SRST | ||
76 | ``-gdb dev`` | ||
77 | - Wait for gdb connection on device dev (see | ||
78 | - :ref:`gdb_005fusage`). Typical connections will likely be | ||
79 | - TCP-based, but also UDP, pseudo TTY, or even stdio are reasonable | ||
80 | - use case. The latter is allowing to start QEMU from within gdb and | ||
81 | - establish the connection via a pipe: | ||
82 | + Accept a gdb connection on device dev (see | ||
83 | + :ref:`gdb_005fusage`). Note that this option does not pause QEMU | ||
84 | + execution -- if you want QEMU to not start the guest until you | ||
85 | + connect with gdb and issue a ``continue`` command, you will need to | ||
86 | + also pass the ``-S`` option to QEMU. | ||
87 | + | ||
88 | + The most usual configuration is to listen on a local TCP socket:: | ||
89 | + | ||
90 | + -gdb tcp::3117 | ||
91 | + | ||
92 | + but you can specify other backends; UDP, pseudo TTY, or even stdio | ||
93 | + are all reasonable use cases. For example, a stdio connection | ||
94 | + allows you to start QEMU from within gdb and establish the | ||
95 | + connection via a pipe: | ||
96 | |||
97 | .. parsed-literal:: | ||
29 | 98 | ||
30 | -- | 99 | -- |
31 | 2.19.2 | 100 | 2.20.1 |
32 | 101 | ||
33 | 102 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | If we are not making warnings fatal for compilation, make them |
---|---|---|---|
2 | non-fatal when building the Sphinx documentation also. (For instance | ||
3 | Sphinx 3.0 warns about some constructs that older versions were happy | ||
4 | with, which is a build failure if we use the warnings-as-errors | ||
5 | flag.) | ||
2 | 6 | ||
3 | Since the TCR_*.HPD bits were RES0 in ARMv8.0, we can simply | 7 | This provides a workaround at least for LP:1872113. |
4 | interpret the bits as if ARMv8.1-HPD is present without checking. | ||
5 | We will need a slightly different check for hpd for aarch32. | ||
6 | 8 | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20181203203839.757-10-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200411182934.28678-2-peter.maydell@linaro.org | ||
12 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | --- | 13 | --- |
12 | target/arm/cpu64.c | 4 ++++ | 14 | configure | 9 ++++++++- |
13 | target/arm/helper.c | 27 ++++++++++++++++++++------- | 15 | Makefile | 2 +- |
14 | 2 files changed, 24 insertions(+), 7 deletions(-) | 16 | 2 files changed, 9 insertions(+), 2 deletions(-) |
15 | 17 | ||
16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 18 | diff --git a/configure b/configure |
19 | index XXXXXXX..XXXXXXX 100755 | ||
20 | --- a/configure | ||
21 | +++ b/configure | ||
22 | @@ -XXX,XX +XXX,XX @@ if check_include sys/kcov.h ; then | ||
23 | kcov=yes | ||
24 | fi | ||
25 | |||
26 | +# If we're making warnings fatal, apply this to Sphinx runs as well | ||
27 | +sphinx_werror="" | ||
28 | +if test "$werror" = "yes"; then | ||
29 | + sphinx_werror="-W" | ||
30 | +fi | ||
31 | + | ||
32 | # Check we have a new enough version of sphinx-build | ||
33 | has_sphinx_build() { | ||
34 | # This is a bit awkward but works: create a trivial document and | ||
35 | @@ -XXX,XX +XXX,XX @@ has_sphinx_build() { | ||
36 | # sphinx-build doesn't exist at all or if it is too old. | ||
37 | mkdir -p "$TMPDIR1/sphinx" | ||
38 | touch "$TMPDIR1/sphinx/index.rst" | ||
39 | - "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
40 | + "$sphinx_build" $sphinx_werror -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/sphinx/out" >/dev/null 2>&1 | ||
41 | } | ||
42 | |||
43 | # Check if tools are available to build documentation. | ||
44 | @@ -XXX,XX +XXX,XX @@ echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak | ||
45 | echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak | ||
46 | echo "PYTHON=$python" >> $config_host_mak | ||
47 | echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak | ||
48 | +echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak | ||
49 | echo "GENISOIMAGE=$genisoimage" >> $config_host_mak | ||
50 | echo "CC=$cc" >> $config_host_mak | ||
51 | if $iasl -h > /dev/null 2>&1; then | ||
52 | diff --git a/Makefile b/Makefile | ||
17 | index XXXXXXX..XXXXXXX 100644 | 53 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu64.c | 54 | --- a/Makefile |
19 | +++ b/target/arm/cpu64.c | 55 | +++ b/Makefile |
20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | 56 | @@ -XXX,XX +XXX,XX @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \ |
21 | t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | 57 | # Note the use of different doctree for each (manual, builder) tuple; |
22 | cpu->isar.id_aa64pfr0 = t; | 58 | # this works around Sphinx not handling parallel invocation on |
23 | 59 | # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 | |
24 | + t = cpu->isar.id_aa64mmfr1; | 60 | -build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) -W -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") |
25 | + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | 61 | +build-manual = $(call quiet-command,CONFDIR="$(qemu_confdir)" $(SPHINX_BUILD) $(if $(V),,-q) $(SPHINX_WERROR) -b $2 -D version=$(VERSION) -D release="$(FULL_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPHINX","$(MANUAL_BUILDDIR)/$1") |
26 | + cpu->isar.id_aa64mmfr1 = t; | 62 | # We assume all RST files in the manual's directory are used in it |
27 | + | 63 | manual-deps = $(wildcard $(SRC_PATH)/docs/$1/*.rst $(SRC_PATH)/docs/$1/*/*.rst) \ |
28 | /* Replicate the same data to the 32-bit id registers. */ | 64 | $(SRC_PATH)/docs/defs.rst.inc \ |
29 | u = cpu->isar.id_isar5; | ||
30 | u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
31 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/target/arm/helper.c | ||
34 | +++ b/target/arm/helper.c | ||
35 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
36 | bool ttbr1_valid = true; | ||
37 | uint64_t descaddrmask; | ||
38 | bool aarch64 = arm_el_is_aa64(env, el); | ||
39 | + bool hpd = false; | ||
40 | |||
41 | /* TODO: | ||
42 | * This code does not handle the different format TCR for VTCR_EL2. | ||
43 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
44 | if (tg == 2) { /* 16KB pages */ | ||
45 | stride = 11; | ||
46 | } | ||
47 | + if (aarch64) { | ||
48 | + if (el > 1) { | ||
49 | + hpd = extract64(tcr->raw_tcr, 24, 1); | ||
50 | + } else { | ||
51 | + hpd = extract64(tcr->raw_tcr, 41, 1); | ||
52 | + } | ||
53 | + } | ||
54 | } else { | ||
55 | /* We should only be here if TTBR1 is valid */ | ||
56 | assert(ttbr1_valid); | ||
57 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
58 | if (tg == 1) { /* 16KB pages */ | ||
59 | stride = 11; | ||
60 | } | ||
61 | + if (aarch64) { | ||
62 | + hpd = extract64(tcr->raw_tcr, 42, 1); | ||
63 | + } | ||
64 | } | ||
65 | |||
66 | /* Here we should have set up all the parameters for the translation: | ||
67 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
68 | descaddr = descriptor & descaddrmask; | ||
69 | |||
70 | if ((descriptor & 2) && (level < 3)) { | ||
71 | - /* Table entry. The top five bits are attributes which may | ||
72 | + /* Table entry. The top five bits are attributes which may | ||
73 | * propagate down through lower levels of the table (and | ||
74 | * which are all arranged so that 0 means "no effect", so | ||
75 | * we can gather them up by ORing in the bits at each level). | ||
76 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
77 | break; | ||
78 | } | ||
79 | /* Merge in attributes from table descriptors */ | ||
80 | - attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */ | ||
81 | - attrs |= extract32(tableattrs, 3, 1) << 5; /* APTable[1] => AP[2] */ | ||
82 | + attrs |= nstable << 3; /* NS */ | ||
83 | + if (hpd) { | ||
84 | + /* HPD disables all the table attributes except NSTable. */ | ||
85 | + break; | ||
86 | + } | ||
87 | + attrs |= extract32(tableattrs, 0, 2) << 11; /* XN, PXN */ | ||
88 | /* The sense of AP[1] vs APTable[0] is reversed, as APTable[0] == 1 | ||
89 | * means "force PL1 access only", which means forcing AP[1] to 0. | ||
90 | */ | ||
91 | - if (extract32(tableattrs, 2, 1)) { | ||
92 | - attrs &= ~(1 << 4); | ||
93 | - } | ||
94 | - attrs |= nstable << 3; /* NS */ | ||
95 | + attrs &= ~(extract32(tableattrs, 2, 1) << 4); /* !APT[0] => AP[1] */ | ||
96 | + attrs |= extract32(tableattrs, 3, 1) << 5; /* APT[1] => AP[2] */ | ||
97 | break; | ||
98 | } | ||
99 | /* Here descaddr is the final physical address, and attributes | ||
100 | -- | 65 | -- |
101 | 2.19.2 | 66 | 2.20.1 |
102 | 67 | ||
103 | 68 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | When kernel-doc generates a 'c:function' directive for a function |
---|---|---|---|
2 | one of whose arguments is a function pointer, it fails to print | ||
3 | the close-paren after the argument list of the function pointer | ||
4 | argument, for instance in the memory API documentation: | ||
5 | .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | ||
2 | 6 | ||
3 | Reduce number of virtio-mmio instances. This is in preparation | 7 | which should have a ')' after the 'void *host' which is the |
4 | for correcting the interrupt setup for Versal. | 8 | last argument to 'resized'. |
5 | 9 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Older versions of Sphinx don't try to parse the argumnet |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | to c:function, but Sphinx 3.0 does do this and will complain: |
8 | Message-id: 20181129163655.20370-3-edgar.iglesias@gmail.com | 12 | |
13 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters | ||
14 | Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208] | ||
15 | void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp) | ||
16 | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ | ||
17 | |||
18 | Add the missing close-paren. | ||
19 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
21 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
22 | Message-id: 20200411182934.28678-3-peter.maydell@linaro.org | ||
23 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | --- | 24 | --- |
11 | hw/arm/xlnx-versal-virt.c | 2 +- | 25 | scripts/kernel-doc | 2 +- |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 26 | 1 file changed, 1 insertion(+), 1 deletion(-) |
13 | 27 | ||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | 28 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc |
15 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100755 |
16 | --- a/hw/arm/xlnx-versal-virt.c | 30 | --- a/scripts/kernel-doc |
17 | +++ b/hw/arm/xlnx-versal-virt.c | 31 | +++ b/scripts/kernel-doc |
18 | @@ -XXX,XX +XXX,XX @@ static void *versal_virt_get_dtb(const struct arm_boot_info *binfo, | 32 | @@ -XXX,XX +XXX,XX @@ sub output_function_rst(%) { |
19 | return board->fdt; | 33 | |
20 | } | 34 | if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { |
21 | 35 | # pointer-to-function | |
22 | -#define NUM_VIRTIO_TRANSPORT 32 | 36 | - print $1 . $parameter . ") (" . $2; |
23 | +#define NUM_VIRTIO_TRANSPORT 8 | 37 | + print $1 . $parameter . ") (" . $2 . ")"; |
24 | static void create_virtio_regions(VersalVirt *s) | 38 | } else { |
25 | { | 39 | print $type . " " . $parameter; |
26 | int virtio_mmio_size = 0x200; | 40 | } |
27 | -- | 41 | -- |
28 | 2.19.2 | 42 | 2.20.1 |
29 | 43 | ||
30 | 44 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The kernel-doc Sphinx plugin and associated script currently emit |
---|---|---|---|
2 | 'c:type' directives for "struct foo" documentation. | ||
2 | 3 | ||
3 | Post v8.4 bits taken from SysReg_v85_xml-00bet8. | 4 | Sphinx 3.0 warns about this: |
5 | /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:3: WARNING: Type must be either just a name or a typedef-like declaration. | ||
6 | If just a name: | ||
7 | Error in declarator or parameters | ||
8 | Invalid C declaration: Expected identifier in nested name, got keyword: struct [error at 6] | ||
9 | struct MemoryListener | ||
10 | ------^ | ||
11 | If typedef-like declaration: | ||
12 | Error in declarator or parameters | ||
13 | Invalid C declaration: Expected identifier in nested name. [error at 21] | ||
14 | struct MemoryListener | ||
15 | ---------------------^ | ||
4 | 16 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 17 | because it wants us to use the new-in-3.0 'c:struct' instead. |
6 | Message-id: 20181203203839.757-4-richard.henderson@linaro.org | 18 | |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Plumb the Sphinx version through to the kernel-doc script |
20 | and use it to select 'c:struct' for newer versions than 3.0. | ||
21 | |||
22 | Fixes: LP:1872113 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 23 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
24 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | --- | 25 | --- |
10 | target/arm/cpu.h | 10 ++++++++++ | 26 | docs/sphinx/kerneldoc.py | 1 + |
11 | 1 file changed, 10 insertions(+) | 27 | scripts/kernel-doc | 16 +++++++++++++++- |
28 | 2 files changed, 16 insertions(+), 1 deletion(-) | ||
12 | 29 | ||
13 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 30 | diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py |
14 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/cpu.h | 32 | --- a/docs/sphinx/kerneldoc.py |
16 | +++ b/target/arm/cpu.h | 33 | +++ b/docs/sphinx/kerneldoc.py |
17 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | 34 | @@ -XXX,XX +XXX,XX @@ class KernelDocDirective(Directive): |
18 | #define SCR_ST (1U << 11) | 35 | env.note_dependency(os.path.abspath(f)) |
19 | #define SCR_TWI (1U << 12) | 36 | cmd += ['-export-file', f] |
20 | #define SCR_TWE (1U << 13) | 37 | |
21 | +#define SCR_TLOR (1U << 14) | 38 | + cmd += ['-sphinx-version', sphinx.__version__] |
22 | +#define SCR_TERR (1U << 15) | 39 | cmd += [filename] |
23 | +#define SCR_APK (1U << 16) | 40 | |
24 | +#define SCR_API (1U << 17) | 41 | try: |
25 | +#define SCR_EEL2 (1U << 18) | 42 | diff --git a/scripts/kernel-doc b/scripts/kernel-doc |
26 | +#define SCR_EASE (1U << 19) | 43 | index XXXXXXX..XXXXXXX 100755 |
27 | +#define SCR_NMEA (1U << 20) | 44 | --- a/scripts/kernel-doc |
28 | +#define SCR_FIEN (1U << 21) | 45 | +++ b/scripts/kernel-doc |
29 | +#define SCR_ENSCXT (1U << 25) | 46 | @@ -XXX,XX +XXX,XX @@ Output selection (mutually exclusive): |
30 | +#define SCR_ATA (1U << 26) | 47 | DOC: sections. May be specified multiple times. |
31 | #define SCR_AARCH32_MASK (0x3fff & ~(SCR_RW | SCR_ST)) | 48 | |
32 | #define SCR_AARCH64_MASK (0x3fff & ~SCR_NET) | 49 | Output selection modifiers: |
33 | 50 | + -sphinx-version VER Generate rST syntax for the specified Sphinx version. | |
51 | + Only works with reStructuredTextFormat. | ||
52 | -no-doc-sections Do not output DOC: sections. | ||
53 | -enable-lineno Enable output of #define LINENO lines. Only works with | ||
54 | reStructuredText format. | ||
55 | @@ -XXX,XX +XXX,XX @@ use constant { | ||
56 | }; | ||
57 | my $output_selection = OUTPUT_ALL; | ||
58 | my $show_not_found = 0; # No longer used | ||
59 | +my $sphinx_version = "0.0"; # if not specified, assume old | ||
60 | |||
61 | my @export_file_list; | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ while ($ARGV[0] =~ m/^--?(.*)/) { | ||
64 | $enable_lineno = 1; | ||
65 | } elsif ($cmd eq 'show-not-found') { | ||
66 | $show_not_found = 1; # A no-op but don't fail | ||
67 | + } elsif ($cmd eq 'sphinx-version') { | ||
68 | + $sphinx_version = shift @ARGV; | ||
69 | } else { | ||
70 | # Unknown argument | ||
71 | usage(); | ||
72 | @@ -XXX,XX +XXX,XX @@ sub output_struct_rst(%) { | ||
73 | my $oldprefix = $lineprefix; | ||
74 | my $name = $args{'type'} . " " . $args{'struct'}; | ||
75 | |||
76 | - print "\n\n.. c:type:: " . $name . "\n\n"; | ||
77 | + # Sphinx 3.0 and up will emit warnings for "c:type:: struct Foo". | ||
78 | + # It wants to see "c:struct:: Foo" (and will add the word 'struct' in | ||
79 | + # the rendered output). | ||
80 | + if ((split(/\./, $sphinx_version))[0] >= 3) { | ||
81 | + my $sname = $name; | ||
82 | + $sname =~ s/^struct //; | ||
83 | + print "\n\n.. c:struct:: " . $sname . "\n\n"; | ||
84 | + } else { | ||
85 | + print "\n\n.. c:type:: " . $name . "\n\n"; | ||
86 | + } | ||
87 | print_lineno($declaration_start_line); | ||
88 | $lineprefix = " "; | ||
89 | output_highlight_rst($args{'purpose'}); | ||
34 | -- | 90 | -- |
35 | 2.19.2 | 91 | 2.20.1 |
36 | 92 | ||
37 | 93 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | Versions of Sphinx older than 1.6 can't build all of our documentation, |
---|---|---|---|
2 | because they are too picky about the syntax of the argument to the | ||
3 | option:: directive; see Sphinx bugs #646, #3366: | ||
2 | 4 | ||
3 | Because EL3 has a fixed execution mode, we can properly decide | 5 | https://github.com/sphinx-doc/sphinx/issues/646 |
4 | which of the bits are RES{0,1}. | 6 | https://github.com/sphinx-doc/sphinx/issues/3366 |
5 | 7 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Trying to build with a 1.4.x Sphinx fails with |
7 | Message-id: 20181203203839.757-8-richard.henderson@linaro.org | 9 | docs/system/images.rst:4: SEVERE: Duplicate ID: "cmdoption-qcow2-arg-encrypt" |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | and a 1.5.x Sphinx fails with |
11 | docs/system/invocation.rst:544: WARNING: Malformed option description '[enable=]PATTERN', should look like "opt", "-opt | ||
12 | args", "--opt args", "/opt args" or "+opt args" | ||
13 | |||
14 | Update our needs_sphinx setting to indicate that we require at least | ||
15 | 1.6. This will allow configure to fall back to "don't build the | ||
16 | docs" rather than causing the build to fail entirely, which is | ||
17 | probably what most users building on a host old enough to have such | ||
18 | an old Sphinx would want; if they do want the docs then they'll have | ||
19 | a useful indication of what they need to do (upgrade Sphinx!) rather | ||
20 | than a confusing error message. | ||
21 | |||
22 | In theory our distro support policy would suggest that we should | ||
23 | support building on the Sphinx shipped in those distros, but: | ||
24 | * EPEL7 has Sphinx 1.2.3 (which we've never supported!) | ||
25 | * Debian Stretch has Sphinx 1.4.8 | ||
26 | |||
27 | Trying to get our docs to work with Sphinx 1.4 is not tractable | ||
28 | for the 5.0 release and I'm not sure it's worthwhile effort anyway; | ||
29 | at least with this change the build as a whole now succeeds. | ||
30 | |||
31 | Thanks to John Snow for doing the investigation and testing to | ||
32 | confirm what Sphinx versions fail in what ways and what distros | ||
33 | shipped what. | ||
34 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 35 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
36 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | 37 | --- |
11 | target/arm/cpu.h | 2 -- | 38 | docs/conf.py | 6 ++++-- |
12 | target/arm/helper.c | 14 +++++++++----- | 39 | 1 file changed, 4 insertions(+), 2 deletions(-) |
13 | 2 files changed, 9 insertions(+), 7 deletions(-) | ||
14 | 40 | ||
15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 41 | diff --git a/docs/conf.py b/docs/conf.py |
16 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/target/arm/cpu.h | 43 | --- a/docs/conf.py |
18 | +++ b/target/arm/cpu.h | 44 | +++ b/docs/conf.py |
19 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | 45 | @@ -XXX,XX +XXX,XX @@ sys.path.insert(0, os.path.join(qemu_docdir, "sphinx")) |
20 | #define SCR_FIEN (1U << 21) | 46 | |
21 | #define SCR_ENSCXT (1U << 25) | 47 | # If your documentation needs a minimal Sphinx version, state it here. |
22 | #define SCR_ATA (1U << 26) | 48 | # |
23 | -#define SCR_AARCH32_MASK (0x3fff & ~(SCR_RW | SCR_ST)) | 49 | -# 1.3 is where the 'alabaster' theme was shipped with Sphinx. |
24 | -#define SCR_AARCH64_MASK (0x3fff & ~SCR_NET) | 50 | -needs_sphinx = '1.3' |
25 | 51 | +# Sphinx 1.5 and earlier can't build our docs because they are too | |
26 | /* Return the current FPSCR value. */ | 52 | +# picky about the syntax of the argument to the option:: directive |
27 | uint32_t vfp_get_fpscr(CPUARMState *env); | 53 | +# (see Sphinx bugs #646, #3366). |
28 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 54 | +needs_sphinx = '1.6' |
29 | index XXXXXXX..XXXXXXX 100644 | 55 | |
30 | --- a/target/arm/helper.c | 56 | # Add any Sphinx extension module names here, as strings. They can be |
31 | +++ b/target/arm/helper.c | 57 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
32 | @@ -XXX,XX +XXX,XX @@ static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
33 | |||
34 | static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
35 | { | ||
36 | - /* We only mask off bits that are RES0 both for AArch64 and AArch32. | ||
37 | - * For bits that vary between AArch32/64, code needs to check the | ||
38 | - * current execution mode before directly using the feature bit. | ||
39 | - */ | ||
40 | - uint32_t valid_mask = SCR_AARCH64_MASK | SCR_AARCH32_MASK; | ||
41 | + /* Begin with base v8.0 state. */ | ||
42 | + uint32_t valid_mask = 0x3fff; | ||
43 | + | ||
44 | + if (arm_el_is_aa64(env, 3)) { | ||
45 | + value |= SCR_FW | SCR_AW; /* these two bits are RES1. */ | ||
46 | + valid_mask &= ~SCR_NET; | ||
47 | + } else { | ||
48 | + valid_mask &= ~(SCR_RW | SCR_ST); | ||
49 | + } | ||
50 | |||
51 | if (!arm_feature(env, ARM_FEATURE_EL2)) { | ||
52 | valid_mask &= ~SCR_HCE; | ||
53 | -- | 58 | -- |
54 | 2.19.2 | 59 | 2.20.1 |
55 | 60 | ||
56 | 61 | diff view generated by jsdifflib |
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | 1 | The Linux kernel has dropped support for allowing 32-bit Arm systems |
---|---|---|---|
2 | to host KVM guests (kernel commit 541ad0150ca4aa663a2, which just | ||
3 | landed upstream in the 5.7 merge window). Mark QEMU's support for | ||
4 | this configuration as deprecated, so that we can delete that support | ||
5 | code in 5.2. | ||
2 | 6 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | tusb6010_class_init(). | 8 | Reviewed-by: Andrew Jones <drjones@redhat.com> |
9 | --- | ||
10 | docs/system/deprecated.rst | 8 ++++++++ | ||
11 | 1 file changed, 8 insertions(+) | ||
5 | 12 | ||
6 | Cc: kraxel@redhat.com | 13 | diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst |
7 | |||
8 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
9 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
10 | Message-id: 20181130093852.20739-20-maozhongyi@cmss.chinamobile.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/usb/tusb6010.c | 8 +++----- | ||
14 | 1 file changed, 3 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/usb/tusb6010.c | 15 | --- a/docs/system/deprecated.rst |
19 | +++ b/hw/usb/tusb6010.c | 16 | +++ b/docs/system/deprecated.rst |
20 | @@ -XXX,XX +XXX,XX @@ static void tusb6010_reset(DeviceState *dev) | 17 | @@ -XXX,XX +XXX,XX @@ The ``compat`` property used to set backwards compatibility modes for |
21 | musb_reset(s->musb); | 18 | the processor has been deprecated. The ``max-cpu-compat`` property of |
22 | } | 19 | the ``pseries`` machine type should be used instead. |
23 | 20 | ||
24 | -static int tusb6010_init(SysBusDevice *sbd) | 21 | +KVM guest support on 32-bit Arm hosts (since 5.0) |
25 | +static void tusb6010_realize(DeviceState *dev, Error **errp) | 22 | +''''''''''''''''''''''''''''''''''''''''''''''''' |
26 | { | 23 | + |
27 | - DeviceState *dev = DEVICE(sbd); | 24 | +The Linux kernel has dropped support for allowing 32-bit Arm systems |
28 | TUSBState *s = TUSB(dev); | 25 | +to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating |
29 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 26 | +its support for this configuration and will remove it in a future version. |
30 | 27 | +Running 32-bit guests on a 64-bit Arm host remains supported. | |
31 | s->otg_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_otg_tick, s); | 28 | + |
32 | s->pwr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_power_tick, s); | 29 | System emulator devices |
33 | @@ -XXX,XX +XXX,XX @@ static int tusb6010_init(SysBusDevice *sbd) | 30 | ----------------------- |
34 | sysbus_init_irq(sbd, &s->irq); | ||
35 | qdev_init_gpio_in(dev, tusb6010_irq, musb_irq_max + 1); | ||
36 | s->musb = musb_init(dev, 1); | ||
37 | - return 0; | ||
38 | } | ||
39 | |||
40 | static void tusb6010_class_init(ObjectClass *klass, void *data) | ||
41 | { | ||
42 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
43 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
44 | |||
45 | - k->init = tusb6010_init; | ||
46 | + dc->realize = tusb6010_realize; | ||
47 | dc->reset = tusb6010_reset; | ||
48 | } | ||
49 | 31 | ||
50 | -- | 32 | -- |
51 | 2.19.2 | 33 | 2.20.1 |
52 | 34 | ||
53 | 35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | The init function doesn't do anything at all, so we | ||
4 | just omit it. | ||
5 | |||
6 | Cc: sstabellini@kernel.org | ||
7 | Cc: anthony.perard@citrix.com | ||
8 | Cc: xen-devel@lists.xenproject.org | ||
9 | Cc: peter.maydell@linaro.org | ||
10 | |||
11 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
12 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
13 | Acked-by: Anthony PERARD <anthony.perard@citrix.com> | ||
14 | Message-id: 20181130093852.20739-21-maozhongyi@cmss.chinamobile.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | hw/xen/xen_backend.c | 7 ------- | ||
18 | 1 file changed, 7 deletions(-) | ||
19 | |||
20 | diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/xen/xen_backend.c | ||
23 | +++ b/hw/xen/xen_backend.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo xensysbus_info = { | ||
25 | } | ||
26 | }; | ||
27 | |||
28 | -static int xen_sysdev_init(SysBusDevice *dev) | ||
29 | -{ | ||
30 | - return 0; | ||
31 | -} | ||
32 | - | ||
33 | static Property xen_sysdev_properties[] = { | ||
34 | {/* end of property list */}, | ||
35 | }; | ||
36 | @@ -XXX,XX +XXX,XX @@ static Property xen_sysdev_properties[] = { | ||
37 | static void xen_sysdev_class_init(ObjectClass *klass, void *data) | ||
38 | { | ||
39 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
40 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); | ||
41 | |||
42 | - k->init = xen_sysdev_init; | ||
43 | dc->props = xen_sysdev_properties; | ||
44 | dc->bus_type = TYPE_XENSYSBUS; | ||
45 | } | ||
46 | -- | ||
47 | 2.19.2 | ||
48 | |||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
2 | 1 | ||
3 | Currently, all sysbus devices have been converted to realize(), | ||
4 | so remove this path. | ||
5 | |||
6 | Cc: ehabkost@redhat.com | ||
7 | Cc: thuth@redhat.com | ||
8 | Cc: pbonzini@redhat.com | ||
9 | Cc: armbru@redhat.com | ||
10 | Cc: peter.maydell@linaro.org | ||
11 | Cc: richard.henderson@linaro.org | ||
12 | Cc: alistair.francis@wdc.com | ||
13 | |||
14 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
15 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> | ||
16 | Message-id: 20181130093852.20739-22-maozhongyi@cmss.chinamobile.com | ||
17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | include/hw/sysbus.h | 3 --- | ||
21 | hw/core/sysbus.c | 15 +++++---------- | ||
22 | 2 files changed, 5 insertions(+), 13 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/include/hw/sysbus.h | ||
27 | +++ b/include/hw/sysbus.h | ||
28 | @@ -XXX,XX +XXX,XX @@ typedef struct SysBusDevice SysBusDevice; | ||
29 | typedef struct SysBusDeviceClass { | ||
30 | /*< private >*/ | ||
31 | DeviceClass parent_class; | ||
32 | - /*< public >*/ | ||
33 | - | ||
34 | - int (*init)(SysBusDevice *dev); | ||
35 | |||
36 | /* | ||
37 | * Let the sysbus device format its own non-PIO, non-MMIO unit address. | ||
38 | diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/core/sysbus.c | ||
41 | +++ b/hw/core/sysbus.c | ||
42 | @@ -XXX,XX +XXX,XX @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size) | ||
43 | } | ||
44 | } | ||
45 | |||
46 | -/* TODO remove once all sysbus devices have been converted to realize */ | ||
47 | +/* The purpose of preserving this empty realize function | ||
48 | + * is to prevent the parent_realize field of some subclasses | ||
49 | + * from being set to NULL to break the normal init/realize | ||
50 | + * of some devices. | ||
51 | + */ | ||
52 | static void sysbus_realize(DeviceState *dev, Error **errp) | ||
53 | { | ||
54 | - SysBusDevice *sd = SYS_BUS_DEVICE(dev); | ||
55 | - SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd); | ||
56 | - | ||
57 | - if (!sbc->init) { | ||
58 | - return; | ||
59 | - } | ||
60 | - if (sbc->init(sd) < 0) { | ||
61 | - error_setg(errp, "Device initialization failed"); | ||
62 | - } | ||
63 | } | ||
64 | |||
65 | DeviceState *sysbus_create_varargs(const char *name, | ||
66 | -- | ||
67 | 2.19.2 | ||
68 | |||
69 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Remove bogus virtio-mmio creation. This was an accidental | ||
4 | left-over an experiment. | ||
5 | |||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | ||
9 | Message-id: 20181129163655.20370-2-edgar.iglesias@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/xlnx-versal-virt.c | 1 - | ||
13 | 1 file changed, 1 deletion(-) | ||
14 | |||
15 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/xlnx-versal-virt.c | ||
18 | +++ b/hw/arm/xlnx-versal-virt.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | ||
20 | sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic_irq); | ||
21 | mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
22 | memory_region_add_subregion(&s->soc.mr_ps, base, mr); | ||
23 | - sysbus_create_simple("virtio-mmio", base, pic_irq); | ||
24 | } | ||
25 | |||
26 | for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { | ||
27 | -- | ||
28 | 2.19.2 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
2 | 1 | ||
3 | Use IRQs 111 - 118 for virtio-mmio. The interrupts we're currently | ||
4 | using 160+ are not available in the Versal GIC. | ||
5 | |||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20181129163655.20370-4-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/arm/xlnx-versal.h | 6 +++--- | ||
12 | hw/arm/xlnx-versal-virt.c | 4 ++-- | ||
13 | 2 files changed, 5 insertions(+), 5 deletions(-) | ||
14 | |||
15 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/arm/xlnx-versal.h | ||
18 | +++ b/include/hw/arm/xlnx-versal.h | ||
19 | @@ -XXX,XX +XXX,XX @@ typedef struct Versal { | ||
20 | #define VERSAL_GEM1_IRQ_0 58 | ||
21 | #define VERSAL_GEM1_WAKE_IRQ_0 59 | ||
22 | |||
23 | -/* Architecturally eserved IRQs suitable for virtualization. */ | ||
24 | -#define VERSAL_RSVD_HIGH_IRQ_FIRST 160 | ||
25 | -#define VERSAL_RSVD_HIGH_IRQ_LAST 255 | ||
26 | +/* Architecturally reserved IRQs suitable for virtualization. */ | ||
27 | +#define VERSAL_RSVD_IRQ_FIRST 111 | ||
28 | +#define VERSAL_RSVD_IRQ_LAST 118 | ||
29 | |||
30 | #define MM_TOP_RSVD 0xa0000000U | ||
31 | #define MM_TOP_RSVD_SIZE 0x4000000 | ||
32 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/hw/arm/xlnx-versal-virt.c | ||
35 | +++ b/hw/arm/xlnx-versal-virt.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | ||
37 | for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { | ||
38 | char *name = g_strdup_printf("virtio%d", i);; | ||
39 | hwaddr base = MM_TOP_RSVD + i * virtio_mmio_size; | ||
40 | - int irq = VERSAL_RSVD_HIGH_IRQ_FIRST + i; | ||
41 | + int irq = VERSAL_RSVD_IRQ_FIRST + i; | ||
42 | MemoryRegion *mr; | ||
43 | DeviceState *dev; | ||
44 | qemu_irq pic_irq; | ||
45 | @@ -XXX,XX +XXX,XX @@ static void create_virtio_regions(VersalVirt *s) | ||
46 | |||
47 | for (i = 0; i < NUM_VIRTIO_TRANSPORT; i++) { | ||
48 | hwaddr base = MM_TOP_RSVD + i * virtio_mmio_size; | ||
49 | - int irq = VERSAL_RSVD_HIGH_IRQ_FIRST + i; | ||
50 | + int irq = VERSAL_RSVD_IRQ_FIRST + i; | ||
51 | char *name = g_strdup_printf("/virtio_mmio@%" PRIx64, base); | ||
52 | |||
53 | qemu_fdt_add_subnode(s->fdt, name); | ||
54 | -- | ||
55 | 2.19.2 | ||
56 | |||
57 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | At the same time, define the fields for these registers, | ||
2 | and use those defines in arm_pamax(). | ||
3 | 1 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | Message-id: 20181203203839.757-2-richard.henderson@linaro.org | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | [PMM: fixed up typo (s/achf/ahcf/) belatedly spotted by RTH] | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/cpu.h | 26 ++++++++++++++++++++++++-- | ||
11 | target/arm/internals.h | 3 ++- | ||
12 | target/arm/cpu64.c | 6 +++--- | ||
13 | target/arm/helper.c | 4 ++-- | ||
14 | target/arm/kvm64.c | 4 ++++ | ||
15 | 5 files changed, 35 insertions(+), 8 deletions(-) | ||
16 | |||
17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/cpu.h | ||
20 | +++ b/target/arm/cpu.h | ||
21 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
22 | uint64_t id_aa64isar1; | ||
23 | uint64_t id_aa64pfr0; | ||
24 | uint64_t id_aa64pfr1; | ||
25 | + uint64_t id_aa64mmfr0; | ||
26 | + uint64_t id_aa64mmfr1; | ||
27 | } isar; | ||
28 | uint32_t midr; | ||
29 | uint32_t revidr; | ||
30 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
31 | uint64_t id_aa64dfr1; | ||
32 | uint64_t id_aa64afr0; | ||
33 | uint64_t id_aa64afr1; | ||
34 | - uint64_t id_aa64mmfr0; | ||
35 | - uint64_t id_aa64mmfr1; | ||
36 | uint32_t dbgdidr; | ||
37 | uint32_t clidr; | ||
38 | uint64_t mp_affinity; /* MP ID without feature bits */ | ||
39 | @@ -XXX,XX +XXX,XX @@ FIELD(ID_AA64PFR0, GIC, 24, 4) | ||
40 | FIELD(ID_AA64PFR0, RAS, 28, 4) | ||
41 | FIELD(ID_AA64PFR0, SVE, 32, 4) | ||
42 | |||
43 | +FIELD(ID_AA64MMFR0, PARANGE, 0, 4) | ||
44 | +FIELD(ID_AA64MMFR0, ASIDBITS, 4, 4) | ||
45 | +FIELD(ID_AA64MMFR0, BIGEND, 8, 4) | ||
46 | +FIELD(ID_AA64MMFR0, SNSMEM, 12, 4) | ||
47 | +FIELD(ID_AA64MMFR0, BIGENDEL0, 16, 4) | ||
48 | +FIELD(ID_AA64MMFR0, TGRAN16, 20, 4) | ||
49 | +FIELD(ID_AA64MMFR0, TGRAN64, 24, 4) | ||
50 | +FIELD(ID_AA64MMFR0, TGRAN4, 28, 4) | ||
51 | +FIELD(ID_AA64MMFR0, TGRAN16_2, 32, 4) | ||
52 | +FIELD(ID_AA64MMFR0, TGRAN64_2, 36, 4) | ||
53 | +FIELD(ID_AA64MMFR0, TGRAN4_2, 40, 4) | ||
54 | +FIELD(ID_AA64MMFR0, EXS, 44, 4) | ||
55 | + | ||
56 | +FIELD(ID_AA64MMFR1, HAFDBS, 0, 4) | ||
57 | +FIELD(ID_AA64MMFR1, VMIDBITS, 4, 4) | ||
58 | +FIELD(ID_AA64MMFR1, VH, 8, 4) | ||
59 | +FIELD(ID_AA64MMFR1, HPDS, 12, 4) | ||
60 | +FIELD(ID_AA64MMFR1, LO, 16, 4) | ||
61 | +FIELD(ID_AA64MMFR1, PAN, 20, 4) | ||
62 | +FIELD(ID_AA64MMFR1, SPECSEI, 24, 4) | ||
63 | +FIELD(ID_AA64MMFR1, XNX, 28, 4) | ||
64 | + | ||
65 | QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK); | ||
66 | |||
67 | /* If adding a feature bit which corresponds to a Linux ELF | ||
68 | diff --git a/target/arm/internals.h b/target/arm/internals.h | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/target/arm/internals.h | ||
71 | +++ b/target/arm/internals.h | ||
72 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int arm_pamax(ARMCPU *cpu) | ||
73 | [4] = 44, | ||
74 | [5] = 48, | ||
75 | }; | ||
76 | - unsigned int parange = extract32(cpu->id_aa64mmfr0, 0, 4); | ||
77 | + unsigned int parange = | ||
78 | + FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); | ||
79 | |||
80 | /* id_aa64mmfr0 is a read-only register so values outside of the | ||
81 | * supported mappings can be considered an implementation error. */ | ||
82 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
83 | index XXXXXXX..XXXXXXX 100644 | ||
84 | --- a/target/arm/cpu64.c | ||
85 | +++ b/target/arm/cpu64.c | ||
86 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) | ||
87 | cpu->pmceid0 = 0x00000000; | ||
88 | cpu->pmceid1 = 0x00000000; | ||
89 | cpu->isar.id_aa64isar0 = 0x00011120; | ||
90 | - cpu->id_aa64mmfr0 = 0x00001124; | ||
91 | + cpu->isar.id_aa64mmfr0 = 0x00001124; | ||
92 | cpu->dbgdidr = 0x3516d000; | ||
93 | cpu->clidr = 0x0a200023; | ||
94 | cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ | ||
95 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | ||
96 | cpu->isar.id_aa64pfr0 = 0x00002222; | ||
97 | cpu->id_aa64dfr0 = 0x10305106; | ||
98 | cpu->isar.id_aa64isar0 = 0x00011120; | ||
99 | - cpu->id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */ | ||
100 | + cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */ | ||
101 | cpu->dbgdidr = 0x3516d000; | ||
102 | cpu->clidr = 0x0a200023; | ||
103 | cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ | ||
104 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | ||
105 | cpu->pmceid0 = 0x00000000; | ||
106 | cpu->pmceid1 = 0x00000000; | ||
107 | cpu->isar.id_aa64isar0 = 0x00011120; | ||
108 | - cpu->id_aa64mmfr0 = 0x00001124; | ||
109 | + cpu->isar.id_aa64mmfr0 = 0x00001124; | ||
110 | cpu->dbgdidr = 0x3516d000; | ||
111 | cpu->clidr = 0x0a200023; | ||
112 | cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ | ||
113 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/target/arm/helper.c | ||
116 | +++ b/target/arm/helper.c | ||
117 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
118 | { .name = "ID_AA64MMFR0_EL1", .state = ARM_CP_STATE_AA64, | ||
119 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 0, | ||
120 | .access = PL1_R, .type = ARM_CP_CONST, | ||
121 | - .resetvalue = cpu->id_aa64mmfr0 }, | ||
122 | + .resetvalue = cpu->isar.id_aa64mmfr0 }, | ||
123 | { .name = "ID_AA64MMFR1_EL1", .state = ARM_CP_STATE_AA64, | ||
124 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 1, | ||
125 | .access = PL1_R, .type = ARM_CP_CONST, | ||
126 | - .resetvalue = cpu->id_aa64mmfr1 }, | ||
127 | + .resetvalue = cpu->isar.id_aa64mmfr1 }, | ||
128 | { .name = "ID_AA64MMFR2_EL1_RESERVED", .state = ARM_CP_STATE_AA64, | ||
129 | .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 7, .opc2 = 2, | ||
130 | .access = PL1_R, .type = ARM_CP_CONST, | ||
131 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/target/arm/kvm64.c | ||
134 | +++ b/target/arm/kvm64.c | ||
135 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
136 | ARM64_SYS_REG(3, 0, 0, 6, 0)); | ||
137 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64isar1, | ||
138 | ARM64_SYS_REG(3, 0, 0, 6, 1)); | ||
139 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr0, | ||
140 | + ARM64_SYS_REG(3, 0, 0, 7, 0)); | ||
141 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr1, | ||
142 | + ARM64_SYS_REG(3, 0, 0, 7, 1)); | ||
143 | |||
144 | /* | ||
145 | * Note that if AArch32 support is not present in the host, | ||
146 | -- | ||
147 | 2.19.2 | ||
148 | |||
149 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
2 | 1 | ||
3 | Post v8.3 bits taken from SysReg_v85_xml-00bet8. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20181203203839.757-3-richard.henderson@linaro.org | ||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | target/arm/cpu.h | 22 +++++++++++++++++++++- | ||
11 | 1 file changed, 21 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/arm/cpu.h | ||
16 | +++ b/target/arm/cpu.h | ||
17 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
18 | #define HCR_TIDCP (1ULL << 20) | ||
19 | #define HCR_TACR (1ULL << 21) | ||
20 | #define HCR_TSW (1ULL << 22) | ||
21 | -#define HCR_TPC (1ULL << 23) | ||
22 | +#define HCR_TPCP (1ULL << 23) | ||
23 | #define HCR_TPU (1ULL << 24) | ||
24 | #define HCR_TTLB (1ULL << 25) | ||
25 | #define HCR_TVM (1ULL << 26) | ||
26 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | ||
27 | #define HCR_CD (1ULL << 32) | ||
28 | #define HCR_ID (1ULL << 33) | ||
29 | #define HCR_E2H (1ULL << 34) | ||
30 | +#define HCR_TLOR (1ULL << 35) | ||
31 | +#define HCR_TERR (1ULL << 36) | ||
32 | +#define HCR_TEA (1ULL << 37) | ||
33 | +#define HCR_MIOCNCE (1ULL << 38) | ||
34 | +#define HCR_APK (1ULL << 40) | ||
35 | +#define HCR_API (1ULL << 41) | ||
36 | +#define HCR_NV (1ULL << 42) | ||
37 | +#define HCR_NV1 (1ULL << 43) | ||
38 | +#define HCR_AT (1ULL << 44) | ||
39 | +#define HCR_NV2 (1ULL << 45) | ||
40 | +#define HCR_FWB (1ULL << 46) | ||
41 | +#define HCR_FIEN (1ULL << 47) | ||
42 | +#define HCR_TID4 (1ULL << 49) | ||
43 | +#define HCR_TICAB (1ULL << 50) | ||
44 | +#define HCR_TOCU (1ULL << 52) | ||
45 | +#define HCR_TTLBIS (1ULL << 54) | ||
46 | +#define HCR_TTLBOS (1ULL << 55) | ||
47 | +#define HCR_ATA (1ULL << 56) | ||
48 | +#define HCR_DCT (1ULL << 57) | ||
49 | + | ||
50 | /* | ||
51 | * When we actually implement ARMv8.1-VHE we should add HCR_E2H to | ||
52 | * HCR_MASK and then clear it again if the feature bit is not set in | ||
53 | -- | ||
54 | 2.19.2 | ||
55 | |||
56 | diff view generated by jsdifflib |