1 | target-arm queue: aspeed patches from Cédric, and | 1 | The following changes since commit e670f6d825d4dee248b311197fd4048469d6772b: |
---|---|---|---|
2 | cleanup and sd card patches from Philippe. | ||
3 | 2 | ||
4 | thanks | 3 | Merge remote-tracking branch 'remotes/legoater/tags/pull-ppc-20220218' into staging (2022-02-20 15:05:41 +0000) |
5 | -- PMM | ||
6 | |||
7 | The following changes since commit bac5ba3dc5da706f52c149fa6c0bd1dc96899bec: | ||
8 | |||
9 | Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging (2018-06-08 10:26:16 +0100) | ||
10 | 4 | ||
11 | are available in the Git repository at: | 5 | are available in the Git repository at: |
12 | 6 | ||
13 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180608 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220221 |
14 | 8 | ||
15 | for you to fetch changes up to 113f31c06c6bf16451892b2459d83c9b9c5e9844: | 9 | for you to fetch changes up to d6333e2543fa41aed4d33f77c808168373e39bff: |
16 | 10 | ||
17 | sdcard: Disable CMD19/CMD23 for Spec v2 (2018-06-08 13:15:34 +0100) | 11 | ui/cocoa: Fix the leak of qemu_console_get_label (2022-02-21 09:12:18 +0000) |
18 | 12 | ||
19 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
20 | target-arm queue: | 14 | arm, cocoa and misc: |
21 | * arm_gicv3_kvm: fix migration of registers corresponding to | 15 | * MAINTAINERS file updates |
22 | IRQs 992 to 1020 in the KVM GIC | 16 | * Mark remaining global TypeInfo instances as const |
23 | * aspeed: remove ignore_memory_transaction_failures on all boards | 17 | * checkpatch: Ensure that TypeInfos are const |
24 | * aspeed: add support for the witherspoon-bmc board | 18 | * tests/qtest: add qtests for npcm7xx sdhci |
25 | * aspeed: add an I2C RTC device and EEPROM I2C devices | 19 | * arm hvf: Handle unknown ID registers as RES0 |
26 | * aspeed: add the pc9552 chips to the witherspoon machine | 20 | * Make KVM -cpu max exactly like -cpu host |
27 | * ftgmac100: fix various bugs | 21 | * Fix '-cpu max' for HVF |
28 | * hw/arm: Remove the deprecated xlnx-ep108 machine | 22 | * Support PAuth extension for hvf |
29 | * hw/i2c: Add trace events | 23 | * Kconfig: Add I2C_DEVICES device group |
30 | * add missing '\n' on various qemu_log() logging strings | 24 | * Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus |
31 | * sdcard: clean up spec version support so we report the | 25 | * hw/arm/armv7m: Handle disconnected clock inputs |
32 | right spec version to the guest and only implement the | 26 | * osdep.h: pull out various things into new header files |
33 | commands that are supposed to be present in that version | 27 | * hw/timer: fix a9gtimer vmstate |
28 | * hw/arm: add initial mori-bmc board | ||
29 | * ui/cocoa: Remove allowedFileTypes restriction in SavePanel | ||
30 | * ui/cocoa: Do not alert even without block devices | ||
31 | * ui/cocoa: Fix the leak of qemu_console_get_label | ||
34 | 32 | ||
35 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
36 | Cédric Le Goater (11): | 34 | Akihiko Odaki (3): |
37 | aspeed: remove ignore_memory_transaction_failures on all boards | 35 | MAINTAINERS: Add Akihiko Odaki to macOS-relateds |
38 | aspeed: add support for the witherspoon-bmc board | 36 | ui/cocoa: Do not alert even without block devices |
39 | aspeed: add an I2C RTC device to all machines | 37 | ui/cocoa: Fix the leak of qemu_console_get_label |
40 | smbus: add a smbus_eeprom_init_one() routine | ||
41 | aspeed: Add EEPROM I2C devices | ||
42 | misc: add pca9552 LED blinker model | ||
43 | aspeed: add the pc9552 chips to the witherspoon machine | ||
44 | ftgmac100: compute maximum frame size depending on the protocol | ||
45 | ftgmac100: add IEEE 802.1Q VLAN support | ||
46 | ftgmac100: fix multicast hash routine | ||
47 | ftgmac100: remove check on runt messages | ||
48 | 38 | ||
49 | Philippe Mathieu-Daudé (18): | 39 | Alexander Graf (2): |
50 | hw/i2c: Add trace events | 40 | hvf: arm: Use macros for sysreg shift/masking |
51 | hw/sd/milkymist-memcard: Add trailing '\n' to qemu_log() call | 41 | hvf: arm: Handle unknown ID registers as RES0 |
52 | hw/digic: Add trailing '\n' to qemu_log() calls | ||
53 | xilinx-dp: Add trailing '\n' to qemu_log() call | ||
54 | ppc/pnv: Add trailing '\n' to qemu_log() calls | ||
55 | hw/core/register: Add trailing '\n' to qemu_log() call | ||
56 | hw/mips/boston: Add trailing '\n' to qemu_log() calls | ||
57 | stellaris: Add trailing '\n' to qemu_log() calls | ||
58 | target/arm: Add trailing '\n' to qemu_log() calls | ||
59 | target/m68k: Add trailing '\n' to qemu_log() call | ||
60 | RISC-V: Add trailing '\n' to qemu_log() calls | ||
61 | target/xtensa: Add trailing '\n' to qemu_log() calls | ||
62 | sdcard: Update the Configuration Register (SCR) to Spec Version 1.10 | ||
63 | sdcard: Allow commands valid in SPI mode | ||
64 | sdcard: Add a 'spec_version' property, default to Spec v2.00 | ||
65 | sdcard: Disable SEND_IF_COND (CMD8) for Spec v1 | ||
66 | sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR) | ||
67 | sdcard: Disable CMD19/CMD23 for Spec v2 | ||
68 | 42 | ||
69 | Shannon Zhao (1): | 43 | Ani Sinha (1): |
70 | arm_gicv3_kvm: kvm_dist_get/put: skip the registers banked by GICR | 44 | MAINTAINERS: Adding myself as a reviewer of some components |
71 | 45 | ||
72 | Thomas Huth (1): | 46 | Bernhard Beschow (2): |
73 | hw/arm: Remove the deprecated xlnx-ep108 machine | 47 | Mark remaining global TypeInfo instances as const |
48 | checkpatch: Ensure that TypeInfos are const | ||
74 | 49 | ||
75 | Makefile.objs | 1 + | 50 | Patrick Venture (1): |
76 | hw/misc/Makefile.objs | 1 + | 51 | hw/arm: add initial mori-bmc board |
77 | tests/Makefile.include | 2 + | ||
78 | include/hw/i2c/smbus.h | 1 + | ||
79 | include/hw/intc/arm_gicv3_common.h | 1 + | ||
80 | include/hw/misc/pca9552.h | 32 +++++ | ||
81 | include/hw/misc/pca9552_regs.h | 32 +++++ | ||
82 | include/hw/net/ftgmac100.h | 7 +- | ||
83 | include/hw/sd/sd.h | 6 + | ||
84 | tests/libqos/i2c.h | 2 + | ||
85 | hw/arm/aspeed.c | 88 +++++++++++++- | ||
86 | hw/arm/stellaris.c | 11 +- | ||
87 | hw/arm/xlnx-zcu102.c | 62 +--------- | ||
88 | hw/char/digic-uart.c | 4 +- | ||
89 | hw/core/register.c | 2 +- | ||
90 | hw/display/xlnx_dp.c | 4 +- | ||
91 | hw/i2c/core.c | 25 ++-- | ||
92 | hw/i2c/smbus_eeprom.c | 16 ++- | ||
93 | hw/intc/arm_gicv3_common.c | 79 ++++++++++++ | ||
94 | hw/intc/arm_gicv3_kvm.c | 38 ++++++ | ||
95 | hw/mips/boston.c | 8 +- | ||
96 | hw/misc/pca9552.c | 240 +++++++++++++++++++++++++++++++++++++ | ||
97 | hw/net/ftgmac100.c | 64 ++++++---- | ||
98 | hw/ppc/pnv_core.c | 4 +- | ||
99 | hw/sd/milkymist-memcard.c | 2 +- | ||
100 | hw/sd/sd.c | 50 +++++--- | ||
101 | hw/timer/digic-timer.c | 4 +- | ||
102 | target/arm/helper.c | 4 +- | ||
103 | target/m68k/translate.c | 2 +- | ||
104 | target/riscv/op_helper.c | 6 +- | ||
105 | target/xtensa/translate.c | 6 +- | ||
106 | tests/pca9552-test.c | 116 ++++++++++++++++++ | ||
107 | tests/tmp105-test.c | 2 - | ||
108 | default-configs/arm-softmmu.mak | 1 + | ||
109 | hw/i2c/trace-events | 7 ++ | ||
110 | qemu-doc.texi | 5 - | ||
111 | 36 files changed, 788 insertions(+), 147 deletions(-) | ||
112 | create mode 100644 include/hw/misc/pca9552.h | ||
113 | create mode 100644 include/hw/misc/pca9552_regs.h | ||
114 | create mode 100644 hw/misc/pca9552.c | ||
115 | create mode 100644 tests/pca9552-test.c | ||
116 | create mode 100644 hw/i2c/trace-events | ||
117 | 52 | ||
53 | Pavel Dovgalyuk (1): | ||
54 | hw/timer: fix a9gtimer vmstate | ||
55 | |||
56 | Peter Maydell (14): | ||
57 | target/arm: Move '-cpu host' code to cpu64.c | ||
58 | target/arm: Use aarch64_cpu_register() for 'host' CPU type | ||
59 | target/arm: Make KVM -cpu max exactly like -cpu host | ||
60 | target/arm: Unindent unnecessary else-clause | ||
61 | target/arm: Fix '-cpu max' for HVF | ||
62 | target/arm: Support PAuth extension for hvf | ||
63 | Kconfig: Add I2C_DEVICES device group | ||
64 | Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus | ||
65 | hw/arm/armv7m: Handle disconnected clock inputs | ||
66 | include: Move qemu_madvise() and related #defines to new qemu/madvise.h | ||
67 | include: Move qemu_mprotect_*() to new qemu/mprotect.h | ||
68 | include: Move QEMU_MAP_* constants to mmap-alloc.h | ||
69 | include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h | ||
70 | include: Move hardware version declarations to new qemu/hw-version.h | ||
71 | |||
72 | Philippe Mathieu-Daudé (1): | ||
73 | ui/cocoa: Remove allowedFileTypes restriction in SavePanel | ||
74 | |||
75 | Shengtan Mao (1): | ||
76 | tests/qtest: add qtests for npcm7xx sdhci | ||
77 | |||
78 | docs/devel/kconfig.rst | 8 +- | ||
79 | docs/system/arm/nuvoton.rst | 1 + | ||
80 | include/qemu/cacheinfo.h | 21 +++ | ||
81 | include/qemu/hw-version.h | 27 ++++ | ||
82 | include/qemu/madvise.h | 95 +++++++++++ | ||
83 | include/qemu/mmap-alloc.h | 23 +++ | ||
84 | include/qemu/mprotect.h | 14 ++ | ||
85 | include/qemu/osdep.h | 132 ---------------- | ||
86 | accel/tcg/translate-all.c | 1 + | ||
87 | backends/hostmem-file.c | 1 + | ||
88 | backends/hostmem.c | 1 + | ||
89 | hw/arm/armv7m.c | 26 ++- | ||
90 | hw/arm/npcm7xx_boards.c | 32 ++++ | ||
91 | hw/arm/nseries.c | 1 + | ||
92 | hw/core/generic-loader.c | 2 +- | ||
93 | hw/core/guest-loader.c | 2 +- | ||
94 | hw/display/bcm2835_fb.c | 2 +- | ||
95 | hw/display/i2c-ddc.c | 2 +- | ||
96 | hw/display/macfb.c | 4 +- | ||
97 | hw/display/virtio-vga.c | 2 +- | ||
98 | hw/dma/bcm2835_dma.c | 2 +- | ||
99 | hw/i386/pc_piix.c | 2 +- | ||
100 | hw/i386/sgx-epc.c | 2 +- | ||
101 | hw/ide/core.c | 1 + | ||
102 | hw/intc/bcm2835_ic.c | 2 +- | ||
103 | hw/intc/bcm2836_control.c | 2 +- | ||
104 | hw/ipmi/ipmi.c | 4 +- | ||
105 | hw/mem/nvdimm.c | 2 +- | ||
106 | hw/mem/pc-dimm.c | 2 +- | ||
107 | hw/misc/bcm2835_mbox.c | 2 +- | ||
108 | hw/misc/bcm2835_powermgt.c | 2 +- | ||
109 | hw/misc/bcm2835_property.c | 2 +- | ||
110 | hw/misc/bcm2835_rng.c | 2 +- | ||
111 | hw/misc/pvpanic-isa.c | 2 +- | ||
112 | hw/misc/pvpanic-pci.c | 2 +- | ||
113 | hw/net/fsl_etsec/etsec.c | 2 +- | ||
114 | hw/ppc/prep_systemio.c | 2 +- | ||
115 | hw/ppc/spapr_iommu.c | 2 +- | ||
116 | hw/s390x/s390-pci-bus.c | 2 +- | ||
117 | hw/s390x/sclp.c | 2 +- | ||
118 | hw/s390x/tod-kvm.c | 2 +- | ||
119 | hw/s390x/tod-tcg.c | 2 +- | ||
120 | hw/s390x/tod.c | 2 +- | ||
121 | hw/scsi/lsi53c895a.c | 2 +- | ||
122 | hw/scsi/megasas.c | 1 + | ||
123 | hw/scsi/scsi-bus.c | 1 + | ||
124 | hw/scsi/scsi-disk.c | 1 + | ||
125 | hw/sd/allwinner-sdhost.c | 2 +- | ||
126 | hw/sd/aspeed_sdhci.c | 2 +- | ||
127 | hw/sd/bcm2835_sdhost.c | 2 +- | ||
128 | hw/sd/cadence_sdhci.c | 2 +- | ||
129 | hw/sd/npcm7xx_sdhci.c | 2 +- | ||
130 | hw/timer/a9gtimer.c | 21 +++ | ||
131 | hw/usb/dev-mtp.c | 2 +- | ||
132 | hw/usb/host-libusb.c | 2 +- | ||
133 | hw/vfio/igd.c | 2 +- | ||
134 | hw/virtio/virtio-balloon.c | 1 + | ||
135 | hw/virtio/virtio-pmem.c | 2 +- | ||
136 | migration/postcopy-ram.c | 1 + | ||
137 | migration/qemu-file.c | 1 + | ||
138 | migration/ram.c | 1 + | ||
139 | plugins/loader.c | 1 + | ||
140 | qom/object.c | 4 +- | ||
141 | softmmu/physmem.c | 1 + | ||
142 | softmmu/vl.c | 1 + | ||
143 | target/arm/cpu.c | 30 ---- | ||
144 | target/arm/cpu64.c | 331 +++++++++++++++++++++------------------ | ||
145 | target/arm/hvf/hvf.c | 83 +++++++--- | ||
146 | target/i386/cpu.c | 1 + | ||
147 | target/s390x/cpu_models.c | 1 + | ||
148 | tcg/region.c | 3 + | ||
149 | tcg/tcg.c | 1 + | ||
150 | tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++ | ||
151 | util/atomic64.c | 1 + | ||
152 | util/cacheflush.c | 1 + | ||
153 | util/cacheinfo.c | 1 + | ||
154 | util/osdep.c | 3 + | ||
155 | util/oslib-posix.c | 1 + | ||
156 | MAINTAINERS | 5 + | ||
157 | hw/arm/Kconfig | 10 ++ | ||
158 | hw/i2c/Kconfig | 5 + | ||
159 | hw/rtc/Kconfig | 2 + | ||
160 | hw/sensor/Kconfig | 5 + | ||
161 | scripts/checkpatch.pl | 1 + | ||
162 | tests/qtest/meson.build | 1 + | ||
163 | ui/cocoa.m | 15 +- | ||
164 | 86 files changed, 822 insertions(+), 393 deletions(-) | ||
165 | create mode 100644 include/qemu/cacheinfo.h | ||
166 | create mode 100644 include/qemu/hw-version.h | ||
167 | create mode 100644 include/qemu/madvise.h | ||
168 | create mode 100644 include/qemu/mprotect.h | ||
169 | create mode 100644 tests/qtest/npcm7xx_sdhci-test.c | ||
170 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Ani Sinha <ani@anisinha.ca> |
---|---|---|---|
2 | 2 | ||
3 | These commands got introduced by Spec v3 | 3 | Added myself as a reviewer of vmgenid, unimplemented device and empty slot. |
4 | (see 0c3fb03f7ec and 4481bbc79d2). | ||
5 | 4 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Signed-off-by: Ani Sinha <ani@anisinha.ca> |
7 | Message-id: 20180607180641.874-7-f4bug@amsat.org | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Message-id: 20220131122001.1476101-1-ani@anisinha.ca |
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 9 | --- |
11 | hw/sd/sd.c | 6 ++++++ | 10 | MAINTAINERS | 3 +++ |
12 | 1 file changed, 6 insertions(+) | 11 | 1 file changed, 3 insertions(+) |
13 | 12 | ||
14 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | 13 | diff --git a/MAINTAINERS b/MAINTAINERS |
15 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/sd/sd.c | 15 | --- a/MAINTAINERS |
17 | +++ b/hw/sd/sd.c | 16 | +++ b/MAINTAINERS |
18 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | 17 | @@ -XXX,XX +XXX,XX @@ F: tests/qtest/prom-env-test.c |
19 | break; | 18 | |
20 | 19 | VM Generation ID | |
21 | case 19: /* CMD19: SEND_TUNING_BLOCK (SD) */ | 20 | S: Orphan |
22 | + if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { | 21 | +R: Ani Sinha <ani@anisinha.ca> |
23 | + break; | 22 | F: hw/acpi/vmgenid.c |
24 | + } | 23 | F: include/hw/acpi/vmgenid.h |
25 | if (sd->state == sd_transfer_state) { | 24 | F: docs/specs/vmgenid.txt |
26 | sd->state = sd_sendingdata_state; | 25 | @@ -XXX,XX +XXX,XX @@ F: hw/misc/led.c |
27 | sd->data_offset = 0; | 26 | Unimplemented device |
28 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | 27 | M: Peter Maydell <peter.maydell@linaro.org> |
29 | break; | 28 | R: Philippe Mathieu-Daudé <f4bug@amsat.org> |
30 | 29 | +R: Ani Sinha <ani@anisinha.ca> | |
31 | case 23: /* CMD23: SET_BLOCK_COUNT */ | 30 | S: Maintained |
32 | + if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { | 31 | F: include/hw/misc/unimp.h |
33 | + break; | 32 | F: hw/misc/unimp.c |
34 | + } | 33 | @@ -XXX,XX +XXX,XX @@ F: hw/misc/unimp.c |
35 | switch (sd->state) { | 34 | Empty slot |
36 | case sd_transfer_state: | 35 | M: Artyom Tarasenko <atar4qemu@gmail.com> |
37 | sd->multi_blk_cnt = req.arg; | 36 | R: Philippe Mathieu-Daudé <f4bug@amsat.org> |
37 | +R: Ani Sinha <ani@anisinha.ca> | ||
38 | S: Maintained | ||
39 | F: include/hw/misc/empty_slot.h | ||
40 | F: hw/misc/empty_slot.c | ||
38 | -- | 41 | -- |
39 | 2.17.1 | 42 | 2.25.1 |
40 | 43 | ||
41 | 44 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Shengtan Mao <stmao@google.com> |
---|---|---|---|
2 | 2 | ||
3 | From the "Physical Layer Simplified Specification Version 1.10" | 3 | Reviewed-by: Hao Wu <wuhaotsh@google.com> |
4 | Chapter 7.3 "SPI Mode Transaction Packets" | 4 | Reviewed-by: Chris Rauer <crauer@google.com> |
5 | Table 57: "Commands and arguments" | 5 | Signed-off-by: Shengtan Mao <stmao@google.com> |
6 | 6 | Signed-off-by: Patrick Venture <venture@google.com> | |
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Message-id: 20220208181843.4003568-1-venture@google.com |
8 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
9 | Message-id: 20180607180641.874-3-f4bug@amsat.org | ||
10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | hw/sd/sd.c | 14 -------------- | 11 | tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++++++++ |
14 | 1 file changed, 14 deletions(-) | 12 | tests/qtest/meson.build | 1 + |
15 | 13 | 2 files changed, 216 insertions(+) | |
16 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | 14 | create mode 100644 tests/qtest/npcm7xx_sdhci-test.c |
15 | |||
16 | diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c | ||
17 | new file mode 100644 | ||
18 | index XXXXXXX..XXXXXXX | ||
19 | --- /dev/null | ||
20 | +++ b/tests/qtest/npcm7xx_sdhci-test.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | +/* | ||
23 | + * QTests for NPCM7xx SD-3.0 / MMC-4.51 Host Controller | ||
24 | + * | ||
25 | + * Copyright (c) 2022 Google LLC | ||
26 | + * | ||
27 | + * This program is free software; you can redistribute it and/or modify it | ||
28 | + * under the terms of the GNU General Public License as published by the | ||
29 | + * Free Software Foundation; either version 2 of the License, or | ||
30 | + * (at your option) any later version. | ||
31 | + * | ||
32 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
33 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
34 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
35 | + * for more details. | ||
36 | + */ | ||
37 | + | ||
38 | +#include "qemu/osdep.h" | ||
39 | +#include "hw/sd/npcm7xx_sdhci.h" | ||
40 | + | ||
41 | +#include "libqos/libqtest.h" | ||
42 | +#include "libqtest-single.h" | ||
43 | +#include "libqos/sdhci-cmd.h" | ||
44 | + | ||
45 | +#define NPCM7XX_REG_SIZE 0x100 | ||
46 | +#define NPCM7XX_MMC_BA 0xF0842000 | ||
47 | +#define NPCM7XX_BLK_SIZE 512 | ||
48 | +#define NPCM7XX_TEST_IMAGE_SIZE (1 << 30) | ||
49 | + | ||
50 | +char *sd_path; | ||
51 | + | ||
52 | +static QTestState *setup_sd_card(void) | ||
53 | +{ | ||
54 | + QTestState *qts = qtest_initf( | ||
55 | + "-machine kudo-bmc " | ||
56 | + "-device sd-card,drive=drive0 " | ||
57 | + "-drive id=drive0,if=none,file=%s,format=raw,auto-read-only=off", | ||
58 | + sd_path); | ||
59 | + | ||
60 | + qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_SWRST, SDHC_RESET_ALL); | ||
61 | + qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_CLKCON, | ||
62 | + SDHC_CLOCK_SDCLK_EN | SDHC_CLOCK_INT_STABLE | | ||
63 | + SDHC_CLOCK_INT_EN); | ||
64 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_APP_CMD); | ||
65 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x41200000, 0, (41 << 8)); | ||
66 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID); | ||
67 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR); | ||
68 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0, | ||
69 | + SDHC_SELECT_DESELECT_CARD); | ||
70 | + | ||
71 | + return qts; | ||
72 | +} | ||
73 | + | ||
74 | +static void write_sdread(QTestState *qts, const char *msg) | ||
75 | +{ | ||
76 | + int fd, ret; | ||
77 | + size_t len = strlen(msg); | ||
78 | + char *rmsg = g_malloc(len); | ||
79 | + | ||
80 | + /* write message to sd */ | ||
81 | + fd = open(sd_path, O_WRONLY); | ||
82 | + g_assert(fd >= 0); | ||
83 | + ret = write(fd, msg, len); | ||
84 | + close(fd); | ||
85 | + g_assert(ret == len); | ||
86 | + | ||
87 | + /* read message using sdhci */ | ||
88 | + ret = sdhci_read_cmd(qts, NPCM7XX_MMC_BA, rmsg, len); | ||
89 | + g_assert(ret == len); | ||
90 | + g_assert(!strcmp(rmsg, msg)); | ||
91 | + | ||
92 | + g_free(rmsg); | ||
93 | +} | ||
94 | + | ||
95 | +/* Check MMC can read values from sd */ | ||
96 | +static void test_read_sd(void) | ||
97 | +{ | ||
98 | + QTestState *qts = setup_sd_card(); | ||
99 | + | ||
100 | + write_sdread(qts, "hello world"); | ||
101 | + write_sdread(qts, "goodbye"); | ||
102 | + | ||
103 | + qtest_quit(qts); | ||
104 | +} | ||
105 | + | ||
106 | +static void sdwrite_read(QTestState *qts, const char *msg) | ||
107 | +{ | ||
108 | + int fd, ret; | ||
109 | + size_t len = strlen(msg); | ||
110 | + char *rmsg = g_malloc(len); | ||
111 | + | ||
112 | + /* write message using sdhci */ | ||
113 | + sdhci_write_cmd(qts, NPCM7XX_MMC_BA, msg, len, NPCM7XX_BLK_SIZE); | ||
114 | + | ||
115 | + /* read message from sd */ | ||
116 | + fd = open(sd_path, O_RDONLY); | ||
117 | + g_assert(fd >= 0); | ||
118 | + ret = read(fd, rmsg, len); | ||
119 | + close(fd); | ||
120 | + g_assert(ret == len); | ||
121 | + | ||
122 | + g_assert(!strcmp(rmsg, msg)); | ||
123 | + | ||
124 | + g_free(rmsg); | ||
125 | +} | ||
126 | + | ||
127 | +/* Check MMC can write values to sd */ | ||
128 | +static void test_write_sd(void) | ||
129 | +{ | ||
130 | + QTestState *qts = setup_sd_card(); | ||
131 | + | ||
132 | + sdwrite_read(qts, "hello world"); | ||
133 | + sdwrite_read(qts, "goodbye"); | ||
134 | + | ||
135 | + qtest_quit(qts); | ||
136 | +} | ||
137 | + | ||
138 | +/* Check SDHCI has correct default values. */ | ||
139 | +static void test_reset(void) | ||
140 | +{ | ||
141 | + QTestState *qts = qtest_init("-machine kudo-bmc"); | ||
142 | + uint64_t addr = NPCM7XX_MMC_BA; | ||
143 | + uint64_t end_addr = addr + NPCM7XX_REG_SIZE; | ||
144 | + uint16_t prstvals_resets[] = {NPCM7XX_PRSTVALS_0_RESET, | ||
145 | + NPCM7XX_PRSTVALS_1_RESET, | ||
146 | + 0, | ||
147 | + NPCM7XX_PRSTVALS_3_RESET, | ||
148 | + 0, | ||
149 | + 0}; | ||
150 | + int i; | ||
151 | + uint32_t mask; | ||
152 | + | ||
153 | + while (addr < end_addr) { | ||
154 | + switch (addr - NPCM7XX_MMC_BA) { | ||
155 | + case SDHC_PRNSTS: | ||
156 | + /* | ||
157 | + * ignores bits 20 to 24: they are changed when reading registers | ||
158 | + */ | ||
159 | + mask = 0x1f00000; | ||
160 | + g_assert_cmphex(qtest_readl(qts, addr) | mask, ==, | ||
161 | + NPCM7XX_PRSNTS_RESET | mask); | ||
162 | + addr += 4; | ||
163 | + break; | ||
164 | + case SDHC_BLKGAP: | ||
165 | + g_assert_cmphex(qtest_readb(qts, addr), ==, NPCM7XX_BLKGAP_RESET); | ||
166 | + addr += 1; | ||
167 | + break; | ||
168 | + case SDHC_CAPAB: | ||
169 | + g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_CAPAB_RESET); | ||
170 | + addr += 8; | ||
171 | + break; | ||
172 | + case SDHC_MAXCURR: | ||
173 | + g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_MAXCURR_RESET); | ||
174 | + addr += 8; | ||
175 | + break; | ||
176 | + case SDHC_HCVER: | ||
177 | + g_assert_cmphex(qtest_readw(qts, addr), ==, NPCM7XX_HCVER_RESET); | ||
178 | + addr += 2; | ||
179 | + break; | ||
180 | + case NPCM7XX_PRSTVALS: | ||
181 | + for (i = 0; i < NPCM7XX_PRSTVALS_SIZE; ++i) { | ||
182 | + g_assert_cmphex(qtest_readw(qts, addr + 2 * i), ==, | ||
183 | + prstvals_resets[i]); | ||
184 | + } | ||
185 | + addr += NPCM7XX_PRSTVALS_SIZE * 2; | ||
186 | + break; | ||
187 | + default: | ||
188 | + g_assert_cmphex(qtest_readb(qts, addr), ==, 0); | ||
189 | + addr += 1; | ||
190 | + } | ||
191 | + } | ||
192 | + | ||
193 | + qtest_quit(qts); | ||
194 | +} | ||
195 | + | ||
196 | +static void drive_destroy(void) | ||
197 | +{ | ||
198 | + unlink(sd_path); | ||
199 | + g_free(sd_path); | ||
200 | +} | ||
201 | + | ||
202 | +static void drive_create(void) | ||
203 | +{ | ||
204 | + int fd, ret; | ||
205 | + GError *error = NULL; | ||
206 | + | ||
207 | + /* Create a temporary raw image */ | ||
208 | + fd = g_file_open_tmp("sdhci_XXXXXX", &sd_path, &error); | ||
209 | + if (fd == -1) { | ||
210 | + fprintf(stderr, "unable to create sdhci file: %s\n", error->message); | ||
211 | + g_error_free(error); | ||
212 | + } | ||
213 | + g_assert(sd_path != NULL); | ||
214 | + | ||
215 | + ret = ftruncate(fd, NPCM7XX_TEST_IMAGE_SIZE); | ||
216 | + g_assert_cmpint(ret, ==, 0); | ||
217 | + g_message("%s", sd_path); | ||
218 | + close(fd); | ||
219 | +} | ||
220 | + | ||
221 | +int main(int argc, char **argv) | ||
222 | +{ | ||
223 | + int ret; | ||
224 | + | ||
225 | + drive_create(); | ||
226 | + | ||
227 | + g_test_init(&argc, &argv, NULL); | ||
228 | + | ||
229 | + qtest_add_func("npcm7xx_sdhci/reset", test_reset); | ||
230 | + qtest_add_func("npcm7xx_sdhci/write_sd", test_write_sd); | ||
231 | + qtest_add_func("npcm7xx_sdhci/read_sd", test_read_sd); | ||
232 | + | ||
233 | + ret = g_test_run(); | ||
234 | + drive_destroy(); | ||
235 | + return ret; | ||
236 | +} | ||
237 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
17 | index XXXXXXX..XXXXXXX 100644 | 238 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/sd/sd.c | 239 | --- a/tests/qtest/meson.build |
19 | +++ b/hw/sd/sd.c | 240 | +++ b/tests/qtest/meson.build |
20 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | 241 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ |
21 | return sd_illegal; | 242 | 'npcm7xx_gpio-test', |
22 | 243 | 'npcm7xx_pwm-test', | |
23 | case 6: /* CMD6: SWITCH_FUNCTION */ | 244 | 'npcm7xx_rng-test', |
24 | - if (sd->spi) | 245 | + 'npcm7xx_sdhci-test', |
25 | - goto bad_cmd; | 246 | 'npcm7xx_smbus-test', |
26 | switch (sd->mode) { | 247 | 'npcm7xx_timer-test', |
27 | case sd_data_transfer_mode: | 248 | 'npcm7xx_watchdog_timer-test'] + \ |
28 | sd_function_switch(sd, req.arg); | ||
29 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | ||
30 | |||
31 | /* Block write commands (Class 4) */ | ||
32 | case 24: /* CMD24: WRITE_SINGLE_BLOCK */ | ||
33 | - if (sd->spi) { | ||
34 | - goto unimplemented_spi_cmd; | ||
35 | - } | ||
36 | switch (sd->state) { | ||
37 | case sd_transfer_state: | ||
38 | /* Writing in SPI mode not implemented. */ | ||
39 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | ||
40 | break; | ||
41 | |||
42 | case 25: /* CMD25: WRITE_MULTIPLE_BLOCK */ | ||
43 | - if (sd->spi) { | ||
44 | - goto unimplemented_spi_cmd; | ||
45 | - } | ||
46 | switch (sd->state) { | ||
47 | case sd_transfer_state: | ||
48 | /* Writing in SPI mode not implemented. */ | ||
49 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | ||
50 | break; | ||
51 | |||
52 | case 27: /* CMD27: PROGRAM_CSD */ | ||
53 | - if (sd->spi) { | ||
54 | - goto unimplemented_spi_cmd; | ||
55 | - } | ||
56 | switch (sd->state) { | ||
57 | case sd_transfer_state: | ||
58 | sd->state = sd_receivingdata_state; | ||
59 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | ||
60 | |||
61 | /* Lock card commands (Class 7) */ | ||
62 | case 42: /* CMD42: LOCK_UNLOCK */ | ||
63 | - if (sd->spi) { | ||
64 | - goto unimplemented_spi_cmd; | ||
65 | - } | ||
66 | switch (sd->state) { | ||
67 | case sd_transfer_state: | ||
68 | sd->state = sd_receivingdata_state; | ||
69 | -- | 249 | -- |
70 | 2.17.1 | 250 | 2.25.1 |
71 | 251 | ||
72 | 252 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | This is a ethernet wire limitation not needed in emulation. It breaks | 3 | We are parsing the syndrome field for sysregs in multiple places across |
4 | U-Boot n/w stack also. | 4 | the hvf code, but repeat shift/mask operations with hard coded constants |
5 | every time. This is an error prone approach and makes it harder to reason | ||
6 | about the correctness of these operations. | ||
5 | 7 | ||
6 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 8 | Let's introduce macros that allow us to unify the constants used as well |
7 | Message-id: 20180530061711.23673-5-clg@kaod.org | 9 | as create new helpers to extract fields from the sysreg value. |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | |
11 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
13 | Reviewed-by: Cameron Esfahani <dirty@apple.com <mailto:dirty@apple.com>> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20220209124135.69183-1-agraf@csgraf.de | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 17 | --- |
11 | hw/net/ftgmac100.c | 6 ------ | 18 | target/arm/hvf/hvf.c | 69 ++++++++++++++++++++++++++++++-------------- |
12 | 1 file changed, 6 deletions(-) | 19 | 1 file changed, 47 insertions(+), 22 deletions(-) |
13 | 20 | ||
14 | diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c | 21 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
15 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/net/ftgmac100.c | 23 | --- a/target/arm/hvf/hvf.c |
17 | +++ b/hw/net/ftgmac100.c | 24 | +++ b/target/arm/hvf/hvf.c |
18 | @@ -XXX,XX +XXX,XX @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf, | 25 | @@ -XXX,XX +XXX,XX @@ |
19 | return size; | 26 | ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, crn, crm, op0, op1, op2) |
27 | #define PL1_WRITE_MASK 0x4 | ||
28 | |||
29 | +#define SYSREG_OP0_SHIFT 20 | ||
30 | +#define SYSREG_OP0_MASK 0x3 | ||
31 | +#define SYSREG_OP0(sysreg) ((sysreg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK) | ||
32 | +#define SYSREG_OP1_SHIFT 14 | ||
33 | +#define SYSREG_OP1_MASK 0x7 | ||
34 | +#define SYSREG_OP1(sysreg) ((sysreg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK) | ||
35 | +#define SYSREG_CRN_SHIFT 10 | ||
36 | +#define SYSREG_CRN_MASK 0xf | ||
37 | +#define SYSREG_CRN(sysreg) ((sysreg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK) | ||
38 | +#define SYSREG_CRM_SHIFT 1 | ||
39 | +#define SYSREG_CRM_MASK 0xf | ||
40 | +#define SYSREG_CRM(sysreg) ((sysreg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK) | ||
41 | +#define SYSREG_OP2_SHIFT 17 | ||
42 | +#define SYSREG_OP2_MASK 0x7 | ||
43 | +#define SYSREG_OP2(sysreg) ((sysreg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK) | ||
44 | + | ||
45 | #define SYSREG(op0, op1, crn, crm, op2) \ | ||
46 | - ((op0 << 20) | (op2 << 17) | (op1 << 14) | (crn << 10) | (crm << 1)) | ||
47 | -#define SYSREG_MASK SYSREG(0x3, 0x7, 0xf, 0xf, 0x7) | ||
48 | + ((op0 << SYSREG_OP0_SHIFT) | \ | ||
49 | + (op1 << SYSREG_OP1_SHIFT) | \ | ||
50 | + (crn << SYSREG_CRN_SHIFT) | \ | ||
51 | + (crm << SYSREG_CRM_SHIFT) | \ | ||
52 | + (op2 << SYSREG_OP2_SHIFT)) | ||
53 | +#define SYSREG_MASK \ | ||
54 | + SYSREG(SYSREG_OP0_MASK, \ | ||
55 | + SYSREG_OP1_MASK, \ | ||
56 | + SYSREG_CRN_MASK, \ | ||
57 | + SYSREG_CRM_MASK, \ | ||
58 | + SYSREG_OP2_MASK) | ||
59 | #define SYSREG_OSLAR_EL1 SYSREG(2, 0, 1, 0, 4) | ||
60 | #define SYSREG_OSLSR_EL1 SYSREG(2, 0, 1, 1, 4) | ||
61 | #define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4) | ||
62 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) | ||
63 | default: | ||
64 | cpu_synchronize_state(cpu); | ||
65 | trace_hvf_unhandled_sysreg_read(env->pc, reg, | ||
66 | - (reg >> 20) & 0x3, | ||
67 | - (reg >> 14) & 0x7, | ||
68 | - (reg >> 10) & 0xf, | ||
69 | - (reg >> 1) & 0xf, | ||
70 | - (reg >> 17) & 0x7); | ||
71 | + SYSREG_OP0(reg), | ||
72 | + SYSREG_OP1(reg), | ||
73 | + SYSREG_CRN(reg), | ||
74 | + SYSREG_CRM(reg), | ||
75 | + SYSREG_OP2(reg)); | ||
76 | hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
77 | return 1; | ||
20 | } | 78 | } |
21 | 79 | ||
22 | - if (size < 64 && !(s->maccr & FTGMAC100_MACCR_RX_RUNT)) { | 80 | trace_hvf_sysreg_read(reg, |
23 | - qemu_log_mask(LOG_GUEST_ERROR, "%s: dropped runt frame of %zd bytes\n", | 81 | - (reg >> 20) & 0x3, |
24 | - __func__, size); | 82 | - (reg >> 14) & 0x7, |
25 | - return size; | 83 | - (reg >> 10) & 0xf, |
26 | - } | 84 | - (reg >> 1) & 0xf, |
27 | - | 85 | - (reg >> 17) & 0x7, |
28 | if (!ftgmac100_filter(s, buf, size)) { | 86 | + SYSREG_OP0(reg), |
29 | return size; | 87 | + SYSREG_OP1(reg), |
88 | + SYSREG_CRN(reg), | ||
89 | + SYSREG_CRM(reg), | ||
90 | + SYSREG_OP2(reg), | ||
91 | val); | ||
92 | hvf_set_reg(cpu, rt, val); | ||
93 | |||
94 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) | ||
95 | CPUARMState *env = &arm_cpu->env; | ||
96 | |||
97 | trace_hvf_sysreg_write(reg, | ||
98 | - (reg >> 20) & 0x3, | ||
99 | - (reg >> 14) & 0x7, | ||
100 | - (reg >> 10) & 0xf, | ||
101 | - (reg >> 1) & 0xf, | ||
102 | - (reg >> 17) & 0x7, | ||
103 | + SYSREG_OP0(reg), | ||
104 | + SYSREG_OP1(reg), | ||
105 | + SYSREG_CRN(reg), | ||
106 | + SYSREG_CRM(reg), | ||
107 | + SYSREG_OP2(reg), | ||
108 | val); | ||
109 | |||
110 | switch (reg) { | ||
111 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) | ||
112 | default: | ||
113 | cpu_synchronize_state(cpu); | ||
114 | trace_hvf_unhandled_sysreg_write(env->pc, reg, | ||
115 | - (reg >> 20) & 0x3, | ||
116 | - (reg >> 14) & 0x7, | ||
117 | - (reg >> 10) & 0xf, | ||
118 | - (reg >> 1) & 0xf, | ||
119 | - (reg >> 17) & 0x7); | ||
120 | + SYSREG_OP0(reg), | ||
121 | + SYSREG_OP1(reg), | ||
122 | + SYSREG_CRN(reg), | ||
123 | + SYSREG_CRM(reg), | ||
124 | + SYSREG_OP2(reg)); | ||
125 | hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
126 | return 1; | ||
30 | } | 127 | } |
31 | -- | 128 | -- |
32 | 2.17.1 | 129 | 2.25.1 |
33 | 130 | ||
34 | 131 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | CMD8 is "Reserved" in Spec v1.10. | 3 | Recent Linux versions added support to read ID_AA64ISAR2_EL1. On M1, |
4 | those reads trap into QEMU which handles them as faults. | ||
4 | 5 | ||
5 | Spec v2.00 introduces the SEND_IF_COND command: | 6 | However, AArch64 ID registers should always read as RES0. Let's |
7 | handle them accordingly. | ||
6 | 8 | ||
7 | 6.4.1 Power Up | 9 | This fixes booting Linux 5.17 guests. |
8 | 10 | ||
9 | CMD8 is newly added in the Physical Layer Specification Version | 11 | Cc: qemu-stable@nongnu.org |
10 | 2.00 to support multiple voltage ranges and used to check whether | 12 | Reported-by: Ivan Babrou <ivan@cloudflare.com> |
11 | the card supports supplied voltage. The version 2.00 or later host | 13 | Signed-off-by: Alexander Graf <agraf@csgraf.de> |
12 | shall issue CMD8 and verify voltage before card initialization. | 14 | Message-id: 20220209124135.69183-2-agraf@csgraf.de |
13 | The host that does not support CMD8 shall supply high voltage range. | ||
14 | |||
15 | Message-Id: 201204252110.20873.paul@codesourcery.com | ||
16 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-id: 20180607180641.874-5-f4bug@amsat.org | ||
18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 17 | --- |
21 | hw/sd/sd.c | 4 +++- | 18 | target/arm/hvf/hvf.c | 14 ++++++++++++++ |
22 | 1 file changed, 3 insertions(+), 1 deletion(-) | 19 | 1 file changed, 14 insertions(+) |
23 | 20 | ||
24 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | 21 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
25 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/sd/sd.c | 23 | --- a/target/arm/hvf/hvf.c |
27 | +++ b/hw/sd/sd.c | 24 | +++ b/target/arm/hvf/hvf.c |
28 | @@ -XXX,XX +XXX,XX @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req) | 25 | @@ -XXX,XX +XXX,XX @@ static bool hvf_handle_psci_call(CPUState *cpu) |
26 | return true; | ||
27 | } | ||
28 | |||
29 | +static bool is_id_sysreg(uint32_t reg) | ||
30 | +{ | ||
31 | + return SYSREG_OP0(reg) == 3 && | ||
32 | + SYSREG_OP1(reg) == 0 && | ||
33 | + SYSREG_CRN(reg) == 0 && | ||
34 | + SYSREG_CRM(reg) >= 1 && | ||
35 | + SYSREG_CRM(reg) < 8; | ||
36 | +} | ||
37 | + | ||
38 | static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) | ||
39 | { | ||
40 | ARMCPU *arm_cpu = ARM_CPU(cpu); | ||
41 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) | ||
42 | /* Dummy register */ | ||
29 | break; | 43 | break; |
30 | 44 | default: | |
31 | case 8: /* CMD8: SEND_IF_COND */ | 45 | + if (is_id_sysreg(reg)) { |
32 | - /* Physical Layer Specification Version 2.00 command */ | 46 | + /* ID system registers read as RES0 */ |
33 | + if (sd->spec_version < SD_PHY_SPECv2_00_VERS) { | 47 | + val = 0; |
34 | + break; | 48 | + break; |
35 | + } | 49 | + } |
36 | if (sd->state != sd_idle_state) { | 50 | cpu_synchronize_state(cpu); |
37 | break; | 51 | trace_hvf_unhandled_sysreg_read(env->pc, reg, |
38 | } | 52 | SYSREG_OP0(reg), |
39 | -- | 53 | -- |
40 | 2.17.1 | 54 | 2.25.1 |
41 | 55 | ||
42 | 56 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | The Witherspoon boards are OpenPOWER system hosting POWER9 Processors. | 3 | More than 1k of TypeInfo instances are already marked as const. Mark the |
4 | Add support for their BMC including a couple of I2C devices as found | 4 | remaining ones, too. |
5 | on real HW. | ||
6 | 5 | ||
7 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 6 | This commit was created with: |
8 | Reviewed-by: Andrew Jeffery <andrew@aj.id.au> | 7 | git grep -z -l 'static TypeInfo' -- '*.c' | \ |
9 | Message-id: 20180530064049.27976-3-clg@kaod.org | 8 | xargs -0 sed -i 's/static TypeInfo/static const TypeInfo/' |
9 | |||
10 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
12 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
15 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
16 | Acked-by: Corey Minyard <cminyard@mvista.com> | ||
17 | Message-id: 20220117145805.173070-2-shentey@gmail.com | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 19 | --- |
12 | hw/arm/aspeed.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ | 20 | hw/core/generic-loader.c | 2 +- |
13 | 1 file changed, 49 insertions(+) | 21 | hw/core/guest-loader.c | 2 +- |
22 | hw/display/bcm2835_fb.c | 2 +- | ||
23 | hw/display/i2c-ddc.c | 2 +- | ||
24 | hw/display/macfb.c | 4 ++-- | ||
25 | hw/display/virtio-vga.c | 2 +- | ||
26 | hw/dma/bcm2835_dma.c | 2 +- | ||
27 | hw/i386/pc_piix.c | 2 +- | ||
28 | hw/i386/sgx-epc.c | 2 +- | ||
29 | hw/intc/bcm2835_ic.c | 2 +- | ||
30 | hw/intc/bcm2836_control.c | 2 +- | ||
31 | hw/ipmi/ipmi.c | 4 ++-- | ||
32 | hw/mem/nvdimm.c | 2 +- | ||
33 | hw/mem/pc-dimm.c | 2 +- | ||
34 | hw/misc/bcm2835_mbox.c | 2 +- | ||
35 | hw/misc/bcm2835_powermgt.c | 2 +- | ||
36 | hw/misc/bcm2835_property.c | 2 +- | ||
37 | hw/misc/bcm2835_rng.c | 2 +- | ||
38 | hw/misc/pvpanic-isa.c | 2 +- | ||
39 | hw/misc/pvpanic-pci.c | 2 +- | ||
40 | hw/net/fsl_etsec/etsec.c | 2 +- | ||
41 | hw/ppc/prep_systemio.c | 2 +- | ||
42 | hw/ppc/spapr_iommu.c | 2 +- | ||
43 | hw/s390x/s390-pci-bus.c | 2 +- | ||
44 | hw/s390x/sclp.c | 2 +- | ||
45 | hw/s390x/tod-kvm.c | 2 +- | ||
46 | hw/s390x/tod-tcg.c | 2 +- | ||
47 | hw/s390x/tod.c | 2 +- | ||
48 | hw/scsi/lsi53c895a.c | 2 +- | ||
49 | hw/sd/allwinner-sdhost.c | 2 +- | ||
50 | hw/sd/aspeed_sdhci.c | 2 +- | ||
51 | hw/sd/bcm2835_sdhost.c | 2 +- | ||
52 | hw/sd/cadence_sdhci.c | 2 +- | ||
53 | hw/sd/npcm7xx_sdhci.c | 2 +- | ||
54 | hw/usb/dev-mtp.c | 2 +- | ||
55 | hw/usb/host-libusb.c | 2 +- | ||
56 | hw/vfio/igd.c | 2 +- | ||
57 | hw/virtio/virtio-pmem.c | 2 +- | ||
58 | qom/object.c | 4 ++-- | ||
59 | 39 files changed, 42 insertions(+), 42 deletions(-) | ||
14 | 60 | ||
15 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 61 | diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c |
16 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/aspeed.c | 63 | --- a/hw/core/generic-loader.c |
18 | +++ b/hw/arm/aspeed.c | 64 | +++ b/hw/core/generic-loader.c |
19 | @@ -XXX,XX +XXX,XX @@ enum { | 65 | @@ -XXX,XX +XXX,XX @@ static void generic_loader_class_init(ObjectClass *klass, void *data) |
20 | PALMETTO_BMC, | 66 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); |
21 | AST2500_EVB, | 67 | } |
22 | ROMULUS_BMC, | 68 | |
23 | + WITHERSPOON_BMC, | 69 | -static TypeInfo generic_loader_info = { |
70 | +static const TypeInfo generic_loader_info = { | ||
71 | .name = TYPE_GENERIC_LOADER, | ||
72 | .parent = TYPE_DEVICE, | ||
73 | .instance_size = sizeof(GenericLoaderState), | ||
74 | diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/hw/core/guest-loader.c | ||
77 | +++ b/hw/core/guest-loader.c | ||
78 | @@ -XXX,XX +XXX,XX @@ static void guest_loader_class_init(ObjectClass *klass, void *data) | ||
79 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
80 | } | ||
81 | |||
82 | -static TypeInfo guest_loader_info = { | ||
83 | +static const TypeInfo guest_loader_info = { | ||
84 | .name = TYPE_GUEST_LOADER, | ||
85 | .parent = TYPE_DEVICE, | ||
86 | .instance_size = sizeof(GuestLoaderState), | ||
87 | diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c | ||
88 | index XXXXXXX..XXXXXXX 100644 | ||
89 | --- a/hw/display/bcm2835_fb.c | ||
90 | +++ b/hw/display/bcm2835_fb.c | ||
91 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data) | ||
92 | dc->vmsd = &vmstate_bcm2835_fb; | ||
93 | } | ||
94 | |||
95 | -static TypeInfo bcm2835_fb_info = { | ||
96 | +static const TypeInfo bcm2835_fb_info = { | ||
97 | .name = TYPE_BCM2835_FB, | ||
98 | .parent = TYPE_SYS_BUS_DEVICE, | ||
99 | .instance_size = sizeof(BCM2835FBState), | ||
100 | diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/hw/display/i2c-ddc.c | ||
103 | +++ b/hw/display/i2c-ddc.c | ||
104 | @@ -XXX,XX +XXX,XX @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data) | ||
105 | isc->send = i2c_ddc_tx; | ||
106 | } | ||
107 | |||
108 | -static TypeInfo i2c_ddc_info = { | ||
109 | +static const TypeInfo i2c_ddc_info = { | ||
110 | .name = TYPE_I2CDDC, | ||
111 | .parent = TYPE_I2C_SLAVE, | ||
112 | .instance_size = sizeof(I2CDDCState), | ||
113 | diff --git a/hw/display/macfb.c b/hw/display/macfb.c | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/hw/display/macfb.c | ||
116 | +++ b/hw/display/macfb.c | ||
117 | @@ -XXX,XX +XXX,XX @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data) | ||
118 | device_class_set_props(dc, macfb_nubus_properties); | ||
119 | } | ||
120 | |||
121 | -static TypeInfo macfb_sysbus_info = { | ||
122 | +static const TypeInfo macfb_sysbus_info = { | ||
123 | .name = TYPE_MACFB, | ||
124 | .parent = TYPE_SYS_BUS_DEVICE, | ||
125 | .instance_size = sizeof(MacfbSysBusState), | ||
126 | .class_init = macfb_sysbus_class_init, | ||
24 | }; | 127 | }; |
25 | 128 | ||
26 | /* Palmetto hardware value: 0x120CE416 */ | 129 | -static TypeInfo macfb_nubus_info = { |
27 | @@ -XXX,XX +XXX,XX @@ enum { | 130 | +static const TypeInfo macfb_nubus_info = { |
28 | SCU_AST2500_HW_STRAP_ACPI_ENABLE | \ | 131 | .name = TYPE_NUBUS_MACFB, |
29 | SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER)) | 132 | .parent = TYPE_NUBUS_DEVICE, |
30 | 133 | .instance_size = sizeof(MacfbNubusState), | |
31 | +/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */ | 134 | diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c |
32 | +#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1 | 135 | index XXXXXXX..XXXXXXX 100644 |
33 | + | 136 | --- a/hw/display/virtio-vga.c |
34 | static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); | 137 | +++ b/hw/display/virtio-vga.c |
35 | static void ast2500_evb_i2c_init(AspeedBoardState *bmc); | 138 | @@ -XXX,XX +XXX,XX @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data) |
36 | +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); | 139 | virtio_vga_set_big_endian_fb); |
37 | 140 | } | |
38 | static const AspeedBoardConfig aspeed_boards[] = { | 141 | |
39 | [PALMETTO_BMC] = { | 142 | -static TypeInfo virtio_vga_base_info = { |
40 | @@ -XXX,XX +XXX,XX @@ static const AspeedBoardConfig aspeed_boards[] = { | 143 | +static const TypeInfo virtio_vga_base_info = { |
41 | .spi_model = "mx66l1g45g", | 144 | .name = TYPE_VIRTIO_VGA_BASE, |
42 | .num_cs = 2, | 145 | .parent = TYPE_VIRTIO_PCI, |
43 | }, | 146 | .instance_size = sizeof(VirtIOVGABase), |
44 | + [WITHERSPOON_BMC] = { | 147 | diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c |
45 | + .soc_name = "ast2500-a1", | 148 | index XXXXXXX..XXXXXXX 100644 |
46 | + .hw_strap1 = WITHERSPOON_BMC_HW_STRAP1, | 149 | --- a/hw/dma/bcm2835_dma.c |
47 | + .fmc_model = "mx25l25635e", | 150 | +++ b/hw/dma/bcm2835_dma.c |
48 | + .spi_model = "mx66l1g45g", | 151 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data) |
49 | + .num_cs = 2, | 152 | dc->vmsd = &vmstate_bcm2835_dma; |
50 | + .i2c_init = witherspoon_bmc_i2c_init, | 153 | } |
51 | + }, | 154 | |
155 | -static TypeInfo bcm2835_dma_info = { | ||
156 | +static const TypeInfo bcm2835_dma_info = { | ||
157 | .name = TYPE_BCM2835_DMA, | ||
158 | .parent = TYPE_SYS_BUS_DEVICE, | ||
159 | .instance_size = sizeof(BCM2835DMAState), | ||
160 | diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c | ||
161 | index XXXXXXX..XXXXXXX 100644 | ||
162 | --- a/hw/i386/pc_piix.c | ||
163 | +++ b/hw/i386/pc_piix.c | ||
164 | @@ -XXX,XX +XXX,XX @@ static void isa_bridge_class_init(ObjectClass *klass, void *data) | ||
165 | k->class_id = PCI_CLASS_BRIDGE_ISA; | ||
52 | }; | 166 | }; |
53 | 167 | ||
54 | #define FIRMWARE_ADDR 0x0 | 168 | -static TypeInfo isa_bridge_info = { |
55 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo romulus_bmc_type = { | 169 | +static const TypeInfo isa_bridge_info = { |
56 | .class_init = romulus_bmc_class_init, | 170 | .name = "igd-passthrough-isa-bridge", |
171 | .parent = TYPE_PCI_DEVICE, | ||
172 | .instance_size = sizeof(PCIDevice), | ||
173 | diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c | ||
174 | index XXXXXXX..XXXXXXX 100644 | ||
175 | --- a/hw/i386/sgx-epc.c | ||
176 | +++ b/hw/i386/sgx-epc.c | ||
177 | @@ -XXX,XX +XXX,XX @@ static void sgx_epc_class_init(ObjectClass *oc, void *data) | ||
178 | mdc->fill_device_info = sgx_epc_md_fill_device_info; | ||
179 | } | ||
180 | |||
181 | -static TypeInfo sgx_epc_info = { | ||
182 | +static const TypeInfo sgx_epc_info = { | ||
183 | .name = TYPE_SGX_EPC, | ||
184 | .parent = TYPE_DEVICE, | ||
185 | .instance_size = sizeof(SGXEPCDevice), | ||
186 | diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c | ||
187 | index XXXXXXX..XXXXXXX 100644 | ||
188 | --- a/hw/intc/bcm2835_ic.c | ||
189 | +++ b/hw/intc/bcm2835_ic.c | ||
190 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data) | ||
191 | dc->vmsd = &vmstate_bcm2835_ic; | ||
192 | } | ||
193 | |||
194 | -static TypeInfo bcm2835_ic_info = { | ||
195 | +static const TypeInfo bcm2835_ic_info = { | ||
196 | .name = TYPE_BCM2835_IC, | ||
197 | .parent = TYPE_SYS_BUS_DEVICE, | ||
198 | .instance_size = sizeof(BCM2835ICState), | ||
199 | diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c | ||
200 | index XXXXXXX..XXXXXXX 100644 | ||
201 | --- a/hw/intc/bcm2836_control.c | ||
202 | +++ b/hw/intc/bcm2836_control.c | ||
203 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data) | ||
204 | dc->vmsd = &vmstate_bcm2836_control; | ||
205 | } | ||
206 | |||
207 | -static TypeInfo bcm2836_control_info = { | ||
208 | +static const TypeInfo bcm2836_control_info = { | ||
209 | .name = TYPE_BCM2836_CONTROL, | ||
210 | .parent = TYPE_SYS_BUS_DEVICE, | ||
211 | .instance_size = sizeof(BCM2836ControlState), | ||
212 | diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c | ||
213 | index XXXXXXX..XXXXXXX 100644 | ||
214 | --- a/hw/ipmi/ipmi.c | ||
215 | +++ b/hw/ipmi/ipmi.c | ||
216 | @@ -XXX,XX +XXX,XX @@ static void ipmi_interface_class_init(ObjectClass *class, void *data) | ||
217 | ik->do_hw_op = ipmi_do_hw_op; | ||
218 | } | ||
219 | |||
220 | -static TypeInfo ipmi_interface_type_info = { | ||
221 | +static const TypeInfo ipmi_interface_type_info = { | ||
222 | .name = TYPE_IPMI_INTERFACE, | ||
223 | .parent = TYPE_INTERFACE, | ||
224 | .class_size = sizeof(IPMIInterfaceClass), | ||
225 | @@ -XXX,XX +XXX,XX @@ static void bmc_class_init(ObjectClass *oc, void *data) | ||
226 | device_class_set_props(dc, ipmi_bmc_properties); | ||
227 | } | ||
228 | |||
229 | -static TypeInfo ipmi_bmc_type_info = { | ||
230 | +static const TypeInfo ipmi_bmc_type_info = { | ||
231 | .name = TYPE_IPMI_BMC, | ||
232 | .parent = TYPE_DEVICE, | ||
233 | .instance_size = sizeof(IPMIBmc), | ||
234 | diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c | ||
235 | index XXXXXXX..XXXXXXX 100644 | ||
236 | --- a/hw/mem/nvdimm.c | ||
237 | +++ b/hw/mem/nvdimm.c | ||
238 | @@ -XXX,XX +XXX,XX @@ static void nvdimm_class_init(ObjectClass *oc, void *data) | ||
239 | set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
240 | } | ||
241 | |||
242 | -static TypeInfo nvdimm_info = { | ||
243 | +static const TypeInfo nvdimm_info = { | ||
244 | .name = TYPE_NVDIMM, | ||
245 | .parent = TYPE_PC_DIMM, | ||
246 | .class_size = sizeof(NVDIMMClass), | ||
247 | diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c | ||
248 | index XXXXXXX..XXXXXXX 100644 | ||
249 | --- a/hw/mem/pc-dimm.c | ||
250 | +++ b/hw/mem/pc-dimm.c | ||
251 | @@ -XXX,XX +XXX,XX @@ static void pc_dimm_class_init(ObjectClass *oc, void *data) | ||
252 | mdc->fill_device_info = pc_dimm_md_fill_device_info; | ||
253 | } | ||
254 | |||
255 | -static TypeInfo pc_dimm_info = { | ||
256 | +static const TypeInfo pc_dimm_info = { | ||
257 | .name = TYPE_PC_DIMM, | ||
258 | .parent = TYPE_DEVICE, | ||
259 | .instance_size = sizeof(PCDIMMDevice), | ||
260 | diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c | ||
261 | index XXXXXXX..XXXXXXX 100644 | ||
262 | --- a/hw/misc/bcm2835_mbox.c | ||
263 | +++ b/hw/misc/bcm2835_mbox.c | ||
264 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data) | ||
265 | dc->vmsd = &vmstate_bcm2835_mbox; | ||
266 | } | ||
267 | |||
268 | -static TypeInfo bcm2835_mbox_info = { | ||
269 | +static const TypeInfo bcm2835_mbox_info = { | ||
270 | .name = TYPE_BCM2835_MBOX, | ||
271 | .parent = TYPE_SYS_BUS_DEVICE, | ||
272 | .instance_size = sizeof(BCM2835MboxState), | ||
273 | diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c | ||
274 | index XXXXXXX..XXXXXXX 100644 | ||
275 | --- a/hw/misc/bcm2835_powermgt.c | ||
276 | +++ b/hw/misc/bcm2835_powermgt.c | ||
277 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data) | ||
278 | dc->vmsd = &vmstate_bcm2835_powermgt; | ||
279 | } | ||
280 | |||
281 | -static TypeInfo bcm2835_powermgt_info = { | ||
282 | +static const TypeInfo bcm2835_powermgt_info = { | ||
283 | .name = TYPE_BCM2835_POWERMGT, | ||
284 | .parent = TYPE_SYS_BUS_DEVICE, | ||
285 | .instance_size = sizeof(BCM2835PowerMgtState), | ||
286 | diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c | ||
287 | index XXXXXXX..XXXXXXX 100644 | ||
288 | --- a/hw/misc/bcm2835_property.c | ||
289 | +++ b/hw/misc/bcm2835_property.c | ||
290 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data) | ||
291 | dc->vmsd = &vmstate_bcm2835_property; | ||
292 | } | ||
293 | |||
294 | -static TypeInfo bcm2835_property_info = { | ||
295 | +static const TypeInfo bcm2835_property_info = { | ||
296 | .name = TYPE_BCM2835_PROPERTY, | ||
297 | .parent = TYPE_SYS_BUS_DEVICE, | ||
298 | .instance_size = sizeof(BCM2835PropertyState), | ||
299 | diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c | ||
300 | index XXXXXXX..XXXXXXX 100644 | ||
301 | --- a/hw/misc/bcm2835_rng.c | ||
302 | +++ b/hw/misc/bcm2835_rng.c | ||
303 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data) | ||
304 | dc->vmsd = &vmstate_bcm2835_rng; | ||
305 | } | ||
306 | |||
307 | -static TypeInfo bcm2835_rng_info = { | ||
308 | +static const TypeInfo bcm2835_rng_info = { | ||
309 | .name = TYPE_BCM2835_RNG, | ||
310 | .parent = TYPE_SYS_BUS_DEVICE, | ||
311 | .instance_size = sizeof(BCM2835RngState), | ||
312 | diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c | ||
313 | index XXXXXXX..XXXXXXX 100644 | ||
314 | --- a/hw/misc/pvpanic-isa.c | ||
315 | +++ b/hw/misc/pvpanic-isa.c | ||
316 | @@ -XXX,XX +XXX,XX @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
317 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
318 | } | ||
319 | |||
320 | -static TypeInfo pvpanic_isa_info = { | ||
321 | +static const TypeInfo pvpanic_isa_info = { | ||
322 | .name = TYPE_PVPANIC_ISA_DEVICE, | ||
323 | .parent = TYPE_ISA_DEVICE, | ||
324 | .instance_size = sizeof(PVPanicISAState), | ||
325 | diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c | ||
326 | index XXXXXXX..XXXXXXX 100644 | ||
327 | --- a/hw/misc/pvpanic-pci.c | ||
328 | +++ b/hw/misc/pvpanic-pci.c | ||
329 | @@ -XXX,XX +XXX,XX @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data) | ||
330 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
331 | } | ||
332 | |||
333 | -static TypeInfo pvpanic_pci_info = { | ||
334 | +static const TypeInfo pvpanic_pci_info = { | ||
335 | .name = TYPE_PVPANIC_PCI_DEVICE, | ||
336 | .parent = TYPE_PCI_DEVICE, | ||
337 | .instance_size = sizeof(PVPanicPCIState), | ||
338 | diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c | ||
339 | index XXXXXXX..XXXXXXX 100644 | ||
340 | --- a/hw/net/fsl_etsec/etsec.c | ||
341 | +++ b/hw/net/fsl_etsec/etsec.c | ||
342 | @@ -XXX,XX +XXX,XX @@ static void etsec_class_init(ObjectClass *klass, void *data) | ||
343 | dc->user_creatable = true; | ||
344 | } | ||
345 | |||
346 | -static TypeInfo etsec_info = { | ||
347 | +static const TypeInfo etsec_info = { | ||
348 | .name = TYPE_ETSEC_COMMON, | ||
349 | .parent = TYPE_SYS_BUS_DEVICE, | ||
350 | .instance_size = sizeof(eTSEC), | ||
351 | diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c | ||
352 | index XXXXXXX..XXXXXXX 100644 | ||
353 | --- a/hw/ppc/prep_systemio.c | ||
354 | +++ b/hw/ppc/prep_systemio.c | ||
355 | @@ -XXX,XX +XXX,XX @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data) | ||
356 | device_class_set_props(dc, prep_systemio_properties); | ||
357 | } | ||
358 | |||
359 | -static TypeInfo prep_systemio800_info = { | ||
360 | +static const TypeInfo prep_systemio800_info = { | ||
361 | .name = TYPE_PREP_SYSTEMIO, | ||
362 | .parent = TYPE_ISA_DEVICE, | ||
363 | .instance_size = sizeof(PrepSystemIoState), | ||
364 | diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c | ||
365 | index XXXXXXX..XXXXXXX 100644 | ||
366 | --- a/hw/ppc/spapr_iommu.c | ||
367 | +++ b/hw/ppc/spapr_iommu.c | ||
368 | @@ -XXX,XX +XXX,XX @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data) | ||
369 | spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce); | ||
370 | } | ||
371 | |||
372 | -static TypeInfo spapr_tce_table_info = { | ||
373 | +static const TypeInfo spapr_tce_table_info = { | ||
374 | .name = TYPE_SPAPR_TCE_TABLE, | ||
375 | .parent = TYPE_DEVICE, | ||
376 | .instance_size = sizeof(SpaprTceTable), | ||
377 | diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c | ||
378 | index XXXXXXX..XXXXXXX 100644 | ||
379 | --- a/hw/s390x/s390-pci-bus.c | ||
380 | +++ b/hw/s390x/s390-pci-bus.c | ||
381 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo s390_pci_device_info = { | ||
382 | .class_init = s390_pci_device_class_init, | ||
57 | }; | 383 | }; |
58 | 384 | ||
59 | +static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | 385 | -static TypeInfo s390_pci_iommu_info = { |
60 | +{ | 386 | +static const TypeInfo s390_pci_iommu_info = { |
61 | + AspeedSoCState *soc = &bmc->soc; | 387 | .name = TYPE_S390_PCI_IOMMU, |
62 | + | 388 | .parent = TYPE_OBJECT, |
63 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c); | 389 | .instance_size = sizeof(S390PCIIOMMU), |
64 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c); | 390 | diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c |
65 | + | 391 | index XXXXXXX..XXXXXXX 100644 |
66 | + /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ | 392 | --- a/hw/s390x/sclp.c |
67 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105", 0x4a); | 393 | +++ b/hw/s390x/sclp.c |
68 | +} | 394 | @@ -XXX,XX +XXX,XX @@ static void sclp_class_init(ObjectClass *oc, void *data) |
69 | + | 395 | sc->service_interrupt = service_interrupt; |
70 | +static void witherspoon_bmc_init(MachineState *machine) | 396 | } |
71 | +{ | 397 | |
72 | + aspeed_board_init(machine, &aspeed_boards[WITHERSPOON_BMC]); | 398 | -static TypeInfo sclp_info = { |
73 | +} | 399 | +static const TypeInfo sclp_info = { |
74 | + | 400 | .name = TYPE_SCLP, |
75 | +static void witherspoon_bmc_class_init(ObjectClass *oc, void *data) | 401 | .parent = TYPE_DEVICE, |
76 | +{ | 402 | .instance_init = sclp_init, |
77 | + MachineClass *mc = MACHINE_CLASS(oc); | 403 | diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c |
78 | + | 404 | index XXXXXXX..XXXXXXX 100644 |
79 | + mc->desc = "OpenPOWER Witherspoon BMC (ARM1176)"; | 405 | --- a/hw/s390x/tod-kvm.c |
80 | + mc->init = witherspoon_bmc_init; | 406 | +++ b/hw/s390x/tod-kvm.c |
81 | + mc->max_cpus = 1; | 407 | @@ -XXX,XX +XXX,XX @@ static void kvm_s390_tod_init(Object *obj) |
82 | + mc->no_sdcard = 1; | 408 | td->stopped = false; |
83 | + mc->no_floppy = 1; | 409 | } |
84 | + mc->no_cdrom = 1; | 410 | |
85 | + mc->no_parallel = 1; | 411 | -static TypeInfo kvm_s390_tod_info = { |
86 | +} | 412 | +static const TypeInfo kvm_s390_tod_info = { |
87 | + | 413 | .name = TYPE_KVM_S390_TOD, |
88 | +static const TypeInfo witherspoon_bmc_type = { | 414 | .parent = TYPE_S390_TOD, |
89 | + .name = MACHINE_TYPE_NAME("witherspoon-bmc"), | 415 | .instance_size = sizeof(S390TODState), |
90 | + .parent = TYPE_MACHINE, | 416 | diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c |
91 | + .class_init = witherspoon_bmc_class_init, | 417 | index XXXXXXX..XXXXXXX 100644 |
92 | +}; | 418 | --- a/hw/s390x/tod-tcg.c |
93 | + | 419 | +++ b/hw/s390x/tod-tcg.c |
94 | static void aspeed_machine_init(void) | 420 | @@ -XXX,XX +XXX,XX @@ static void qemu_s390_tod_init(Object *obj) |
421 | } | ||
422 | } | ||
423 | |||
424 | -static TypeInfo qemu_s390_tod_info = { | ||
425 | +static const TypeInfo qemu_s390_tod_info = { | ||
426 | .name = TYPE_QEMU_S390_TOD, | ||
427 | .parent = TYPE_S390_TOD, | ||
428 | .instance_size = sizeof(S390TODState), | ||
429 | diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c | ||
430 | index XXXXXXX..XXXXXXX 100644 | ||
431 | --- a/hw/s390x/tod.c | ||
432 | +++ b/hw/s390x/tod.c | ||
433 | @@ -XXX,XX +XXX,XX @@ static void s390_tod_class_init(ObjectClass *oc, void *data) | ||
434 | dc->user_creatable = false; | ||
435 | } | ||
436 | |||
437 | -static TypeInfo s390_tod_info = { | ||
438 | +static const TypeInfo s390_tod_info = { | ||
439 | .name = TYPE_S390_TOD, | ||
440 | .parent = TYPE_DEVICE, | ||
441 | .instance_size = sizeof(S390TODState), | ||
442 | diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c | ||
443 | index XXXXXXX..XXXXXXX 100644 | ||
444 | --- a/hw/scsi/lsi53c895a.c | ||
445 | +++ b/hw/scsi/lsi53c895a.c | ||
446 | @@ -XXX,XX +XXX,XX @@ static void lsi53c810_class_init(ObjectClass *klass, void *data) | ||
447 | k->device_id = PCI_DEVICE_ID_LSI_53C810; | ||
448 | } | ||
449 | |||
450 | -static TypeInfo lsi53c810_info = { | ||
451 | +static const TypeInfo lsi53c810_info = { | ||
452 | .name = TYPE_LSI53C810, | ||
453 | .parent = TYPE_LSI53C895A, | ||
454 | .class_init = lsi53c810_class_init, | ||
455 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c | ||
456 | index XXXXXXX..XXXXXXX 100644 | ||
457 | --- a/hw/sd/allwinner-sdhost.c | ||
458 | +++ b/hw/sd/allwinner-sdhost.c | ||
459 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data) | ||
460 | sc->max_desc_size = 64 * KiB; | ||
461 | } | ||
462 | |||
463 | -static TypeInfo allwinner_sdhost_info = { | ||
464 | +static const TypeInfo allwinner_sdhost_info = { | ||
465 | .name = TYPE_AW_SDHOST, | ||
466 | .parent = TYPE_SYS_BUS_DEVICE, | ||
467 | .instance_init = allwinner_sdhost_init, | ||
468 | diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c | ||
469 | index XXXXXXX..XXXXXXX 100644 | ||
470 | --- a/hw/sd/aspeed_sdhci.c | ||
471 | +++ b/hw/sd/aspeed_sdhci.c | ||
472 | @@ -XXX,XX +XXX,XX @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data) | ||
473 | device_class_set_props(dc, aspeed_sdhci_properties); | ||
474 | } | ||
475 | |||
476 | -static TypeInfo aspeed_sdhci_info = { | ||
477 | +static const TypeInfo aspeed_sdhci_info = { | ||
478 | .name = TYPE_ASPEED_SDHCI, | ||
479 | .parent = TYPE_SYS_BUS_DEVICE, | ||
480 | .instance_size = sizeof(AspeedSDHCIState), | ||
481 | diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c | ||
482 | index XXXXXXX..XXXXXXX 100644 | ||
483 | --- a/hw/sd/bcm2835_sdhost.c | ||
484 | +++ b/hw/sd/bcm2835_sdhost.c | ||
485 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data) | ||
486 | dc->vmsd = &vmstate_bcm2835_sdhost; | ||
487 | } | ||
488 | |||
489 | -static TypeInfo bcm2835_sdhost_info = { | ||
490 | +static const TypeInfo bcm2835_sdhost_info = { | ||
491 | .name = TYPE_BCM2835_SDHOST, | ||
492 | .parent = TYPE_SYS_BUS_DEVICE, | ||
493 | .instance_size = sizeof(BCM2835SDHostState), | ||
494 | diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c | ||
495 | index XXXXXXX..XXXXXXX 100644 | ||
496 | --- a/hw/sd/cadence_sdhci.c | ||
497 | +++ b/hw/sd/cadence_sdhci.c | ||
498 | @@ -XXX,XX +XXX,XX @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data) | ||
499 | dc->vmsd = &vmstate_cadence_sdhci; | ||
500 | } | ||
501 | |||
502 | -static TypeInfo cadence_sdhci_info = { | ||
503 | +static const TypeInfo cadence_sdhci_info = { | ||
504 | .name = TYPE_CADENCE_SDHCI, | ||
505 | .parent = TYPE_SYS_BUS_DEVICE, | ||
506 | .instance_size = sizeof(CadenceSDHCIState), | ||
507 | diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c | ||
508 | index XXXXXXX..XXXXXXX 100644 | ||
509 | --- a/hw/sd/npcm7xx_sdhci.c | ||
510 | +++ b/hw/sd/npcm7xx_sdhci.c | ||
511 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_sdhci_instance_init(Object *obj) | ||
512 | TYPE_SYSBUS_SDHCI); | ||
513 | } | ||
514 | |||
515 | -static TypeInfo npcm7xx_sdhci_info = { | ||
516 | +static const TypeInfo npcm7xx_sdhci_info = { | ||
517 | .name = TYPE_NPCM7XX_SDHCI, | ||
518 | .parent = TYPE_SYS_BUS_DEVICE, | ||
519 | .instance_size = sizeof(NPCM7xxSDHCIState), | ||
520 | diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c | ||
521 | index XXXXXXX..XXXXXXX 100644 | ||
522 | --- a/hw/usb/dev-mtp.c | ||
523 | +++ b/hw/usb/dev-mtp.c | ||
524 | @@ -XXX,XX +XXX,XX @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data) | ||
525 | device_class_set_props(dc, mtp_properties); | ||
526 | } | ||
527 | |||
528 | -static TypeInfo mtp_info = { | ||
529 | +static const TypeInfo mtp_info = { | ||
530 | .name = TYPE_USB_MTP, | ||
531 | .parent = TYPE_USB_DEVICE, | ||
532 | .instance_size = sizeof(MTPState), | ||
533 | diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c | ||
534 | index XXXXXXX..XXXXXXX 100644 | ||
535 | --- a/hw/usb/host-libusb.c | ||
536 | +++ b/hw/usb/host-libusb.c | ||
537 | @@ -XXX,XX +XXX,XX @@ static void usb_host_class_initfn(ObjectClass *klass, void *data) | ||
538 | set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); | ||
539 | } | ||
540 | |||
541 | -static TypeInfo usb_host_dev_info = { | ||
542 | +static const TypeInfo usb_host_dev_info = { | ||
543 | .name = TYPE_USB_HOST_DEVICE, | ||
544 | .parent = TYPE_USB_DEVICE, | ||
545 | .instance_size = sizeof(USBHostDevice), | ||
546 | diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c | ||
547 | index XXXXXXX..XXXXXXX 100644 | ||
548 | --- a/hw/vfio/igd.c | ||
549 | +++ b/hw/vfio/igd.c | ||
550 | @@ -XXX,XX +XXX,XX @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data) | ||
551 | k->class_id = PCI_CLASS_BRIDGE_ISA; | ||
552 | } | ||
553 | |||
554 | -static TypeInfo vfio_pci_igd_lpc_bridge_info = { | ||
555 | +static const TypeInfo vfio_pci_igd_lpc_bridge_info = { | ||
556 | .name = "vfio-pci-igd-lpc-bridge", | ||
557 | .parent = TYPE_PCI_DEVICE, | ||
558 | .class_init = vfio_pci_igd_lpc_bridge_class_init, | ||
559 | diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c | ||
560 | index XXXXXXX..XXXXXXX 100644 | ||
561 | --- a/hw/virtio/virtio-pmem.c | ||
562 | +++ b/hw/virtio/virtio-pmem.c | ||
563 | @@ -XXX,XX +XXX,XX @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data) | ||
564 | set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
565 | } | ||
566 | |||
567 | -static TypeInfo virtio_pmem_info = { | ||
568 | +static const TypeInfo virtio_pmem_info = { | ||
569 | .name = TYPE_VIRTIO_PMEM, | ||
570 | .parent = TYPE_VIRTIO_DEVICE, | ||
571 | .class_size = sizeof(VirtIOPMEMClass), | ||
572 | diff --git a/qom/object.c b/qom/object.c | ||
573 | index XXXXXXX..XXXXXXX 100644 | ||
574 | --- a/qom/object.c | ||
575 | +++ b/qom/object.c | ||
576 | @@ -XXX,XX +XXX,XX @@ static void object_class_init(ObjectClass *klass, void *data) | ||
577 | |||
578 | static void register_types(void) | ||
95 | { | 579 | { |
96 | type_register_static(&palmetto_bmc_type); | 580 | - static TypeInfo interface_info = { |
97 | type_register_static(&ast2500_evb_type); | 581 | + static const TypeInfo interface_info = { |
98 | type_register_static(&romulus_bmc_type); | 582 | .name = TYPE_INTERFACE, |
99 | + type_register_static(&witherspoon_bmc_type); | 583 | .class_size = sizeof(InterfaceClass), |
100 | } | 584 | .abstract = true, |
101 | 585 | }; | |
102 | type_init(aspeed_machine_init) | 586 | |
587 | - static TypeInfo object_info = { | ||
588 | + static const TypeInfo object_info = { | ||
589 | .name = TYPE_OBJECT, | ||
590 | .instance_size = sizeof(Object), | ||
591 | .class_init = object_class_init, | ||
103 | -- | 592 | -- |
104 | 2.17.1 | 593 | 2.25.1 |
105 | 594 | ||
106 | 595 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Now that all static TypeInfo instances are declared const, prevent that |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | new non-const instances are created. |
5 | Message-id: 20180607180641.874-6-f4bug@amsat.org | 5 | |
6 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-id: 20220117145805.173070-3-shentey@gmail.com | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 10 | --- |
8 | include/hw/sd/sd.h | 1 + | 11 | scripts/checkpatch.pl | 1 + |
9 | hw/sd/sd.c | 7 +++++-- | 12 | 1 file changed, 1 insertion(+) |
10 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
11 | 13 | ||
12 | diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h | 14 | diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl |
13 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100755 |
14 | --- a/include/hw/sd/sd.h | 16 | --- a/scripts/checkpatch.pl |
15 | +++ b/include/hw/sd/sd.h | 17 | +++ b/scripts/checkpatch.pl |
16 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ sub process { |
17 | enum SDPhySpecificationVersion { | 19 | SCSIBusInfo| |
18 | SD_PHY_SPECv1_10_VERS = 1, | 20 | SCSIReqOps| |
19 | SD_PHY_SPECv2_00_VERS = 2, | 21 | Spice[A-Z][a-zA-Z0-9]*Interface| |
20 | + SD_PHY_SPECv3_01_VERS = 3, | 22 | + TypeInfo| |
21 | }; | 23 | USBDesc[A-Z][a-zA-Z0-9]*| |
22 | 24 | VhostOps| | |
23 | typedef enum { | 25 | VMStateDescription| |
24 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/hw/sd/sd.c | ||
27 | +++ b/hw/sd/sd.c | ||
28 | @@ -XXX,XX +XXX,XX @@ static void sd_set_scr(SDState *sd) | ||
29 | if (sd->spec_version == SD_PHY_SPECv1_10_VERS) { | ||
30 | sd->scr[0] |= 1; /* Spec Version 1.10 */ | ||
31 | } else { | ||
32 | - sd->scr[0] |= 2; /* Spec Version 2.00 */ | ||
33 | + sd->scr[0] |= 2; /* Spec Version 2.00 or Version 3.0X */ | ||
34 | } | ||
35 | sd->scr[1] = (2 << 4) /* SDSC Card (Security Version 1.01) */ | ||
36 | | 0b0101; /* 1-bit or 4-bit width bus modes */ | ||
37 | sd->scr[2] = 0x00; /* Extended Security is not supported. */ | ||
38 | + if (sd->spec_version >= SD_PHY_SPECv3_01_VERS) { | ||
39 | + sd->scr[2] |= 1 << 7; /* Spec Version 3.0X */ | ||
40 | + } | ||
41 | sd->scr[3] = 0x00; | ||
42 | /* reserved for manufacturer usage */ | ||
43 | sd->scr[4] = 0x00; | ||
44 | @@ -XXX,XX +XXX,XX @@ static void sd_realize(DeviceState *dev, Error **errp) | ||
45 | |||
46 | switch (sd->spec_version) { | ||
47 | case SD_PHY_SPECv1_10_VERS | ||
48 | - ... SD_PHY_SPECv2_00_VERS: | ||
49 | + ... SD_PHY_SPECv3_01_VERS: | ||
50 | break; | ||
51 | default: | ||
52 | error_setg(errp, "Invalid SD card Spec version: %u", sd->spec_version); | ||
53 | -- | 26 | -- |
54 | 2.17.1 | 27 | 2.25.1 |
55 | 28 | ||
56 | 29 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | Now that KVM has dropped AArch32 host support, the 'host' CPU type is |
---|---|---|---|
2 | always AArch64, and we can move it to cpu64.c. This move will allow | ||
3 | us to share code between it and '-cpu max', which should behave | ||
4 | the same as '-cpu host' when using KVM or HVF. | ||
2 | 5 | ||
3 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Message-id: 20180530064049.27976-2-clg@kaod.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220204165506.2846058-2-peter.maydell@linaro.org | ||
7 | --- | 12 | --- |
8 | hw/arm/aspeed.c | 3 --- | 13 | target/arm/cpu.c | 30 ------------------------------ |
9 | 1 file changed, 3 deletions(-) | 14 | target/arm/cpu64.c | 30 ++++++++++++++++++++++++++++++ |
15 | 2 files changed, 30 insertions(+), 30 deletions(-) | ||
10 | 16 | ||
11 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 17 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
12 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/aspeed.c | 19 | --- a/target/arm/cpu.c |
14 | +++ b/hw/arm/aspeed.c | 20 | +++ b/target/arm/cpu.c |
15 | @@ -XXX,XX +XXX,XX @@ static void palmetto_bmc_class_init(ObjectClass *oc, void *data) | 21 | @@ -XXX,XX +XXX,XX @@ |
16 | mc->no_floppy = 1; | 22 | #include "sysemu/tcg.h" |
17 | mc->no_cdrom = 1; | 23 | #include "sysemu/hw_accel.h" |
18 | mc->no_parallel = 1; | 24 | #include "kvm_arm.h" |
19 | - mc->ignore_memory_transaction_failures = true; | 25 | -#include "hvf_arm.h" |
26 | #include "disas/capstone.h" | ||
27 | #include "fpu/softfloat.h" | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
30 | #endif /* CONFIG_TCG */ | ||
20 | } | 31 | } |
21 | 32 | ||
22 | static const TypeInfo palmetto_bmc_type = { | 33 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
23 | @@ -XXX,XX +XXX,XX @@ static void ast2500_evb_class_init(ObjectClass *oc, void *data) | 34 | -static void arm_host_initfn(Object *obj) |
24 | mc->no_floppy = 1; | 35 | -{ |
25 | mc->no_cdrom = 1; | 36 | - ARMCPU *cpu = ARM_CPU(obj); |
26 | mc->no_parallel = 1; | 37 | - |
27 | - mc->ignore_memory_transaction_failures = true; | 38 | -#ifdef CONFIG_KVM |
39 | - kvm_arm_set_cpu_features_from_host(cpu); | ||
40 | - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
41 | - aarch64_add_sve_properties(obj); | ||
42 | - aarch64_add_pauth_properties(obj); | ||
43 | - } | ||
44 | -#else | ||
45 | - hvf_arm_set_cpu_features_from_host(cpu); | ||
46 | -#endif | ||
47 | - arm_cpu_post_init(obj); | ||
48 | -} | ||
49 | - | ||
50 | -static const TypeInfo host_arm_cpu_type_info = { | ||
51 | - .name = TYPE_ARM_HOST_CPU, | ||
52 | - .parent = TYPE_AARCH64_CPU, | ||
53 | - .instance_init = arm_host_initfn, | ||
54 | -}; | ||
55 | - | ||
56 | -#endif | ||
57 | - | ||
58 | static void arm_cpu_instance_init(Object *obj) | ||
59 | { | ||
60 | ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj); | ||
61 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo arm_cpu_type_info = { | ||
62 | static void arm_cpu_register_types(void) | ||
63 | { | ||
64 | type_register_static(&arm_cpu_type_info); | ||
65 | - | ||
66 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
67 | - type_register_static(&host_arm_cpu_type_info); | ||
68 | -#endif | ||
28 | } | 69 | } |
29 | 70 | ||
30 | static const TypeInfo ast2500_evb_type = { | 71 | type_init(arm_cpu_register_types) |
31 | @@ -XXX,XX +XXX,XX @@ static void romulus_bmc_class_init(ObjectClass *oc, void *data) | 72 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
32 | mc->no_floppy = 1; | 73 | index XXXXXXX..XXXXXXX 100644 |
33 | mc->no_cdrom = 1; | 74 | --- a/target/arm/cpu64.c |
34 | mc->no_parallel = 1; | 75 | +++ b/target/arm/cpu64.c |
35 | - mc->ignore_memory_transaction_failures = true; | 76 | @@ -XXX,XX +XXX,XX @@ |
77 | #endif | ||
78 | #include "sysemu/kvm.h" | ||
79 | #include "kvm_arm.h" | ||
80 | +#include "hvf_arm.h" | ||
81 | #include "qapi/visitor.h" | ||
82 | #include "hw/qdev-properties.h" | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) | ||
85 | } | ||
36 | } | 86 | } |
37 | 87 | ||
38 | static const TypeInfo romulus_bmc_type = { | 88 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
89 | +static void arm_host_initfn(Object *obj) | ||
90 | +{ | ||
91 | + ARMCPU *cpu = ARM_CPU(obj); | ||
92 | + | ||
93 | +#ifdef CONFIG_KVM | ||
94 | + kvm_arm_set_cpu_features_from_host(cpu); | ||
95 | + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
96 | + aarch64_add_sve_properties(obj); | ||
97 | + aarch64_add_pauth_properties(obj); | ||
98 | + } | ||
99 | +#else | ||
100 | + hvf_arm_set_cpu_features_from_host(cpu); | ||
101 | +#endif | ||
102 | + arm_cpu_post_init(obj); | ||
103 | +} | ||
104 | + | ||
105 | +static const TypeInfo host_arm_cpu_type_info = { | ||
106 | + .name = TYPE_ARM_HOST_CPU, | ||
107 | + .parent = TYPE_AARCH64_CPU, | ||
108 | + .instance_init = arm_host_initfn, | ||
109 | +}; | ||
110 | + | ||
111 | +#endif | ||
112 | + | ||
113 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); | ||
114 | * otherwise, a CPU with as many features enabled as our emulation supports. | ||
115 | * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; | ||
116 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void) | ||
117 | for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { | ||
118 | aarch64_cpu_register(&aarch64_cpus[i]); | ||
119 | } | ||
120 | + | ||
121 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
122 | + type_register_static(&host_arm_cpu_type_info); | ||
123 | +#endif | ||
124 | } | ||
125 | |||
126 | type_init(aarch64_cpu_register_types) | ||
39 | -- | 127 | -- |
40 | 2.17.1 | 128 | 2.25.1 |
41 | 129 | ||
42 | 130 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | Use the aarch64_cpu_register() machinery to register the 'host' CPU |
---|---|---|---|
2 | type. This doesn't gain us anything functionally, but it does mean | ||
3 | that the code for initializing it looks more like that for the other | ||
4 | CPU types, in that its initfn then doesn't need to call | ||
5 | arm_cpu_post_init() (because aarch64_cpu_instance_init() does that | ||
6 | for it). | ||
2 | 7 | ||
3 | The AST2500 EVB does not have an RTC but we can pretend that one is | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | plugged on the I2C bus header. | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
10 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
11 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20220204165506.2846058-3-peter.maydell@linaro.org | ||
14 | --- | ||
15 | target/arm/cpu64.c | 17 ++++------------- | ||
16 | 1 file changed, 4 insertions(+), 13 deletions(-) | ||
5 | 17 | ||
6 | The romulus and witherspoon boards expects an Epson RX8900 I2C RTC but | 18 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
7 | a ds1338 is good enough for the basic features we need. | ||
8 | |||
9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
10 | Reviewed-by: Andrew Jeffery <andrew@aj.id.au> | ||
11 | Message-id: 20180530064049.27976-4-clg@kaod.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | hw/arm/aspeed.c | 19 +++++++++++++++++++ | ||
15 | 1 file changed, 19 insertions(+) | ||
16 | |||
17 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/aspeed.c | 20 | --- a/target/arm/cpu64.c |
20 | +++ b/hw/arm/aspeed.c | 21 | +++ b/target/arm/cpu64.c |
21 | @@ -XXX,XX +XXX,XX @@ enum { | 22 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) |
22 | |||
23 | static void palmetto_bmc_i2c_init(AspeedBoardState *bmc); | ||
24 | static void ast2500_evb_i2c_init(AspeedBoardState *bmc); | ||
25 | +static void romulus_bmc_i2c_init(AspeedBoardState *bmc); | ||
26 | static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc); | ||
27 | |||
28 | static const AspeedBoardConfig aspeed_boards[] = { | ||
29 | @@ -XXX,XX +XXX,XX @@ static const AspeedBoardConfig aspeed_boards[] = { | ||
30 | .fmc_model = "n25q256a", | ||
31 | .spi_model = "mx66l1g45g", | ||
32 | .num_cs = 2, | ||
33 | + .i2c_init = romulus_bmc_i2c_init, | ||
34 | }, | ||
35 | [WITHERSPOON_BMC] = { | ||
36 | .soc_name = "ast2500-a1", | ||
37 | @@ -XXX,XX +XXX,XX @@ static void ast2500_evb_i2c_init(AspeedBoardState *bmc) | ||
38 | |||
39 | /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ | ||
40 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x4d); | ||
41 | + | ||
42 | + /* The AST2500 EVB does not have an RTC. Let's pretend that one is | ||
43 | + * plugged on the I2C bus header */ | ||
44 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32); | ||
45 | } | 23 | } |
46 | 24 | ||
47 | static void ast2500_evb_init(MachineState *machine) | 25 | #if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
48 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo ast2500_evb_type = { | 26 | -static void arm_host_initfn(Object *obj) |
49 | .class_init = ast2500_evb_class_init, | 27 | +static void aarch64_host_initfn(Object *obj) |
28 | { | ||
29 | ARMCPU *cpu = ARM_CPU(obj); | ||
30 | |||
31 | @@ -XXX,XX +XXX,XX @@ static void arm_host_initfn(Object *obj) | ||
32 | #else | ||
33 | hvf_arm_set_cpu_features_from_host(cpu); | ||
34 | #endif | ||
35 | - arm_cpu_post_init(obj); | ||
36 | } | ||
37 | - | ||
38 | -static const TypeInfo host_arm_cpu_type_info = { | ||
39 | - .name = TYPE_ARM_HOST_CPU, | ||
40 | - .parent = TYPE_AARCH64_CPU, | ||
41 | - .instance_init = arm_host_initfn, | ||
42 | -}; | ||
43 | - | ||
44 | #endif | ||
45 | |||
46 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); | ||
47 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { | ||
48 | { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | ||
49 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | ||
50 | { .name = "max", .initfn = aarch64_max_initfn }, | ||
51 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
52 | + { .name = "host", .initfn = aarch64_host_initfn }, | ||
53 | +#endif | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | +static void romulus_bmc_i2c_init(AspeedBoardState *bmc) | 56 | static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp) |
53 | +{ | 57 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void) |
54 | + AspeedSoCState *soc = &bmc->soc; | 58 | for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { |
55 | + | 59 | aarch64_cpu_register(&aarch64_cpus[i]); |
56 | + /* The romulus board expects Epson RX8900 I2C RTC but a ds1338 is | 60 | } |
57 | + * good enough */ | 61 | - |
58 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32); | 62 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
59 | +} | 63 | - type_register_static(&host_arm_cpu_type_info); |
60 | + | 64 | -#endif |
61 | static void romulus_bmc_init(MachineState *machine) | ||
62 | { | ||
63 | aspeed_board_init(machine, &aspeed_boards[ROMULUS_BMC]); | ||
64 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
65 | |||
66 | /* The Witherspoon expects a TMP275 but a TMP105 is compatible */ | ||
67 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp105", 0x4a); | ||
68 | + | ||
69 | + /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is | ||
70 | + * good enough */ | ||
71 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32); | ||
72 | } | 65 | } |
73 | 66 | ||
74 | static void witherspoon_bmc_init(MachineState *machine) | 67 | type_init(aarch64_cpu_register_types) |
75 | -- | 68 | -- |
76 | 2.17.1 | 69 | 2.25.1 |
77 | 70 | ||
78 | 71 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Currently for KVM the intention is that '-cpu max' and '-cpu host' |
---|---|---|---|
2 | are the same thing, but because we did this with two separate | ||
3 | pieces of code they have got a little bit out of sync. Specifically, | ||
4 | 'max' has a 'sve-max-vq' property, and 'host' does not. | ||
2 | 5 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Bring the two together by having the initfn for 'max' actually |
4 | Acked-by: Max Filippov <jcmvbkbc@gmail.com> | 7 | call the initfn for 'host'. This will result in 'max' no longer |
5 | Message-id: 20180606152128.449-12-f4bug@amsat.org | 8 | exposing the 'sve-max-vq' property when using KVM. |
9 | |||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
13 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220204165506.2846058-4-peter.maydell@linaro.org | ||
7 | --- | 16 | --- |
8 | target/xtensa/translate.c | 6 +++--- | 17 | target/arm/cpu64.c | 14 ++++++++------ |
9 | 1 file changed, 3 insertions(+), 3 deletions(-) | 18 | 1 file changed, 8 insertions(+), 6 deletions(-) |
10 | 19 | ||
11 | diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
12 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/xtensa/translate.c | 22 | --- a/target/arm/cpu64.c |
14 | +++ b/target/xtensa/translate.c | 23 | +++ b/target/arm/cpu64.c |
15 | @@ -XXX,XX +XXX,XX @@ static void translate_rur(DisasContext *dc, const uint32_t arg[], | 24 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) |
16 | if (uregnames[par[0]].name) { | ||
17 | tcg_gen_mov_i32(cpu_R[arg[0]], cpu_UR[par[0]]); | ||
18 | } else { | ||
19 | - qemu_log_mask(LOG_UNIMP, "RUR %d not implemented, ", par[0]); | ||
20 | + qemu_log_mask(LOG_UNIMP, "RUR %d not implemented\n", par[0]); | ||
21 | } | ||
22 | } | 25 | } |
23 | } | 26 | } |
24 | @@ -XXX,XX +XXX,XX @@ static void translate_slli(DisasContext *dc, const uint32_t arg[], | 27 | |
28 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
29 | static void aarch64_host_initfn(Object *obj) | ||
25 | { | 30 | { |
26 | if (gen_window_check2(dc, arg[0], arg[1])) { | 31 | +#if defined(CONFIG_KVM) |
27 | if (arg[2] == 32) { | 32 | ARMCPU *cpu = ARM_CPU(obj); |
28 | - qemu_log_mask(LOG_GUEST_ERROR, "slli a%d, a%d, 32 is undefined", | 33 | - |
29 | + qemu_log_mask(LOG_GUEST_ERROR, "slli a%d, a%d, 32 is undefined\n", | 34 | -#ifdef CONFIG_KVM |
30 | arg[0], arg[1]); | 35 | kvm_arm_set_cpu_features_from_host(cpu); |
31 | } | 36 | if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { |
32 | tcg_gen_shli_i32(cpu_R[arg[0]], cpu_R[arg[1]], arg[2] & 0x1f); | 37 | aarch64_add_sve_properties(obj); |
33 | @@ -XXX,XX +XXX,XX @@ static void translate_wur(DisasContext *dc, const uint32_t arg[], | 38 | aarch64_add_pauth_properties(obj); |
34 | if (uregnames[par[0]].name) { | ||
35 | gen_wur(par[0], cpu_R[arg[0]]); | ||
36 | } else { | ||
37 | - qemu_log_mask(LOG_UNIMP, "WUR %d not implemented, ", par[0]); | ||
38 | + qemu_log_mask(LOG_UNIMP, "WUR %d not implemented\n", par[0]); | ||
39 | } | ||
40 | } | 39 | } |
40 | -#else | ||
41 | +#elif defined(CONFIG_HVF) | ||
42 | + ARMCPU *cpu = ARM_CPU(obj); | ||
43 | hvf_arm_set_cpu_features_from_host(cpu); | ||
44 | +#else | ||
45 | + g_assert_not_reached(); | ||
46 | #endif | ||
41 | } | 47 | } |
48 | -#endif | ||
49 | |||
50 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); | ||
51 | * otherwise, a CPU with as many features enabled as our emulation supports. | ||
52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
53 | ARMCPU *cpu = ARM_CPU(obj); | ||
54 | |||
55 | if (kvm_enabled()) { | ||
56 | - kvm_arm_set_cpu_features_from_host(cpu); | ||
57 | + /* With KVM, '-cpu max' is identical to '-cpu host' */ | ||
58 | + aarch64_host_initfn(obj); | ||
59 | + return; | ||
60 | } else { | ||
61 | uint64_t t; | ||
62 | uint32_t u; | ||
42 | -- | 63 | -- |
43 | 2.17.1 | 64 | 2.25.1 |
44 | 65 | ||
45 | 66 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Now that the if() branch of the condition in aarch64_max_initfn() |
---|---|---|---|
2 | returns early, we don't need to keep the rest of the code in | ||
3 | the function inside an else block. Remove the else, unindenting | ||
4 | that code. | ||
2 | 5 | ||
3 | The initial implementation is based on the Specs v1.10 (see a1bb27b1e98). | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220204165506.2846058-5-peter.maydell@linaro.org | ||
12 | --- | ||
13 | target/arm/cpu64.c | 289 +++++++++++++++++++++++---------------------- | ||
14 | 1 file changed, 146 insertions(+), 143 deletions(-) | ||
4 | 15 | ||
5 | However the SCR is anouncing the card being v1.01. | 16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
6 | |||
7 | The new chapters added in version 1.10 are: | ||
8 | |||
9 | 4.3.10 Switch function command | ||
10 | |||
11 | Switch function command (CMD6) 1 is used to switch or expand | ||
12 | memory card functions. [...] | ||
13 | This is a new feature, introduced in SD physical Layer | ||
14 | Specification Version 1.10. Therefore, cards that are | ||
15 | compatible with earlier versions of the spec do not support | ||
16 | it. The host shall check the "SD_SPEC" field in the SCR | ||
17 | register to recognize what version of the spec the card | ||
18 | complies with before using CMD6. It is mandatory for SD | ||
19 | memory card of Ver1.10 to support CMD6. | ||
20 | |||
21 | 4.3.11 High-Speed mode (25MB/sec interface speed) | ||
22 | |||
23 | Though the Rev 1.01 SD memory card supports up to 12.5MB/sec | ||
24 | interface speed, the speed of 25MB/sec is necessary to support | ||
25 | increasing performance needs of the host and because of memory | ||
26 | size which continues to grow. | ||
27 | To achieve 25MB/sec interface speed, clock rate is increased to | ||
28 | 50MHz and CLK/CMD/DAT signal timing and circuit conditions are | ||
29 | reconsidered and changed from Physical Layer Specification | ||
30 | Version 1.01. | ||
31 | |||
32 | 4.3.12 Command system (This chapter is newly added in version 1.10) | ||
33 | |||
34 | SD commands CMD34-37, CMD50, CMD57 are reserved for SD command | ||
35 | system expansion via the switch command. | ||
36 | [These commands] will be considered as illegal commands (as | ||
37 | defined in revision 1.01 of the SD physical layer specification). | ||
38 | |||
39 | The SWITCH_FUNCTION is implemented since the first commit, a1bb27b1e98. | ||
40 | |||
41 | The 25MB/sec High-Speed mode was already updated in d7ecb867529. | ||
42 | |||
43 | The current implementation does not implements CMD34-37, CMD50 and | ||
44 | CMD57, thus these commands already return ILLEGAL. | ||
45 | |||
46 | With this patch, the SCR register now matches the description of the header: | ||
47 | |||
48 | * SD Memory Card emulation as defined in the "SD Memory Card Physical | ||
49 | * layer specification, Version 1.10." | ||
50 | |||
51 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
52 | Message-id: 20180607180641.874-2-f4bug@amsat.org | ||
53 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
54 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
55 | --- | ||
56 | hw/sd/sd.c | 4 ++-- | ||
57 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
58 | |||
59 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | ||
60 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
61 | --- a/hw/sd/sd.c | 18 | --- a/target/arm/cpu64.c |
62 | +++ b/hw/sd/sd.c | 19 | +++ b/target/arm/cpu64.c |
63 | @@ -XXX,XX +XXX,XX @@ static void sd_ocr_powerup(void *opaque) | 20 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) |
64 | 21 | static void aarch64_max_initfn(Object *obj) | |
65 | static void sd_set_scr(SDState *sd) | ||
66 | { | 22 | { |
67 | - sd->scr[0] = (0 << 4) /* SCR version 1.0 */ | 23 | ARMCPU *cpu = ARM_CPU(obj); |
68 | - | 0; /* Spec Versions 1.0 and 1.01 */ | 24 | + uint64_t t; |
69 | + sd->scr[0] = (0 << 4) /* SCR structure version 1.0 */ | 25 | + uint32_t u; |
70 | + | 1; /* Spec Version 1.10 */ | 26 | |
71 | sd->scr[1] = (2 << 4) /* SDSC Card (Security Version 1.01) */ | 27 | if (kvm_enabled()) { |
72 | | 0b0101; /* 1-bit or 4-bit width bus modes */ | 28 | /* With KVM, '-cpu max' is identical to '-cpu host' */ |
73 | sd->scr[2] = 0x00; /* Extended Security is not supported. */ | 29 | aarch64_host_initfn(obj); |
30 | return; | ||
31 | - } else { | ||
32 | - uint64_t t; | ||
33 | - uint32_t u; | ||
34 | - aarch64_a57_initfn(obj); | ||
35 | + } | ||
36 | |||
37 | - /* | ||
38 | - * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
39 | - * one and try to apply errata workarounds or use impdef features we | ||
40 | - * don't provide. | ||
41 | - * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
42 | - * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
43 | - * to see which features are present"; | ||
44 | - * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
45 | - * defined and we choose to define PARTNUM just in case guest | ||
46 | - * code needs to distinguish this QEMU CPU from other software | ||
47 | - * implementations, though this shouldn't be needed. | ||
48 | - */ | ||
49 | - t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
50 | - t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
51 | - t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
52 | - t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
53 | - t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
54 | - cpu->midr = t; | ||
55 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
56 | |||
57 | - t = cpu->isar.id_aa64isar0; | ||
58 | - t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | ||
59 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | ||
60 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ | ||
61 | - t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
62 | - t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); | ||
63 | - t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); | ||
64 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); | ||
65 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); | ||
66 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
67 | - t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
68 | - t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
69 | - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
70 | - t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
71 | - t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); | ||
72 | - cpu->isar.id_aa64isar0 = t; | ||
73 | + aarch64_a57_initfn(obj); | ||
74 | |||
75 | - t = cpu->isar.id_aa64isar1; | ||
76 | - t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); | ||
77 | - t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); | ||
78 | - t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); | ||
79 | - t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
80 | - t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
81 | - t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); | ||
82 | - t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
83 | - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | ||
84 | - t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); | ||
85 | - cpu->isar.id_aa64isar1 = t; | ||
86 | + /* | ||
87 | + * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
88 | + * one and try to apply errata workarounds or use impdef features we | ||
89 | + * don't provide. | ||
90 | + * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
91 | + * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
92 | + * to see which features are present"; | ||
93 | + * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
94 | + * defined and we choose to define PARTNUM just in case guest | ||
95 | + * code needs to distinguish this QEMU CPU from other software | ||
96 | + * implementations, though this shouldn't be needed. | ||
97 | + */ | ||
98 | + t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
99 | + t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
100 | + t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
101 | + t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
102 | + t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
103 | + cpu->midr = t; | ||
104 | |||
105 | - t = cpu->isar.id_aa64pfr0; | ||
106 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
107 | - t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); | ||
108 | - t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | ||
109 | - t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); | ||
110 | - t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); | ||
111 | - cpu->isar.id_aa64pfr0 = t; | ||
112 | + t = cpu->isar.id_aa64isar0; | ||
113 | + t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | ||
114 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | ||
115 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ | ||
116 | + t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
117 | + t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); | ||
118 | + t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); | ||
119 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); | ||
120 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); | ||
121 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
122 | + t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
123 | + t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
124 | + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
125 | + t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
126 | + t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); | ||
127 | + cpu->isar.id_aa64isar0 = t; | ||
128 | |||
129 | - t = cpu->isar.id_aa64pfr1; | ||
130 | - t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); | ||
131 | - t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); | ||
132 | - /* | ||
133 | - * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
134 | - * during realize if the board provides no tag memory, much like | ||
135 | - * we do for EL2 with the virtualization=on property. | ||
136 | - */ | ||
137 | - t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); | ||
138 | - cpu->isar.id_aa64pfr1 = t; | ||
139 | + t = cpu->isar.id_aa64isar1; | ||
140 | + t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); | ||
141 | + t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); | ||
142 | + t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); | ||
143 | + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
144 | + t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
145 | + t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); | ||
146 | + t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
147 | + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | ||
148 | + t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); | ||
149 | + cpu->isar.id_aa64isar1 = t; | ||
150 | |||
151 | - t = cpu->isar.id_aa64mmfr0; | ||
152 | - t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */ | ||
153 | - cpu->isar.id_aa64mmfr0 = t; | ||
154 | + t = cpu->isar.id_aa64pfr0; | ||
155 | + t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
156 | + t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); | ||
157 | + t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | ||
158 | + t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); | ||
159 | + t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); | ||
160 | + cpu->isar.id_aa64pfr0 = t; | ||
161 | |||
162 | - t = cpu->isar.id_aa64mmfr1; | ||
163 | - t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
164 | - t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
165 | - t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
166 | - t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
167 | - t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
168 | - t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
169 | - cpu->isar.id_aa64mmfr1 = t; | ||
170 | + t = cpu->isar.id_aa64pfr1; | ||
171 | + t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); | ||
172 | + t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); | ||
173 | + /* | ||
174 | + * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
175 | + * during realize if the board provides no tag memory, much like | ||
176 | + * we do for EL2 with the virtualization=on property. | ||
177 | + */ | ||
178 | + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); | ||
179 | + cpu->isar.id_aa64pfr1 = t; | ||
180 | |||
181 | - t = cpu->isar.id_aa64mmfr2; | ||
182 | - t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | ||
183 | - t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | ||
184 | - t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ | ||
185 | - cpu->isar.id_aa64mmfr2 = t; | ||
186 | + t = cpu->isar.id_aa64mmfr0; | ||
187 | + t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */ | ||
188 | + cpu->isar.id_aa64mmfr0 = t; | ||
189 | |||
190 | - t = cpu->isar.id_aa64zfr0; | ||
191 | - t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
192 | - t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ | ||
193 | - t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); | ||
194 | - t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); | ||
195 | - t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); | ||
196 | - t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); | ||
197 | - t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); | ||
198 | - t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); | ||
199 | - t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
200 | - cpu->isar.id_aa64zfr0 = t; | ||
201 | + t = cpu->isar.id_aa64mmfr1; | ||
202 | + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
203 | + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
204 | + t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
205 | + t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
206 | + t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
207 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
208 | + cpu->isar.id_aa64mmfr1 = t; | ||
209 | |||
210 | - /* Replicate the same data to the 32-bit id registers. */ | ||
211 | - u = cpu->isar.id_isar5; | ||
212 | - u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
213 | - u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); | ||
214 | - u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); | ||
215 | - u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); | ||
216 | - u = FIELD_DP32(u, ID_ISAR5, RDM, 1); | ||
217 | - u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); | ||
218 | - cpu->isar.id_isar5 = u; | ||
219 | + t = cpu->isar.id_aa64mmfr2; | ||
220 | + t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | ||
221 | + t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | ||
222 | + t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ | ||
223 | + cpu->isar.id_aa64mmfr2 = t; | ||
224 | |||
225 | - u = cpu->isar.id_isar6; | ||
226 | - u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
227 | - u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
228 | - u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
229 | - u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
230 | - u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
231 | - u = FIELD_DP32(u, ID_ISAR6, BF16, 1); | ||
232 | - u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); | ||
233 | - cpu->isar.id_isar6 = u; | ||
234 | + t = cpu->isar.id_aa64zfr0; | ||
235 | + t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
236 | + t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ | ||
237 | + t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); | ||
238 | + t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); | ||
239 | + t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); | ||
240 | + t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); | ||
241 | + t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); | ||
242 | + t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); | ||
243 | + t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
244 | + cpu->isar.id_aa64zfr0 = t; | ||
245 | |||
246 | - u = cpu->isar.id_pfr0; | ||
247 | - u = FIELD_DP32(u, ID_PFR0, DIT, 1); | ||
248 | - cpu->isar.id_pfr0 = u; | ||
249 | + /* Replicate the same data to the 32-bit id registers. */ | ||
250 | + u = cpu->isar.id_isar5; | ||
251 | + u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
252 | + u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); | ||
253 | + u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); | ||
254 | + u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); | ||
255 | + u = FIELD_DP32(u, ID_ISAR5, RDM, 1); | ||
256 | + u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); | ||
257 | + cpu->isar.id_isar5 = u; | ||
258 | |||
259 | - u = cpu->isar.id_pfr2; | ||
260 | - u = FIELD_DP32(u, ID_PFR2, SSBS, 1); | ||
261 | - cpu->isar.id_pfr2 = u; | ||
262 | + u = cpu->isar.id_isar6; | ||
263 | + u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
264 | + u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
265 | + u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
266 | + u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
267 | + u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
268 | + u = FIELD_DP32(u, ID_ISAR6, BF16, 1); | ||
269 | + u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); | ||
270 | + cpu->isar.id_isar6 = u; | ||
271 | |||
272 | - u = cpu->isar.id_mmfr3; | ||
273 | - u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
274 | - cpu->isar.id_mmfr3 = u; | ||
275 | + u = cpu->isar.id_pfr0; | ||
276 | + u = FIELD_DP32(u, ID_PFR0, DIT, 1); | ||
277 | + cpu->isar.id_pfr0 = u; | ||
278 | |||
279 | - u = cpu->isar.id_mmfr4; | ||
280 | - u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
281 | - u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
282 | - u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
283 | - u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
284 | - cpu->isar.id_mmfr4 = u; | ||
285 | + u = cpu->isar.id_pfr2; | ||
286 | + u = FIELD_DP32(u, ID_PFR2, SSBS, 1); | ||
287 | + cpu->isar.id_pfr2 = u; | ||
288 | |||
289 | - t = cpu->isar.id_aa64dfr0; | ||
290 | - t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
291 | - cpu->isar.id_aa64dfr0 = t; | ||
292 | + u = cpu->isar.id_mmfr3; | ||
293 | + u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
294 | + cpu->isar.id_mmfr3 = u; | ||
295 | |||
296 | - u = cpu->isar.id_dfr0; | ||
297 | - u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
298 | - cpu->isar.id_dfr0 = u; | ||
299 | + u = cpu->isar.id_mmfr4; | ||
300 | + u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
301 | + u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
302 | + u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
303 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
304 | + cpu->isar.id_mmfr4 = u; | ||
305 | |||
306 | - u = cpu->isar.mvfr1; | ||
307 | - u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
308 | - u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
309 | - cpu->isar.mvfr1 = u; | ||
310 | + t = cpu->isar.id_aa64dfr0; | ||
311 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
312 | + cpu->isar.id_aa64dfr0 = t; | ||
313 | + | ||
314 | + u = cpu->isar.id_dfr0; | ||
315 | + u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
316 | + cpu->isar.id_dfr0 = u; | ||
317 | + | ||
318 | + u = cpu->isar.mvfr1; | ||
319 | + u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
320 | + u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
321 | + cpu->isar.mvfr1 = u; | ||
322 | |||
323 | #ifdef CONFIG_USER_ONLY | ||
324 | - /* For usermode -cpu max we can use a larger and more efficient DCZ | ||
325 | - * blocksize since we don't have to follow what the hardware does. | ||
326 | - */ | ||
327 | - cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ | ||
328 | - cpu->dcz_blocksize = 7; /* 512 bytes */ | ||
329 | + /* | ||
330 | + * For usermode -cpu max we can use a larger and more efficient DCZ | ||
331 | + * blocksize since we don't have to follow what the hardware does. | ||
332 | + */ | ||
333 | + cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ | ||
334 | + cpu->dcz_blocksize = 7; /* 512 bytes */ | ||
335 | #endif | ||
336 | |||
337 | - bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
338 | - } | ||
339 | + bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
340 | |||
341 | aarch64_add_pauth_properties(obj); | ||
342 | aarch64_add_sve_properties(obj); | ||
74 | -- | 343 | -- |
75 | 2.17.1 | 344 | 2.25.1 |
76 | 345 | ||
77 | 346 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Currently when using hvf we mishandle '-cpu max': we fall through to |
---|---|---|---|
2 | the TCG version of its initfn, which then sets a lot of feature bits | ||
3 | that the real host CPU doesn't have. The hvf accelerator code then | ||
4 | exposes these bogus ID register values to the guest because it | ||
5 | doesn't check that the host really has the features. | ||
2 | 6 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 7 | Make '-cpu host' be like '-cpu max' for hvf, as we do with kvm. |
4 | Message-id: 20180606152128.449-7-f4bug@amsat.org | 8 | |
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
12 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20220204165506.2846058-6-peter.maydell@linaro.org | ||
7 | --- | 15 | --- |
8 | hw/mips/boston.c | 8 ++++---- | 16 | target/arm/cpu64.c | 5 +++-- |
9 | 1 file changed, 4 insertions(+), 4 deletions(-) | 17 | 1 file changed, 3 insertions(+), 2 deletions(-) |
10 | 18 | ||
11 | diff --git a/hw/mips/boston.c b/hw/mips/boston.c | 19 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
12 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/mips/boston.c | 21 | --- a/target/arm/cpu64.c |
14 | +++ b/hw/mips/boston.c | 22 | +++ b/target/arm/cpu64.c |
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t boston_platreg_read(void *opaque, hwaddr addr, | 23 | @@ -XXX,XX +XXX,XX @@ |
16 | uint32_t gic_freq, val; | 24 | #include "hw/loader.h" |
17 | 25 | #endif | |
18 | if (size != 4) { | 26 | #include "sysemu/kvm.h" |
19 | - qemu_log_mask(LOG_UNIMP, "%uB platform register read", size); | 27 | +#include "sysemu/hvf.h" |
20 | + qemu_log_mask(LOG_UNIMP, "%uB platform register read\n", size); | 28 | #include "kvm_arm.h" |
21 | return 0; | 29 | #include "hvf_arm.h" |
22 | } | 30 | #include "qapi/visitor.h" |
23 | 31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | |
24 | @@ -XXX,XX +XXX,XX @@ static uint64_t boston_platreg_read(void *opaque, hwaddr addr, | 32 | uint64_t t; |
25 | val |= PLAT_DDR_CFG_MHZ; | 33 | uint32_t u; |
26 | return val; | 34 | |
27 | default: | 35 | - if (kvm_enabled()) { |
28 | - qemu_log_mask(LOG_UNIMP, "Read platform register 0x%" HWADDR_PRIx, | 36 | - /* With KVM, '-cpu max' is identical to '-cpu host' */ |
29 | + qemu_log_mask(LOG_UNIMP, "Read platform register 0x%" HWADDR_PRIx "\n", | 37 | + if (kvm_enabled() || hvf_enabled()) { |
30 | addr & 0xffff); | 38 | + /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ |
31 | return 0; | 39 | aarch64_host_initfn(obj); |
32 | } | ||
33 | @@ -XXX,XX +XXX,XX @@ static void boston_platreg_write(void *opaque, hwaddr addr, | ||
34 | uint64_t val, unsigned size) | ||
35 | { | ||
36 | if (size != 4) { | ||
37 | - qemu_log_mask(LOG_UNIMP, "%uB platform register write", size); | ||
38 | + qemu_log_mask(LOG_UNIMP, "%uB platform register write\n", size); | ||
39 | return; | 40 | return; |
40 | } | 41 | } |
41 | |||
42 | @@ -XXX,XX +XXX,XX @@ static void boston_platreg_write(void *opaque, hwaddr addr, | ||
43 | break; | ||
44 | default: | ||
45 | qemu_log_mask(LOG_UNIMP, "Write platform register 0x%" HWADDR_PRIx | ||
46 | - " = 0x%" PRIx64, addr & 0xffff, val); | ||
47 | + " = 0x%" PRIx64 "\n", addr & 0xffff, val); | ||
48 | break; | ||
49 | } | ||
50 | } | ||
51 | -- | 42 | -- |
52 | 2.17.1 | 43 | 2.25.1 |
53 | 44 | ||
54 | 45 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | Currently we don't allow guests under hvf to use the PAuth extension, |
---|---|---|---|
2 | because we didn't have any special code to handle that, and therefore | ||
3 | in arm_cpu_pauth_finalize() we will sanitize the ID_AA64ISAR1 value | ||
4 | the guest sees to clear the PAuth related fields. | ||
2 | 5 | ||
3 | The ftgmac100 NIC supports VLAN tag insertion and the MAC engine also | 6 | Add support for this in the same way that KVM does it, by defaulting |
4 | has a control to remove VLAN tags from received packets. | 7 | to "PAuth enabled" if the host CPU has it and allowing the user to |
8 | disable it via '-cpu pauth=no' on the command line. | ||
5 | 9 | ||
6 | The VLAN control bits and VLAN tag information are contained in the | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | second word of the transmit and receive descriptors. The Insert VLAN | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | bit and the VLAN Tag available bit are only valid in the first segment | 12 | Reviewed-by: Andrew Jones <drjones@redhat.com> |
9 | of the packet. | 13 | Reviewed-by: Alexander Graf <agraf@csgraf.de> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220204165506.2846058-7-peter.maydell@linaro.org | ||
16 | --- | ||
17 | target/arm/cpu64.c | 14 ++++++++++---- | ||
18 | 1 file changed, 10 insertions(+), 4 deletions(-) | ||
10 | 19 | ||
11 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Message-id: 20180530061711.23673-3-clg@kaod.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | hw/net/ftgmac100.c | 31 ++++++++++++++++++++++++++++++- | ||
17 | 1 file changed, 30 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/net/ftgmac100.c | 22 | --- a/target/arm/cpu64.c |
22 | +++ b/hw/net/ftgmac100.c | 23 | +++ b/target/arm/cpu64.c |
23 | @@ -XXX,XX +XXX,XX @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t tx_ring, | 24 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) |
24 | break; | 25 | uint64_t t; |
26 | |||
27 | /* Exit early if PAuth is enabled, and fall through to disable it */ | ||
28 | - if (kvm_enabled() && cpu->prop_pauth) { | ||
29 | + if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) { | ||
30 | if (!cpu_isar_feature(aa64_pauth, cpu)) { | ||
31 | - error_setg(errp, "'pauth' feature not supported by KVM on this host"); | ||
32 | + error_setg(errp, "'pauth' feature not supported by %s on this host", | ||
33 | + kvm_enabled() ? "KVM" : "hvf"); | ||
25 | } | 34 | } |
26 | 35 | ||
27 | + /* Check for VLAN */ | 36 | return; |
28 | + if (bd.des0 & FTGMAC100_TXDES0_FTS && | 37 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) |
29 | + bd.des1 & FTGMAC100_TXDES1_INS_VLANTAG && | 38 | |
30 | + be16_to_cpu(PKT_GET_ETH_HDR(ptr)->h_proto) != ETH_P_VLAN) { | 39 | /* Default to PAUTH on, with the architected algorithm on TCG. */ |
31 | + if (frame_size + len + 4 > sizeof(s->frame)) { | 40 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); |
32 | + qemu_log_mask(LOG_GUEST_ERROR, "%s: frame too big : %d bytes\n", | 41 | - if (kvm_enabled()) { |
33 | + __func__, len); | 42 | + if (kvm_enabled() || hvf_enabled()) { |
34 | + s->isr |= FTGMAC100_INT_XPKT_LOST; | 43 | /* |
35 | + len = sizeof(s->frame) - frame_size - 4; | 44 | * Mirror PAuth support from the probed sysregs back into the |
36 | + } | 45 | - * property for KVM. Is it just a bit backward? Yes it is! |
37 | + memmove(ptr + 16, ptr + 12, len - 12); | 46 | + * property for KVM or hvf. Is it just a bit backward? Yes it is! |
38 | + stw_be_p(ptr + 12, ETH_P_VLAN); | 47 | + * Note that prop_pauth is true whether the host CPU supports the |
39 | + stw_be_p(ptr + 14, bd.des1); | 48 | + * architected QARMA5 algorithm or the IMPDEF one. We don't |
40 | + len += 4; | 49 | + * provide the separate pauth-impdef property for KVM or hvf, |
41 | + } | 50 | + * only for TCG. |
42 | + | 51 | */ |
43 | ptr += len; | 52 | cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu); |
44 | frame_size += len; | 53 | } else { |
45 | if (bd.des0 & FTGMAC100_TXDES0_LTS) { | 54 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) |
46 | @@ -XXX,XX +XXX,XX @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf, | 55 | #elif defined(CONFIG_HVF) |
47 | buf_len += size - 4; | 56 | ARMCPU *cpu = ARM_CPU(obj); |
48 | } | 57 | hvf_arm_set_cpu_features_from_host(cpu); |
49 | buf_addr = bd.des3; | 58 | + aarch64_add_pauth_properties(obj); |
50 | - dma_memory_write(&address_space_memory, buf_addr, buf, buf_len); | 59 | #else |
51 | + if (first && proto == ETH_P_VLAN && buf_len >= 18) { | 60 | g_assert_not_reached(); |
52 | + bd.des1 = lduw_be_p(buf + 14) | FTGMAC100_RXDES1_VLANTAG_AVAIL; | 61 | #endif |
53 | + | ||
54 | + if (s->maccr & FTGMAC100_MACCR_RM_VLAN) { | ||
55 | + dma_memory_write(&address_space_memory, buf_addr, buf, 12); | ||
56 | + dma_memory_write(&address_space_memory, buf_addr + 12, buf + 16, | ||
57 | + buf_len - 16); | ||
58 | + } else { | ||
59 | + dma_memory_write(&address_space_memory, buf_addr, buf, buf_len); | ||
60 | + } | ||
61 | + } else { | ||
62 | + bd.des1 = 0; | ||
63 | + dma_memory_write(&address_space_memory, buf_addr, buf, buf_len); | ||
64 | + } | ||
65 | buf += buf_len; | ||
66 | if (size < 4) { | ||
67 | dma_memory_write(&address_space_memory, buf_addr + buf_len, | ||
68 | -- | 62 | -- |
69 | 2.17.1 | 63 | 2.25.1 |
70 | 64 | ||
71 | 65 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | Currently there is no way for a board model's Kconfig stanza to |
---|---|---|---|
2 | say "I have an i2c bus which the user can plug an i2c device into, | ||
3 | build all the free-standing i2c devices". The Kconfig mechanism | ||
4 | for this is the "device group". Add an I2C_DEVICES group along | ||
5 | the same lines as the existing PCI_DEVICES. Simple free-standing | ||
6 | i2c devices which a user might plausibly want to be able to | ||
7 | plug in on the QEMU commandline should have | ||
8 | default y if I2C_DEVICES | ||
9 | and board models which have an i2c bus that is user-accessible | ||
10 | should use | ||
11 | imply I2C_DEVICES | ||
12 | to cause those pluggable devices to be built. | ||
2 | 13 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 14 | In this commit we mark only a fairly conservative set of i2c devices |
4 | Message-id: 20180606152128.449-11-f4bug@amsat.org | 15 | as belonging to the I2C_DEVICES group: the simple sensors and RTCs |
16 | (not including PMBus devices or devices which need GPIO lines to be | ||
17 | connected). | ||
18 | |||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
23 | Message-id: 20220208155911.3408455-2-peter.maydell@linaro.org | ||
6 | --- | 24 | --- |
7 | target/riscv/op_helper.c | 6 ++++-- | 25 | docs/devel/kconfig.rst | 8 ++++++-- |
8 | 1 file changed, 4 insertions(+), 2 deletions(-) | 26 | hw/i2c/Kconfig | 5 +++++ |
27 | hw/rtc/Kconfig | 2 ++ | ||
28 | hw/sensor/Kconfig | 5 +++++ | ||
29 | 4 files changed, 18 insertions(+), 2 deletions(-) | ||
9 | 30 | ||
10 | diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c | 31 | diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst |
11 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/target/riscv/op_helper.c | 33 | --- a/docs/devel/kconfig.rst |
13 | +++ b/target/riscv/op_helper.c | 34 | +++ b/docs/devel/kconfig.rst |
14 | @@ -XXX,XX +XXX,XX @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write, | 35 | @@ -XXX,XX +XXX,XX @@ declares its dependencies in different ways: |
15 | if ((val_to_write & 3) == 0) { | 36 | no directive and are not used in the Makefile either; they only appear |
16 | env->stvec = val_to_write >> 2 << 2; | 37 | as conditions for ``default y`` directives. |
17 | } else { | 38 | |
18 | - qemu_log_mask(LOG_UNIMP, "CSR_STVEC: vectored traps not supported"); | 39 | - QEMU currently has two device groups, ``PCI_DEVICES`` and |
19 | + qemu_log_mask(LOG_UNIMP, | 40 | - ``TEST_DEVICES``. PCI devices usually have a ``default y if |
20 | + "CSR_STVEC: vectored traps not supported\n"); | 41 | + QEMU currently has three device groups, ``PCI_DEVICES``, ``I2C_DEVICES``, |
21 | } | 42 | + and ``TEST_DEVICES``. PCI devices usually have a ``default y if |
22 | break; | 43 | PCI_DEVICES`` directive rather than just ``default y``. This lets |
23 | case CSR_SCOUNTEREN: | 44 | some boards (notably s390) easily support a subset of PCI devices, |
24 | @@ -XXX,XX +XXX,XX @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write, | 45 | for example only VFIO (passthrough) and virtio-pci devices. |
25 | if ((val_to_write & 3) == 0) { | 46 | + ``I2C_DEVICES`` is similar to ``PCI_DEVICES``. It contains i2c devices |
26 | env->mtvec = val_to_write >> 2 << 2; | 47 | + that users might reasonably want to plug in to an i2c bus on any |
27 | } else { | 48 | + board (and not ones which are very board-specific or that need |
28 | - qemu_log_mask(LOG_UNIMP, "CSR_MTVEC: vectored traps not supported"); | 49 | + to be wired up in a way that can't be done on the command line). |
29 | + qemu_log_mask(LOG_UNIMP, | 50 | ``TEST_DEVICES`` instead is used for devices that are rarely used on |
30 | + "CSR_MTVEC: vectored traps not supported\n"); | 51 | production virtual machines, but provide useful hooks to test QEMU |
31 | } | 52 | or KVM. |
32 | break; | 53 | diff --git a/hw/i2c/Kconfig b/hw/i2c/Kconfig |
33 | case CSR_MCOUNTEREN: | 54 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/hw/i2c/Kconfig | ||
56 | +++ b/hw/i2c/Kconfig | ||
57 | @@ -XXX,XX +XXX,XX @@ | ||
58 | config I2C | ||
59 | bool | ||
60 | |||
61 | +config I2C_DEVICES | ||
62 | + # Device group for i2c devices which can reasonably be user-plugged | ||
63 | + # to any board's i2c bus | ||
64 | + bool | ||
65 | + | ||
66 | config SMBUS | ||
67 | bool | ||
68 | select I2C | ||
69 | diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/hw/rtc/Kconfig | ||
72 | +++ b/hw/rtc/Kconfig | ||
73 | @@ -XXX,XX +XXX,XX @@ | ||
74 | config DS1338 | ||
75 | bool | ||
76 | depends on I2C | ||
77 | + default y if I2C_DEVICES | ||
78 | |||
79 | config M41T80 | ||
80 | bool | ||
81 | depends on I2C | ||
82 | + default y if I2C_DEVICES | ||
83 | |||
84 | config M48T59 | ||
85 | bool | ||
86 | diff --git a/hw/sensor/Kconfig b/hw/sensor/Kconfig | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/sensor/Kconfig | ||
89 | +++ b/hw/sensor/Kconfig | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | config TMP105 | ||
92 | bool | ||
93 | depends on I2C | ||
94 | + default y if I2C_DEVICES | ||
95 | |||
96 | config TMP421 | ||
97 | bool | ||
98 | depends on I2C | ||
99 | + default y if I2C_DEVICES | ||
100 | |||
101 | config DPS310 | ||
102 | bool | ||
103 | depends on I2C | ||
104 | + default y if I2C_DEVICES | ||
105 | |||
106 | config EMC141X | ||
107 | bool | ||
108 | depends on I2C | ||
109 | + default y if I2C_DEVICES | ||
110 | |||
111 | config ADM1272 | ||
112 | bool | ||
113 | @@ -XXX,XX +XXX,XX @@ config MAX34451 | ||
114 | config LSM303DLHC_MAG | ||
115 | bool | ||
116 | depends on I2C | ||
117 | + default y if I2C_DEVICES | ||
34 | -- | 118 | -- |
35 | 2.17.1 | 119 | 2.25.1 |
36 | 120 | ||
37 | 121 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | For arm boards with an i2c bus which a user could reasonably |
---|---|---|---|
2 | want to plug arbitrary devices, add 'imply I2C_DEVICES' to the | ||
3 | Kconfig stanza. | ||
2 | 4 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Reviewed-by: Laurent Vivier <laurent@vivier.eu> | ||
5 | Message-id: 20180606152128.449-10-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
9 | Message-id: 20220208155911.3408455-3-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | target/m68k/translate.c | 2 +- | 11 | hw/arm/Kconfig | 10 ++++++++++ |
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 10 insertions(+) |
10 | 13 | ||
11 | diff --git a/target/m68k/translate.c b/target/m68k/translate.c | 14 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/m68k/translate.c | 16 | --- a/hw/arm/Kconfig |
14 | +++ b/target/m68k/translate.c | 17 | +++ b/hw/arm/Kconfig |
15 | @@ -XXX,XX +XXX,XX @@ DISAS_INSN(undef) | 18 | @@ -XXX,XX +XXX,XX @@ config DIGIC |
16 | /* ??? This is both instructions that are as yet unimplemented | 19 | |
17 | for the 680x0 series, as well as those that are implemented | 20 | config EXYNOS4 |
18 | but actually illegal for CPU32 or pre-68020. */ | 21 | bool |
19 | - qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x", | 22 | + imply I2C_DEVICES |
20 | + qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x\n", | 23 | select A9MPCORE |
21 | insn, s->insn_pc); | 24 | select I2C |
22 | gen_exception(s, s->insn_pc, EXCP_UNSUPPORTED); | 25 | select LAN9118 |
23 | } | 26 | @@ -XXX,XX +XXX,XX @@ config REALVIEW |
27 | bool | ||
28 | imply PCI_DEVICES | ||
29 | imply PCI_TESTDEV | ||
30 | + imply I2C_DEVICES | ||
31 | select SMC91C111 | ||
32 | select LAN9118 | ||
33 | select A9MPCORE | ||
34 | @@ -XXX,XX +XXX,XX @@ config SABRELITE | ||
35 | |||
36 | config STELLARIS | ||
37 | bool | ||
38 | + imply I2C_DEVICES | ||
39 | select ARM_V7M | ||
40 | select CMSDK_APB_WATCHDOG | ||
41 | select I2C | ||
42 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX | ||
43 | |||
44 | config FSL_IMX25 | ||
45 | bool | ||
46 | + imply I2C_DEVICES | ||
47 | select IMX | ||
48 | select IMX_FEC | ||
49 | select IMX_I2C | ||
50 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX25 | ||
51 | |||
52 | config FSL_IMX31 | ||
53 | bool | ||
54 | + imply I2C_DEVICES | ||
55 | select SERIAL | ||
56 | select IMX | ||
57 | select IMX_I2C | ||
58 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX31 | ||
59 | |||
60 | config FSL_IMX6 | ||
61 | bool | ||
62 | + imply I2C_DEVICES | ||
63 | select A9MPCORE | ||
64 | select IMX | ||
65 | select IMX_FEC | ||
66 | @@ -XXX,XX +XXX,XX @@ config ASPEED_SOC | ||
67 | |||
68 | config MPS2 | ||
69 | bool | ||
70 | + imply I2C_DEVICES | ||
71 | select ARMSSE | ||
72 | select LAN9118 | ||
73 | select MPS2_FPGAIO | ||
74 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX7 | ||
75 | bool | ||
76 | imply PCI_DEVICES | ||
77 | imply TEST_DEVICES | ||
78 | + imply I2C_DEVICES | ||
79 | select A15MPCORE | ||
80 | select PCI | ||
81 | select IMX | ||
82 | @@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3 | ||
83 | |||
84 | config FSL_IMX6UL | ||
85 | bool | ||
86 | + imply I2C_DEVICES | ||
87 | select A15MPCORE | ||
88 | select IMX | ||
89 | select IMX_FEC | ||
90 | @@ -XXX,XX +XXX,XX @@ config MICROBIT | ||
91 | |||
92 | config NRF51_SOC | ||
93 | bool | ||
94 | + imply I2C_DEVICES | ||
95 | select I2C | ||
96 | select ARM_V7M | ||
97 | select UNIMP | ||
24 | -- | 98 | -- |
25 | 2.17.1 | 99 | 2.25.1 |
26 | 100 | ||
27 | 101 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | In the armv7m object, handle clock inputs that aren't connected. |
---|---|---|---|
2 | This is always an error for 'cpuclk'. For 'refclk' it is OK for this | ||
3 | to be disconnected, but we need to handle it by not trying to connect | ||
4 | a sourceless-clock to the systick device. | ||
2 | 5 | ||
3 | As of this commit, the Spec v1 is not working, and all controllers | 6 | This fixes a bug where on the mps2-an521 and similar boards (which |
4 | expect the cards to be conformant to Spec v2. | 7 | do not have a refclk) the systick device incorrectly reset with |
8 | SYST_CSR.CLKSOURCE 0 ("use refclk") rather than 1 ("use CPU clock"). | ||
5 | 9 | ||
6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | Cc: qemu-stable@nongnu.org |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 11 | Reported-by: Richard Petri <git@rpls.de> |
8 | Message-id: 20180607180641.874-4-f4bug@amsat.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220208171643.3486277-1-peter.maydell@linaro.org | ||
10 | --- | 16 | --- |
11 | include/hw/sd/sd.h | 5 +++++ | 17 | hw/arm/armv7m.c | 26 ++++++++++++++++++++++---- |
12 | hw/sd/sd.c | 23 ++++++++++++++++++++--- | 18 | 1 file changed, 22 insertions(+), 4 deletions(-) |
13 | 2 files changed, 25 insertions(+), 3 deletions(-) | ||
14 | 19 | ||
15 | diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h | 20 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c |
16 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/hw/sd/sd.h | 22 | --- a/hw/arm/armv7m.c |
18 | +++ b/include/hw/sd/sd.h | 23 | +++ b/hw/arm/armv7m.c |
19 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) |
20 | #define APP_CMD (1 << 5) | 25 | return; |
21 | #define AKE_SEQ_ERROR (1 << 3) | 26 | } |
22 | 27 | ||
23 | +enum SDPhySpecificationVersion { | 28 | + /* cpuclk must be connected; refclk is optional */ |
24 | + SD_PHY_SPECv1_10_VERS = 1, | 29 | + if (!clock_has_source(s->cpuclk)) { |
25 | + SD_PHY_SPECv2_00_VERS = 2, | 30 | + error_setg(errp, "armv7m: cpuclk must be connected"); |
26 | +}; | ||
27 | + | ||
28 | typedef enum { | ||
29 | SD_VOLTAGE_0_4V = 400, /* currently not supported */ | ||
30 | SD_VOLTAGE_1_8V = 1800, | ||
31 | diff --git a/hw/sd/sd.c b/hw/sd/sd.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/hw/sd/sd.c | ||
34 | +++ b/hw/sd/sd.c | ||
35 | @@ -XXX,XX +XXX,XX @@ | ||
36 | /* | ||
37 | * SD Memory Card emulation as defined in the "SD Memory Card Physical | ||
38 | - * layer specification, Version 1.10." | ||
39 | + * layer specification, Version 2.00." | ||
40 | * | ||
41 | * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org> | ||
42 | * Copyright (c) 2007 CodeSourcery | ||
43 | + * Copyright (c) 2018 Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
44 | * | ||
45 | * Redistribution and use in source and binary forms, with or without | ||
46 | * modification, are permitted provided that the following conditions | ||
47 | @@ -XXX,XX +XXX,XX @@ struct SDState { | ||
48 | uint8_t sd_status[64]; | ||
49 | |||
50 | /* Configurable properties */ | ||
51 | + uint8_t spec_version; | ||
52 | BlockBackend *blk; | ||
53 | bool spi; | ||
54 | |||
55 | @@ -XXX,XX +XXX,XX @@ static void sd_ocr_powerup(void *opaque) | ||
56 | |||
57 | static void sd_set_scr(SDState *sd) | ||
58 | { | ||
59 | - sd->scr[0] = (0 << 4) /* SCR structure version 1.0 */ | ||
60 | - | 1; /* Spec Version 1.10 */ | ||
61 | + sd->scr[0] = 0 << 4; /* SCR structure version 1.0 */ | ||
62 | + if (sd->spec_version == SD_PHY_SPECv1_10_VERS) { | ||
63 | + sd->scr[0] |= 1; /* Spec Version 1.10 */ | ||
64 | + } else { | ||
65 | + sd->scr[0] |= 2; /* Spec Version 2.00 */ | ||
66 | + } | ||
67 | sd->scr[1] = (2 << 4) /* SDSC Card (Security Version 1.01) */ | ||
68 | | 0b0101; /* 1-bit or 4-bit width bus modes */ | ||
69 | sd->scr[2] = 0x00; /* Extended Security is not supported. */ | ||
70 | @@ -XXX,XX +XXX,XX @@ static void sd_realize(DeviceState *dev, Error **errp) | ||
71 | |||
72 | sd->proto_name = sd->spi ? "SPI" : "SD"; | ||
73 | |||
74 | + switch (sd->spec_version) { | ||
75 | + case SD_PHY_SPECv1_10_VERS | ||
76 | + ... SD_PHY_SPECv2_00_VERS: | ||
77 | + break; | ||
78 | + default: | ||
79 | + error_setg(errp, "Invalid SD card Spec version: %u", sd->spec_version); | ||
80 | + return; | 31 | + return; |
81 | + } | 32 | + } |
82 | + | 33 | + |
83 | if (sd->blk && blk_is_read_only(sd->blk)) { | 34 | memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1); |
84 | error_setg(errp, "Cannot use read-only drive as SD card"); | 35 | |
36 | s->cpu = ARM_CPU(object_new_with_props(s->cpu_type, OBJECT(s), "cpu", | ||
37 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) | ||
38 | &s->sysreg_ns_mem); | ||
39 | } | ||
40 | |||
41 | - /* Create and map the systick devices */ | ||
42 | - qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", s->refclk); | ||
43 | + /* | ||
44 | + * Create and map the systick devices. Note that we only connect | ||
45 | + * refclk if it has been connected to us; otherwise the systick | ||
46 | + * device gets the wrong answer for clock_has_source(refclk), because | ||
47 | + * it has an immediate source (the ARMv7M's clock object) but not | ||
48 | + * an ultimate source, and then it won't correctly auto-select the | ||
49 | + * CPU clock as its only possible clock source. | ||
50 | + */ | ||
51 | + if (clock_has_source(s->refclk)) { | ||
52 | + qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", | ||
53 | + s->refclk); | ||
54 | + } | ||
55 | qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "cpuclk", s->cpuclk); | ||
56 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->systick[M_REG_NS]), errp)) { | ||
85 | return; | 57 | return; |
86 | @@ -XXX,XX +XXX,XX @@ static void sd_realize(DeviceState *dev, Error **errp) | 58 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) |
87 | } | 59 | */ |
88 | 60 | object_initialize_child(OBJECT(dev), "systick-reg-s", | |
89 | static Property sd_properties[] = { | 61 | &s->systick[M_REG_S], TYPE_SYSTICK); |
90 | + DEFINE_PROP_UINT8("spec_version", SDState, | 62 | - qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk", |
91 | + spec_version, SD_PHY_SPECv2_00_VERS), | 63 | - s->refclk); |
92 | DEFINE_PROP_DRIVE("drive", SDState, blk), | 64 | + if (clock_has_source(s->refclk)) { |
93 | /* We do not model the chip select pin, so allow the board to select | 65 | + qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk", |
94 | * whether card should be in SSI or MMC/SD mode. It is also up to the | 66 | + s->refclk); |
67 | + } | ||
68 | qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "cpuclk", | ||
69 | s->cpuclk); | ||
70 | |||
95 | -- | 71 | -- |
96 | 2.17.1 | 72 | 2.25.1 |
97 | 73 | ||
98 | 74 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | The function qemu_madvise() and the QEMU_MADV_* constants associated |
---|---|---|---|
2 | with it are used in only 10 files. Move them out of osdep.h to a new | ||
3 | qemu/madvise.h header that is included where it is needed. | ||
2 | 4 | ||
3 | Specs are available here : | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20220208200856.3558249-2-peter.maydell@linaro.org | ||
9 | --- | ||
10 | include/qemu/madvise.h | 95 ++++++++++++++++++++++++++++++++++++++ | ||
11 | include/qemu/osdep.h | 82 -------------------------------- | ||
12 | backends/hostmem-file.c | 1 + | ||
13 | backends/hostmem.c | 1 + | ||
14 | hw/virtio/virtio-balloon.c | 1 + | ||
15 | migration/postcopy-ram.c | 1 + | ||
16 | migration/qemu-file.c | 1 + | ||
17 | migration/ram.c | 1 + | ||
18 | softmmu/physmem.c | 1 + | ||
19 | tcg/region.c | 1 + | ||
20 | util/osdep.c | 1 + | ||
21 | util/oslib-posix.c | 1 + | ||
22 | 12 files changed, 105 insertions(+), 82 deletions(-) | ||
23 | create mode 100644 include/qemu/madvise.h | ||
4 | 24 | ||
5 | https://www.nxp.com/docs/en/application-note/AN264.pdf | 25 | diff --git a/include/qemu/madvise.h b/include/qemu/madvise.h |
6 | |||
7 | This is a simple model supporting the basic registers for led and GPIO | ||
8 | mode. The device also supports two blinking rates but not the model | ||
9 | yet. | ||
10 | |||
11 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Message-id: 20180530064049.27976-7-clg@kaod.org | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | --- | ||
17 | hw/misc/Makefile.objs | 1 + | ||
18 | tests/Makefile.include | 2 + | ||
19 | include/hw/misc/pca9552.h | 32 +++++ | ||
20 | include/hw/misc/pca9552_regs.h | 32 +++++ | ||
21 | tests/libqos/i2c.h | 2 + | ||
22 | hw/misc/pca9552.c | 240 ++++++++++++++++++++++++++++++++ | ||
23 | tests/pca9552-test.c | 116 +++++++++++++++ | ||
24 | tests/tmp105-test.c | 2 - | ||
25 | default-configs/arm-softmmu.mak | 1 + | ||
26 | 9 files changed, 426 insertions(+), 2 deletions(-) | ||
27 | create mode 100644 include/hw/misc/pca9552.h | ||
28 | create mode 100644 include/hw/misc/pca9552_regs.h | ||
29 | create mode 100644 hw/misc/pca9552.c | ||
30 | create mode 100644 tests/pca9552-test.c | ||
31 | |||
32 | diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/hw/misc/Makefile.objs | ||
35 | +++ b/hw/misc/Makefile.objs | ||
36 | @@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_SGA) += sga.o | ||
37 | common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o | ||
38 | common-obj-$(CONFIG_PCI_TESTDEV) += pci-testdev.o | ||
39 | common-obj-$(CONFIG_EDU) += edu.o | ||
40 | +common-obj-$(CONFIG_PCA9552) += pca9552.o | ||
41 | |||
42 | common-obj-y += unimp.o | ||
43 | common-obj-$(CONFIG_FW_CFG_DMA) += vmcoreinfo.o | ||
44 | diff --git a/tests/Makefile.include b/tests/Makefile.include | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/tests/Makefile.include | ||
47 | +++ b/tests/Makefile.include | ||
48 | @@ -XXX,XX +XXX,XX @@ check-qtest-sparc64-y += tests/prom-env-test$(EXESUF) | ||
49 | check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF) | ||
50 | |||
51 | check-qtest-arm-y = tests/tmp105-test$(EXESUF) | ||
52 | +check-qtest-arm-y += tests/pca9552-test$(EXESUF) | ||
53 | check-qtest-arm-y += tests/ds1338-test$(EXESUF) | ||
54 | check-qtest-arm-y += tests/m25p80-test$(EXESUF) | ||
55 | gcov-files-arm-y += hw/misc/tmp105.c | ||
56 | @@ -XXX,XX +XXX,XX @@ tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \ | ||
57 | tests/boot-sector.o tests/acpi-utils.o $(libqos-obj-y) | ||
58 | tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o $(libqos-obj-y) | ||
59 | tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y) | ||
60 | +tests/pca9552-test$(EXESUF): tests/pca9552-test.o $(libqos-omap-obj-y) | ||
61 | tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y) | ||
62 | tests/m25p80-test$(EXESUF): tests/m25p80-test.o | ||
63 | tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y) | ||
64 | diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h | ||
65 | new file mode 100644 | 26 | new file mode 100644 |
66 | index XXXXXXX..XXXXXXX | 27 | index XXXXXXX..XXXXXXX |
67 | --- /dev/null | 28 | --- /dev/null |
68 | +++ b/include/hw/misc/pca9552.h | 29 | +++ b/include/qemu/madvise.h |
69 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ |
70 | +/* | 31 | +/* |
71 | + * PCA9552 I2C LED blinker | 32 | + * QEMU madvise wrapper functions |
72 | + * | ||
73 | + * Copyright (c) 2017-2018, IBM Corporation. | ||
74 | + * | ||
75 | + * This work is licensed under the terms of the GNU GPL, version 2 or | ||
76 | + * later. See the COPYING file in the top-level directory. | ||
77 | + */ | ||
78 | +#ifndef PCA9552_H | ||
79 | +#define PCA9552_H | ||
80 | + | ||
81 | +#include "hw/i2c/i2c.h" | ||
82 | + | ||
83 | +#define TYPE_PCA9552 "pca9552" | ||
84 | +#define PCA9552(obj) OBJECT_CHECK(PCA9552State, (obj), TYPE_PCA9552) | ||
85 | + | ||
86 | +#define PCA9552_NR_REGS 10 | ||
87 | + | ||
88 | +typedef struct PCA9552State { | ||
89 | + /*< private >*/ | ||
90 | + I2CSlave i2c; | ||
91 | + /*< public >*/ | ||
92 | + | ||
93 | + uint8_t len; | ||
94 | + uint8_t pointer; | ||
95 | + | ||
96 | + uint8_t regs[PCA9552_NR_REGS]; | ||
97 | + uint8_t max_reg; | ||
98 | + uint8_t nr_leds; | ||
99 | +} PCA9552State; | ||
100 | + | ||
101 | +#endif | ||
102 | diff --git a/include/hw/misc/pca9552_regs.h b/include/hw/misc/pca9552_regs.h | ||
103 | new file mode 100644 | ||
104 | index XXXXXXX..XXXXXXX | ||
105 | --- /dev/null | ||
106 | +++ b/include/hw/misc/pca9552_regs.h | ||
107 | @@ -XXX,XX +XXX,XX @@ | ||
108 | +/* | ||
109 | + * PCA9552 I2C LED blinker registers | ||
110 | + * | ||
111 | + * Copyright (c) 2017-2018, IBM Corporation. | ||
112 | + * | ||
113 | + * This work is licensed under the terms of the GNU GPL, version 2 or | ||
114 | + * later. See the COPYING file in the top-level directory. | ||
115 | + */ | ||
116 | +#ifndef PCA9552_REGS_H | ||
117 | +#define PCA9552_REGS_H | ||
118 | + | ||
119 | +/* | ||
120 | + * Bits [0:3] are used to address a specific register. | ||
121 | + */ | ||
122 | +#define PCA9552_INPUT0 0 /* read only input register 0 */ | ||
123 | +#define PCA9552_INPUT1 1 /* read only input register 1 */ | ||
124 | +#define PCA9552_PSC0 2 /* read/write frequency prescaler 0 */ | ||
125 | +#define PCA9552_PWM0 3 /* read/write PWM register 0 */ | ||
126 | +#define PCA9552_PSC1 4 /* read/write frequency prescaler 1 */ | ||
127 | +#define PCA9552_PWM1 5 /* read/write PWM register 1 */ | ||
128 | +#define PCA9552_LS0 6 /* read/write LED0 to LED3 selector */ | ||
129 | +#define PCA9552_LS1 7 /* read/write LED4 to LED7 selector */ | ||
130 | +#define PCA9552_LS2 8 /* read/write LED8 to LED11 selector */ | ||
131 | +#define PCA9552_LS3 9 /* read/write LED12 to LED15 selector */ | ||
132 | + | ||
133 | +/* | ||
134 | + * Bit [4] is used to activate the Auto-Increment option of the | ||
135 | + * register address | ||
136 | + */ | ||
137 | +#define PCA9552_AUTOINC (1 << 4) | ||
138 | + | ||
139 | +#endif | ||
140 | diff --git a/tests/libqos/i2c.h b/tests/libqos/i2c.h | ||
141 | index XXXXXXX..XXXXXXX 100644 | ||
142 | --- a/tests/libqos/i2c.h | ||
143 | +++ b/tests/libqos/i2c.h | ||
144 | @@ -XXX,XX +XXX,XX @@ struct I2CAdapter { | ||
145 | QTestState *qts; | ||
146 | }; | ||
147 | |||
148 | +#define OMAP2_I2C_1_BASE 0x48070000 | ||
149 | + | ||
150 | void i2c_send(I2CAdapter *i2c, uint8_t addr, | ||
151 | const uint8_t *buf, uint16_t len); | ||
152 | void i2c_recv(I2CAdapter *i2c, uint8_t addr, | ||
153 | diff --git a/hw/misc/pca9552.c b/hw/misc/pca9552.c | ||
154 | new file mode 100644 | ||
155 | index XXXXXXX..XXXXXXX | ||
156 | --- /dev/null | ||
157 | +++ b/hw/misc/pca9552.c | ||
158 | @@ -XXX,XX +XXX,XX @@ | ||
159 | +/* | ||
160 | + * PCA9552 I2C LED blinker | ||
161 | + * | ||
162 | + * https://www.nxp.com/docs/en/application-note/AN264.pdf | ||
163 | + * | ||
164 | + * Copyright (c) 2017-2018, IBM Corporation. | ||
165 | + * | ||
166 | + * This work is licensed under the terms of the GNU GPL, version 2 or | ||
167 | + * later. See the COPYING file in the top-level directory. | ||
168 | + */ | ||
169 | + | ||
170 | +#include "qemu/osdep.h" | ||
171 | +#include "qemu/log.h" | ||
172 | +#include "hw/hw.h" | ||
173 | +#include "hw/misc/pca9552.h" | ||
174 | +#include "hw/misc/pca9552_regs.h" | ||
175 | + | ||
176 | +#define PCA9552_LED_ON 0x0 | ||
177 | +#define PCA9552_LED_OFF 0x1 | ||
178 | +#define PCA9552_LED_PWM0 0x2 | ||
179 | +#define PCA9552_LED_PWM1 0x3 | ||
180 | + | ||
181 | +static uint8_t pca9552_pin_get_config(PCA9552State *s, int pin) | ||
182 | +{ | ||
183 | + uint8_t reg = PCA9552_LS0 + (pin / 4); | ||
184 | + uint8_t shift = (pin % 4) << 1; | ||
185 | + | ||
186 | + return extract32(s->regs[reg], shift, 2); | ||
187 | +} | ||
188 | + | ||
189 | +static void pca9552_update_pin_input(PCA9552State *s) | ||
190 | +{ | ||
191 | + int i; | ||
192 | + | ||
193 | + for (i = 0; i < s->nr_leds; i++) { | ||
194 | + uint8_t input_reg = PCA9552_INPUT0 + (i / 8); | ||
195 | + uint8_t input_shift = (i % 8); | ||
196 | + uint8_t config = pca9552_pin_get_config(s, i); | ||
197 | + | ||
198 | + switch (config) { | ||
199 | + case PCA9552_LED_ON: | ||
200 | + s->regs[input_reg] |= 1 << input_shift; | ||
201 | + break; | ||
202 | + case PCA9552_LED_OFF: | ||
203 | + s->regs[input_reg] &= ~(1 << input_shift); | ||
204 | + break; | ||
205 | + case PCA9552_LED_PWM0: | ||
206 | + case PCA9552_LED_PWM1: | ||
207 | + /* TODO */ | ||
208 | + default: | ||
209 | + break; | ||
210 | + } | ||
211 | + } | ||
212 | +} | ||
213 | + | ||
214 | +static uint8_t pca9552_read(PCA9552State *s, uint8_t reg) | ||
215 | +{ | ||
216 | + switch (reg) { | ||
217 | + case PCA9552_INPUT0: | ||
218 | + case PCA9552_INPUT1: | ||
219 | + case PCA9552_PSC0: | ||
220 | + case PCA9552_PWM0: | ||
221 | + case PCA9552_PSC1: | ||
222 | + case PCA9552_PWM1: | ||
223 | + case PCA9552_LS0: | ||
224 | + case PCA9552_LS1: | ||
225 | + case PCA9552_LS2: | ||
226 | + case PCA9552_LS3: | ||
227 | + return s->regs[reg]; | ||
228 | + default: | ||
229 | + qemu_log_mask(LOG_GUEST_ERROR, "%s: unexpected read to register %d\n", | ||
230 | + __func__, reg); | ||
231 | + return 0xFF; | ||
232 | + } | ||
233 | +} | ||
234 | + | ||
235 | +static void pca9552_write(PCA9552State *s, uint8_t reg, uint8_t data) | ||
236 | +{ | ||
237 | + switch (reg) { | ||
238 | + case PCA9552_PSC0: | ||
239 | + case PCA9552_PWM0: | ||
240 | + case PCA9552_PSC1: | ||
241 | + case PCA9552_PWM1: | ||
242 | + s->regs[reg] = data; | ||
243 | + break; | ||
244 | + | ||
245 | + case PCA9552_LS0: | ||
246 | + case PCA9552_LS1: | ||
247 | + case PCA9552_LS2: | ||
248 | + case PCA9552_LS3: | ||
249 | + s->regs[reg] = data; | ||
250 | + pca9552_update_pin_input(s); | ||
251 | + break; | ||
252 | + | ||
253 | + case PCA9552_INPUT0: | ||
254 | + case PCA9552_INPUT1: | ||
255 | + default: | ||
256 | + qemu_log_mask(LOG_GUEST_ERROR, "%s: unexpected write to register %d\n", | ||
257 | + __func__, reg); | ||
258 | + } | ||
259 | +} | ||
260 | + | ||
261 | +/* | ||
262 | + * When Auto-Increment is on, the register address is incremented | ||
263 | + * after each byte is sent to or received by the device. The index | ||
264 | + * rollovers to 0 when the maximum register address is reached. | ||
265 | + */ | ||
266 | +static void pca9552_autoinc(PCA9552State *s) | ||
267 | +{ | ||
268 | + if (s->pointer != 0xFF && s->pointer & PCA9552_AUTOINC) { | ||
269 | + uint8_t reg = s->pointer & 0xf; | ||
270 | + | ||
271 | + reg = (reg + 1) % (s->max_reg + 1); | ||
272 | + s->pointer = reg | PCA9552_AUTOINC; | ||
273 | + } | ||
274 | +} | ||
275 | + | ||
276 | +static int pca9552_recv(I2CSlave *i2c) | ||
277 | +{ | ||
278 | + PCA9552State *s = PCA9552(i2c); | ||
279 | + uint8_t ret; | ||
280 | + | ||
281 | + ret = pca9552_read(s, s->pointer & 0xf); | ||
282 | + | ||
283 | + /* | ||
284 | + * From the Specs: | ||
285 | + * | ||
286 | + * Important Note: When a Read sequence is initiated and the | ||
287 | + * AI bit is set to Logic Level 1, the Read Sequence MUST | ||
288 | + * start by a register different from 0. | ||
289 | + * | ||
290 | + * I don't know what should be done in this case, so throw an | ||
291 | + * error. | ||
292 | + */ | ||
293 | + if (s->pointer == PCA9552_AUTOINC) { | ||
294 | + qemu_log_mask(LOG_GUEST_ERROR, | ||
295 | + "%s: Autoincrement read starting with register 0\n", | ||
296 | + __func__); | ||
297 | + } | ||
298 | + | ||
299 | + pca9552_autoinc(s); | ||
300 | + | ||
301 | + return ret; | ||
302 | +} | ||
303 | + | ||
304 | +static int pca9552_send(I2CSlave *i2c, uint8_t data) | ||
305 | +{ | ||
306 | + PCA9552State *s = PCA9552(i2c); | ||
307 | + | ||
308 | + /* First byte sent by is the register address */ | ||
309 | + if (s->len == 0) { | ||
310 | + s->pointer = data; | ||
311 | + s->len++; | ||
312 | + } else { | ||
313 | + pca9552_write(s, s->pointer & 0xf, data); | ||
314 | + | ||
315 | + pca9552_autoinc(s); | ||
316 | + } | ||
317 | + | ||
318 | + return 0; | ||
319 | +} | ||
320 | + | ||
321 | +static int pca9552_event(I2CSlave *i2c, enum i2c_event event) | ||
322 | +{ | ||
323 | + PCA9552State *s = PCA9552(i2c); | ||
324 | + | ||
325 | + s->len = 0; | ||
326 | + return 0; | ||
327 | +} | ||
328 | + | ||
329 | +static const VMStateDescription pca9552_vmstate = { | ||
330 | + .name = "PCA9552", | ||
331 | + .version_id = 0, | ||
332 | + .minimum_version_id = 0, | ||
333 | + .fields = (VMStateField[]) { | ||
334 | + VMSTATE_UINT8(len, PCA9552State), | ||
335 | + VMSTATE_UINT8(pointer, PCA9552State), | ||
336 | + VMSTATE_UINT8_ARRAY(regs, PCA9552State, PCA9552_NR_REGS), | ||
337 | + VMSTATE_I2C_SLAVE(i2c, PCA9552State), | ||
338 | + VMSTATE_END_OF_LIST() | ||
339 | + } | ||
340 | +}; | ||
341 | + | ||
342 | +static void pca9552_reset(DeviceState *dev) | ||
343 | +{ | ||
344 | + PCA9552State *s = PCA9552(dev); | ||
345 | + | ||
346 | + s->regs[PCA9552_PSC0] = 0xFF; | ||
347 | + s->regs[PCA9552_PWM0] = 0x80; | ||
348 | + s->regs[PCA9552_PSC1] = 0xFF; | ||
349 | + s->regs[PCA9552_PWM1] = 0x80; | ||
350 | + s->regs[PCA9552_LS0] = 0x55; /* all OFF */ | ||
351 | + s->regs[PCA9552_LS1] = 0x55; | ||
352 | + s->regs[PCA9552_LS2] = 0x55; | ||
353 | + s->regs[PCA9552_LS3] = 0x55; | ||
354 | + | ||
355 | + pca9552_update_pin_input(s); | ||
356 | + | ||
357 | + s->pointer = 0xFF; | ||
358 | + s->len = 0; | ||
359 | +} | ||
360 | + | ||
361 | +static void pca9552_initfn(Object *obj) | ||
362 | +{ | ||
363 | + PCA9552State *s = PCA9552(obj); | ||
364 | + | ||
365 | + /* If support for the other PCA955X devices are implemented, these | ||
366 | + * constant values might be part of class structure describing the | ||
367 | + * PCA955X device | ||
368 | + */ | ||
369 | + s->max_reg = PCA9552_LS3; | ||
370 | + s->nr_leds = 16; | ||
371 | +} | ||
372 | + | ||
373 | +static void pca9552_class_init(ObjectClass *klass, void *data) | ||
374 | +{ | ||
375 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
376 | + I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); | ||
377 | + | ||
378 | + k->event = pca9552_event; | ||
379 | + k->recv = pca9552_recv; | ||
380 | + k->send = pca9552_send; | ||
381 | + dc->reset = pca9552_reset; | ||
382 | + dc->vmsd = &pca9552_vmstate; | ||
383 | +} | ||
384 | + | ||
385 | +static const TypeInfo pca9552_info = { | ||
386 | + .name = TYPE_PCA9552, | ||
387 | + .parent = TYPE_I2C_SLAVE, | ||
388 | + .instance_init = pca9552_initfn, | ||
389 | + .instance_size = sizeof(PCA9552State), | ||
390 | + .class_init = pca9552_class_init, | ||
391 | +}; | ||
392 | + | ||
393 | +static void pca9552_register_types(void) | ||
394 | +{ | ||
395 | + type_register_static(&pca9552_info); | ||
396 | +} | ||
397 | + | ||
398 | +type_init(pca9552_register_types) | ||
399 | diff --git a/tests/pca9552-test.c b/tests/pca9552-test.c | ||
400 | new file mode 100644 | ||
401 | index XXXXXXX..XXXXXXX | ||
402 | --- /dev/null | ||
403 | +++ b/tests/pca9552-test.c | ||
404 | @@ -XXX,XX +XXX,XX @@ | ||
405 | +/* | ||
406 | + * QTest testcase for the PCA9552 LED blinker | ||
407 | + * | ||
408 | + * Copyright (c) 2017-2018, IBM Corporation. | ||
409 | + * | 33 | + * |
410 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 34 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. |
411 | + * See the COPYING file in the top-level directory. | 35 | + * See the COPYING file in the top-level directory. |
412 | + */ | 36 | + */ |
413 | + | 37 | + |
414 | +#include "qemu/osdep.h" | 38 | +#ifndef QEMU_MADVISE_H |
415 | + | 39 | +#define QEMU_MADVISE_H |
416 | +#include "libqtest.h" | 40 | + |
417 | +#include "libqos/i2c.h" | 41 | +#define QEMU_MADV_INVALID -1 |
418 | +#include "hw/misc/pca9552_regs.h" | 42 | + |
419 | + | 43 | +#if defined(CONFIG_MADVISE) |
420 | +#define PCA9552_TEST_ID "pca9552-test" | 44 | + |
421 | +#define PCA9552_TEST_ADDR 0x60 | 45 | +#define QEMU_MADV_WILLNEED MADV_WILLNEED |
422 | + | 46 | +#define QEMU_MADV_DONTNEED MADV_DONTNEED |
423 | +static I2CAdapter *i2c; | 47 | +#ifdef MADV_DONTFORK |
424 | + | 48 | +#define QEMU_MADV_DONTFORK MADV_DONTFORK |
425 | +static uint8_t pca9552_get8(I2CAdapter *i2c, uint8_t addr, uint8_t reg) | 49 | +#else |
426 | +{ | 50 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
427 | + uint8_t resp[1]; | 51 | +#endif |
428 | + i2c_send(i2c, addr, ®, 1); | 52 | +#ifdef MADV_MERGEABLE |
429 | + i2c_recv(i2c, addr, resp, 1); | 53 | +#define QEMU_MADV_MERGEABLE MADV_MERGEABLE |
430 | + return resp[0]; | 54 | +#else |
431 | +} | 55 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
432 | + | 56 | +#endif |
433 | +static void pca9552_set8(I2CAdapter *i2c, uint8_t addr, uint8_t reg, | 57 | +#ifdef MADV_UNMERGEABLE |
434 | + uint8_t value) | 58 | +#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE |
435 | +{ | 59 | +#else |
436 | + uint8_t cmd[2]; | 60 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
437 | + uint8_t resp[1]; | 61 | +#endif |
438 | + | 62 | +#ifdef MADV_DODUMP |
439 | + cmd[0] = reg; | 63 | +#define QEMU_MADV_DODUMP MADV_DODUMP |
440 | + cmd[1] = value; | 64 | +#else |
441 | + i2c_send(i2c, addr, cmd, 2); | 65 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
442 | + i2c_recv(i2c, addr, resp, 1); | 66 | +#endif |
443 | + g_assert_cmphex(resp[0], ==, cmd[1]); | 67 | +#ifdef MADV_DONTDUMP |
444 | +} | 68 | +#define QEMU_MADV_DONTDUMP MADV_DONTDUMP |
445 | + | 69 | +#else |
446 | +static void receive_autoinc(void) | 70 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
447 | +{ | 71 | +#endif |
448 | + uint8_t resp; | 72 | +#ifdef MADV_HUGEPAGE |
449 | + uint8_t reg = PCA9552_LS0 | PCA9552_AUTOINC; | 73 | +#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE |
450 | + | 74 | +#else |
451 | + i2c_send(i2c, PCA9552_TEST_ADDR, ®, 1); | 75 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
452 | + | 76 | +#endif |
453 | + /* PCA9552_LS0 */ | 77 | +#ifdef MADV_NOHUGEPAGE |
454 | + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); | 78 | +#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE |
455 | + g_assert_cmphex(resp, ==, 0x54); | 79 | +#else |
456 | + | 80 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
457 | + /* PCA9552_LS1 */ | 81 | +#endif |
458 | + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); | 82 | +#ifdef MADV_REMOVE |
459 | + g_assert_cmphex(resp, ==, 0x55); | 83 | +#define QEMU_MADV_REMOVE MADV_REMOVE |
460 | + | 84 | +#else |
461 | + /* PCA9552_LS2 */ | 85 | +#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
462 | + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); | 86 | +#endif |
463 | + g_assert_cmphex(resp, ==, 0x55); | 87 | +#ifdef MADV_POPULATE_WRITE |
464 | + | 88 | +#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE |
465 | + /* PCA9552_LS3 */ | 89 | +#else |
466 | + i2c_recv(i2c, PCA9552_TEST_ADDR, &resp, 1); | 90 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
467 | + g_assert_cmphex(resp, ==, 0x54); | 91 | +#endif |
468 | +} | 92 | + |
469 | + | 93 | +#elif defined(CONFIG_POSIX_MADVISE) |
470 | +static void send_and_receive(void) | 94 | + |
471 | +{ | 95 | +#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED |
472 | + uint8_t value; | 96 | +#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED |
473 | + | 97 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
474 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0); | 98 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
475 | + g_assert_cmphex(value, ==, 0x55); | 99 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
476 | + | 100 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
477 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); | 101 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
478 | + g_assert_cmphex(value, ==, 0x0); | 102 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
479 | + | 103 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
480 | + /* Switch on LED 0 */ | 104 | +#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
481 | + pca9552_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0, 0x54); | 105 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
482 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS0); | 106 | + |
483 | + g_assert_cmphex(value, ==, 0x54); | 107 | +#else /* no-op */ |
484 | + | 108 | + |
485 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT0); | 109 | +#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID |
486 | + g_assert_cmphex(value, ==, 0x01); | 110 | +#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID |
487 | + | 111 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
488 | + /* Switch on LED 12 */ | 112 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
489 | + pca9552_set8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3, 0x54); | 113 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
490 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_LS3); | 114 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
491 | + g_assert_cmphex(value, ==, 0x54); | 115 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
492 | + | 116 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
493 | + value = pca9552_get8(i2c, PCA9552_TEST_ADDR, PCA9552_INPUT1); | 117 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
494 | + g_assert_cmphex(value, ==, 0x10); | 118 | +#define QEMU_MADV_REMOVE QEMU_MADV_INVALID |
495 | +} | 119 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
496 | + | 120 | + |
497 | +int main(int argc, char **argv) | 121 | +#endif |
498 | +{ | 122 | + |
499 | + QTestState *s = NULL; | 123 | +int qemu_madvise(void *addr, size_t len, int advice); |
500 | + int ret; | 124 | + |
501 | + | 125 | +#endif |
502 | + g_test_init(&argc, &argv, NULL); | 126 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h |
503 | + | 127 | index XXXXXXX..XXXXXXX 100644 |
504 | + s = qtest_start("-machine n800 " | 128 | --- a/include/qemu/osdep.h |
505 | + "-device pca9552,bus=i2c-bus.0,id=" PCA9552_TEST_ID | 129 | +++ b/include/qemu/osdep.h |
506 | + ",address=0x60"); | 130 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p) |
507 | + i2c = omap_i2c_create(s, OMAP2_I2C_1_BASE); | 131 | #define QEMU_MAP_NORESERVE (1 << 3) |
508 | + | 132 | |
509 | + qtest_add_func("/pca9552/tx-rx", send_and_receive); | 133 | |
510 | + qtest_add_func("/pca9552/rx-autoinc", receive_autoinc); | 134 | -#define QEMU_MADV_INVALID -1 |
511 | + | 135 | - |
512 | + ret = g_test_run(); | 136 | -#if defined(CONFIG_MADVISE) |
513 | + | 137 | - |
514 | + if (s) { | 138 | -#define QEMU_MADV_WILLNEED MADV_WILLNEED |
515 | + qtest_quit(s); | 139 | -#define QEMU_MADV_DONTNEED MADV_DONTNEED |
516 | + } | 140 | -#ifdef MADV_DONTFORK |
517 | + g_free(i2c); | 141 | -#define QEMU_MADV_DONTFORK MADV_DONTFORK |
518 | + | 142 | -#else |
519 | + return ret; | 143 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
520 | +} | 144 | -#endif |
521 | diff --git a/tests/tmp105-test.c b/tests/tmp105-test.c | 145 | -#ifdef MADV_MERGEABLE |
522 | index XXXXXXX..XXXXXXX 100644 | 146 | -#define QEMU_MADV_MERGEABLE MADV_MERGEABLE |
523 | --- a/tests/tmp105-test.c | 147 | -#else |
524 | +++ b/tests/tmp105-test.c | 148 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
525 | @@ -XXX,XX +XXX,XX @@ | 149 | -#endif |
526 | #include "qapi/qmp/qdict.h" | 150 | -#ifdef MADV_UNMERGEABLE |
527 | #include "hw/misc/tmp105_regs.h" | 151 | -#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE |
528 | 152 | -#else | |
529 | -#define OMAP2_I2C_1_BASE 0x48070000 | 153 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
530 | - | 154 | -#endif |
531 | #define TMP105_TEST_ID "tmp105-test" | 155 | -#ifdef MADV_DODUMP |
532 | #define TMP105_TEST_ADDR 0x49 | 156 | -#define QEMU_MADV_DODUMP MADV_DODUMP |
533 | 157 | -#else | |
534 | diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak | 158 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
535 | index XXXXXXX..XXXXXXX 100644 | 159 | -#endif |
536 | --- a/default-configs/arm-softmmu.mak | 160 | -#ifdef MADV_DONTDUMP |
537 | +++ b/default-configs/arm-softmmu.mak | 161 | -#define QEMU_MADV_DONTDUMP MADV_DONTDUMP |
538 | @@ -XXX,XX +XXX,XX @@ CONFIG_TSC2005=y | 162 | -#else |
539 | CONFIG_LM832X=y | 163 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
540 | CONFIG_TMP105=y | 164 | -#endif |
541 | CONFIG_TMP421=y | 165 | -#ifdef MADV_HUGEPAGE |
542 | +CONFIG_PCA9552=y | 166 | -#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE |
543 | CONFIG_STELLARIS=y | 167 | -#else |
544 | CONFIG_STELLARIS_INPUT=y | 168 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
545 | CONFIG_STELLARIS_ENET=y | 169 | -#endif |
170 | -#ifdef MADV_NOHUGEPAGE | ||
171 | -#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE | ||
172 | -#else | ||
173 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID | ||
174 | -#endif | ||
175 | -#ifdef MADV_REMOVE | ||
176 | -#define QEMU_MADV_REMOVE MADV_REMOVE | ||
177 | -#else | ||
178 | -#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED | ||
179 | -#endif | ||
180 | -#ifdef MADV_POPULATE_WRITE | ||
181 | -#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE | ||
182 | -#else | ||
183 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID | ||
184 | -#endif | ||
185 | - | ||
186 | -#elif defined(CONFIG_POSIX_MADVISE) | ||
187 | - | ||
188 | -#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED | ||
189 | -#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED | ||
190 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID | ||
191 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID | ||
192 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID | ||
193 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID | ||
194 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID | ||
195 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID | ||
196 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID | ||
197 | -#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED | ||
198 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID | ||
199 | - | ||
200 | -#else /* no-op */ | ||
201 | - | ||
202 | -#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID | ||
203 | -#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID | ||
204 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID | ||
205 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID | ||
206 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID | ||
207 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID | ||
208 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID | ||
209 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID | ||
210 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID | ||
211 | -#define QEMU_MADV_REMOVE QEMU_MADV_INVALID | ||
212 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID | ||
213 | - | ||
214 | -#endif | ||
215 | |||
216 | #ifdef _WIN32 | ||
217 | #define HAVE_CHARDEV_SERIAL 1 | ||
218 | @@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action, | ||
219 | struct qemu_signalfd_siginfo *info); | ||
220 | #endif | ||
221 | |||
222 | -int qemu_madvise(void *addr, size_t len, int advice); | ||
223 | int qemu_mprotect_rw(void *addr, size_t size); | ||
224 | int qemu_mprotect_rwx(void *addr, size_t size); | ||
225 | int qemu_mprotect_none(void *addr, size_t size); | ||
226 | diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c | ||
227 | index XXXXXXX..XXXXXXX 100644 | ||
228 | --- a/backends/hostmem-file.c | ||
229 | +++ b/backends/hostmem-file.c | ||
230 | @@ -XXX,XX +XXX,XX @@ | ||
231 | #include "qapi/error.h" | ||
232 | #include "qemu/error-report.h" | ||
233 | #include "qemu/module.h" | ||
234 | +#include "qemu/madvise.h" | ||
235 | #include "sysemu/hostmem.h" | ||
236 | #include "qom/object_interfaces.h" | ||
237 | #include "qom/object.h" | ||
238 | diff --git a/backends/hostmem.c b/backends/hostmem.c | ||
239 | index XXXXXXX..XXXXXXX 100644 | ||
240 | --- a/backends/hostmem.c | ||
241 | +++ b/backends/hostmem.c | ||
242 | @@ -XXX,XX +XXX,XX @@ | ||
243 | #include "qemu/config-file.h" | ||
244 | #include "qom/object_interfaces.h" | ||
245 | #include "qemu/mmap-alloc.h" | ||
246 | +#include "qemu/madvise.h" | ||
247 | |||
248 | #ifdef CONFIG_NUMA | ||
249 | #include <numaif.h> | ||
250 | diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c | ||
251 | index XXXXXXX..XXXXXXX 100644 | ||
252 | --- a/hw/virtio/virtio-balloon.c | ||
253 | +++ b/hw/virtio/virtio-balloon.c | ||
254 | @@ -XXX,XX +XXX,XX @@ | ||
255 | #include "qemu/iov.h" | ||
256 | #include "qemu/module.h" | ||
257 | #include "qemu/timer.h" | ||
258 | +#include "qemu/madvise.h" | ||
259 | #include "hw/virtio/virtio.h" | ||
260 | #include "hw/mem/pc-dimm.h" | ||
261 | #include "hw/qdev-properties.h" | ||
262 | diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c | ||
263 | index XXXXXXX..XXXXXXX 100644 | ||
264 | --- a/migration/postcopy-ram.c | ||
265 | +++ b/migration/postcopy-ram.c | ||
266 | @@ -XXX,XX +XXX,XX @@ | ||
267 | |||
268 | #include "qemu/osdep.h" | ||
269 | #include "qemu/rcu.h" | ||
270 | +#include "qemu/madvise.h" | ||
271 | #include "exec/target_page.h" | ||
272 | #include "migration.h" | ||
273 | #include "qemu-file.h" | ||
274 | diff --git a/migration/qemu-file.c b/migration/qemu-file.c | ||
275 | index XXXXXXX..XXXXXXX 100644 | ||
276 | --- a/migration/qemu-file.c | ||
277 | +++ b/migration/qemu-file.c | ||
278 | @@ -XXX,XX +XXX,XX @@ | ||
279 | */ | ||
280 | #include "qemu/osdep.h" | ||
281 | #include <zlib.h> | ||
282 | +#include "qemu/madvise.h" | ||
283 | #include "qemu/error-report.h" | ||
284 | #include "qemu/iov.h" | ||
285 | #include "migration.h" | ||
286 | diff --git a/migration/ram.c b/migration/ram.c | ||
287 | index XXXXXXX..XXXXXXX 100644 | ||
288 | --- a/migration/ram.c | ||
289 | +++ b/migration/ram.c | ||
290 | @@ -XXX,XX +XXX,XX @@ | ||
291 | #include "qemu/cutils.h" | ||
292 | #include "qemu/bitops.h" | ||
293 | #include "qemu/bitmap.h" | ||
294 | +#include "qemu/madvise.h" | ||
295 | #include "qemu/main-loop.h" | ||
296 | #include "xbzrle.h" | ||
297 | #include "ram.h" | ||
298 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | ||
299 | index XXXXXXX..XXXXXXX 100644 | ||
300 | --- a/softmmu/physmem.c | ||
301 | +++ b/softmmu/physmem.c | ||
302 | @@ -XXX,XX +XXX,XX @@ | ||
303 | |||
304 | #include "qemu/cutils.h" | ||
305 | #include "qemu/cacheflush.h" | ||
306 | +#include "qemu/madvise.h" | ||
307 | |||
308 | #ifdef CONFIG_TCG | ||
309 | #include "hw/core/tcg-cpu-ops.h" | ||
310 | diff --git a/tcg/region.c b/tcg/region.c | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/tcg/region.c | ||
313 | +++ b/tcg/region.c | ||
314 | @@ -XXX,XX +XXX,XX @@ | ||
315 | |||
316 | #include "qemu/osdep.h" | ||
317 | #include "qemu/units.h" | ||
318 | +#include "qemu/madvise.h" | ||
319 | #include "qapi/error.h" | ||
320 | #include "exec/exec-all.h" | ||
321 | #include "tcg/tcg.h" | ||
322 | diff --git a/util/osdep.c b/util/osdep.c | ||
323 | index XXXXXXX..XXXXXXX 100644 | ||
324 | --- a/util/osdep.c | ||
325 | +++ b/util/osdep.c | ||
326 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); | ||
327 | #include "qemu/cutils.h" | ||
328 | #include "qemu/sockets.h" | ||
329 | #include "qemu/error-report.h" | ||
330 | +#include "qemu/madvise.h" | ||
331 | #include "monitor/monitor.h" | ||
332 | |||
333 | static bool fips_enabled = false; | ||
334 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c | ||
335 | index XXXXXXX..XXXXXXX 100644 | ||
336 | --- a/util/oslib-posix.c | ||
337 | +++ b/util/oslib-posix.c | ||
338 | @@ -XXX,XX +XXX,XX @@ | ||
339 | #include "trace.h" | ||
340 | #include "qapi/error.h" | ||
341 | #include "qemu/error-report.h" | ||
342 | +#include "qemu/madvise.h" | ||
343 | #include "qemu/sockets.h" | ||
344 | #include "qemu/thread.h" | ||
345 | #include <libgen.h> | ||
546 | -- | 346 | -- |
547 | 2.17.1 | 347 | 2.25.1 |
548 | 348 | ||
549 | 349 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The qemu_mprotect_*() family of functions are used in very few files; |
---|---|---|---|
2 | move them from osdep.h to a new qemu/mprotect.h. | ||
2 | 3 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Message-id: 20180606152128.449-9-f4bug@amsat.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220208200856.3558249-3-peter.maydell@linaro.org | ||
7 | --- | 8 | --- |
8 | target/arm/helper.c | 4 ++-- | 9 | include/qemu/mprotect.h | 14 ++++++++++++++ |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 10 | include/qemu/osdep.h | 4 ---- |
11 | tcg/region.c | 1 + | ||
12 | util/osdep.c | 1 + | ||
13 | 4 files changed, 16 insertions(+), 4 deletions(-) | ||
14 | create mode 100644 include/qemu/mprotect.h | ||
10 | 15 | ||
11 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 16 | diff --git a/include/qemu/mprotect.h b/include/qemu/mprotect.h |
17 | new file mode 100644 | ||
18 | index XXXXXXX..XXXXXXX | ||
19 | --- /dev/null | ||
20 | +++ b/include/qemu/mprotect.h | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | +/* | ||
23 | + * QEMU mprotect functions | ||
24 | + * | ||
25 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
26 | + * See the COPYING file in the top-level directory. | ||
27 | + */ | ||
28 | +#ifndef QEMU_MPROTECT_H | ||
29 | +#define QEMU_MPROTECT_H | ||
30 | + | ||
31 | +int qemu_mprotect_rw(void *addr, size_t size); | ||
32 | +int qemu_mprotect_rwx(void *addr, size_t size); | ||
33 | +int qemu_mprotect_none(void *addr, size_t size); | ||
34 | + | ||
35 | +#endif | ||
36 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/helper.c | 38 | --- a/include/qemu/osdep.h |
14 | +++ b/target/arm/helper.c | 39 | +++ b/include/qemu/osdep.h |
15 | @@ -XXX,XX +XXX,XX @@ void hw_breakpoint_update(ARMCPU *cpu, int n) | 40 | @@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action, |
16 | case 4: /* unlinked address mismatch (reserved if AArch64) */ | 41 | struct qemu_signalfd_siginfo *info); |
17 | case 5: /* linked address mismatch (reserved if AArch64) */ | 42 | #endif |
18 | qemu_log_mask(LOG_UNIMP, | 43 | |
19 | - "arm: address mismatch breakpoint types not implemented"); | 44 | -int qemu_mprotect_rw(void *addr, size_t size); |
20 | + "arm: address mismatch breakpoint types not implemented\n"); | 45 | -int qemu_mprotect_rwx(void *addr, size_t size); |
21 | return; | 46 | -int qemu_mprotect_none(void *addr, size_t size); |
22 | case 0: /* unlinked address match */ | 47 | - |
23 | case 1: /* linked address match */ | 48 | /* |
24 | @@ -XXX,XX +XXX,XX @@ void hw_breakpoint_update(ARMCPU *cpu, int n) | 49 | * Don't introduce new usage of this function, prefer the following |
25 | case 8: /* unlinked VMID match (reserved if no EL2) */ | 50 | * qemu_open/qemu_create that take an "Error **errp" |
26 | case 10: /* unlinked context ID and VMID match (reserved if no EL2) */ | 51 | diff --git a/tcg/region.c b/tcg/region.c |
27 | qemu_log_mask(LOG_UNIMP, | 52 | index XXXXXXX..XXXXXXX 100644 |
28 | - "arm: unlinked context breakpoint types not implemented"); | 53 | --- a/tcg/region.c |
29 | + "arm: unlinked context breakpoint types not implemented\n"); | 54 | +++ b/tcg/region.c |
30 | return; | 55 | @@ -XXX,XX +XXX,XX @@ |
31 | case 9: /* linked VMID match (reserved if no EL2) */ | 56 | #include "qemu/osdep.h" |
32 | case 11: /* linked context ID and VMID match (reserved if no EL2) */ | 57 | #include "qemu/units.h" |
58 | #include "qemu/madvise.h" | ||
59 | +#include "qemu/mprotect.h" | ||
60 | #include "qapi/error.h" | ||
61 | #include "exec/exec-all.h" | ||
62 | #include "tcg/tcg.h" | ||
63 | diff --git a/util/osdep.c b/util/osdep.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/util/osdep.c | ||
66 | +++ b/util/osdep.c | ||
67 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); | ||
68 | #include "qemu/sockets.h" | ||
69 | #include "qemu/error-report.h" | ||
70 | #include "qemu/madvise.h" | ||
71 | +#include "qemu/mprotect.h" | ||
72 | #include "monitor/monitor.h" | ||
73 | |||
74 | static bool fips_enabled = false; | ||
33 | -- | 75 | -- |
34 | 2.17.1 | 76 | 2.25.1 |
35 | 77 | ||
36 | 78 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | The QEMU_MAP_* constants are used only as arguments to the |
---|---|---|---|
2 | qemu_ram_mmap() function. Move them to mmap-alloc.h, where that | ||
3 | function's prototype is defined. | ||
2 | 4 | ||
3 | The maximum frame size includes the CRC and depends if a VLAN tag is | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | inserted or not. Adjust the frame size limit in the transmit handler | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | using on the FTGMAC100State buffer size and in the receive handler use | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | the packet protocol. | 8 | Message-id: 20220208200856.3558249-4-peter.maydell@linaro.org |
9 | --- | ||
10 | include/qemu/mmap-alloc.h | 23 +++++++++++++++++++++++ | ||
11 | include/qemu/osdep.h | 25 ------------------------- | ||
12 | 2 files changed, 23 insertions(+), 25 deletions(-) | ||
7 | 13 | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 14 | diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
10 | Message-id: 20180530061711.23673-2-clg@kaod.org | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | include/hw/net/ftgmac100.h | 7 ++++++- | ||
14 | hw/net/ftgmac100.c | 23 ++++++++++++----------- | ||
15 | 2 files changed, 18 insertions(+), 12 deletions(-) | ||
16 | |||
17 | diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/hw/net/ftgmac100.h | 16 | --- a/include/qemu/mmap-alloc.h |
20 | +++ b/include/hw/net/ftgmac100.h | 17 | +++ b/include/qemu/mmap-alloc.h |
21 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ void *qemu_ram_mmap(int fd, |
22 | #include "hw/sysbus.h" | 19 | |
23 | #include "net/net.h" | 20 | void qemu_ram_munmap(int fd, void *ptr, size_t size); |
24 | 21 | ||
25 | +/* | 22 | +/* |
26 | + * Max frame size for the receiving buffer | 23 | + * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example, |
24 | + * consumed by qemu_ram_mmap(). | ||
27 | + */ | 25 | + */ |
28 | +#define FTGMAC100_MAX_FRAME_SIZE 9220 | ||
29 | + | 26 | + |
30 | typedef struct FTGMAC100State { | 27 | +/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */ |
31 | /*< private >*/ | 28 | +#define QEMU_MAP_READONLY (1 << 0) |
32 | SysBusDevice parent_obj; | 29 | + |
33 | @@ -XXX,XX +XXX,XX @@ typedef struct FTGMAC100State { | 30 | +/* Use MAP_SHARED instead of MAP_PRIVATE. */ |
34 | qemu_irq irq; | 31 | +#define QEMU_MAP_SHARED (1 << 1) |
35 | MemoryRegion iomem; | 32 | + |
36 | 33 | +/* | |
37 | - uint8_t *frame; | 34 | + * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without |
38 | + uint8_t frame[FTGMAC100_MAX_FRAME_SIZE]; | 35 | + * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC. |
39 | 36 | + */ | |
40 | uint32_t irq_state; | 37 | +#define QEMU_MAP_SYNC (1 << 2) |
41 | uint32_t isr; | 38 | + |
42 | diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c | 39 | +/* |
40 | + * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if | ||
41 | + * applicable). Bail out if not supported/effective. | ||
42 | + */ | ||
43 | +#define QEMU_MAP_NORESERVE (1 << 3) | ||
44 | + | ||
45 | #endif | ||
46 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
43 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
44 | --- a/hw/net/ftgmac100.c | 48 | --- a/include/qemu/osdep.h |
45 | +++ b/hw/net/ftgmac100.c | 49 | +++ b/include/qemu/osdep.h |
46 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 50 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p) |
47 | /* | ||
48 | * Max frame size for the receiving buffer | ||
49 | */ | 51 | */ |
50 | -#define FTGMAC100_MAX_FRAME_SIZE 10240 | 52 | #define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree))) |
51 | +#define FTGMAC100_MAX_FRAME_SIZE 9220 | 53 | |
52 | 54 | -/* | |
53 | /* Limits depending on the type of the frame | 55 | - * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example, |
54 | * | 56 | - * consumed by qemu_ram_mmap(). |
55 | * 9216 for Jumbo frames (+ 4 for VLAN) | 57 | - */ |
56 | * 1518 for other frames (+ 4 for VLAN) | ||
57 | */ | ||
58 | -static int ftgmac100_max_frame_size(FTGMAC100State *s) | ||
59 | +static int ftgmac100_max_frame_size(FTGMAC100State *s, uint16_t proto) | ||
60 | { | ||
61 | - return (s->maccr & FTGMAC100_MACCR_JUMBO_LF ? 9216 : 1518) + 4; | ||
62 | + int max = (s->maccr & FTGMAC100_MACCR_JUMBO_LF ? 9216 : 1518); | ||
63 | + | ||
64 | + return max + (proto == ETH_P_VLAN ? 4 : 0); | ||
65 | } | ||
66 | |||
67 | static void ftgmac100_update_irq(FTGMAC100State *s) | ||
68 | @@ -XXX,XX +XXX,XX @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t tx_ring, | ||
69 | uint8_t *ptr = s->frame; | ||
70 | uint32_t addr = tx_descriptor; | ||
71 | uint32_t flags = 0; | ||
72 | - int max_frame_size = ftgmac100_max_frame_size(s); | ||
73 | |||
74 | while (1) { | ||
75 | FTGMAC100Desc bd; | ||
76 | @@ -XXX,XX +XXX,XX @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t tx_ring, | ||
77 | flags = bd.des1; | ||
78 | } | ||
79 | |||
80 | - len = bd.des0 & 0x3FFF; | ||
81 | - if (frame_size + len > max_frame_size) { | ||
82 | + len = FTGMAC100_TXDES0_TXBUF_SIZE(bd.des0); | ||
83 | + if (frame_size + len > sizeof(s->frame)) { | ||
84 | qemu_log_mask(LOG_GUEST_ERROR, "%s: frame too big : %d bytes\n", | ||
85 | __func__, len); | ||
86 | - len = max_frame_size - frame_size; | ||
87 | + s->isr |= FTGMAC100_INT_XPKT_LOST; | ||
88 | + len = sizeof(s->frame) - frame_size; | ||
89 | } | ||
90 | |||
91 | if (dma_memory_read(&address_space_memory, bd.des3, ptr, len)) { | ||
92 | @@ -XXX,XX +XXX,XX @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf, | ||
93 | uint32_t buf_len; | ||
94 | size_t size = len; | ||
95 | uint32_t first = FTGMAC100_RXDES0_FRS; | ||
96 | - int max_frame_size = ftgmac100_max_frame_size(s); | ||
97 | + uint16_t proto = be16_to_cpu(PKT_GET_ETH_HDR(buf)->h_proto); | ||
98 | + int max_frame_size = ftgmac100_max_frame_size(s, proto); | ||
99 | |||
100 | if ((s->maccr & (FTGMAC100_MACCR_RXDMA_EN | FTGMAC100_MACCR_RXMAC_EN)) | ||
101 | != (FTGMAC100_MACCR_RXDMA_EN | FTGMAC100_MACCR_RXMAC_EN)) { | ||
102 | @@ -XXX,XX +XXX,XX @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf, | ||
103 | |||
104 | /* Huge frames are truncated. */ | ||
105 | if (size > max_frame_size) { | ||
106 | - size = max_frame_size; | ||
107 | qemu_log_mask(LOG_GUEST_ERROR, "%s: frame too big : %zd bytes\n", | ||
108 | __func__, size); | ||
109 | + size = max_frame_size; | ||
110 | flags |= FTGMAC100_RXDES0_FTL; | ||
111 | } | ||
112 | |||
113 | @@ -XXX,XX +XXX,XX @@ static void ftgmac100_realize(DeviceState *dev, Error **errp) | ||
114 | object_get_typename(OBJECT(dev)), DEVICE(dev)->id, | ||
115 | s); | ||
116 | qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); | ||
117 | - | 58 | - |
118 | - s->frame = g_malloc(FTGMAC100_MAX_FRAME_SIZE); | 59 | -/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */ |
119 | } | 60 | -#define QEMU_MAP_READONLY (1 << 0) |
120 | 61 | - | |
121 | static const VMStateDescription vmstate_ftgmac100 = { | 62 | -/* Use MAP_SHARED instead of MAP_PRIVATE. */ |
63 | -#define QEMU_MAP_SHARED (1 << 1) | ||
64 | - | ||
65 | -/* | ||
66 | - * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without | ||
67 | - * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC. | ||
68 | - */ | ||
69 | -#define QEMU_MAP_SYNC (1 << 2) | ||
70 | - | ||
71 | -/* | ||
72 | - * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if | ||
73 | - * applicable). Bail out if not supported/effective. | ||
74 | - */ | ||
75 | -#define QEMU_MAP_NORESERVE (1 << 3) | ||
76 | - | ||
77 | - | ||
78 | - | ||
79 | #ifdef _WIN32 | ||
80 | #define HAVE_CHARDEV_SERIAL 1 | ||
81 | #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ | ||
122 | -- | 82 | -- |
123 | 2.17.1 | 83 | 2.25.1 |
124 | 84 | ||
125 | 85 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The qemu_icache_linesize, qemu_icache_linesize_log, |
---|---|---|---|
2 | qemu_dcache_linesize, and qemu_dcache_linesize_log variables are not | ||
3 | used in many files. Move them out of osdep.h to a new | ||
4 | qemu/cacheinfo.h, and document them. | ||
2 | 5 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Message-id: 20180606152128.449-8-f4bug@amsat.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220208200856.3558249-5-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | hw/arm/stellaris.c | 11 ++++++----- | 11 | include/qemu/cacheinfo.h | 21 +++++++++++++++++++++ |
9 | 1 file changed, 6 insertions(+), 5 deletions(-) | 12 | include/qemu/osdep.h | 5 ----- |
13 | accel/tcg/translate-all.c | 1 + | ||
14 | plugins/loader.c | 1 + | ||
15 | tcg/region.c | 1 + | ||
16 | tcg/tcg.c | 1 + | ||
17 | util/atomic64.c | 1 + | ||
18 | util/cacheflush.c | 1 + | ||
19 | util/cacheinfo.c | 1 + | ||
20 | 9 files changed, 28 insertions(+), 5 deletions(-) | ||
21 | create mode 100644 include/qemu/cacheinfo.h | ||
10 | 22 | ||
11 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c | 23 | diff --git a/include/qemu/cacheinfo.h b/include/qemu/cacheinfo.h |
24 | new file mode 100644 | ||
25 | index XXXXXXX..XXXXXXX | ||
26 | --- /dev/null | ||
27 | +++ b/include/qemu/cacheinfo.h | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | +/* | ||
30 | + * QEMU host cacheinfo information | ||
31 | + * | ||
32 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
33 | + * See the COPYING file in the top-level directory. | ||
34 | + */ | ||
35 | +#ifndef QEMU_CACHEINFO_H | ||
36 | +#define QEMU_CACHEINFO_H | ||
37 | + | ||
38 | +/* | ||
39 | + * These variables represent our best guess at the host icache and | ||
40 | + * dcache sizes, expressed both as the size in bytes and as the | ||
41 | + * base-2 log of the size in bytes. They are initialized at startup | ||
42 | + * (via an attribute 'constructor' function). | ||
43 | + */ | ||
44 | +extern int qemu_icache_linesize; | ||
45 | +extern int qemu_icache_linesize_log; | ||
46 | +extern int qemu_dcache_linesize; | ||
47 | +extern int qemu_dcache_linesize_log; | ||
48 | + | ||
49 | +#endif | ||
50 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
12 | index XXXXXXX..XXXXXXX 100644 | 51 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/arm/stellaris.c | 52 | --- a/include/qemu/osdep.h |
14 | +++ b/hw/arm/stellaris.c | 53 | +++ b/include/qemu/osdep.h |
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t gptm_read(void *opaque, hwaddr offset, | 54 | @@ -XXX,XX +XXX,XX @@ pid_t qemu_fork(Error **errp); |
16 | return s->rtc; | 55 | extern uintptr_t qemu_real_host_page_size; |
17 | } | 56 | extern intptr_t qemu_real_host_page_mask; |
18 | qemu_log_mask(LOG_UNIMP, | 57 | |
19 | - "GPTM: read of TAR but timer read not supported"); | 58 | -extern int qemu_icache_linesize; |
20 | + "GPTM: read of TAR but timer read not supported\n"); | 59 | -extern int qemu_icache_linesize_log; |
21 | return 0; | 60 | -extern int qemu_dcache_linesize; |
22 | case 0x4c: /* TBR */ | 61 | -extern int qemu_dcache_linesize_log; |
23 | qemu_log_mask(LOG_UNIMP, | 62 | - |
24 | - "GPTM: read of TBR but timer read not supported"); | 63 | /* |
25 | + "GPTM: read of TBR but timer read not supported\n"); | 64 | * After using getopt or getopt_long, if you need to parse another set |
26 | return 0; | 65 | * of options, then you must reset optind. Unfortunately the way to |
27 | default: | 66 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c |
28 | qemu_log_mask(LOG_GUEST_ERROR, | 67 | index XXXXXXX..XXXXXXX 100644 |
29 | @@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_write(void *opaque, hwaddr offset, | 68 | --- a/accel/tcg/translate-all.c |
30 | break; | 69 | +++ b/accel/tcg/translate-all.c |
31 | case 0x20: /* MCR */ | 70 | @@ -XXX,XX +XXX,XX @@ |
32 | if (value & 1) { | 71 | #include "qemu/qemu-print.h" |
33 | - qemu_log_mask(LOG_UNIMP, "stellaris_i2c: Loopback not implemented"); | 72 | #include "qemu/timer.h" |
34 | + qemu_log_mask(LOG_UNIMP, | 73 | #include "qemu/main-loop.h" |
35 | + "stellaris_i2c: Loopback not implemented\n"); | 74 | +#include "qemu/cacheinfo.h" |
36 | } | 75 | #include "exec/log.h" |
37 | if (value & 0x20) { | 76 | #include "sysemu/cpus.h" |
38 | qemu_log_mask(LOG_UNIMP, | 77 | #include "sysemu/cpu-timers.h" |
39 | - "stellaris_i2c: Slave mode not implemented"); | 78 | diff --git a/plugins/loader.c b/plugins/loader.c |
40 | + "stellaris_i2c: Slave mode not implemented\n"); | 79 | index XXXXXXX..XXXXXXX 100644 |
41 | } | 80 | --- a/plugins/loader.c |
42 | s->mcr = value & 0x31; | 81 | +++ b/plugins/loader.c |
43 | break; | 82 | @@ -XXX,XX +XXX,XX @@ |
44 | @@ -XXX,XX +XXX,XX @@ static void stellaris_adc_write(void *opaque, hwaddr offset, | 83 | #include "qemu/rcu_queue.h" |
45 | s->sspri = value; | 84 | #include "qemu/qht.h" |
46 | break; | 85 | #include "qemu/bitmap.h" |
47 | case 0x28: /* PSSI */ | 86 | +#include "qemu/cacheinfo.h" |
48 | - qemu_log_mask(LOG_UNIMP, "ADC: sample initiate unimplemented"); | 87 | #include "qemu/xxhash.h" |
49 | + qemu_log_mask(LOG_UNIMP, "ADC: sample initiate unimplemented\n"); | 88 | #include "qemu/plugin.h" |
50 | break; | 89 | #include "hw/core/cpu.h" |
51 | case 0x30: /* SAC */ | 90 | diff --git a/tcg/region.c b/tcg/region.c |
52 | s->sac = value; | 91 | index XXXXXXX..XXXXXXX 100644 |
92 | --- a/tcg/region.c | ||
93 | +++ b/tcg/region.c | ||
94 | @@ -XXX,XX +XXX,XX @@ | ||
95 | #include "qemu/units.h" | ||
96 | #include "qemu/madvise.h" | ||
97 | #include "qemu/mprotect.h" | ||
98 | +#include "qemu/cacheinfo.h" | ||
99 | #include "qapi/error.h" | ||
100 | #include "exec/exec-all.h" | ||
101 | #include "tcg/tcg.h" | ||
102 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/tcg/tcg.c | ||
105 | +++ b/tcg/tcg.c | ||
106 | @@ -XXX,XX +XXX,XX @@ | ||
107 | #include "qemu/qemu-print.h" | ||
108 | #include "qemu/timer.h" | ||
109 | #include "qemu/cacheflush.h" | ||
110 | +#include "qemu/cacheinfo.h" | ||
111 | |||
112 | /* Note: the long term plan is to reduce the dependencies on the QEMU | ||
113 | CPU definitions. Currently they are used for qemu_ld/st | ||
114 | diff --git a/util/atomic64.c b/util/atomic64.c | ||
115 | index XXXXXXX..XXXXXXX 100644 | ||
116 | --- a/util/atomic64.c | ||
117 | +++ b/util/atomic64.c | ||
118 | @@ -XXX,XX +XXX,XX @@ | ||
119 | #include "qemu/osdep.h" | ||
120 | #include "qemu/atomic.h" | ||
121 | #include "qemu/thread.h" | ||
122 | +#include "qemu/cacheinfo.h" | ||
123 | |||
124 | #ifdef CONFIG_ATOMIC64 | ||
125 | #error This file must only be compiled if !CONFIG_ATOMIC64 | ||
126 | diff --git a/util/cacheflush.c b/util/cacheflush.c | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/util/cacheflush.c | ||
129 | +++ b/util/cacheflush.c | ||
130 | @@ -XXX,XX +XXX,XX @@ | ||
131 | |||
132 | #include "qemu/osdep.h" | ||
133 | #include "qemu/cacheflush.h" | ||
134 | +#include "qemu/cacheinfo.h" | ||
135 | #include "qemu/bitops.h" | ||
136 | |||
137 | |||
138 | diff --git a/util/cacheinfo.c b/util/cacheinfo.c | ||
139 | index XXXXXXX..XXXXXXX 100644 | ||
140 | --- a/util/cacheinfo.c | ||
141 | +++ b/util/cacheinfo.c | ||
142 | @@ -XXX,XX +XXX,XX @@ | ||
143 | #include "qemu/osdep.h" | ||
144 | #include "qemu/host-utils.h" | ||
145 | #include "qemu/atomic.h" | ||
146 | +#include "qemu/cacheinfo.h" | ||
147 | |||
148 | int qemu_icache_linesize = 0; | ||
149 | int qemu_icache_linesize_log; | ||
53 | -- | 150 | -- |
54 | 2.17.1 | 151 | 2.25.1 |
55 | 152 | ||
56 | 153 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The "hardware version" machinery (qemu_set_hw_version(), |
---|---|---|---|
2 | qemu_hw_version(), and the QEMU_HW_VERSION define) is used by fewer | ||
3 | than 10 files. Move it out from osdep.h into a new | ||
4 | qemu/hw-version.h. | ||
2 | 5 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Message-id: 20180606191801.6331-1-f4bug@amsat.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-id: 20220208200856.3558249-6-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | Makefile.objs | 1 + | 11 | include/qemu/hw-version.h | 27 +++++++++++++++++++++++++++ |
9 | hw/i2c/core.c | 25 ++++++++++++++++++------- | 12 | include/qemu/osdep.h | 16 ---------------- |
10 | hw/i2c/trace-events | 7 +++++++ | 13 | hw/arm/nseries.c | 1 + |
11 | 3 files changed, 26 insertions(+), 7 deletions(-) | 14 | hw/ide/core.c | 1 + |
12 | create mode 100644 hw/i2c/trace-events | 15 | hw/scsi/megasas.c | 1 + |
16 | hw/scsi/scsi-bus.c | 1 + | ||
17 | hw/scsi/scsi-disk.c | 1 + | ||
18 | softmmu/vl.c | 1 + | ||
19 | target/i386/cpu.c | 1 + | ||
20 | target/s390x/cpu_models.c | 1 + | ||
21 | util/osdep.c | 1 + | ||
22 | 11 files changed, 36 insertions(+), 16 deletions(-) | ||
23 | create mode 100644 include/qemu/hw-version.h | ||
13 | 24 | ||
14 | diff --git a/Makefile.objs b/Makefile.objs | 25 | diff --git a/include/qemu/hw-version.h b/include/qemu/hw-version.h |
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/Makefile.objs | ||
17 | +++ b/Makefile.objs | ||
18 | @@ -XXX,XX +XXX,XX @@ trace-events-subdirs += hw/char | ||
19 | trace-events-subdirs += hw/display | ||
20 | trace-events-subdirs += hw/dma | ||
21 | trace-events-subdirs += hw/hppa | ||
22 | +trace-events-subdirs += hw/i2c | ||
23 | trace-events-subdirs += hw/i386 | ||
24 | trace-events-subdirs += hw/i386/xen | ||
25 | trace-events-subdirs += hw/ide | ||
26 | diff --git a/hw/i2c/core.c b/hw/i2c/core.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/hw/i2c/core.c | ||
29 | +++ b/hw/i2c/core.c | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | |||
32 | #include "qemu/osdep.h" | ||
33 | #include "hw/i2c/i2c.h" | ||
34 | +#include "trace.h" | ||
35 | |||
36 | #define I2C_BROADCAST 0x00 | ||
37 | |||
38 | @@ -XXX,XX +XXX,XX @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv) | ||
39 | } | ||
40 | |||
41 | QLIST_FOREACH(node, &bus->current_devs, next) { | ||
42 | + I2CSlave *s = node->elt; | ||
43 | int rv; | ||
44 | |||
45 | - sc = I2C_SLAVE_GET_CLASS(node->elt); | ||
46 | + sc = I2C_SLAVE_GET_CLASS(s); | ||
47 | /* If the bus is already busy, assume this is a repeated | ||
48 | start condition. */ | ||
49 | |||
50 | if (sc->event) { | ||
51 | - rv = sc->event(node->elt, recv ? I2C_START_RECV : I2C_START_SEND); | ||
52 | + trace_i2c_event("start", s->address); | ||
53 | + rv = sc->event(s, recv ? I2C_START_RECV : I2C_START_SEND); | ||
54 | if (rv && !bus->broadcast) { | ||
55 | if (bus_scanned) { | ||
56 | /* First call, terminate the transfer. */ | ||
57 | @@ -XXX,XX +XXX,XX @@ void i2c_end_transfer(I2CBus *bus) | ||
58 | I2CNode *node, *next; | ||
59 | |||
60 | QLIST_FOREACH_SAFE(node, &bus->current_devs, next, next) { | ||
61 | - sc = I2C_SLAVE_GET_CLASS(node->elt); | ||
62 | + I2CSlave *s = node->elt; | ||
63 | + sc = I2C_SLAVE_GET_CLASS(s); | ||
64 | if (sc->event) { | ||
65 | - sc->event(node->elt, I2C_FINISH); | ||
66 | + trace_i2c_event("finish", s->address); | ||
67 | + sc->event(s, I2C_FINISH); | ||
68 | } | ||
69 | QLIST_REMOVE(node, next); | ||
70 | g_free(node); | ||
71 | @@ -XXX,XX +XXX,XX @@ void i2c_end_transfer(I2CBus *bus) | ||
72 | int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send) | ||
73 | { | ||
74 | I2CSlaveClass *sc; | ||
75 | + I2CSlave *s; | ||
76 | I2CNode *node; | ||
77 | int ret = 0; | ||
78 | |||
79 | if (send) { | ||
80 | QLIST_FOREACH(node, &bus->current_devs, next) { | ||
81 | - sc = I2C_SLAVE_GET_CLASS(node->elt); | ||
82 | + s = node->elt; | ||
83 | + sc = I2C_SLAVE_GET_CLASS(s); | ||
84 | if (sc->send) { | ||
85 | - ret = ret || sc->send(node->elt, *data); | ||
86 | + trace_i2c_send(s->address, *data); | ||
87 | + ret = ret || sc->send(s, *data); | ||
88 | } else { | ||
89 | ret = -1; | ||
90 | } | ||
91 | @@ -XXX,XX +XXX,XX @@ int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send) | ||
92 | |||
93 | sc = I2C_SLAVE_GET_CLASS(QLIST_FIRST(&bus->current_devs)->elt); | ||
94 | if (sc->recv) { | ||
95 | - ret = sc->recv(QLIST_FIRST(&bus->current_devs)->elt); | ||
96 | + s = QLIST_FIRST(&bus->current_devs)->elt; | ||
97 | + ret = sc->recv(s); | ||
98 | + trace_i2c_recv(s->address, ret); | ||
99 | if (ret < 0) { | ||
100 | return ret; | ||
101 | } else { | ||
102 | @@ -XXX,XX +XXX,XX @@ void i2c_nack(I2CBus *bus) | ||
103 | QLIST_FOREACH(node, &bus->current_devs, next) { | ||
104 | sc = I2C_SLAVE_GET_CLASS(node->elt); | ||
105 | if (sc->event) { | ||
106 | + trace_i2c_event("nack", node->elt->address); | ||
107 | sc->event(node->elt, I2C_NACK); | ||
108 | } | ||
109 | } | ||
110 | diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events | ||
111 | new file mode 100644 | 26 | new file mode 100644 |
112 | index XXXXXXX..XXXXXXX | 27 | index XXXXXXX..XXXXXXX |
113 | --- /dev/null | 28 | --- /dev/null |
114 | +++ b/hw/i2c/trace-events | 29 | +++ b/include/qemu/hw-version.h |
115 | @@ -XXX,XX +XXX,XX @@ | 30 | @@ -XXX,XX +XXX,XX @@ |
116 | +# See docs/devel/tracing.txt for syntax documentation. | 31 | +/* |
32 | + * QEMU "hardware version" machinery | ||
33 | + * | ||
34 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
35 | + * See the COPYING file in the top-level directory. | ||
36 | + */ | ||
37 | +#ifndef QEMU_HW_VERSION_H | ||
38 | +#define QEMU_HW_VERSION_H | ||
117 | + | 39 | + |
118 | +# hw/i2c/core.c | 40 | +/* |
41 | + * Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default | ||
42 | + * instead of QEMU_VERSION, so setting hw_version on MachineClass | ||
43 | + * is no longer mandatory. | ||
44 | + * | ||
45 | + * Do NOT change this string, or it will break compatibility on all | ||
46 | + * machine classes that don't set hw_version. | ||
47 | + */ | ||
48 | +#define QEMU_HW_VERSION "2.5+" | ||
119 | + | 49 | + |
120 | +i2c_event(const char *event, uint8_t address) "%s(addr:0x%02x)" | 50 | +/* QEMU "hardware version" setting. Used to replace code that exposed |
121 | +i2c_send(uint8_t address, uint8_t data) "send(addr:0x%02x) data:0x%02x" | 51 | + * QEMU_VERSION to guests in the past and need to keep compatibility. |
122 | +i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x) data:0x%02x" | 52 | + * Do not use qemu_hw_version() in new code. |
53 | + */ | ||
54 | +void qemu_set_hw_version(const char *); | ||
55 | +const char *qemu_hw_version(void); | ||
56 | + | ||
57 | +#endif | ||
58 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/include/qemu/osdep.h | ||
61 | +++ b/include/qemu/osdep.h | ||
62 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_timersub(const struct timeval *val1, | ||
63 | |||
64 | void qemu_set_cloexec(int fd); | ||
65 | |||
66 | -/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default | ||
67 | - * instead of QEMU_VERSION, so setting hw_version on MachineClass | ||
68 | - * is no longer mandatory. | ||
69 | - * | ||
70 | - * Do NOT change this string, or it will break compatibility on all | ||
71 | - * machine classes that don't set hw_version. | ||
72 | - */ | ||
73 | -#define QEMU_HW_VERSION "2.5+" | ||
74 | - | ||
75 | -/* QEMU "hardware version" setting. Used to replace code that exposed | ||
76 | - * QEMU_VERSION to guests in the past and need to keep compatibility. | ||
77 | - * Do not use qemu_hw_version() in new code. | ||
78 | - */ | ||
79 | -void qemu_set_hw_version(const char *); | ||
80 | -const char *qemu_hw_version(void); | ||
81 | - | ||
82 | void fips_set_state(bool requested); | ||
83 | bool fips_get_state(void); | ||
84 | |||
85 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/arm/nseries.c | ||
88 | +++ b/hw/arm/nseries.c | ||
89 | @@ -XXX,XX +XXX,XX @@ | ||
90 | #include "chardev/char.h" | ||
91 | #include "qemu/cutils.h" | ||
92 | #include "qemu/bswap.h" | ||
93 | +#include "qemu/hw-version.h" | ||
94 | #include "sysemu/reset.h" | ||
95 | #include "sysemu/runstate.h" | ||
96 | #include "sysemu/sysemu.h" | ||
97 | diff --git a/hw/ide/core.c b/hw/ide/core.c | ||
98 | index XXXXXXX..XXXXXXX 100644 | ||
99 | --- a/hw/ide/core.c | ||
100 | +++ b/hw/ide/core.c | ||
101 | @@ -XXX,XX +XXX,XX @@ | ||
102 | #include "qemu/error-report.h" | ||
103 | #include "qemu/main-loop.h" | ||
104 | #include "qemu/timer.h" | ||
105 | +#include "qemu/hw-version.h" | ||
106 | #include "sysemu/sysemu.h" | ||
107 | #include "sysemu/blockdev.h" | ||
108 | #include "sysemu/dma.h" | ||
109 | diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/hw/scsi/megasas.c | ||
112 | +++ b/hw/scsi/megasas.c | ||
113 | @@ -XXX,XX +XXX,XX @@ | ||
114 | #include "hw/pci/msix.h" | ||
115 | #include "qemu/iov.h" | ||
116 | #include "qemu/module.h" | ||
117 | +#include "qemu/hw-version.h" | ||
118 | #include "hw/scsi/scsi.h" | ||
119 | #include "scsi/constants.h" | ||
120 | #include "trace.h" | ||
121 | diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c | ||
122 | index XXXXXXX..XXXXXXX 100644 | ||
123 | --- a/hw/scsi/scsi-bus.c | ||
124 | +++ b/hw/scsi/scsi-bus.c | ||
125 | @@ -XXX,XX +XXX,XX @@ | ||
126 | #include "qemu/error-report.h" | ||
127 | #include "qemu/module.h" | ||
128 | #include "qemu/option.h" | ||
129 | +#include "qemu/hw-version.h" | ||
130 | #include "hw/qdev-properties.h" | ||
131 | #include "hw/scsi/scsi.h" | ||
132 | #include "migration/qemu-file-types.h" | ||
133 | diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/hw/scsi/scsi-disk.c | ||
136 | +++ b/hw/scsi/scsi-disk.c | ||
137 | @@ -XXX,XX +XXX,XX @@ | ||
138 | #include "qemu/error-report.h" | ||
139 | #include "qemu/main-loop.h" | ||
140 | #include "qemu/module.h" | ||
141 | +#include "qemu/hw-version.h" | ||
142 | #include "hw/scsi/scsi.h" | ||
143 | #include "migration/qemu-file-types.h" | ||
144 | #include "migration/vmstate.h" | ||
145 | diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
146 | index XXXXXXX..XXXXXXX 100644 | ||
147 | --- a/softmmu/vl.c | ||
148 | +++ b/softmmu/vl.c | ||
149 | @@ -XXX,XX +XXX,XX @@ | ||
150 | #include "qemu-version.h" | ||
151 | #include "qemu/cutils.h" | ||
152 | #include "qemu/help_option.h" | ||
153 | +#include "qemu/hw-version.h" | ||
154 | #include "qemu/uuid.h" | ||
155 | #include "sysemu/reset.h" | ||
156 | #include "sysemu/runstate.h" | ||
157 | diff --git a/target/i386/cpu.c b/target/i386/cpu.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/target/i386/cpu.c | ||
160 | +++ b/target/i386/cpu.c | ||
161 | @@ -XXX,XX +XXX,XX @@ | ||
162 | #include "qemu/units.h" | ||
163 | #include "qemu/cutils.h" | ||
164 | #include "qemu/qemu-print.h" | ||
165 | +#include "qemu/hw-version.h" | ||
166 | #include "cpu.h" | ||
167 | #include "tcg/helper-tcg.h" | ||
168 | #include "sysemu/reset.h" | ||
169 | diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/target/s390x/cpu_models.c | ||
172 | +++ b/target/s390x/cpu_models.c | ||
173 | @@ -XXX,XX +XXX,XX @@ | ||
174 | #include "qapi/error.h" | ||
175 | #include "qapi/visitor.h" | ||
176 | #include "qemu/module.h" | ||
177 | +#include "qemu/hw-version.h" | ||
178 | #include "qemu/qemu-print.h" | ||
179 | #ifndef CONFIG_USER_ONLY | ||
180 | #include "sysemu/sysemu.h" | ||
181 | diff --git a/util/osdep.c b/util/osdep.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/util/osdep.c | ||
184 | +++ b/util/osdep.c | ||
185 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); | ||
186 | #include "qemu/error-report.h" | ||
187 | #include "qemu/madvise.h" | ||
188 | #include "qemu/mprotect.h" | ||
189 | +#include "qemu/hw-version.h" | ||
190 | #include "monitor/monitor.h" | ||
191 | |||
192 | static bool fips_enabled = false; | ||
123 | -- | 193 | -- |
124 | 2.17.1 | 194 | 2.25.1 |
125 | 195 | ||
126 | 196 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 4 | Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> |
5 | Message-id: 20180606152128.449-6-f4bug@amsat.org | 5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Message-id: 20220213021215.1974-1-akihiko.odaki@gmail.com | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 8 | --- |
8 | hw/core/register.c | 2 +- | 9 | MAINTAINERS | 2 ++ |
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | 10 | 1 file changed, 2 insertions(+) |
10 | 11 | ||
11 | diff --git a/hw/core/register.c b/hw/core/register.c | 12 | diff --git a/MAINTAINERS b/MAINTAINERS |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/core/register.c | 14 | --- a/MAINTAINERS |
14 | +++ b/hw/core/register.c | 15 | +++ b/MAINTAINERS |
15 | @@ -XXX,XX +XXX,XX @@ void register_write(RegisterInfo *reg, uint64_t val, uint64_t we, | 16 | @@ -XXX,XX +XXX,XX @@ F: audio/alsaaudio.c |
16 | if (test) { | 17 | Core Audio framework backend |
17 | qemu_log_mask(LOG_UNIMP, | 18 | M: Gerd Hoffmann <kraxel@redhat.com> |
18 | "%s:%s writing %#" PRIx64 " to unimplemented bits:" \ | 19 | R: Christian Schoenebeck <qemu_oss@crudebyte.com> |
19 | - " %#" PRIx64 "", | 20 | +R: Akihiko Odaki <akihiko.odaki@gmail.com> |
20 | + " %#" PRIx64 "\n", | 21 | S: Odd Fixes |
21 | prefix, reg->access->name, val, ac->unimp); | 22 | F: audio/coreaudio.c |
22 | } | 23 | |
24 | @@ -XXX,XX +XXX,XX @@ F: util/drm.c | ||
25 | |||
26 | Cocoa graphics | ||
27 | M: Peter Maydell <peter.maydell@linaro.org> | ||
28 | +R: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
29 | S: Odd Fixes | ||
30 | F: ui/cocoa.m | ||
23 | 31 | ||
24 | -- | 32 | -- |
25 | 2.17.1 | 33 | 2.25.1 |
26 | 34 | ||
27 | 35 | diff view generated by jsdifflib |
1 | From: Shannon Zhao <zhaoshenglong@huawei.com> | 1 | From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru> |
---|---|---|---|
2 | 2 | ||
3 | While we skip the GIC_INTERNAL irqs, we don't change the register offset | 3 | A9 gtimer includes global control field and number of per-cpu fields. |
4 | accordingly. This will overlap the GICR registers value and leave the | 4 | But only per-cpu ones are migrated. This patch adds a subsection for |
5 | last GIC_INTERNAL irq's registers out of update. | 5 | global control field migration. |
6 | 6 | ||
7 | Fix this by skipping the registers banked by GICR. | 7 | Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> |
8 | 8 | Message-id: 164422345976.2186660.1104517592452494510.stgit@pasha-ThinkPad-X280 | |
9 | Also for migration compatibility if the migration source (old version | ||
10 | qemu) doesn't send gicd_no_migration_shift_bug = 1 to destination, then | ||
11 | we shift the data of PPI to get the right data for SPI. | ||
12 | |||
13 | Fixes: 367b9f527becdd20ddf116e17a3c0c2bbc486920 | ||
14 | Cc: qemu-stable@nongnu.org | ||
15 | Reviewed-by: Eric Auger <eric.auger@redhat.com> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> | ||
18 | Message-id: 1527816987-16108-1-git-send-email-zhaoshenglong@huawei.com | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
20 | --- | 11 | --- |
21 | include/hw/intc/arm_gicv3_common.h | 1 + | 12 | hw/timer/a9gtimer.c | 21 +++++++++++++++++++++ |
22 | hw/intc/arm_gicv3_common.c | 79 ++++++++++++++++++++++++++++++ | 13 | 1 file changed, 21 insertions(+) |
23 | hw/intc/arm_gicv3_kvm.c | 38 ++++++++++++++ | ||
24 | 3 files changed, 118 insertions(+) | ||
25 | 14 | ||
26 | diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h | 15 | diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c |
27 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/include/hw/intc/arm_gicv3_common.h | 17 | --- a/hw/timer/a9gtimer.c |
29 | +++ b/include/hw/intc/arm_gicv3_common.h | 18 | +++ b/hw/timer/a9gtimer.c |
30 | @@ -XXX,XX +XXX,XX @@ struct GICv3State { | 19 | @@ -XXX,XX +XXX,XX @@ static void a9_gtimer_realize(DeviceState *dev, Error **errp) |
31 | uint32_t revision; | 20 | } |
32 | bool security_extn; | 21 | } |
33 | bool irq_reset_nonsecure; | 22 | |
34 | + bool gicd_no_migration_shift_bug; | 23 | +static bool vmstate_a9_gtimer_control_needed(void *opaque) |
35 | 24 | +{ | |
36 | int dev_fd; /* kvm device fd if backed by kvm vgic support */ | 25 | + A9GTimerState *s = opaque; |
37 | Error *migration_blocker; | 26 | + return s->control != 0; |
38 | diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c | 27 | +} |
39 | index XXXXXXX..XXXXXXX 100644 | 28 | + |
40 | --- a/hw/intc/arm_gicv3_common.c | 29 | static const VMStateDescription vmstate_a9_gtimer_per_cpu = { |
41 | +++ b/hw/intc/arm_gicv3_common.c | 30 | .name = "arm.cortex-a9-global-timer.percpu", |
42 | @@ -XXX,XX +XXX,XX @@ | 31 | .version_id = 1, |
43 | #include "hw/intc/arm_gicv3_common.h" | 32 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = { |
44 | #include "gicv3_internal.h" | ||
45 | #include "hw/arm/linux-boot-if.h" | ||
46 | +#include "sysemu/kvm.h" | ||
47 | |||
48 | static int gicv3_pre_save(void *opaque) | ||
49 | { | ||
50 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_gicv3_cpu = { | ||
51 | } | 33 | } |
52 | }; | 34 | }; |
53 | 35 | ||
54 | +static int gicv3_gicd_no_migration_shift_bug_pre_load(void *opaque) | 36 | +static const VMStateDescription vmstate_a9_gtimer_control = { |
55 | +{ | 37 | + .name = "arm.cortex-a9-global-timer.control", |
56 | + GICv3State *cs = opaque; | ||
57 | + | ||
58 | + /* | ||
59 | + * The gicd_no_migration_shift_bug flag is used for migration compatibility | ||
60 | + * for old version QEMU which may have the GICD bmp shift bug under KVM mode. | ||
61 | + * Strictly, what we want to know is whether the migration source is using | ||
62 | + * KVM. Since we don't have any way to determine that, we look at whether the | ||
63 | + * destination is using KVM; this is close enough because for the older QEMU | ||
64 | + * versions with this bug KVM -> TCG migration didn't work anyway. If the | ||
65 | + * source is a newer QEMU without this bug it will transmit the migration | ||
66 | + * subsection which sets the flag to true; otherwise it will remain set to | ||
67 | + * the value we select here. | ||
68 | + */ | ||
69 | + if (kvm_enabled()) { | ||
70 | + cs->gicd_no_migration_shift_bug = false; | ||
71 | + } | ||
72 | + | ||
73 | + return 0; | ||
74 | +} | ||
75 | + | ||
76 | +static int gicv3_gicd_no_migration_shift_bug_post_load(void *opaque, | ||
77 | + int version_id) | ||
78 | +{ | ||
79 | + GICv3State *cs = opaque; | ||
80 | + | ||
81 | + if (cs->gicd_no_migration_shift_bug) { | ||
82 | + return 0; | ||
83 | + } | ||
84 | + | ||
85 | + /* Older versions of QEMU had a bug in the handling of state save/restore | ||
86 | + * to the KVM GICv3: they got the offset in the bitmap arrays wrong, | ||
87 | + * so that instead of the data for external interrupts 32 and up | ||
88 | + * starting at bit position 32 in the bitmap, it started at bit | ||
89 | + * position 64. If we're receiving data from a QEMU with that bug, | ||
90 | + * we must move the data down into the right place. | ||
91 | + */ | ||
92 | + memmove(cs->group, (uint8_t *)cs->group + GIC_INTERNAL / 8, | ||
93 | + sizeof(cs->group) - GIC_INTERNAL / 8); | ||
94 | + memmove(cs->grpmod, (uint8_t *)cs->grpmod + GIC_INTERNAL / 8, | ||
95 | + sizeof(cs->grpmod) - GIC_INTERNAL / 8); | ||
96 | + memmove(cs->enabled, (uint8_t *)cs->enabled + GIC_INTERNAL / 8, | ||
97 | + sizeof(cs->enabled) - GIC_INTERNAL / 8); | ||
98 | + memmove(cs->pending, (uint8_t *)cs->pending + GIC_INTERNAL / 8, | ||
99 | + sizeof(cs->pending) - GIC_INTERNAL / 8); | ||
100 | + memmove(cs->active, (uint8_t *)cs->active + GIC_INTERNAL / 8, | ||
101 | + sizeof(cs->active) - GIC_INTERNAL / 8); | ||
102 | + memmove(cs->edge_trigger, (uint8_t *)cs->edge_trigger + GIC_INTERNAL / 8, | ||
103 | + sizeof(cs->edge_trigger) - GIC_INTERNAL / 8); | ||
104 | + | ||
105 | + /* | ||
106 | + * While this new version QEMU doesn't have this kind of bug as we fix it, | ||
107 | + * so it needs to set the flag to true to indicate that and it's necessary | ||
108 | + * for next migration to work from this new version QEMU. | ||
109 | + */ | ||
110 | + cs->gicd_no_migration_shift_bug = true; | ||
111 | + | ||
112 | + return 0; | ||
113 | +} | ||
114 | + | ||
115 | +const VMStateDescription vmstate_gicv3_gicd_no_migration_shift_bug = { | ||
116 | + .name = "arm_gicv3/gicd_no_migration_shift_bug", | ||
117 | + .version_id = 1, | 38 | + .version_id = 1, |
118 | + .minimum_version_id = 1, | 39 | + .minimum_version_id = 1, |
119 | + .pre_load = gicv3_gicd_no_migration_shift_bug_pre_load, | 40 | + .needed = vmstate_a9_gtimer_control_needed, |
120 | + .post_load = gicv3_gicd_no_migration_shift_bug_post_load, | ||
121 | + .fields = (VMStateField[]) { | 41 | + .fields = (VMStateField[]) { |
122 | + VMSTATE_BOOL(gicd_no_migration_shift_bug, GICv3State), | 42 | + VMSTATE_UINT32(control, A9GTimerState), |
123 | + VMSTATE_END_OF_LIST() | 43 | + VMSTATE_END_OF_LIST() |
124 | + } | 44 | + } |
125 | +}; | 45 | +}; |
126 | + | 46 | + |
127 | static const VMStateDescription vmstate_gicv3 = { | 47 | static const VMStateDescription vmstate_a9_gtimer = { |
128 | .name = "arm_gicv3", | 48 | .name = "arm.cortex-a9-global-timer", |
129 | .version_id = 1, | 49 | .version_id = 1, |
130 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_gicv3 = { | 50 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer = { |
131 | VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, GICv3State, num_cpu, | 51 | 1, vmstate_a9_gtimer_per_cpu, |
132 | vmstate_gicv3_cpu, GICv3CPUState), | 52 | A9GTimerPerCPU), |
133 | VMSTATE_END_OF_LIST() | 53 | VMSTATE_END_OF_LIST() |
134 | + }, | 54 | + }, |
135 | + .subsections = (const VMStateDescription * []) { | 55 | + .subsections = (const VMStateDescription*[]) { |
136 | + &vmstate_gicv3_gicd_no_migration_shift_bug, | 56 | + &vmstate_a9_gtimer_control, |
137 | + NULL | 57 | + NULL |
138 | } | 58 | } |
139 | }; | 59 | }; |
140 | 60 | ||
141 | @@ -XXX,XX +XXX,XX @@ static void arm_gicv3_common_reset(DeviceState *dev) | ||
142 | gicv3_gicd_group_set(s, i); | ||
143 | } | ||
144 | } | ||
145 | + s->gicd_no_migration_shift_bug = true; | ||
146 | } | ||
147 | |||
148 | static void arm_gic_common_linux_init(ARMLinuxBootIf *obj, | ||
149 | diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/hw/intc/arm_gicv3_kvm.c | ||
152 | +++ b/hw/intc/arm_gicv3_kvm.c | ||
153 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_get_edge_trigger(GICv3State *s, uint32_t offset, | ||
154 | uint32_t reg; | ||
155 | int irq; | ||
156 | |||
157 | + /* For the KVM GICv3, affinity routing is always enabled, and the first 2 | ||
158 | + * GICD_ICFGR<n> registers are always RAZ/WI. The corresponding | ||
159 | + * functionality is replaced by GICR_ICFGR<n>. It doesn't need to sync | ||
160 | + * them. So it should increase the offset to skip GIC_INTERNAL irqs. | ||
161 | + * This matches the for_each_dist_irq_reg() macro which also skips the | ||
162 | + * first GIC_INTERNAL irqs. | ||
163 | + */ | ||
164 | + offset += (GIC_INTERNAL * 2) / 8; | ||
165 | for_each_dist_irq_reg(irq, s->num_irq, 2) { | ||
166 | kvm_gicd_access(s, offset, ®, false); | ||
167 | reg = half_unshuffle32(reg >> 1); | ||
168 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_put_edge_trigger(GICv3State *s, uint32_t offset, | ||
169 | uint32_t reg; | ||
170 | int irq; | ||
171 | |||
172 | + /* For the KVM GICv3, affinity routing is always enabled, and the first 2 | ||
173 | + * GICD_ICFGR<n> registers are always RAZ/WI. The corresponding | ||
174 | + * functionality is replaced by GICR_ICFGR<n>. It doesn't need to sync | ||
175 | + * them. So it should increase the offset to skip GIC_INTERNAL irqs. | ||
176 | + * This matches the for_each_dist_irq_reg() macro which also skips the | ||
177 | + * first GIC_INTERNAL irqs. | ||
178 | + */ | ||
179 | + offset += (GIC_INTERNAL * 2) / 8; | ||
180 | for_each_dist_irq_reg(irq, s->num_irq, 2) { | ||
181 | reg = *gic_bmp_ptr32(bmp, irq); | ||
182 | if (irq % 32 != 0) { | ||
183 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_getbmp(GICv3State *s, uint32_t offset, uint32_t *bmp) | ||
184 | uint32_t reg; | ||
185 | int irq; | ||
186 | |||
187 | + /* For the KVM GICv3, affinity routing is always enabled, and the | ||
188 | + * GICD_IGROUPR0/GICD_IGRPMODR0/GICD_ISENABLER0/GICD_ISPENDR0/ | ||
189 | + * GICD_ISACTIVER0 registers are always RAZ/WI. The corresponding | ||
190 | + * functionality is replaced by the GICR registers. It doesn't need to sync | ||
191 | + * them. So it should increase the offset to skip GIC_INTERNAL irqs. | ||
192 | + * This matches the for_each_dist_irq_reg() macro which also skips the | ||
193 | + * first GIC_INTERNAL irqs. | ||
194 | + */ | ||
195 | + offset += (GIC_INTERNAL * 1) / 8; | ||
196 | for_each_dist_irq_reg(irq, s->num_irq, 1) { | ||
197 | kvm_gicd_access(s, offset, ®, false); | ||
198 | *gic_bmp_ptr32(bmp, irq) = reg; | ||
199 | @@ -XXX,XX +XXX,XX @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset, | ||
200 | uint32_t reg; | ||
201 | int irq; | ||
202 | |||
203 | + /* For the KVM GICv3, affinity routing is always enabled, and the | ||
204 | + * GICD_IGROUPR0/GICD_IGRPMODR0/GICD_ISENABLER0/GICD_ISPENDR0/ | ||
205 | + * GICD_ISACTIVER0 registers are always RAZ/WI. The corresponding | ||
206 | + * functionality is replaced by the GICR registers. It doesn't need to sync | ||
207 | + * them. So it should increase the offset and clroffset to skip GIC_INTERNAL | ||
208 | + * irqs. This matches the for_each_dist_irq_reg() macro which also skips the | ||
209 | + * first GIC_INTERNAL irqs. | ||
210 | + */ | ||
211 | + offset += (GIC_INTERNAL * 1) / 8; | ||
212 | + if (clroffset != 0) { | ||
213 | + clroffset += (GIC_INTERNAL * 1) / 8; | ||
214 | + } | ||
215 | + | ||
216 | for_each_dist_irq_reg(irq, s->num_irq, 1) { | ||
217 | /* If this bitmap is a set/clear register pair, first write to the | ||
218 | * clear-reg to clear all bits before using the set-reg to write | ||
219 | -- | 61 | -- |
220 | 2.17.1 | 62 | 2.25.1 |
221 | 63 | ||
222 | 64 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Cédric Le Goater <clg@kaod.org> | ||
2 | 1 | ||
3 | This is an helper routine to add a single EEPROM on an I2C bus. It can | ||
4 | be directly used by smbus_eeprom_init() which adds a certain number of | ||
5 | EEPROMs on mips and x86 machines. | ||
6 | |||
7 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20180530064049.27976-5-clg@kaod.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | include/hw/i2c/smbus.h | 1 + | ||
13 | hw/i2c/smbus_eeprom.c | 16 +++++++++++----- | ||
14 | 2 files changed, 12 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/include/hw/i2c/smbus.h b/include/hw/i2c/smbus.h | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/include/hw/i2c/smbus.h | ||
19 | +++ b/include/hw/i2c/smbus.h | ||
20 | @@ -XXX,XX +XXX,XX @@ int smbus_read_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data); | ||
21 | int smbus_write_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data, | ||
22 | int len); | ||
23 | |||
24 | +void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom_buf); | ||
25 | void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, | ||
26 | const uint8_t *eeprom_spd, int size); | ||
27 | |||
28 | diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/i2c/smbus_eeprom.c | ||
31 | +++ b/hw/i2c/smbus_eeprom.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void smbus_eeprom_register_types(void) | ||
33 | |||
34 | type_init(smbus_eeprom_register_types) | ||
35 | |||
36 | +void smbus_eeprom_init_one(I2CBus *smbus, uint8_t address, uint8_t *eeprom_buf) | ||
37 | +{ | ||
38 | + DeviceState *dev; | ||
39 | + | ||
40 | + dev = qdev_create((BusState *) smbus, "smbus-eeprom"); | ||
41 | + qdev_prop_set_uint8(dev, "address", address); | ||
42 | + qdev_prop_set_ptr(dev, "data", eeprom_buf); | ||
43 | + qdev_init_nofail(dev); | ||
44 | +} | ||
45 | + | ||
46 | void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, | ||
47 | const uint8_t *eeprom_spd, int eeprom_spd_size) | ||
48 | { | ||
49 | @@ -XXX,XX +XXX,XX @@ void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom, | ||
50 | } | ||
51 | |||
52 | for (i = 0; i < nb_eeprom; i++) { | ||
53 | - DeviceState *eeprom; | ||
54 | - eeprom = qdev_create((BusState *)smbus, "smbus-eeprom"); | ||
55 | - qdev_prop_set_uint8(eeprom, "address", 0x50 + i); | ||
56 | - qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); | ||
57 | - qdev_init_nofail(eeprom); | ||
58 | + smbus_eeprom_init_one(smbus, 0x50 + i, eeprom_buf + (i * 256)); | ||
59 | } | ||
60 | } | ||
61 | -- | ||
62 | 2.17.1 | ||
63 | |||
64 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Cédric Le Goater <clg@kaod.org> | ||
2 | 1 | ||
3 | The Aspeed boards have at least one EEPROM to hold the Vital Product | ||
4 | Data (VPD). | ||
5 | |||
6 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Reviewed-by: Andrew Jeffery <andrew@aj.id.au> | ||
8 | Message-id: 20180530064049.27976-6-clg@kaod.org | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | hw/arm/aspeed.c | 13 +++++++++++++ | ||
12 | 1 file changed, 13 insertions(+) | ||
13 | |||
14 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/hw/arm/aspeed.c | ||
17 | +++ b/hw/arm/aspeed.c | ||
18 | @@ -XXX,XX +XXX,XX @@ | ||
19 | #include "hw/arm/arm.h" | ||
20 | #include "hw/arm/aspeed_soc.h" | ||
21 | #include "hw/boards.h" | ||
22 | +#include "hw/i2c/smbus.h" | ||
23 | #include "qemu/log.h" | ||
24 | #include "sysemu/block-backend.h" | ||
25 | #include "hw/loader.h" | ||
26 | @@ -XXX,XX +XXX,XX @@ static void palmetto_bmc_i2c_init(AspeedBoardState *bmc) | ||
27 | { | ||
28 | AspeedSoCState *soc = &bmc->soc; | ||
29 | DeviceState *dev; | ||
30 | + uint8_t *eeprom_buf = g_malloc0(32 * 1024); | ||
31 | |||
32 | /* The palmetto platform expects a ds3231 RTC but a ds1338 is | ||
33 | * enough to provide basic RTC features. Alarms will be missing */ | ||
34 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68); | ||
35 | |||
36 | + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), 0x50, | ||
37 | + eeprom_buf); | ||
38 | + | ||
39 | /* add a TMP423 temperature sensor */ | ||
40 | dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2), | ||
41 | "tmp423", 0x4c); | ||
42 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo palmetto_bmc_type = { | ||
43 | static void ast2500_evb_i2c_init(AspeedBoardState *bmc) | ||
44 | { | ||
45 | AspeedSoCState *soc = &bmc->soc; | ||
46 | + uint8_t *eeprom_buf = g_malloc0(8 * 1024); | ||
47 | + | ||
48 | + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), 0x50, | ||
49 | + eeprom_buf); | ||
50 | |||
51 | /* The AST2500 EVB expects a LM75 but a TMP105 is compatible */ | ||
52 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x4d); | ||
53 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo romulus_bmc_type = { | ||
54 | static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
55 | { | ||
56 | AspeedSoCState *soc = &bmc->soc; | ||
57 | + uint8_t *eeprom_buf = g_malloc0(8 * 1024); | ||
58 | |||
59 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c); | ||
60 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c); | ||
61 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
62 | /* The witherspoon board expects Epson RX8900 I2C RTC but a ds1338 is | ||
63 | * good enough */ | ||
64 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32); | ||
65 | + | ||
66 | + smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51, | ||
67 | + eeprom_buf); | ||
68 | } | ||
69 | |||
70 | static void witherspoon_bmc_init(MachineState *machine) | ||
71 | -- | ||
72 | 2.17.1 | ||
73 | |||
74 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Cédric Le Goater <clg@kaod.org> | ||
2 | 1 | ||
3 | The pca9552 LED blinkers on the Witherspoon machine are used for leds | ||
4 | but also as GPIOs to control fans and GPUs. | ||
5 | |||
6 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Reviewed-by: Andrew Jeffery <andrew@aj.id.au> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20180530064049.27976-8-clg@kaod.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | --- | ||
12 | hw/arm/aspeed.c | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/hw/arm/aspeed.c | ||
18 | +++ b/hw/arm/aspeed.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
20 | AspeedSoCState *soc = &bmc->soc; | ||
21 | uint8_t *eeprom_buf = g_malloc0(8 * 1024); | ||
22 | |||
23 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60); | ||
24 | + | ||
25 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 4), "tmp423", 0x4c); | ||
26 | i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 5), "tmp423", 0x4c); | ||
27 | |||
28 | @@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc) | ||
29 | |||
30 | smbus_eeprom_init_one(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), 0x51, | ||
31 | eeprom_buf); | ||
32 | + i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "pca9552", | ||
33 | + 0x60); | ||
34 | } | ||
35 | |||
36 | static void witherspoon_bmc_init(MachineState *machine) | ||
37 | -- | ||
38 | 2.17.1 | ||
39 | |||
40 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Cédric Le Goater <clg@kaod.org> | ||
2 | 1 | ||
3 | Based on the multicast hash calculation of the FTGMAC100 Linux driver. | ||
4 | |||
5 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
7 | Message-id: 20180530061711.23673-4-clg@kaod.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/net/ftgmac100.c | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/net/ftgmac100.c | ||
16 | +++ b/hw/net/ftgmac100.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static int ftgmac100_filter(FTGMAC100State *s, const uint8_t *buf, size_t len) | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | - /* TODO: this does not seem to work for ftgmac100 */ | ||
22 | - mcast_idx = net_crc32(buf, ETH_ALEN) >> 26; | ||
23 | + mcast_idx = net_crc32_le(buf, ETH_ALEN); | ||
24 | + mcast_idx = (~(mcast_idx >> 2)) & 0x3f; | ||
25 | if (!(s->math[mcast_idx / 32] & (1 << (mcast_idx % 32)))) { | ||
26 | return 0; | ||
27 | } | ||
28 | -- | ||
29 | 2.17.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | This is the BMC attached to the OpenBMC Mori board. |
4 | Message-id: 20180606152128.449-3-f4bug@amsat.org | 4 | |
5 | Signed-off-by: Patrick Venture <venture@google.com> | ||
6 | Reviewed-by: Chris Rauer <crauer@google.com> | ||
7 | Reviewed-by: Ilkyun Choi <ikchoi@google.com> | ||
8 | Message-id: 20220208233104.284425-1-venture@google.com | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 11 | --- |
8 | hw/char/digic-uart.c | 4 ++-- | 12 | docs/system/arm/nuvoton.rst | 1 + |
9 | hw/timer/digic-timer.c | 4 ++-- | 13 | hw/arm/npcm7xx_boards.c | 32 ++++++++++++++++++++++++++++++++ |
10 | 2 files changed, 4 insertions(+), 4 deletions(-) | 14 | 2 files changed, 33 insertions(+) |
11 | 15 | ||
12 | diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c | 16 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst |
13 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/char/digic-uart.c | 18 | --- a/docs/system/arm/nuvoton.rst |
15 | +++ b/hw/char/digic-uart.c | 19 | +++ b/docs/system/arm/nuvoton.rst |
16 | @@ -XXX,XX +XXX,XX @@ static uint64_t digic_uart_read(void *opaque, hwaddr addr, | 20 | @@ -XXX,XX +XXX,XX @@ Hyperscale applications. The following machines are based on this chip : |
17 | default: | 21 | - ``quanta-gbs-bmc`` Quanta GBS server BMC |
18 | qemu_log_mask(LOG_UNIMP, | 22 | - ``quanta-gsj`` Quanta GSJ server BMC |
19 | "digic-uart: read access to unknown register 0x" | 23 | - ``kudo-bmc`` Fii USA Kudo server BMC |
20 | - TARGET_FMT_plx, addr << 2); | 24 | +- ``mori-bmc`` Fii USA Mori server BMC |
21 | + TARGET_FMT_plx "\n", addr << 2); | 25 | |
22 | } | 26 | There are also two more SoCs, NPCM710 and NPCM705, which are single-core |
23 | 27 | variants of NPCM750 and NPCM730, respectively. These are currently not | |
24 | return ret; | 28 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c |
25 | @@ -XXX,XX +XXX,XX @@ static void digic_uart_write(void *opaque, hwaddr addr, uint64_t value, | 29 | index XXXXXXX..XXXXXXX 100644 |
26 | default: | 30 | --- a/hw/arm/npcm7xx_boards.c |
27 | qemu_log_mask(LOG_UNIMP, | 31 | +++ b/hw/arm/npcm7xx_boards.c |
28 | "digic-uart: write access to unknown register 0x" | 32 | @@ -XXX,XX +XXX,XX @@ |
29 | - TARGET_FMT_plx, addr << 2); | 33 | #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff |
30 | + TARGET_FMT_plx "\n", addr << 2); | 34 | #define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff |
31 | } | 35 | #define KUDO_BMC_POWER_ON_STRAPS 0x00001fff |
36 | +#define MORI_BMC_POWER_ON_STRAPS 0x00001fff | ||
37 | |||
38 | static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin"; | ||
39 | |||
40 | @@ -XXX,XX +XXX,XX @@ static void kudo_bmc_init(MachineState *machine) | ||
41 | npcm7xx_load_kernel(machine, soc); | ||
32 | } | 42 | } |
33 | 43 | ||
34 | diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c | 44 | +static void mori_bmc_init(MachineState *machine) |
35 | index XXXXXXX..XXXXXXX 100644 | 45 | +{ |
36 | --- a/hw/timer/digic-timer.c | 46 | + NPCM7xxState *soc; |
37 | +++ b/hw/timer/digic-timer.c | 47 | + |
38 | @@ -XXX,XX +XXX,XX @@ static uint64_t digic_timer_read(void *opaque, hwaddr offset, unsigned size) | 48 | + soc = npcm7xx_create_soc(machine, MORI_BMC_POWER_ON_STRAPS); |
39 | default: | 49 | + npcm7xx_connect_dram(soc, machine->ram); |
40 | qemu_log_mask(LOG_UNIMP, | 50 | + qdev_realize(DEVICE(soc), NULL, &error_fatal); |
41 | "digic-timer: read access to unknown register 0x" | 51 | + |
42 | - TARGET_FMT_plx, offset); | 52 | + npcm7xx_load_bootrom(machine, soc); |
43 | + TARGET_FMT_plx "\n", offset); | 53 | + npcm7xx_connect_flash(&soc->fiu[1], 0, "mx66u51235f", |
44 | } | 54 | + drive_get(IF_MTD, 3, 0)); |
45 | 55 | + | |
46 | return ret; | 56 | + npcm7xx_load_kernel(machine, soc); |
47 | @@ -XXX,XX +XXX,XX @@ static void digic_timer_write(void *opaque, hwaddr offset, | 57 | +} |
48 | default: | 58 | + |
49 | qemu_log_mask(LOG_UNIMP, | 59 | static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type) |
50 | "digic-timer: read access to unknown register 0x" | 60 | { |
51 | - TARGET_FMT_plx, offset); | 61 | NPCM7xxClass *sc = NPCM7XX_CLASS(object_class_by_name(type)); |
52 | + TARGET_FMT_plx "\n", offset); | 62 | @@ -XXX,XX +XXX,XX @@ static void kudo_bmc_machine_class_init(ObjectClass *oc, void *data) |
53 | } | 63 | mc->default_ram_size = 1 * GiB; |
54 | } | 64 | }; |
65 | |||
66 | +static void mori_bmc_machine_class_init(ObjectClass *oc, void *data) | ||
67 | +{ | ||
68 | + NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_CLASS(oc); | ||
69 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
70 | + | ||
71 | + npcm7xx_set_soc_type(nmc, TYPE_NPCM730); | ||
72 | + | ||
73 | + mc->desc = "Mori BMC (Cortex-A9)"; | ||
74 | + mc->init = mori_bmc_init; | ||
75 | + mc->default_ram_size = 1 * GiB; | ||
76 | +} | ||
77 | + | ||
78 | static const TypeInfo npcm7xx_machine_types[] = { | ||
79 | { | ||
80 | .name = TYPE_NPCM7XX_MACHINE, | ||
81 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo npcm7xx_machine_types[] = { | ||
82 | .name = MACHINE_TYPE_NAME("kudo-bmc"), | ||
83 | .parent = TYPE_NPCM7XX_MACHINE, | ||
84 | .class_init = kudo_bmc_machine_class_init, | ||
85 | + }, { | ||
86 | + .name = MACHINE_TYPE_NAME("mori-bmc"), | ||
87 | + .parent = TYPE_NPCM7XX_MACHINE, | ||
88 | + .class_init = mori_bmc_machine_class_init, | ||
89 | }, | ||
90 | }; | ||
55 | 91 | ||
56 | -- | 92 | -- |
57 | 2.17.1 | 93 | 2.25.1 |
58 | 94 | ||
59 | 95 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | setAllowedFileTypes is deprecated in macOS 12. | ||
4 | |||
5 | Per Akihiko Odaki [*]: | ||
6 | |||
7 | An image file, which is being chosen by the panel, can be a | ||
8 | raw file and have a variety of file extensions and many are not | ||
9 | covered by the provided list (e.g. "udf"). Other platforms like | ||
10 | GTK can provide an option to open a file with an extension not | ||
11 | listed, but Cocoa can't. It forces the user to rename the file | ||
12 | to give an extension in the list. Moreover, Cocoa does not tell | ||
13 | which extensions are in the list so the user needs to read the | ||
14 | source code, which is pretty bad. | ||
15 | |||
16 | Since this code is harming the usability rather than improving it, | ||
17 | simply remove the [NSSavePanel allowedFileTypes:] call, fixing: | ||
18 | |||
19 | [2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o | ||
20 | ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first deprecated in macOS 12.0 - Use -allowedContentTypes instead [-Werror,-Wdeprecated-declarations] | ||
21 | [openPanel setAllowedFileTypes: supportedImageFileTypes]; | ||
22 | ^ | ||
23 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: property 'allowedFileTypes' is declared deprecated here | ||
24 | @property (nullable, copy) NSArray<NSString *> *allowedFileTypes API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0)); | ||
25 | ^ | ||
26 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: 'setAllowedFileTypes:' has been explicitly marked deprecated here | ||
27 | FAILED: libcommon.fa.p/ui_cocoa.m.o | ||
28 | |||
29 | [*] https://lore.kernel.org/qemu-devel/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/ | ||
30 | |||
31 | Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
32 | Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> | ||
33 | Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> | ||
34 | Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 35 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 36 | Message-id: 20220215080307.69550-11-f4bug@amsat.org |
5 | Message-id: 20180606152128.449-4-f4bug@amsat.org | 37 | Reviewed by: Cameron Esfahani <dirty@apple.com> |
38 | Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
39 | Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
40 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 42 | --- |
8 | hw/display/xlnx_dp.c | 4 +++- | 43 | ui/cocoa.m | 6 ------ |
9 | 1 file changed, 3 insertions(+), 1 deletion(-) | 44 | 1 file changed, 6 deletions(-) |
10 | 45 | ||
11 | diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c | 46 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
12 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/display/xlnx_dp.c | 48 | --- a/ui/cocoa.m |
14 | +++ b/hw/display/xlnx_dp.c | 49 | +++ b/ui/cocoa.m |
15 | @@ -XXX,XX +XXX,XX @@ static void xlnx_dp_avbufm_write(void *opaque, hwaddr offset, uint64_t value, | 50 | @@ -XXX,XX +XXX,XX @@ static int gArgc; |
16 | case AV_BUF_STC_SNAPSHOT1: | 51 | static char **gArgv; |
17 | case AV_BUF_HCOUNT_VCOUNT_INT0: | 52 | static bool stretch_video; |
18 | case AV_BUF_HCOUNT_VCOUNT_INT1: | 53 | static NSTextField *pauseLabel; |
19 | - qemu_log_mask(LOG_UNIMP, "avbufm: unimplmented"); | 54 | -static NSArray * supportedImageFileTypes; |
20 | + qemu_log_mask(LOG_UNIMP, "avbufm: unimplemented register 0x%04" | 55 | |
21 | + PRIx64 "\n", | 56 | static QemuSemaphore display_init_sem; |
22 | + offset << 2); | 57 | static QemuSemaphore app_started_sem; |
23 | break; | 58 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; |
24 | default: | 59 | [pauseLabel setTextColor: [NSColor blackColor]]; |
25 | s->avbufm_registers[offset] = value; | 60 | [pauseLabel sizeToFit]; |
61 | |||
62 | - // set the supported image file types that can be opened | ||
63 | - supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg", | ||
64 | - @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr", | ||
65 | - @"toast", nil]; | ||
66 | [self make_about_window]; | ||
67 | } | ||
68 | return self; | ||
69 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; | ||
70 | openPanel = [NSOpenPanel openPanel]; | ||
71 | [openPanel setCanChooseFiles: YES]; | ||
72 | [openPanel setAllowsMultipleSelection: NO]; | ||
73 | - [openPanel setAllowedFileTypes: supportedImageFileTypes]; | ||
74 | if([openPanel runModal] == NSModalResponseOK) { | ||
75 | NSString * file = [[[openPanel URLs] objectAtIndex: 0] path]; | ||
76 | if(file == nil) { | ||
26 | -- | 77 | -- |
27 | 2.17.1 | 78 | 2.25.1 |
28 | 79 | ||
29 | 80 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
4 | Message-id: 20220215080307.69550-13-f4bug@amsat.org | ||
5 | Message-Id: <20220213021418.2155-1-akihiko.odaki@gmail.com> | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | Acked-by: David Gibson <david@gibson.dropbear.id.au> | ||
5 | Message-id: 20180606152128.449-5-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 8 | --- |
8 | hw/ppc/pnv_core.c | 4 ++-- | 9 | ui/cocoa.m | 5 ----- |
9 | 1 file changed, 2 insertions(+), 2 deletions(-) | 10 | 1 file changed, 5 deletions(-) |
10 | 11 | ||
11 | diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c | 12 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/ppc/pnv_core.c | 14 | --- a/ui/cocoa.m |
14 | +++ b/hw/ppc/pnv_core.c | 15 | +++ b/ui/cocoa.m |
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t pnv_core_xscom_read(void *opaque, hwaddr addr, | 16 | @@ -XXX,XX +XXX,XX @@ static void addRemovableDevicesMenuItems(void) |
16 | val = 0x24f000000000000ull; | 17 | |
17 | break; | 18 | currentDevice = qmp_query_block(NULL); |
18 | default: | 19 | pointerToFree = currentDevice; |
19 | - qemu_log_mask(LOG_UNIMP, "Warning: reading reg=0x%" HWADDR_PRIx, | 20 | - if(currentDevice == NULL) { |
20 | + qemu_log_mask(LOG_UNIMP, "Warning: reading reg=0x%" HWADDR_PRIx "\n", | 21 | - NSBeep(); |
21 | addr); | 22 | - QEMU_Alert(@"Failed to query for block devices!"); |
22 | } | 23 | - return; |
23 | 24 | - } | |
24 | @@ -XXX,XX +XXX,XX @@ static uint64_t pnv_core_xscom_read(void *opaque, hwaddr addr, | 25 | |
25 | static void pnv_core_xscom_write(void *opaque, hwaddr addr, uint64_t val, | 26 | menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu]; |
26 | unsigned int width) | ||
27 | { | ||
28 | - qemu_log_mask(LOG_UNIMP, "Warning: writing to reg=0x%" HWADDR_PRIx, | ||
29 | + qemu_log_mask(LOG_UNIMP, "Warning: writing to reg=0x%" HWADDR_PRIx "\n", | ||
30 | addr); | ||
31 | } | ||
32 | 27 | ||
33 | -- | 28 | -- |
34 | 2.17.1 | 29 | 2.25.1 |
35 | 30 | ||
36 | 31 | diff view generated by jsdifflib |
1 | From: Thomas Huth <thuth@redhat.com> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | It has been marked as deprecated since QEMU v2.11, so it is time to | 3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> |
4 | remove this now. The xlnx-zcu102 machine is very much the same and | 4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | can be used as a replacement instead. | 5 | Message-id: 20220215080307.69550-14-f4bug@amsat.org |
6 | 6 | Message-Id: <20220213021329.2066-1-akihiko.odaki@gmail.com> | |
7 | Signed-off-by: Thomas Huth <thuth@redhat.com> | 7 | [PMD: Use g_autofree, suggested by Zoltan BALATON] |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.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/arm/xlnx-zcu102.c | 62 ++------------------------------------------ | 11 | ui/cocoa.m | 4 +++- |
12 | qemu-doc.texi | 5 ---- | 12 | 1 file changed, 3 insertions(+), 1 deletion(-) |
13 | 2 files changed, 2 insertions(+), 65 deletions(-) | ||
14 | 13 | ||
15 | diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c | 14 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
16 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/xlnx-zcu102.c | 16 | --- a/ui/cocoa.m |
18 | +++ b/hw/arm/xlnx-zcu102.c | 17 | +++ b/ui/cocoa.m |
19 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxZCU102 { | 18 | @@ -XXX,XX +XXX,XX @@ static void create_initial_menus(void) |
20 | #define ZCU102_MACHINE(obj) \ | 19 | /* Returns a name for a given console */ |
21 | OBJECT_CHECK(XlnxZCU102, (obj), TYPE_ZCU102_MACHINE) | 20 | static NSString * getConsoleName(QemuConsole * console) |
22 | 21 | { | |
23 | -#define TYPE_EP108_MACHINE MACHINE_TYPE_NAME("xlnx-ep108") | 22 | - return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)]; |
24 | -#define EP108_MACHINE(obj) \ | 23 | + g_autofree char *label = qemu_console_get_label(console); |
25 | - OBJECT_CHECK(XlnxZCU102, (obj), TYPE_EP108_MACHINE) | 24 | + |
26 | - | 25 | + return [NSString stringWithUTF8String:label]; |
27 | static struct arm_boot_info xlnx_zcu102_binfo; | ||
28 | |||
29 | static bool zcu102_get_secure(Object *obj, Error **errp) | ||
30 | @@ -XXX,XX +XXX,XX @@ static void zcu102_set_virt(Object *obj, bool value, Error **errp) | ||
31 | s->virt = value; | ||
32 | } | 26 | } |
33 | 27 | ||
34 | -static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | 28 | /* Add an entry to the View menu for each console */ |
35 | +static void xlnx_zcu102_init(MachineState *machine) | ||
36 | { | ||
37 | + XlnxZCU102 *s = ZCU102_MACHINE(machine); | ||
38 | int i; | ||
39 | uint64_t ram_size = machine->ram_size; | ||
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine) | ||
42 | arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_zcu102_binfo); | ||
43 | } | ||
44 | |||
45 | -static void xlnx_ep108_init(MachineState *machine) | ||
46 | -{ | ||
47 | - XlnxZCU102 *s = EP108_MACHINE(machine); | ||
48 | - | ||
49 | - if (!qtest_enabled()) { | ||
50 | - info_report("The Xilinx EP108 machine is deprecated, please use the " | ||
51 | - "ZCU102 machine (which has the same features) instead."); | ||
52 | - } | ||
53 | - | ||
54 | - xlnx_zynqmp_init(s, machine); | ||
55 | -} | ||
56 | - | ||
57 | -static void xlnx_ep108_machine_instance_init(Object *obj) | ||
58 | -{ | ||
59 | - XlnxZCU102 *s = EP108_MACHINE(obj); | ||
60 | - | ||
61 | - /* EP108, we don't support setting secure or virt */ | ||
62 | - s->secure = false; | ||
63 | - s->virt = false; | ||
64 | -} | ||
65 | - | ||
66 | -static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data) | ||
67 | -{ | ||
68 | - MachineClass *mc = MACHINE_CLASS(oc); | ||
69 | - | ||
70 | - mc->desc = "Xilinx ZynqMP EP108 board (Deprecated, please use xlnx-zcu102)"; | ||
71 | - mc->init = xlnx_ep108_init; | ||
72 | - mc->block_default_type = IF_IDE; | ||
73 | - mc->units_per_default_bus = 1; | ||
74 | - mc->ignore_memory_transaction_failures = true; | ||
75 | - mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS; | ||
76 | - mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS; | ||
77 | -} | ||
78 | - | ||
79 | -static const TypeInfo xlnx_ep108_machine_init_typeinfo = { | ||
80 | - .name = MACHINE_TYPE_NAME("xlnx-ep108"), | ||
81 | - .parent = TYPE_MACHINE, | ||
82 | - .class_init = xlnx_ep108_machine_class_init, | ||
83 | - .instance_init = xlnx_ep108_machine_instance_init, | ||
84 | - .instance_size = sizeof(XlnxZCU102), | ||
85 | -}; | ||
86 | - | ||
87 | -static void xlnx_ep108_machine_init_register_types(void) | ||
88 | -{ | ||
89 | - type_register_static(&xlnx_ep108_machine_init_typeinfo); | ||
90 | -} | ||
91 | - | ||
92 | -static void xlnx_zcu102_init(MachineState *machine) | ||
93 | -{ | ||
94 | - XlnxZCU102 *s = ZCU102_MACHINE(machine); | ||
95 | - | ||
96 | - xlnx_zynqmp_init(s, machine); | ||
97 | -} | ||
98 | - | ||
99 | static void xlnx_zcu102_machine_instance_init(Object *obj) | ||
100 | { | ||
101 | XlnxZCU102 *s = ZCU102_MACHINE(obj); | ||
102 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zcu102_machine_init_register_types(void) | ||
103 | } | ||
104 | |||
105 | type_init(xlnx_zcu102_machine_init_register_types) | ||
106 | -type_init(xlnx_ep108_machine_init_register_types) | ||
107 | diff --git a/qemu-doc.texi b/qemu-doc.texi | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
109 | --- a/qemu-doc.texi | ||
110 | +++ b/qemu-doc.texi | ||
111 | @@ -XXX,XX +XXX,XX @@ support page sizes < 4096 any longer. | ||
112 | |||
113 | @section System emulator machines | ||
114 | |||
115 | -@subsection Xilinx EP108 (since 2.11.0) | ||
116 | - | ||
117 | -The ``xlnx-ep108'' machine has been replaced by the ``xlnx-zcu102'' machine. | ||
118 | -The ``xlnx-zcu102'' machine has the same features and capabilites in QEMU. | ||
119 | - | ||
120 | @section Block device options | ||
121 | |||
122 | @subsection "backing": "" (since 2.12.0) | ||
123 | -- | 29 | -- |
124 | 2.17.1 | 30 | 2.25.1 |
125 | 31 | ||
126 | 32 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Message-id: 20180606152128.449-2-f4bug@amsat.org | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/milkymist-memcard.c | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/hw/sd/milkymist-memcard.c | ||
14 | +++ b/hw/sd/milkymist-memcard.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t memcard_read(void *opaque, hwaddr addr, | ||
16 | r = s->response[s->response_read_ptr++]; | ||
17 | if (s->response_read_ptr > s->response_len) { | ||
18 | qemu_log_mask(LOG_GUEST_ERROR, "milkymist_memcard: " | ||
19 | - "read more cmd bytes than available. Clipping."); | ||
20 | + "read more cmd bytes than available: clipping\n"); | ||
21 | s->response_read_ptr = 0; | ||
22 | } | ||
23 | } | ||
24 | -- | ||
25 | 2.17.1 | ||
26 | |||
27 | diff view generated by jsdifflib |