1 | Ten arm-related bug fixes for 2.12... | 1 | First target-arm pullreq of the 4.0 series; most of this |
---|---|---|---|
2 | is Mao's cleanups that finally let us drop sysbus::init; | ||
3 | the most interesting user-visible feature is RTH's patches | ||
4 | adding some v8.1 and v8.2 architecture features. | ||
2 | 5 | ||
3 | thanks | 6 | thanks |
4 | -- PMM | 7 | -- PMM |
5 | 8 | ||
6 | The following changes since commit 4c2c1015905fa1d616750dfe024b4c0b35875950: | 9 | The following changes since commit 6145a6d84b3bf0f25935b88543febe076c61b0f4: |
7 | 10 | ||
8 | Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20180323' into staging (2018-03-23 10:20:54 +0000) | 11 | Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181212' into staging (2018-12-13 13:06:09 +0000) |
9 | 12 | ||
10 | are available in the Git repository at: | 13 | are available in the Git repository at: |
11 | 14 | ||
12 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180323 | 15 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20181213 |
13 | 16 | ||
14 | for you to fetch changes up to 548f514cf89dd9ab39c0cb4c063097bccf141fdd: | 17 | for you to fetch changes up to 2d7137c10fafefe40a0a049ff8a7bd78b66e661f: |
15 | 18 | ||
16 | target/arm: Always set FAR to a known unknown value for debug exceptions (2018-03-23 18:26:46 +0000) | 19 | target/arm: Implement the ARMv8.1-LOR extension (2018-12-13 14:41:24 +0000) |
17 | 20 | ||
18 | ---------------------------------------------------------------- | 21 | ---------------------------------------------------------------- |
19 | target-arm queue: | 22 | target-arm queue: |
20 | * arm/translate-a64: don't lose interrupts after unmasking via write to DAIF | 23 | * Convert various devices from sysbus init to instance_init |
21 | * sdhci: fix incorrect use of Error * | 24 | * Remove the now unused sysbus init support entirely |
22 | * hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses | 25 | * Allow AArch64 processors to boot from a kernel placed over 4GB |
23 | * hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15 | 26 | * hw: arm: musicpal: drop TYPE_WM8750 in object_property_set_link() |
24 | * i.MX: Support serial RS-232 break properly | 27 | * versal: minor fixes to virtio-mmio instantation |
25 | * mach-virt: Set VM's SMBIOS system version to mc->name | 28 | * arm: Implement the ARMv8.1-HPD extension |
26 | * target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK | 29 | * arm: Implement the ARMv8.2-AA32HPD extension |
27 | * target/arm: Factor out code to calculate FSR for debug exceptions | 30 | * arm: Implement the ARMv8.1-LOR extension (as the trivial |
28 | * target/arm: Set FSR for BKPT, BRK when raising exception | 31 | "no limited ordering regions provided" minimum) |
29 | * target/arm: Always set FAR to a known unknown value for debug exceptions | ||
30 | 32 | ||
31 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
32 | Paolo Bonzini (1): | 34 | Edgar E. Iglesias (4): |
33 | sdhci: fix incorrect use of Error * | 35 | hw/arm: versal: Remove bogus virtio-mmio creation |
36 | hw/arm: versal: Reduce number of virtio-mmio instances | ||
37 | hw/arm: versal: Use IRQs 111 - 118 for virtio-mmio | ||
38 | hw/arm: versal: Correct the nr of IRQs to 192 | ||
34 | 39 | ||
35 | Peter Maydell (6): | 40 | Li Qiang (1): |
36 | hw/intc/arm_gicv3: Fix secure-GIC NS ICC_PMR and ICC_RPR accesses | 41 | hw: arm: musicpal: drop TYPE_WM8750 in object_property_set_link() |
37 | hw/arm/bcm2836: Use the Cortex-A7 instead of Cortex-A15 | ||
38 | target/arm: Honour MDCR_EL2.TDE when routing exceptions due to BKPT/BRK | ||
39 | target/arm: Factor out code to calculate FSR for debug exceptions | ||
40 | target/arm: Set FSR for BKPT, BRK when raising exception | ||
41 | target/arm: Always set FAR to a known unknown value for debug exceptions | ||
42 | 42 | ||
43 | Trent Piepho (1): | 43 | Mao Zhongyi (21): |
44 | i.MX: Support serial RS-232 break properly | 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 | ||
45 | 65 | ||
46 | Victor Kamensky (1): | 66 | Peter Maydell (1): |
47 | arm/translate-a64: treat DISAS_UPDATE as variant of DISAS_EXIT | 67 | target/arm: Move id_aa64mmfr* to ARMISARegisters |
48 | 68 | ||
49 | Wei Huang (1): | 69 | Ricardo Perez Blanco (1): |
50 | mach-virt: Set VM's SMBIOS system version to mc->name | 70 | Allow AArch64 processors to boot from a kernel placed over 4GB |
51 | 71 | ||
52 | include/hw/arm/virt.h | 1 + | 72 | Richard Henderson (9): |
53 | include/hw/char/imx_serial.h | 1 + | 73 | target/arm: Add HCR_EL2 bits up to ARMv8.5 |
54 | target/arm/helper.h | 1 + | 74 | target/arm: Add SCR_EL3 bits up to ARMv8.5 |
55 | target/arm/internals.h | 25 +++++++++++++++++++++++++ | 75 | target/arm: Fix HCR_EL2.TGE check in arm_phys_excp_target_el |
56 | hw/arm/bcm2836.c | 2 +- | 76 | target/arm: Tidy scr_write |
57 | hw/arm/raspi.c | 2 +- | 77 | target/arm: Implement the ARMv8.1-HPD extension |
58 | hw/arm/virt.c | 8 +++++++- | 78 | target/arm: Implement the ARMv8.2-AA32HPD extension |
59 | hw/char/imx_serial.c | 5 ++++- | 79 | target/arm: Introduce arm_hcr_el2_eff |
60 | hw/intc/arm_gicv3_cpuif.c | 6 +++--- | 80 | target/arm: Use arm_hcr_el2_eff more places |
61 | hw/sd/sdhci.c | 4 ++-- | 81 | target/arm: Implement the ARMv8.1-LOR extension |
62 | target/arm/helper.c | 1 - | ||
63 | target/arm/op_helper.c | 33 ++++++++++++++++++++++----------- | ||
64 | target/arm/translate-a64.c | 21 ++++++++++++++++----- | ||
65 | target/arm/translate.c | 19 ++++++++++++++----- | ||
66 | 14 files changed, 98 insertions(+), 31 deletions(-) | ||
67 | 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 |
New patch | |||
---|---|---|---|
1 | From: Li Qiang <liq3ea@gmail.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Ricardo Perez Blanco <ricardo.perez_blanco@nokia.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | pci_dec_21154_device_class_init(). | ||
5 | |||
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> | ||
17 | --- | ||
18 | hw/pci-bridge/dec.c | 12 ++++++------ | ||
19 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
20 | |||
21 | diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/pci-bridge/dec.c | ||
24 | +++ b/hw/pci-bridge/dec.c | ||
25 | @@ -XXX,XX +XXX,XX @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn) | ||
26 | return pci_bridge_get_sec_bus(br); | ||
27 | } | ||
28 | |||
29 | -static int pci_dec_21154_device_init(SysBusDevice *dev) | ||
30 | +static void pci_dec_21154_device_realize(DeviceState *dev, Error **errp) | ||
31 | { | ||
32 | PCIHostState *phb; | ||
33 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
34 | |||
35 | phb = PCI_HOST_BRIDGE(dev); | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ static int pci_dec_21154_device_init(SysBusDevice *dev) | ||
38 | dev, "pci-conf-idx", 0x1000); | ||
39 | memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_ops, | ||
40 | dev, "pci-data-idx", 0x1000); | ||
41 | - sysbus_init_mmio(dev, &phb->conf_mem); | ||
42 | - sysbus_init_mmio(dev, &phb->data_mem); | ||
43 | - return 0; | ||
44 | + sysbus_init_mmio(sbd, &phb->conf_mem); | ||
45 | + sysbus_init_mmio(sbd, &phb->data_mem); | ||
46 | } | ||
47 | |||
48 | static void dec_21154_pci_host_realize(PCIDevice *d, Error **errp) | ||
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 | -- | ||
62 | 2.19.2 | ||
63 | |||
64 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 | The MDCR_EL2.TDE bit allows the exception level targeted by debug | 1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
---|---|---|---|
2 | exceptions to be set to EL2 for code executing at EL0. We handle | ||
3 | this in the arm_debug_target_el() function, but this is only used for | ||
4 | hardware breakpoint and watchpoint exceptions, not for the exception | ||
5 | generated when the guest executes an AArch32 BKPT or AArch64 BRK | ||
6 | instruction. We don't have enough information for a translate-time | ||
7 | equivalent of arm_debug_target_el(), so instead make BKPT and BRK | ||
8 | call a special purpose helper which can do the routing, rather than | ||
9 | the generic exception_with_syndrome helper. | ||
10 | 2 | ||
3 | Use DeviceClass rather than SysBusDeviceClass in | ||
4 | tusb6010_class_init(). | ||
5 | |||
6 | Cc: kraxel@redhat.com | ||
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> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180320134114.30418-2-peter.maydell@linaro.org | ||
14 | --- | 12 | --- |
15 | target/arm/helper.h | 1 + | 13 | hw/usb/tusb6010.c | 8 +++----- |
16 | target/arm/op_helper.c | 8 ++++++++ | 14 | 1 file changed, 3 insertions(+), 5 deletions(-) |
17 | target/arm/translate-a64.c | 15 +++++++++++++-- | ||
18 | target/arm/translate.c | 19 ++++++++++++++----- | ||
19 | 4 files changed, 36 insertions(+), 7 deletions(-) | ||
20 | 15 | ||
21 | diff --git a/target/arm/helper.h b/target/arm/helper.h | 16 | diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c |
22 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/helper.h | 18 | --- a/hw/usb/tusb6010.c |
24 | +++ b/target/arm/helper.h | 19 | +++ b/hw/usb/tusb6010.c |
25 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, | 20 | @@ -XXX,XX +XXX,XX @@ static void tusb6010_reset(DeviceState *dev) |
26 | i32, i32, i32, i32) | 21 | musb_reset(s->musb); |
27 | DEF_HELPER_2(exception_internal, void, env, i32) | ||
28 | DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) | ||
29 | +DEF_HELPER_2(exception_bkpt_insn, void, env, i32) | ||
30 | DEF_HELPER_1(setend, void, env) | ||
31 | DEF_HELPER_2(wfi, void, env, i32) | ||
32 | DEF_HELPER_1(wfe, void, env) | ||
33 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/target/arm/op_helper.c | ||
36 | +++ b/target/arm/op_helper.c | ||
37 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, | ||
38 | raise_exception(env, excp, syndrome, target_el); | ||
39 | } | 22 | } |
40 | 23 | ||
41 | +/* Raise an EXCP_BKPT with the specified syndrome register value, | 24 | -static int tusb6010_init(SysBusDevice *sbd) |
42 | + * targeting the correct exception level for debug exceptions. | 25 | +static void tusb6010_realize(DeviceState *dev, Error **errp) |
43 | + */ | ||
44 | +void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) | ||
45 | +{ | ||
46 | + raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); | ||
47 | +} | ||
48 | + | ||
49 | uint32_t HELPER(cpsr_read)(CPUARMState *env) | ||
50 | { | 26 | { |
51 | return cpsr_read(env) & ~(CPSR_EXEC | CPSR_RESERVED); | 27 | - DeviceState *dev = DEVICE(sbd); |
52 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 28 | TUSBState *s = TUSB(dev); |
53 | index XXXXXXX..XXXXXXX 100644 | 29 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); |
54 | --- a/target/arm/translate-a64.c | 30 | |
55 | +++ b/target/arm/translate-a64.c | 31 | s->otg_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_otg_tick, s); |
56 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp, | 32 | s->pwr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_power_tick, s); |
57 | s->base.is_jmp = DISAS_NORETURN; | 33 | @@ -XXX,XX +XXX,XX @@ static int tusb6010_init(SysBusDevice *sbd) |
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; | ||
58 | } | 38 | } |
59 | 39 | ||
60 | +static void gen_exception_bkpt_insn(DisasContext *s, int offset, | 40 | static void tusb6010_class_init(ObjectClass *klass, void *data) |
61 | + uint32_t syndrome) | ||
62 | +{ | ||
63 | + TCGv_i32 tcg_syn; | ||
64 | + | ||
65 | + gen_a64_set_pc_im(s->pc - offset); | ||
66 | + tcg_syn = tcg_const_i32(syndrome); | ||
67 | + gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
68 | + tcg_temp_free_i32(tcg_syn); | ||
69 | + s->base.is_jmp = DISAS_NORETURN; | ||
70 | +} | ||
71 | + | ||
72 | static void gen_ss_advance(DisasContext *s) | ||
73 | { | 41 | { |
74 | /* If the singlestep state is Active-not-pending, advance to | 42 | DeviceClass *dc = DEVICE_CLASS(klass); |
75 | @@ -XXX,XX +XXX,XX @@ static void disas_exc(DisasContext *s, uint32_t insn) | 43 | - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); |
76 | break; | 44 | |
77 | } | 45 | - k->init = tusb6010_init; |
78 | /* BRK */ | 46 | + dc->realize = tusb6010_realize; |
79 | - gen_exception_insn(s, 4, EXCP_BKPT, syn_aa64_bkpt(imm16), | 47 | dc->reset = tusb6010_reset; |
80 | - default_exception_el(s)); | ||
81 | + gen_exception_bkpt_insn(s, 4, syn_aa64_bkpt(imm16)); | ||
82 | break; | ||
83 | case 2: | ||
84 | if (op2_ll != 0) { | ||
85 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/target/arm/translate.c | ||
88 | +++ b/target/arm/translate.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_insn(DisasContext *s, int offset, int excp, | ||
90 | s->base.is_jmp = DISAS_NORETURN; | ||
91 | } | 48 | } |
92 | 49 | ||
93 | +static void gen_exception_bkpt_insn(DisasContext *s, int offset, uint32_t syn) | ||
94 | +{ | ||
95 | + TCGv_i32 tcg_syn; | ||
96 | + | ||
97 | + gen_set_condexec(s); | ||
98 | + gen_set_pc_im(s, s->pc - offset); | ||
99 | + tcg_syn = tcg_const_i32(syn); | ||
100 | + gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); | ||
101 | + tcg_temp_free_i32(tcg_syn); | ||
102 | + s->base.is_jmp = DISAS_NORETURN; | ||
103 | +} | ||
104 | + | ||
105 | /* Force a TB lookup after an instruction that changes the CPU state. */ | ||
106 | static inline void gen_lookup_tb(DisasContext *s) | ||
107 | { | ||
108 | @@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) | ||
109 | case 1: | ||
110 | /* bkpt */ | ||
111 | ARCH(5); | ||
112 | - gen_exception_insn(s, 4, EXCP_BKPT, | ||
113 | - syn_aa32_bkpt(imm16, false), | ||
114 | - default_exception_el(s)); | ||
115 | + gen_exception_bkpt_insn(s, 4, syn_aa32_bkpt(imm16, false)); | ||
116 | break; | ||
117 | case 2: | ||
118 | /* Hypervisor call (v7) */ | ||
119 | @@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn) | ||
120 | { | ||
121 | int imm8 = extract32(insn, 0, 8); | ||
122 | ARCH(5); | ||
123 | - gen_exception_insn(s, 2, EXCP_BKPT, syn_aa32_bkpt(imm8, true), | ||
124 | - default_exception_el(s)); | ||
125 | + gen_exception_bkpt_insn(s, 2, syn_aa32_bkpt(imm8, true)); | ||
126 | break; | ||
127 | } | ||
128 | |||
129 | -- | 50 | -- |
130 | 2.16.2 | 51 | 2.19.2 |
131 | 52 | ||
132 | 53 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> | ||
1 | 2 | ||
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 |
1 | From: Trent Piepho <tpiepho@impinj.com> | 1 | From: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
---|---|---|---|
2 | 2 | ||
3 | Linux does not detect a break from this IMX serial driver as a magic | 3 | Currently, all sysbus devices have been converted to realize(), |
4 | sysrq. Nor does it note a break in the port error counts. | 4 | so remove this path. |
5 | 5 | ||
6 | The former is because the Linux driver uses the BRCD bit in the USR2 | 6 | Cc: ehabkost@redhat.com |
7 | register to trigger the RS-232 break handler in the kernel, which is | 7 | Cc: thuth@redhat.com |
8 | where sysrq hooks in. The emulated UART was not setting this status | 8 | Cc: pbonzini@redhat.com |
9 | bit. | 9 | Cc: armbru@redhat.com |
10 | Cc: peter.maydell@linaro.org | ||
11 | Cc: richard.henderson@linaro.org | ||
12 | Cc: alistair.francis@wdc.com | ||
10 | 13 | ||
11 | The latter is because the Linux driver expects, in addition to the BRK | 14 | Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> |
12 | bit, that the ERR bit is set when a break is read in the FIFO. A break | 15 | Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> |
13 | should also count as a frame error, so add that bit too. | 16 | Message-id: 20181130093852.20739-22-maozhongyi@cmss.chinamobile.com |
14 | |||
15 | Cc: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
16 | Signed-off-by: Trent Piepho <tpiepho@impinj.com> | ||
17 | Message-id: 20180320013657.25038-1-tpiepho@impinj.com | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 17 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 19 | --- |
21 | include/hw/char/imx_serial.h | 1 + | 20 | include/hw/sysbus.h | 3 --- |
22 | hw/char/imx_serial.c | 5 ++++- | 21 | hw/core/sysbus.c | 15 +++++---------- |
23 | 2 files changed, 5 insertions(+), 1 deletion(-) | 22 | 2 files changed, 5 insertions(+), 13 deletions(-) |
24 | 23 | ||
25 | diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h | 24 | diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h |
26 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
27 | --- a/include/hw/char/imx_serial.h | 26 | --- a/include/hw/sysbus.h |
28 | +++ b/include/hw/char/imx_serial.h | 27 | +++ b/include/hw/sysbus.h |
29 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ typedef struct SysBusDevice SysBusDevice; |
30 | 29 | typedef struct SysBusDeviceClass { | |
31 | #define URXD_CHARRDY (1<<15) /* character read is valid */ | 30 | /*< private >*/ |
32 | #define URXD_ERR (1<<14) /* Character has error */ | 31 | DeviceClass parent_class; |
33 | +#define URXD_FRMERR (1<<12) /* Character has frame error */ | 32 | - /*< public >*/ |
34 | #define URXD_BRK (1<<11) /* Break received */ | 33 | - |
35 | 34 | - int (*init)(SysBusDevice *dev); | |
36 | #define USR1_PARTYER (1<<15) /* Parity Error */ | 35 | |
37 | diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c | 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 | ||
38 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/hw/char/imx_serial.c | 40 | --- a/hw/core/sysbus.c |
40 | +++ b/hw/char/imx_serial.c | 41 | +++ b/hw/core/sysbus.c |
41 | @@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value) | 42 | @@ -XXX,XX +XXX,XX @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size) |
42 | s->usr2 |= USR2_RDR; | ||
43 | s->uts1 &= ~UTS1_RXEMPTY; | ||
44 | s->readbuff = value; | ||
45 | + if (value & URXD_BRK) { | ||
46 | + s->usr2 |= USR2_BRCD; | ||
47 | + } | ||
48 | imx_update(s); | ||
49 | } | ||
50 | |||
51 | @@ -XXX,XX +XXX,XX @@ static void imx_receive(void *opaque, const uint8_t *buf, int size) | ||
52 | static void imx_event(void *opaque, int event) | ||
53 | { | ||
54 | if (event == CHR_EVENT_BREAK) { | ||
55 | - imx_put_data(opaque, URXD_BRK); | ||
56 | + imx_put_data(opaque, URXD_BRK | URXD_FRMERR | URXD_ERR); | ||
57 | } | 43 | } |
58 | } | 44 | } |
59 | 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, | ||
60 | -- | 66 | -- |
61 | 2.16.2 | 67 | 2.19.2 |
62 | 68 | ||
63 | 69 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
3 | Reduce number of virtio-mmio instances. This is in preparation | ||
4 | for correcting the interrupt setup for Versal. | ||
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-3-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/xlnx-versal-virt.c | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/xlnx-versal-virt.c | ||
17 | +++ b/hw/arm/xlnx-versal-virt.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void *versal_virt_get_dtb(const struct arm_boot_info *binfo, | ||
19 | return board->fdt; | ||
20 | } | ||
21 | |||
22 | -#define NUM_VIRTIO_TRANSPORT 32 | ||
23 | +#define NUM_VIRTIO_TRANSPORT 8 | ||
24 | static void create_virtio_regions(VersalVirt *s) | ||
25 | { | ||
26 | int virtio_mmio_size = 0x200; | ||
27 | -- | ||
28 | 2.19.2 | ||
29 | |||
30 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | ||
1 | 2 | ||
3 | Correct the nr of IRQs to 192. | ||
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
7 | Message-id: 20181129163655.20370-5-edgar.iglesias@gmail.com | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | include/hw/arm/xlnx-versal.h | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/include/hw/arm/xlnx-versal.h | ||
16 | +++ b/include/hw/arm/xlnx-versal.h | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #define XLNX_VERSAL_NR_ACPUS 2 | ||
19 | #define XLNX_VERSAL_NR_UARTS 2 | ||
20 | #define XLNX_VERSAL_NR_GEMS 2 | ||
21 | -#define XLNX_VERSAL_NR_IRQS 256 | ||
22 | +#define XLNX_VERSAL_NR_IRQS 192 | ||
23 | |||
24 | typedef struct Versal { | ||
25 | /*< private >*/ | ||
26 | -- | ||
27 | 2.19.2 | ||
28 | |||
29 | diff view generated by jsdifflib |
1 | When a debug exception is taken to AArch32, it appears as a Prefetch | 1 | At the same time, define the fields for these registers, |
---|---|---|---|
2 | Abort, and the Instruction Fault Status Register (IFSR) must be set. | 2 | and use those defines in arm_pamax(). |
3 | The IFSR has two possible formats, depending on whether LPAE is in | ||
4 | use. Factor out the code in arm_debug_excp_handler() which picks | ||
5 | an FSR value into its own utility function, update it to use | ||
6 | arm_fi_to_lfsc() and arm_fi_to_sfsc() rather than hard-coded constants, | ||
7 | and use the correct condition to select long or short format. | ||
8 | 3 | ||
9 | In particular this fixes a bug where we could select the short | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | format because we're at EL0 and the EL1 translation regime is | 5 | Message-id: 20181203203839.757-2-richard.henderson@linaro.org |
11 | not using LPAE, but then route the debug exception to EL2 because | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | of MDCR_EL2.TDE and hand EL2 the wrong format FSR. | 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(-) | ||
13 | 16 | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | Message-id: 20180320134114.30418-3-peter.maydell@linaro.org | 19 | --- a/target/arm/cpu.h |
17 | --- | 20 | +++ b/target/arm/cpu.h |
18 | target/arm/internals.h | 25 +++++++++++++++++++++++++ | 21 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { |
19 | target/arm/op_helper.c | 12 ++---------- | 22 | uint64_t id_aa64isar1; |
20 | 2 files changed, 27 insertions(+), 10 deletions(-) | 23 | uint64_t id_aa64pfr0; |
21 | 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 | ||
22 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 68 | diff --git a/target/arm/internals.h b/target/arm/internals.h |
23 | index XXXXXXX..XXXXXXX 100644 | 69 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/internals.h | 70 | --- a/target/arm/internals.h |
25 | +++ b/target/arm/internals.h | 71 | +++ b/target/arm/internals.h |
26 | @@ -XXX,XX +XXX,XX @@ static inline bool regime_is_secure(CPUARMState *env, ARMMMUIdx mmu_idx) | 72 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int arm_pamax(ARMCPU *cpu) |
27 | } | 73 | [4] = 44, |
28 | } | 74 | [5] = 48, |
29 | 75 | }; | |
30 | +/* Return the FSR value for a debug exception (watchpoint, hardware | 76 | - unsigned int parange = extract32(cpu->id_aa64mmfr0, 0, 4); |
31 | + * breakpoint or BKPT insn) targeting the specified exception level. | 77 | + unsigned int parange = |
32 | + */ | 78 | + FIELD_EX64(cpu->isar.id_aa64mmfr0, ID_AA64MMFR0, PARANGE); |
33 | +static inline uint32_t arm_debug_exception_fsr(CPUARMState *env) | 79 | |
34 | +{ | 80 | /* id_aa64mmfr0 is a read-only register so values outside of the |
35 | + ARMMMUFaultInfo fi = { .type = ARMFault_Debug }; | 81 | * supported mappings can be considered an implementation error. */ |
36 | + int target_el = arm_debug_target_el(env); | 82 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
37 | + bool using_lpae = false; | ||
38 | + | ||
39 | + if (target_el == 2 || arm_el_is_aa64(env, target_el)) { | ||
40 | + using_lpae = true; | ||
41 | + } else { | ||
42 | + if (arm_feature(env, ARM_FEATURE_LPAE) && | ||
43 | + (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { | ||
44 | + using_lpae = true; | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + if (using_lpae) { | ||
49 | + return arm_fi_to_lfsc(&fi); | ||
50 | + } else { | ||
51 | + return arm_fi_to_sfsc(&fi); | ||
52 | + } | ||
53 | +} | ||
54 | + | ||
55 | #endif | ||
56 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | 83 | index XXXXXXX..XXXXXXX 100644 |
58 | --- a/target/arm/op_helper.c | 84 | --- a/target/arm/cpu64.c |
59 | +++ b/target/arm/op_helper.c | 85 | +++ b/target/arm/cpu64.c |
60 | @@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs) | 86 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) |
61 | 87 | cpu->pmceid0 = 0x00000000; | |
62 | cs->watchpoint_hit = NULL; | 88 | cpu->pmceid1 = 0x00000000; |
63 | 89 | cpu->isar.id_aa64isar0 = 0x00011120; | |
64 | - if (extended_addresses_enabled(env)) { | 90 | - cpu->id_aa64mmfr0 = 0x00001124; |
65 | - env->exception.fsr = (1 << 9) | 0x22; | 91 | + cpu->isar.id_aa64mmfr0 = 0x00001124; |
66 | - } else { | 92 | cpu->dbgdidr = 0x3516d000; |
67 | - env->exception.fsr = 0x2; | 93 | cpu->clidr = 0x0a200023; |
68 | - } | 94 | cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ |
69 | + env->exception.fsr = arm_debug_exception_fsr(env); | 95 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) |
70 | env->exception.vaddress = wp_hit->hitaddr; | 96 | cpu->isar.id_aa64pfr0 = 0x00002222; |
71 | raise_exception(env, EXCP_DATA_ABORT, | 97 | cpu->id_aa64dfr0 = 0x10305106; |
72 | syn_watchpoint(same_el, 0, wnr), | 98 | cpu->isar.id_aa64isar0 = 0x00011120; |
73 | @@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs) | 99 | - cpu->id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */ |
74 | return; | 100 | + cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */ |
75 | } | 101 | cpu->dbgdidr = 0x3516d000; |
76 | 102 | cpu->clidr = 0x0a200023; | |
77 | - if (extended_addresses_enabled(env)) { | 103 | cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */ |
78 | - env->exception.fsr = (1 << 9) | 0x22; | 104 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) |
79 | - } else { | 105 | cpu->pmceid0 = 0x00000000; |
80 | - env->exception.fsr = 0x2; | 106 | cpu->pmceid1 = 0x00000000; |
81 | - } | 107 | cpu->isar.id_aa64isar0 = 0x00011120; |
82 | + env->exception.fsr = arm_debug_exception_fsr(env); | 108 | - cpu->id_aa64mmfr0 = 0x00001124; |
83 | /* FAR is UNKNOWN, so doesn't need setting */ | 109 | + cpu->isar.id_aa64mmfr0 = 0x00001124; |
84 | raise_exception(env, EXCP_PREFETCH_ABORT, | 110 | cpu->dbgdidr = 0x3516d000; |
85 | syn_breakpoint(same_el), | 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, | ||
86 | -- | 146 | -- |
87 | 2.16.2 | 147 | 2.19.2 |
88 | 148 | ||
89 | 149 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
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 |
New patch | |||
---|---|---|---|
1 | From: Richard Henderson <richard.henderson@linaro.org> | ||
1 | 2 | ||
3 | Post v8.4 bits taken from SysReg_v85_xml-00bet8. | ||
4 | |||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Message-id: 20181203203839.757-4-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 | 10 ++++++++++ | ||
11 | 1 file changed, 10 insertions(+) | ||
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 SCR_ST (1U << 11) | ||
19 | #define SCR_TWI (1U << 12) | ||
20 | #define SCR_TWE (1U << 13) | ||
21 | +#define SCR_TLOR (1U << 14) | ||
22 | +#define SCR_TERR (1U << 15) | ||
23 | +#define SCR_APK (1U << 16) | ||
24 | +#define SCR_API (1U << 17) | ||
25 | +#define SCR_EEL2 (1U << 18) | ||
26 | +#define SCR_EASE (1U << 19) | ||
27 | +#define SCR_NMEA (1U << 20) | ||
28 | +#define SCR_FIEN (1U << 21) | ||
29 | +#define SCR_ENSCXT (1U << 25) | ||
30 | +#define SCR_ATA (1U << 26) | ||
31 | #define SCR_AARCH32_MASK (0x3fff & ~(SCR_RW | SCR_ST)) | ||
32 | #define SCR_AARCH64_MASK (0x3fff & ~SCR_NET) | ||
33 | |||
34 | -- | ||
35 | 2.19.2 | ||
36 | |||
37 | diff view generated by jsdifflib |
1 | From: Wei Huang <wei@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Instead of using "1.0" as the system version of SMBIOS, we should use | 3 | The enable for TGE has already occurred within arm_hcr_el2_amo |
4 | mc->name for mach-virt machine type to be consistent other architectures. | 4 | and friends. Moreover, when E2H is also set, the sense is |
5 | With this patch, "dmidecode -t 1" (e.g., "-M virt-2.12,accel=kvm") will | 5 | supposed to be reversed, which has also already occurred within |
6 | show: | 6 | the helpers. |
7 | 7 | ||
8 | Handle 0x0100, DMI type 1, 27 bytes | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | System Information | 9 | Message-id: 20181203203839.757-5-richard.henderson@linaro.org |
10 | Manufacturer: QEMU | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Product Name: KVM Virtual Machine | ||
12 | Version: virt-2.12 | ||
13 | Serial Number: Not Specified | ||
14 | ... | ||
15 | |||
16 | instead of: | ||
17 | |||
18 | Handle 0x0100, DMI type 1, 27 bytes | ||
19 | System Information | ||
20 | Manufacturer: QEMU | ||
21 | Product Name: KVM Virtual Machine | ||
22 | Version: 1.0 | ||
23 | Serial Number: Not Specified | ||
24 | ... | ||
25 | |||
26 | For backward compatibility, we allow older machine types to keep "1.0" | ||
27 | as the default system version. | ||
28 | |||
29 | Signed-off-by: Wei Huang <wei@redhat.com> | ||
30 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
31 | Message-id: 20180322212318.7182-1-wei@redhat.com | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 12 | --- |
34 | include/hw/arm/virt.h | 1 + | 13 | target/arm/helper.c | 3 --- |
35 | hw/arm/virt.c | 8 +++++++- | 14 | 1 file changed, 3 deletions(-) |
36 | 2 files changed, 8 insertions(+), 1 deletion(-) | ||
37 | 15 | ||
38 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | 16 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
39 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
40 | --- a/include/hw/arm/virt.h | 18 | --- a/target/arm/helper.c |
41 | +++ b/include/hw/arm/virt.h | 19 | +++ b/target/arm/helper.c |
42 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 20 | @@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, |
43 | bool no_its; | 21 | break; |
44 | bool no_pmu; | 22 | }; |
45 | bool claim_edge_triggered_timers; | 23 | |
46 | + bool smbios_old_sys_ver; | 24 | - /* If HCR.TGE is set then HCR is treated as being 1 */ |
47 | } VirtMachineClass; | 25 | - hcr |= ((env->cp15.hcr_el2 & HCR_TGE) == HCR_TGE); |
48 | 26 | - | |
49 | typedef struct { | 27 | /* Perform a table-lookup for the target EL given the current state */ |
50 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 28 | target_el = target_el_table[is64][scr][rw][hcr][secure][cur_el]; |
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/arm/virt.c | ||
53 | +++ b/hw/arm/virt.c | ||
54 | @@ -XXX,XX +XXX,XX @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) | ||
55 | |||
56 | static void virt_build_smbios(VirtMachineState *vms) | ||
57 | { | ||
58 | + MachineClass *mc = MACHINE_GET_CLASS(vms); | ||
59 | + VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); | ||
60 | uint8_t *smbios_tables, *smbios_anchor; | ||
61 | size_t smbios_tables_len, smbios_anchor_len; | ||
62 | const char *product = "QEMU Virtual Machine"; | ||
63 | @@ -XXX,XX +XXX,XX @@ static void virt_build_smbios(VirtMachineState *vms) | ||
64 | } | ||
65 | |||
66 | smbios_set_defaults("QEMU", product, | ||
67 | - "1.0", false, true, SMBIOS_ENTRY_POINT_30); | ||
68 | + vmc->smbios_old_sys_ver ? "1.0" : mc->name, false, | ||
69 | + true, SMBIOS_ENTRY_POINT_30); | ||
70 | |||
71 | smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len, | ||
72 | &smbios_anchor, &smbios_anchor_len); | ||
73 | @@ -XXX,XX +XXX,XX @@ static void virt_2_11_instance_init(Object *obj) | ||
74 | |||
75 | static void virt_machine_2_11_options(MachineClass *mc) | ||
76 | { | ||
77 | + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); | ||
78 | + | ||
79 | virt_machine_2_12_options(mc); | ||
80 | SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); | ||
81 | + vmc->smbios_old_sys_ver = true; | ||
82 | } | ||
83 | DEFINE_VIRT_MACHINE(2, 11) | ||
84 | 29 | ||
85 | -- | 30 | -- |
86 | 2.16.2 | 31 | 2.19.2 |
87 | 32 | ||
88 | 33 | diff view generated by jsdifflib |
1 | From: Paolo Bonzini <pbonzini@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Detected by Coverity (CID 1386072, 1386073, 1386076, 1386077). local_err | 3 | Because EL3 has a fixed execution mode, we can properly decide |
4 | was unused, and this made the static analyzer unhappy. | 4 | which of the bits are RES{0,1}. |
5 | 5 | ||
6 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20180320151355.25854-1-pbonzini@redhat.com | 7 | Message-id: 20181203203839.757-8-richard.henderson@linaro.org |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/sd/sdhci.c | 4 ++-- | 11 | target/arm/cpu.h | 2 -- |
12 | 1 file changed, 2 insertions(+), 2 deletions(-) | 12 | target/arm/helper.c | 14 +++++++++----- |
13 | 2 files changed, 9 insertions(+), 7 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 15 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/sd/sdhci.c | 17 | --- a/target/arm/cpu.h |
17 | +++ b/hw/sd/sdhci.c | 18 | +++ b/target/arm/cpu.h |
18 | @@ -XXX,XX +XXX,XX @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp) | 19 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) |
19 | Error *local_err = NULL; | 20 | #define SCR_FIEN (1U << 21) |
20 | 21 | #define SCR_ENSCXT (1U << 25) | |
21 | sdhci_initfn(s); | 22 | #define SCR_ATA (1U << 26) |
22 | - sdhci_common_realize(s, errp); | 23 | -#define SCR_AARCH32_MASK (0x3fff & ~(SCR_RW | SCR_ST)) |
23 | + sdhci_common_realize(s, &local_err); | 24 | -#define SCR_AARCH64_MASK (0x3fff & ~SCR_NET) |
24 | if (local_err) { | 25 | |
25 | error_propagate(errp, local_err); | 26 | /* Return the current FPSCR value. */ |
26 | return; | 27 | uint32_t vfp_get_fpscr(CPUARMState *env); |
27 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) | 28 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
28 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | 29 | index XXXXXXX..XXXXXXX 100644 |
29 | Error *local_err = NULL; | 30 | --- a/target/arm/helper.c |
30 | 31 | +++ b/target/arm/helper.c | |
31 | - sdhci_common_realize(s, errp); | 32 | @@ -XXX,XX +XXX,XX @@ static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri, |
32 | + sdhci_common_realize(s, &local_err); | 33 | |
33 | if (local_err) { | 34 | static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) |
34 | error_propagate(errp, local_err); | 35 | { |
35 | return; | 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; | ||
36 | -- | 53 | -- |
37 | 2.16.2 | 54 | 2.19.2 |
38 | 55 | ||
39 | 56 | diff view generated by jsdifflib |
1 | The BCM2836 uses a Cortex-A7, not a Cortex-A15. Update the device to | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | use the correct CPU. | ||
3 | https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf | ||
4 | 2 | ||
5 | When the BCM2836 was introduced (bad5623690b) the Cortex-A7 was not | 3 | Since the TCR_*.HPD bits were RES0 in ARMv8.0, we can simply |
6 | available, so the very similar Cortex-A15 was used. Since dcf578ed8ce | 4 | interpret the bits as if ARMv8.1-HPD is present without checking. |
7 | we can model the correct core. | 5 | We will need a slightly different check for hpd for aarch32. |
8 | 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-10-richard.henderson@linaro.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Alistair Francis <alistair@alistair23.me> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Message-id: 20180319110215.16755-1-peter.maydell@linaro.org | ||
13 | --- | 11 | --- |
14 | hw/arm/bcm2836.c | 2 +- | 12 | target/arm/cpu64.c | 4 ++++ |
15 | hw/arm/raspi.c | 2 +- | 13 | target/arm/helper.c | 27 ++++++++++++++++++++------- |
16 | 2 files changed, 2 insertions(+), 2 deletions(-) | 14 | 2 files changed, 24 insertions(+), 7 deletions(-) |
17 | 15 | ||
18 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | 16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
19 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/hw/arm/bcm2836.c | 18 | --- a/target/arm/cpu64.c |
21 | +++ b/hw/arm/bcm2836.c | 19 | +++ b/target/arm/cpu64.c |
22 | @@ -XXX,XX +XXX,XX @@ struct BCM283XInfo { | 20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
23 | static const BCM283XInfo bcm283x_socs[] = { | 21 | t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); |
24 | { | 22 | cpu->isar.id_aa64pfr0 = t; |
25 | .name = TYPE_BCM2836, | 23 | |
26 | - .cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"), | 24 | + t = cpu->isar.id_aa64mmfr1; |
27 | + .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"), | 25 | + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ |
28 | .clusterid = 0xf, | 26 | + cpu->isar.id_aa64mmfr1 = t; |
29 | }, | 27 | + |
30 | #ifdef TARGET_AARCH64 | 28 | /* Replicate the same data to the 32-bit id registers. */ |
31 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 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 | 32 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/hw/arm/raspi.c | 33 | --- a/target/arm/helper.c |
34 | +++ b/hw/arm/raspi.c | 34 | +++ b/target/arm/helper.c |
35 | @@ -XXX,XX +XXX,XX @@ static void raspi2_machine_init(MachineClass *mc) | 35 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, |
36 | mc->no_parallel = 1; | 36 | bool ttbr1_valid = true; |
37 | mc->no_floppy = 1; | 37 | uint64_t descaddrmask; |
38 | mc->no_cdrom = 1; | 38 | bool aarch64 = arm_el_is_aa64(env, el); |
39 | - mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15"); | 39 | + bool hpd = false; |
40 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); | 40 | |
41 | mc->max_cpus = BCM283X_NCPUS; | 41 | /* TODO: |
42 | mc->min_cpus = BCM283X_NCPUS; | 42 | * This code does not handle the different format TCR for VTCR_EL2. |
43 | mc->default_cpus = BCM283X_NCPUS; | 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 | ||
44 | -- | 100 | -- |
45 | 2.16.2 | 101 | 2.19.2 |
46 | 102 | ||
47 | 103 | diff view generated by jsdifflib |
1 | For debug exceptions due to breakpoints or the BKPT instruction which | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | are taken to AArch32, the Fault Address Register is architecturally | ||
3 | UNKNOWN. We were using that as license to simply not set | ||
4 | env->exception.vaddress, but this isn't correct, because it will | ||
5 | expose to the guest whatever old value was in that field when | ||
6 | arm_cpu_do_interrupt_aarch32() writes it to the guest IFSR. That old | ||
7 | value might be a FAR for a previous guest EL2 or secure exception, in | ||
8 | which case we shouldn't show it to an EL1 or non-secure exception | ||
9 | handler. It might also be a non-deterministic value, which is bad | ||
10 | for record-and-replay. | ||
11 | 2 | ||
12 | Clear env->exception.vaddress before taking breakpoint debug | 3 | The bulk of the work here, beyond base HPD, is defining the |
13 | exceptions, to avoid this minor information leak. | 4 | TTBCR2 register. In addition we must check TTBCR.T2E, which |
5 | is not present (RES0) for AArch64. | ||
14 | 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 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20180320134114.30418-5-peter.maydell@linaro.org | ||
18 | --- | 11 | --- |
19 | target/arm/op_helper.c | 11 ++++++++++- | 12 | target/arm/cpu.h | 9 +++++++++ |
20 | 1 file changed, 10 insertions(+), 1 deletion(-) | 13 | target/arm/cpu.c | 4 ++++ |
14 | target/arm/helper.c | 37 +++++++++++++++++++++++++++++-------- | ||
15 | 3 files changed, 42 insertions(+), 8 deletions(-) | ||
21 | 16 | ||
22 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 17 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h |
23 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/op_helper.c | 19 | --- a/target/arm/cpu.h |
25 | +++ b/target/arm/op_helper.c | 20 | +++ b/target/arm/cpu.h |
26 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) | 21 | @@ -XXX,XX +XXX,XX @@ FIELD(ID_ISAR6, FHM, 8, 4) |
22 | FIELD(ID_ISAR6, SB, 12, 4) | ||
23 | FIELD(ID_ISAR6, SPECRES, 16, 4) | ||
24 | |||
25 | +FIELD(ID_MMFR4, SPECSEI, 0, 4) | ||
26 | +FIELD(ID_MMFR4, AC2, 4, 4) | ||
27 | +FIELD(ID_MMFR4, XNX, 8, 4) | ||
28 | +FIELD(ID_MMFR4, CNP, 12, 4) | ||
29 | +FIELD(ID_MMFR4, HPDS, 16, 4) | ||
30 | +FIELD(ID_MMFR4, LSM, 20, 4) | ||
31 | +FIELD(ID_MMFR4, CCIDX, 24, 4) | ||
32 | +FIELD(ID_MMFR4, EVT, 28, 4) | ||
33 | + | ||
34 | FIELD(ID_AA64ISAR0, AES, 4, 4) | ||
35 | FIELD(ID_AA64ISAR0, SHA1, 8, 4) | ||
36 | FIELD(ID_AA64ISAR0, SHA2, 12, 4) | ||
37 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/target/arm/cpu.c | ||
40 | +++ b/target/arm/cpu.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj) | ||
42 | t = cpu->isar.id_isar6; | ||
43 | t = FIELD_DP32(t, ID_ISAR6, DP, 1); | ||
44 | cpu->isar.id_isar6 = t; | ||
45 | + | ||
46 | + t = cpu->id_mmfr4; | ||
47 | + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
48 | + cpu->id_mmfr4 = t; | ||
49 | } | ||
50 | #endif | ||
51 | } | ||
52 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
53 | index XXXXXXX..XXXXXXX 100644 | ||
54 | --- a/target/arm/helper.c | ||
55 | +++ b/target/arm/helper.c | ||
56 | @@ -XXX,XX +XXX,XX @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
57 | uint64_t value) | ||
27 | { | 58 | { |
28 | /* FSR will only be used if the debug target EL is AArch32. */ | 59 | ARMCPU *cpu = arm_env_get_cpu(env); |
29 | env->exception.fsr = arm_debug_exception_fsr(env); | 60 | + TCR *tcr = raw_ptr(env, ri); |
30 | + /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing | 61 | |
31 | + * values to the guest that it shouldn't be able to see at its | 62 | if (arm_feature(env, ARM_FEATURE_LPAE)) { |
32 | + * exception/security level. | 63 | /* With LPAE the TTBCR could result in a change of ASID |
33 | + */ | 64 | @@ -XXX,XX +XXX,XX @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri, |
34 | + env->exception.vaddress = 0; | 65 | */ |
35 | raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); | 66 | tlb_flush(CPU(cpu)); |
67 | } | ||
68 | + /* Preserve the high half of TCR_EL1, set via TTBCR2. */ | ||
69 | + value = deposit64(tcr->raw_tcr, 0, 32, value); | ||
70 | vmsa_ttbcr_raw_write(env, ri, value); | ||
36 | } | 71 | } |
37 | 72 | ||
38 | @@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs) | 73 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { |
74 | REGINFO_SENTINEL | ||
75 | }; | ||
76 | |||
77 | +/* Note that unlike TTBCR, writing to TTBCR2 does not require flushing | ||
78 | + * qemu tlbs nor adjusting cached masks. | ||
79 | + */ | ||
80 | +static const ARMCPRegInfo ttbcr2_reginfo = { | ||
81 | + .name = "TTBCR2", .cp = 15, .opc1 = 0, .crn = 2, .crm = 0, .opc2 = 3, | ||
82 | + .access = PL1_RW, .type = ARM_CP_ALIAS, | ||
83 | + .bank_fieldoffsets = { offsetofhigh32(CPUARMState, cp15.tcr_el[3]), | ||
84 | + offsetofhigh32(CPUARMState, cp15.tcr_el[1]) }, | ||
85 | +}; | ||
86 | + | ||
87 | static void omap_ticonfig_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
88 | uint64_t value) | ||
89 | { | ||
90 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
91 | } else { | ||
92 | define_arm_cp_regs(cpu, vmsa_pmsa_cp_reginfo); | ||
93 | define_arm_cp_regs(cpu, vmsa_cp_reginfo); | ||
94 | + /* TTCBR2 is introduced with ARMv8.2-A32HPD. */ | ||
95 | + if (FIELD_EX32(cpu->id_mmfr4, ID_MMFR4, HPDS) != 0) { | ||
96 | + define_one_arm_cp_reg(cpu, &ttbcr2_reginfo); | ||
97 | + } | ||
98 | } | ||
99 | if (arm_feature(env, ARM_FEATURE_THUMB2EE)) { | ||
100 | define_arm_cp_regs(cpu, t2ee_cp_reginfo); | ||
101 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
102 | if (tg == 2) { /* 16KB pages */ | ||
103 | stride = 11; | ||
39 | } | 104 | } |
40 | 105 | - if (aarch64) { | |
41 | env->exception.fsr = arm_debug_exception_fsr(env); | 106 | - if (el > 1) { |
42 | - /* FAR is UNKNOWN, so doesn't need setting */ | 107 | - hpd = extract64(tcr->raw_tcr, 24, 1); |
43 | + /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing | 108 | - } else { |
44 | + * values to the guest that it shouldn't be able to see at its | 109 | - hpd = extract64(tcr->raw_tcr, 41, 1); |
45 | + * exception/security level. | 110 | - } |
46 | + */ | 111 | + if (aarch64 && el > 1) { |
47 | + env->exception.vaddress = 0; | 112 | + hpd = extract64(tcr->raw_tcr, 24, 1); |
48 | raise_exception(env, EXCP_PREFETCH_ABORT, | 113 | + } else { |
49 | syn_breakpoint(same_el), | 114 | + hpd = extract64(tcr->raw_tcr, 41, 1); |
50 | arm_debug_target_el(env)); | 115 | + } |
116 | + if (!aarch64) { | ||
117 | + /* For aarch32, hpd0 is not enabled without t2e as well. */ | ||
118 | + hpd &= extract64(tcr->raw_tcr, 6, 1); | ||
119 | } | ||
120 | } else { | ||
121 | /* We should only be here if TTBR1 is valid */ | ||
122 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
123 | if (tg == 1) { /* 16KB pages */ | ||
124 | stride = 11; | ||
125 | } | ||
126 | - if (aarch64) { | ||
127 | - hpd = extract64(tcr->raw_tcr, 42, 1); | ||
128 | + hpd = extract64(tcr->raw_tcr, 42, 1); | ||
129 | + if (!aarch64) { | ||
130 | + /* For aarch32, hpd1 is not enabled without t2e as well. */ | ||
131 | + hpd &= extract64(tcr->raw_tcr, 6, 1); | ||
132 | } | ||
133 | } | ||
134 | |||
51 | -- | 135 | -- |
52 | 2.16.2 | 136 | 2.19.2 |
53 | 137 | ||
54 | 138 | diff view generated by jsdifflib |
1 | If the GIC has the security extension support enabled, then a | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | non-secure access to ICC_PMR must take account of the non-secure | 2 | |
3 | view of interrupt priorities, where real priorities 0x00..0x7f | 3 | Replace arm_hcr_el2_{fmo,imo,amo} with a more general routine |
4 | are secure-only and not visible to the non-secure guest, and | 4 | that also takes SCR_EL3.NS (aka arm_is_secure_below_el3) into |
5 | priorities 0x80..0xff are shown to the guest as if they were | 5 | account, as documented for the plethora of bits in HCR_EL2. |
6 | 0x00..0xff. We had the logic here wrong: | 6 | |
7 | * on reads, the priority is in the secure range if bit 7 | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | is clear, not if it is set | 8 | Message-id: 20181210150501.7990-2-richard.henderson@linaro.org |
9 | * on writes, we want to set bit 7, not mask everything else | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | |||
11 | Our ICC_RPR read code had the same error as ICC_PMR. | ||
12 | |||
13 | (Compare the GICv3 spec pseudocode functions ICC_RPR_EL1 | ||
14 | and ICC_PMR_EL1.) | ||
15 | |||
16 | Fixes: https://bugs.launchpad.net/qemu/+bug/1748434 | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
19 | Message-id: 20180315133441.24149-1-peter.maydell@linaro.org | ||
20 | --- | 11 | --- |
21 | hw/intc/arm_gicv3_cpuif.c | 6 +++--- | 12 | target/arm/cpu.h | 67 +++++++++------------------------------ |
22 | 1 file changed, 3 insertions(+), 3 deletions(-) | 13 | hw/intc/arm_gicv3_cpuif.c | 21 ++++++------ |
23 | 14 | target/arm/helper.c | 66 ++++++++++++++++++++++++++++++++------ | |
15 | 3 files changed, 83 insertions(+), 71 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 @@ static inline bool arm_is_secure(CPUARMState *env) | ||
22 | } | ||
23 | #endif | ||
24 | |||
25 | +/** | ||
26 | + * arm_hcr_el2_eff(): Return the effective value of HCR_EL2. | ||
27 | + * E.g. when in secure state, fields in HCR_EL2 are suppressed, | ||
28 | + * "for all purposes other than a direct read or write access of HCR_EL2." | ||
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: | ||
24 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c | 142 | diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c |
25 | index XXXXXXX..XXXXXXX 100644 | 143 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/intc/arm_gicv3_cpuif.c | 144 | --- a/hw/intc/arm_gicv3_cpuif.c |
27 | +++ b/hw/intc/arm_gicv3_cpuif.c | 145 | +++ b/hw/intc/arm_gicv3_cpuif.c |
28 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_pmr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 146 | @@ -XXX,XX +XXX,XX @@ static bool icv_access(CPUARMState *env, int hcr_flags) |
29 | /* NS access and Group 0 is inaccessible to NS: return the | 147 | * * access if NS EL1 and either IMO or FMO == 1: |
30 | * NS view of the current priority | 148 | * CTLR, DIR, PMR, RPR |
31 | */ | 149 | */ |
32 | - if (value & 0x80) { | 150 | - bool flagmatch = ((hcr_flags & HCR_IMO) && arm_hcr_el2_imo(env)) || |
33 | + if ((value & 0x80) == 0) { | 151 | - ((hcr_flags & HCR_FMO) && arm_hcr_el2_fmo(env)); |
34 | /* Secure priorities not visible to NS */ | 152 | + uint64_t hcr_el2 = arm_hcr_el2_eff(env); |
35 | value = 0; | 153 | + bool flagmatch = hcr_el2 & hcr_flags & (HCR_IMO | HCR_FMO); |
36 | } else if (value != 0xff) { | 154 | |
37 | @@ -XXX,XX +XXX,XX @@ static void icc_pmr_write(CPUARMState *env, const ARMCPRegInfo *ri, | 155 | return flagmatch && arm_current_el(env) == 1 |
38 | /* Current PMR in the secure range, don't allow NS to change it */ | 156 | && !arm_is_secure_below_el3(env); |
39 | return; | 157 | @@ -XXX,XX +XXX,XX @@ static void icc_dir_write(CPUARMState *env, const ARMCPRegInfo *ri, |
40 | } | 158 | /* No need to include !IsSecure in route_*_to_el2 as it's only |
41 | - value = (value >> 1) & 0x80; | 159 | * tested in cases where we know !IsSecure is true. |
42 | + value = (value >> 1) | 0x80; | 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; | ||
43 | } | 190 | } |
44 | cs->icc_pmr_el1 = value; | 191 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_fiq_access(CPUARMState *env, |
45 | gicv3_cpuif_update(cs); | 192 | if (env->cp15.scr_el3 & SCR_FIQ) { |
46 | @@ -XXX,XX +XXX,XX @@ static uint64_t icc_rpr_read(CPUARMState *env, const ARMCPRegInfo *ri) | 193 | switch (el) { |
47 | if (arm_feature(env, ARM_FEATURE_EL3) && | 194 | case 1: |
48 | !arm_is_secure(env) && (env->cp15.scr_el3 & SCR_FIQ)) { | 195 | - if (arm_is_secure_below_el3(env) || !arm_hcr_el2_fmo(env)) { |
49 | /* NS GIC access and Group 0 is inaccessible to NS */ | 196 | + if ((arm_hcr_el2_eff(env) & HCR_FMO) == 0) { |
50 | - if (prio & 0x80) { | 197 | r = CP_ACCESS_TRAP_EL3; |
51 | + if ((prio & 0x80) == 0) { | 198 | } |
52 | /* NS mustn't see priorities in the Secure half of the range */ | 199 | break; |
53 | prio = 0; | 200 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult gicv3_irq_access(CPUARMState *env, |
54 | } else if (prio != 0xff) { | 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 | |||
55 | -- | 327 | -- |
56 | 2.16.2 | 328 | 2.19.2 |
57 | 329 | ||
58 | 330 | diff view generated by jsdifflib |
1 | Now that we have a helper function specifically for the BRK and | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | BKPT instructions, we can set the exception.fsr there rather | ||
3 | than in arm_cpu_do_interrupt_aarch32(). This allows us to | ||
4 | use our new arm_debug_exception_fsr() helper. | ||
5 | 2 | ||
6 | In particular this fixes a bug where we were hardcoding the | 3 | Since arm_hcr_el2_eff includes a check against |
7 | short-form IFSR value, which is wrong if the target exception | 4 | arm_is_secure_below_el3, we can often remove a |
8 | level has LPAE enabled. | 5 | nearby check against secure state. |
9 | 6 | ||
10 | Fixes: https://bugs.launchpad.net/qemu/+bug/1756927 | 7 | In some cases, sort the call to arm_hcr_el2_eff |
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 | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180320134114.30418-4-peter.maydell@linaro.org | ||
14 | --- | 14 | --- |
15 | target/arm/helper.c | 1 - | 15 | target/arm/helper.c | 12 +++++------- |
16 | target/arm/op_helper.c | 2 ++ | 16 | target/arm/op_helper.c | 14 ++++++-------- |
17 | 2 files changed, 2 insertions(+), 1 deletion(-) | 17 | 2 files changed, 11 insertions(+), 15 deletions(-) |
18 | 18 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 19 | diff --git a/target/arm/helper.c b/target/arm/helper.c |
20 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 21 | --- a/target/arm/helper.c |
22 | +++ b/target/arm/helper.c | 22 | +++ b/target/arm/helper.c |
23 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) | 23 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tdosa(CPUARMState *env, const ARMCPRegInfo *ri, |
24 | offset = 0; | 24 | int el = arm_current_el(env); |
25 | break; | 25 | bool mdcr_el2_tdosa = (env->cp15.mdcr_el2 & MDCR_TDOSA) || |
26 | case EXCP_BKPT: | 26 | (env->cp15.mdcr_el2 & MDCR_TDE) || |
27 | - env->exception.fsr = 2; | 27 | - (env->cp15.hcr_el2 & HCR_TGE); |
28 | /* Fall through to prefetch abort. */ | 28 | + (arm_hcr_el2_eff(env) & HCR_TGE); |
29 | case EXCP_PREFETCH_ABORT: | 29 | |
30 | A32_BANKED_CURRENT_REG_SET(env, ifsr, env->exception.fsr); | 30 | if (el < 2 && mdcr_el2_tdosa && !arm_is_secure_below_el3(env)) { |
31 | return CP_ACCESS_TRAP_EL2; | ||
32 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tdra(CPUARMState *env, const ARMCPRegInfo *ri, | ||
33 | int el = arm_current_el(env); | ||
34 | bool mdcr_el2_tdra = (env->cp15.mdcr_el2 & MDCR_TDRA) || | ||
35 | (env->cp15.mdcr_el2 & MDCR_TDE) || | ||
36 | - (env->cp15.hcr_el2 & HCR_TGE); | ||
37 | + (arm_hcr_el2_eff(env) & HCR_TGE); | ||
38 | |||
39 | if (el < 2 && mdcr_el2_tdra && !arm_is_secure_below_el3(env)) { | ||
40 | return CP_ACCESS_TRAP_EL2; | ||
41 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tda(CPUARMState *env, const ARMCPRegInfo *ri, | ||
42 | int el = arm_current_el(env); | ||
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; | ||
31 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | 71 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c |
32 | index XXXXXXX..XXXXXXX 100644 | 72 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/target/arm/op_helper.c | 73 | --- a/target/arm/op_helper.c |
34 | +++ b/target/arm/op_helper.c | 74 | +++ b/target/arm/op_helper.c |
35 | @@ -XXX,XX +XXX,XX @@ void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, | 75 | @@ -XXX,XX +XXX,XX @@ void raise_exception(CPUARMState *env, uint32_t excp, |
36 | */ | ||
37 | void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) | ||
38 | { | 76 | { |
39 | + /* FSR will only be used if the debug target EL is AArch32. */ | 77 | CPUState *cs = CPU(arm_env_get_cpu(env)); |
40 | + env->exception.fsr = arm_debug_exception_fsr(env); | 78 | |
41 | raise_exception(env, EXCP_BKPT, syndrome, arm_debug_target_el(env)); | 79 | - if ((env->cp15.hcr_el2 & HCR_TGE) && |
42 | } | 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 | } | ||
43 | 116 | ||
44 | -- | 117 | -- |
45 | 2.16.2 | 118 | 2.19.2 |
46 | 119 | ||
47 | 120 | diff view generated by jsdifflib |
1 | From: Victor Kamensky <kamensky@cisco.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | In OE project 4.15 linux kernel boot hang was observed under | 3 | Provide a trivial implementation with zero limited ordering regions, |
4 | single cpu aarch64 qemu. Kernel code was in a loop waiting for | 4 | which causes the LDLAR and STLLR instructions to devolve into the |
5 | vtimer arrival, spinning in TC generated blocks, while interrupt | 5 | LDAR and STLR instructions from the base ARMv8.0 instruction set. |
6 | was pending unprocessed. This happened because when qemu tried to | ||
7 | handle vtimer interrupt target had interrupts disabled, as | ||
8 | result flag indicating TCG exit, cpu->icount_decr.u16.high, | ||
9 | was cleared but arm_cpu_exec_interrupt function did not call | ||
10 | arm_cpu_do_interrupt to process interrupt. Later when target | ||
11 | reenabled interrupts, it happened without exit into main loop, so | ||
12 | following code that waited for result of interrupt execution | ||
13 | run in infinite loop. | ||
14 | 6 | ||
15 | To solve the problem instructions that operate on CPU sys state | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | (i.e enable/disable interrupt), and marked as DISAS_UPDATE, | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
17 | should be considered as DISAS_EXIT variant, and should be | 9 | Message-id: 20181210150501.7990-4-richard.henderson@linaro.org |
18 | forced to exit back to main loop so qemu will have a chance | ||
19 | processing pending CPU state updates, including pending | ||
20 | interrupts. | ||
21 | |||
22 | This change brings consistency with how DISAS_UPDATE is treated | ||
23 | in aarch32 case. | ||
24 | |||
25 | CC: Peter Maydell <peter.maydell@linaro.org> | ||
26 | CC: Alex Bennée <alex.bennee@linaro.org> | ||
27 | CC: qemu-stable@nongnu.org | ||
28 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
29 | Signed-off-by: Victor Kamensky <kamensky@cisco.com> | ||
30 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
31 | Message-id: 1521526368-1996-1-git-send-email-kamensky@cisco.com | ||
32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
33 | --- | 11 | --- |
34 | target/arm/translate-a64.c | 6 +++--- | 12 | target/arm/cpu.h | 5 +++ |
35 | 1 file changed, 3 insertions(+), 3 deletions(-) | 13 | target/arm/cpu64.c | 1 + |
14 | target/arm/helper.c | 75 ++++++++++++++++++++++++++++++++++++++ | ||
15 | target/arm/translate-a64.c | 12 ++++++ | ||
16 | 4 files changed, 93 insertions(+) | ||
36 | 17 | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
19 | index XXXXXXX..XXXXXXX 100644 | ||
20 | --- a/target/arm/cpu.h | ||
21 | +++ b/target/arm/cpu.h | ||
22 | @@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) | ||
23 | return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; | ||
24 | } | ||
25 | |||
26 | +static inline bool isar_feature_aa64_lor(const ARMISARegisters *id) | ||
27 | +{ | ||
28 | + return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, LO) != 0; | ||
29 | +} | ||
30 | + | ||
31 | /* | ||
32 | * Forward to the above feature tests given an ARMCPU pointer. | ||
33 | */ | ||
34 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/target/arm/cpu64.c | ||
37 | +++ b/target/arm/cpu64.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
39 | |||
40 | t = cpu->isar.id_aa64mmfr1; | ||
41 | t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
42 | + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
43 | cpu->isar.id_aa64mmfr1 = t; | ||
44 | |||
45 | /* Replicate the same data to the 32-bit id registers. */ | ||
46 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/target/arm/helper.c | ||
49 | +++ b/target/arm/helper.c | ||
50 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
51 | { | ||
52 | /* Begin with base v8.0 state. */ | ||
53 | uint32_t valid_mask = 0x3fff; | ||
54 | + ARMCPU *cpu = arm_env_get_cpu(env); | ||
55 | |||
56 | if (arm_el_is_aa64(env, 3)) { | ||
57 | value |= SCR_FW | SCR_AW; /* these two bits are RES1. */ | ||
58 | @@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) | ||
59 | valid_mask &= ~SCR_SMD; | ||
60 | } | ||
61 | } | ||
62 | + if (cpu_isar_feature(aa64_lor, cpu)) { | ||
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 | +} | ||
97 | + | ||
98 | +static CPAccessResult access_lorid(CPUARMState *env, const ARMCPRegInfo *ri, | ||
99 | + bool isread) | ||
100 | +{ | ||
101 | + if (arm_is_secure_below_el3(env)) { | ||
102 | + /* Access ok in secure mode. */ | ||
103 | + return CP_ACCESS_OK; | ||
104 | + } | ||
105 | + return access_lor_ns(env); | ||
106 | +} | ||
107 | + | ||
108 | +static CPAccessResult access_lor_other(CPUARMState *env, | ||
109 | + const ARMCPRegInfo *ri, bool isread) | ||
110 | +{ | ||
111 | + if (arm_is_secure_below_el3(env)) { | ||
112 | + /* Access denied in secure mode. */ | ||
113 | + return CP_ACCESS_TRAP; | ||
114 | + } | ||
115 | + return access_lor_ns(env); | ||
116 | +} | ||
117 | + | ||
118 | void register_cp_regs_for_features(ARMCPU *cpu) | ||
119 | { | ||
120 | /* Register all the coprocessor registers based on feature bits */ | ||
121 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
122 | define_one_arm_cp_reg(cpu, &sctlr); | ||
123 | } | ||
124 | |||
125 | + if (cpu_isar_feature(aa64_lor, cpu)) { | ||
126 | + /* | ||
127 | + * A trivial implementation of ARMv8.1-LOR leaves all of these | ||
128 | + * registers fixed at 0, which indicates that there are zero | ||
129 | + * supported Limited Ordering regions. | ||
130 | + */ | ||
131 | + static const ARMCPRegInfo lor_reginfo[] = { | ||
132 | + { .name = "LORSA_EL1", .state = ARM_CP_STATE_AA64, | ||
133 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 0, | ||
134 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
135 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
136 | + { .name = "LOREA_EL1", .state = ARM_CP_STATE_AA64, | ||
137 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 1, | ||
138 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
139 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
140 | + { .name = "LORN_EL1", .state = ARM_CP_STATE_AA64, | ||
141 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 2, | ||
142 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
143 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
144 | + { .name = "LORC_EL1", .state = ARM_CP_STATE_AA64, | ||
145 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 3, | ||
146 | + .access = PL1_RW, .accessfn = access_lor_other, | ||
147 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
148 | + { .name = "LORID_EL1", .state = ARM_CP_STATE_AA64, | ||
149 | + .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, | ||
150 | + .access = PL1_R, .accessfn = access_lorid, | ||
151 | + .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
152 | + REGINFO_SENTINEL | ||
153 | + }; | ||
154 | + define_arm_cp_regs(cpu, lor_reginfo); | ||
155 | + } | ||
156 | + | ||
157 | if (cpu_isar_feature(aa64_sve, cpu)) { | ||
158 | define_one_arm_cp_reg(cpu, &zcr_el1_reginfo); | ||
159 | if (arm_feature(env, ARM_FEATURE_EL2)) { | ||
37 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 160 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
38 | index XXXXXXX..XXXXXXX 100644 | 161 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/translate-a64.c | 162 | --- a/target/arm/translate-a64.c |
40 | +++ b/target/arm/translate-a64.c | 163 | +++ b/target/arm/translate-a64.c |
41 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | 164 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) |
42 | case DISAS_UPDATE: | 165 | } |
43 | gen_a64_set_pc_im(dc->pc); | 166 | return; |
44 | /* fall through */ | 167 | |
45 | - case DISAS_JUMP: | 168 | + case 0x8: /* STLLR */ |
46 | - tcg_gen_lookup_and_goto_ptr(); | 169 | + if (!dc_isar_feature(aa64_lor, s)) { |
47 | - break; | ||
48 | case DISAS_EXIT: | ||
49 | tcg_gen_exit_tb(0); | ||
50 | break; | ||
51 | + case DISAS_JUMP: | ||
52 | + tcg_gen_lookup_and_goto_ptr(); | ||
53 | + break; | 170 | + break; |
54 | case DISAS_NORETURN: | 171 | + } |
55 | case DISAS_SWI: | 172 | + /* StoreLORelease is the same as Store-Release for QEMU. */ |
56 | break; | 173 | + /* fall through */ |
174 | case 0x9: /* STLR */ | ||
175 | /* Generate ISS for non-exclusive accesses including LASR. */ | ||
176 | if (rn == 31) { | ||
177 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_excl(DisasContext *s, uint32_t insn) | ||
178 | disas_ldst_compute_iss_sf(size, false, 0), is_lasr); | ||
179 | return; | ||
180 | |||
181 | + case 0xc: /* LDLAR */ | ||
182 | + if (!dc_isar_feature(aa64_lor, s)) { | ||
183 | + break; | ||
184 | + } | ||
185 | + /* LoadLOAcquire is the same as Load-Acquire for QEMU. */ | ||
186 | + /* fall through */ | ||
187 | case 0xd: /* LDAR */ | ||
188 | /* Generate ISS for non-exclusive accesses including LASR. */ | ||
189 | if (rn == 31) { | ||
57 | -- | 190 | -- |
58 | 2.16.2 | 191 | 2.19.2 |
59 | 192 | ||
60 | 193 | diff view generated by jsdifflib |