1 | More arm patches (mostly the SDHCI ones from Philippe) | 1 | Handful of bugfixes for rc2. None of these are particularly critical |
---|---|---|---|
2 | or exciting. | ||
2 | 3 | ||
3 | thanks | ||
4 | -- PMM | 4 | -- PMM |
5 | 5 | ||
6 | The following changes since commit f521eeee3bd060b460c99e605472b7e03967db43: | 6 | The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345: |
7 | 7 | ||
8 | Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20180115' into staging (2018-01-15 13:17:47 +0000) | 8 | Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100) |
9 | 9 | ||
10 | are available in the git repository at: | 10 | are available in the Git repository at: |
11 | 11 | ||
12 | git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180116 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803 |
13 | 13 | ||
14 | for you to fetch changes up to 60765b6ceeb4998a0d4220b3a53f1f185061da77: | 14 | for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8: |
15 | 15 | ||
16 | sdhci: add a 'dma' property to the sysbus devices (2018-01-16 13:28:21 +0000) | 16 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100) |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | target-arm queue: | 19 | target-arm queue: |
20 | * SDHCI: cleanups and minor bug fixes | 20 | * hw/timer/imx_epit: Avoid assertion when CR.SWR is written |
21 | * target/arm: minor refactor preparatory to fp16 support | 21 | * netduino2, netduinoplus2, microbit: set system_clock_scale so that |
22 | * omap_ssd, ssi-sd, pl181, milkymist-memcard: reset the SD | 22 | SysTick running on the CPU clock works |
23 | card on controller reset (fixes migration failures) | 23 | * target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
24 | * target/arm: Handle page table walk load failures correctly | 24 | * target/arm: Fix AddPAC error indication |
25 | * hw/arm/virt: Add virt-2.12 machine type | 25 | * Make AIRCR.SYSRESETREQ actually reset the system for the |
26 | * get_phys_addr_pmsav7: Support AP=0b111 for v7M | 26 | microbit, mps2-*, musca-*, netduino* boards |
27 | * hw/intc/armv7m: Support byte and halfword accesses to CFSR | ||
28 | 27 | ||
29 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
30 | Andrey Smirnov (1): | 29 | Kaige Li (1): |
31 | sdhci: Implement write method of ACMD12ERRSTS register | 30 | target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
32 | 31 | ||
33 | Peter Maydell (8): | 32 | Peter Maydell (6): |
34 | hw/intc/armv7m: Support byte and halfword accesses to CFSR | 33 | hw/arm/netduino2, netduinoplus2: Set system_clock_scale |
35 | get_phys_addr_pmsav7: Support AP=0b111 for v7M | 34 | include/hw/irq.h: New function qemu_irq_is_connected() |
36 | hw/arm/virt: Add virt-2.12 machine type | 35 | hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ |
37 | target/arm: Handle page table walk load failures correctly | 36 | msf2-soc, stellaris: Don't wire up SYSRESETREQ |
38 | hw/sd/pl181: Reset SD card on controller reset | 37 | hw/arm/nrf51_soc: Set system_clock_scale |
39 | hw/sd/milkymist-memcard: Reset SD card on controller reset | 38 | hw/timer/imx_epit: Avoid assertion when CR.SWR is written |
40 | hw/sd/ssi-sd: Reset SD card on controller reset | ||
41 | hw/sd/omap_mmc: Reset SD card on controller reset | ||
42 | 39 | ||
43 | Philippe Mathieu-Daudé (13): | 40 | Richard Henderson (1): |
44 | sdhci: clean up includes | 41 | target/arm: Fix AddPAC error indication |
45 | sdhci: remove dead code | ||
46 | sdhci: use DEFINE_SDHCI_COMMON_PROPERTIES() for common sysbus/pci properties | ||
47 | sdhci: refactor common sysbus/pci class_init() into sdhci_common_class_init() | ||
48 | sdhci: refactor common sysbus/pci realize() into sdhci_common_realize() | ||
49 | sdhci: refactor common sysbus/pci unrealize() into sdhci_common_unrealize() | ||
50 | sdhci: use qemu_log_mask(UNIMP) instead of fprintf() | ||
51 | sdhci: convert the DPRINT() calls into trace events | ||
52 | sdhci: move MASK_TRNMOD with other SDHC_TRN* defines in "sd-internal.h" | ||
53 | sdhci: rename the SDHC_CAPAB register | ||
54 | sdhci: fix CAPAB/MAXCURR registers, both are 64bit and read-only | ||
55 | sdhci: fix the PCI device, using the PCI address space for DMA | ||
56 | sdhci: add a 'dma' property to the sysbus devices | ||
57 | 42 | ||
58 | Richard Henderson (2): | 43 | include/hw/arm/armv7m.h | 4 +++- |
59 | target/arm: Split out vfp_expand_imm | 44 | include/hw/irq.h | 18 ++++++++++++++++++ |
60 | target/arm: Add fp16 support to vfp_expand_imm | 45 | hw/arm/msf2-soc.c | 11 ----------- |
46 | hw/arm/netduino2.c | 10 ++++++++++ | ||
47 | hw/arm/netduinoplus2.c | 10 ++++++++++ | ||
48 | hw/arm/nrf51_soc.c | 5 +++++ | ||
49 | hw/arm/stellaris.c | 12 ------------ | ||
50 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- | ||
51 | hw/timer/imx_epit.c | 13 ++++++++++--- | ||
52 | target/arm/pauth_helper.c | 6 +++++- | ||
53 | target/arm/translate-a64.c | 2 +- | ||
54 | tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++++ | ||
55 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
56 | 13 files changed, 112 insertions(+), 31 deletions(-) | ||
57 | create mode 100644 tests/tcg/aarch64/pauth-5.c | ||
61 | 58 | ||
62 | hw/sd/sdhci-internal.h | 7 +- | ||
63 | include/hw/sd/sdhci.h | 19 +++- | ||
64 | target/arm/internals.h | 10 ++ | ||
65 | hw/arm/virt.c | 19 +++- | ||
66 | hw/intc/armv7m_nvic.c | 38 ++++--- | ||
67 | hw/sd/milkymist-memcard.c | 4 + | ||
68 | hw/sd/omap_mmc.c | 14 ++- | ||
69 | hw/sd/pl181.c | 4 + | ||
70 | hw/sd/sdhci.c | 266 +++++++++++++++++++++++++++------------------ | ||
71 | hw/sd/ssi-sd.c | 25 ++++- | ||
72 | target/arm/helper.c | 53 ++++++++- | ||
73 | target/arm/op_helper.c | 7 +- | ||
74 | target/arm/translate-a64.c | 49 ++++++--- | ||
75 | hw/sd/trace-events | 14 +++ | ||
76 | 14 files changed, 362 insertions(+), 167 deletions(-) | ||
77 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale |
---|---|---|---|
2 | global, which meant that if guest code used the systick timer in "use | ||
3 | the processor clock" mode it would hang because time never advances. | ||
2 | 4 | ||
3 | Add a 'dma' property allowing machine creation to provide the address-space | 5 | Set the global to match the documented CPU clock speed of these boards. |
4 | SDHCI DMA operates on. | 6 | Judging by the data sheet this is slightly simplistic because the |
7 | SoC allows configuration of the SYSCLK source and frequency via the | ||
8 | RCC (reset and clock control) module, but we don't model that. | ||
5 | 9 | ||
6 | [based on a patch from Alistair Francis <alistair.francis@xilinx.com> | 10 | Fixes: https://bugs.launchpad.net/qemu/+bug/1876187 |
7 | from qemu/xilinx tag xilinx-v2016.1] | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Message-id: 20180115182436.2066-15-f4bug@amsat.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
13 | Message-id: 20200727162617.26227-1-peter.maydell@linaro.org | ||
11 | --- | 14 | --- |
12 | include/hw/sd/sdhci.h | 1 + | 15 | hw/arm/netduino2.c | 10 ++++++++++ |
13 | hw/sd/sdhci.c | 18 +++++++++++++++++- | 16 | hw/arm/netduinoplus2.c | 10 ++++++++++ |
14 | 2 files changed, 18 insertions(+), 1 deletion(-) | 17 | 2 files changed, 20 insertions(+) |
15 | 18 | ||
16 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | 19 | diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c |
17 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/sd/sdhci.h | 21 | --- a/hw/arm/netduino2.c |
19 | +++ b/include/hw/sd/sdhci.h | 22 | +++ b/hw/arm/netduino2.c |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | 23 | @@ -XXX,XX +XXX,XX @@ |
21 | SDBus sdbus; | 24 | #include "hw/arm/stm32f205_soc.h" |
22 | MemoryRegion iomem; | 25 | #include "hw/arm/boot.h" |
23 | AddressSpace *dma_as; | 26 | |
24 | + MemoryRegion *dma_mr; | 27 | +/* Main SYSCLK frequency in Hz (120MHz) */ |
25 | 28 | +#define SYSCLK_FRQ 120000000ULL | |
26 | QEMUTimer *insert_timer; /* timer for 'changing' sd card. */ | 29 | + |
27 | QEMUTimer *transfer_timer; | 30 | static void netduino2_init(MachineState *machine) |
28 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 31 | { |
32 | DeviceState *dev; | ||
33 | |||
34 | + /* | ||
35 | + * TODO: ideally we would model the SoC RCC and let it handle | ||
36 | + * system_clock_scale, including its ability to define different | ||
37 | + * possible SYSCLK sources. | ||
38 | + */ | ||
39 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; | ||
40 | + | ||
41 | dev = qdev_new(TYPE_STM32F205_SOC); | ||
42 | qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); | ||
43 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); | ||
44 | diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/hw/sd/sdhci.c | 46 | --- a/hw/arm/netduinoplus2.c |
31 | +++ b/hw/sd/sdhci.c | 47 | +++ b/hw/arm/netduinoplus2.c |
32 | @@ -XXX,XX +XXX,XX @@ static Property sdhci_sysbus_properties[] = { | 48 | @@ -XXX,XX +XXX,XX @@ |
33 | DEFINE_SDHCI_COMMON_PROPERTIES(SDHCIState), | 49 | #include "hw/arm/stm32f405_soc.h" |
34 | DEFINE_PROP_BOOL("pending-insert-quirk", SDHCIState, pending_insert_quirk, | 50 | #include "hw/arm/boot.h" |
35 | false), | 51 | |
36 | + DEFINE_PROP_LINK("dma", SDHCIState, | 52 | +/* Main SYSCLK frequency in Hz (168MHz) */ |
37 | + dma_mr, TYPE_MEMORY_REGION, MemoryRegion *), | 53 | +#define SYSCLK_FRQ 168000000ULL |
38 | DEFINE_PROP_END_OF_LIST(), | 54 | + |
39 | }; | 55 | static void netduinoplus2_init(MachineState *machine) |
40 | |||
41 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_init(Object *obj) | ||
42 | static void sdhci_sysbus_finalize(Object *obj) | ||
43 | { | 56 | { |
44 | SDHCIState *s = SYSBUS_SDHCI(obj); | 57 | DeviceState *dev; |
58 | |||
59 | + /* | ||
60 | + * TODO: ideally we would model the SoC RCC and let it handle | ||
61 | + * system_clock_scale, including its ability to define different | ||
62 | + * possible SYSCLK sources. | ||
63 | + */ | ||
64 | + system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ; | ||
45 | + | 65 | + |
46 | + if (s->dma_mr) { | 66 | dev = qdev_new(TYPE_STM32F405_SOC); |
47 | + object_unparent(OBJECT(s->dma_mr)); | 67 | qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); |
48 | + } | 68 | sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); |
49 | + | ||
50 | sdhci_uninitfn(s); | ||
51 | } | ||
52 | |||
53 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) | ||
54 | return; | ||
55 | } | ||
56 | |||
57 | - s->dma_as = &address_space_memory; | ||
58 | + if (s->dma_mr) { | ||
59 | + address_space_init(s->dma_as, s->dma_mr, "sdhci-dma"); | ||
60 | + } else { | ||
61 | + /* use system_memory() if property "dma" not set */ | ||
62 | + s->dma_as = &address_space_memory; | ||
63 | + } | ||
64 | |||
65 | sysbus_init_irq(sbd, &s->irq); | ||
66 | sysbus_init_mmio(sbd, &s->iomem); | ||
67 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_unrealize(DeviceState *dev, Error **errp) | ||
68 | SDHCIState *s = SYSBUS_SDHCI(dev); | ||
69 | |||
70 | sdhci_common_unrealize(s, &error_abort); | ||
71 | + | ||
72 | + if (s->dma_mr) { | ||
73 | + address_space_destroy(s->dma_as); | ||
74 | + } | ||
75 | } | ||
76 | |||
77 | static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) | ||
78 | -- | 69 | -- |
79 | 2.7.4 | 70 | 2.20.1 |
80 | 71 | ||
81 | 72 | diff view generated by jsdifflib |
1 | Instead of ignoring the response from address_space_ld*() | 1 | Mostly devices don't need to care whether one of their output |
---|---|---|---|
2 | (indicating an attempt to read a page table descriptor from | 2 | qemu_irq lines is connected, because functions like qemu_set_irq() |
3 | an invalid physical address), use it to report the failure | 3 | silently do nothing if there is nothing on the other end. However |
4 | correctly. | 4 | sometimes a device might want to implement default behaviour for the |
5 | case where the machine hasn't wired the line up to anywhere. | ||
5 | 6 | ||
6 | Since this is another couple of locations where we need to | 7 | Provide a function qemu_irq_is_connected() that devices can use for |
7 | decide the value of the ARMMMUFaultInfo ea bit based on a | 8 | this purpose. (The test is trivial but encapsulating it in a |
8 | MemTxResult, we factor out that operation into a helper | 9 | function makes it easier to see where we're doing it in case we need |
9 | function. | 10 | to change the implementation later.) |
10 | 11 | ||
11 | 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: Alistair Francis <alistair.francis@wdc.com> | ||
15 | Message-id: 20200728103744.6909-2-peter.maydell@linaro.org | ||
12 | --- | 16 | --- |
13 | target/arm/internals.h | 10 ++++++++++ | 17 | include/hw/irq.h | 18 ++++++++++++++++++ |
14 | target/arm/helper.c | 39 ++++++++++++++++++++++++++++++++++----- | 18 | 1 file changed, 18 insertions(+) |
15 | target/arm/op_helper.c | 7 +------ | ||
16 | 3 files changed, 45 insertions(+), 11 deletions(-) | ||
17 | 19 | ||
18 | diff --git a/target/arm/internals.h b/target/arm/internals.h | 20 | diff --git a/include/hw/irq.h b/include/hw/irq.h |
19 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/internals.h | 22 | --- a/include/hw/irq.h |
21 | +++ b/target/arm/internals.h | 23 | +++ b/include/hw/irq.h |
22 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t arm_fi_to_lfsc(ARMMMUFaultInfo *fi) | 24 | @@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2); |
23 | return fsc; | 25 | on an existing vector of qemu_irq. */ |
24 | } | 26 | void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n); |
25 | 27 | ||
26 | +static inline bool arm_extabort_type(MemTxResult result) | 28 | +/** |
29 | + * qemu_irq_is_connected: Return true if IRQ line is wired up | ||
30 | + * | ||
31 | + * If a qemu_irq has a device on the other (receiving) end of it, | ||
32 | + * return true; otherwise return false. | ||
33 | + * | ||
34 | + * Usually device models don't need to care whether the machine model | ||
35 | + * has wired up their outbound qemu_irq lines, because functions like | ||
36 | + * qemu_set_irq() silently do nothing if there is nothing on the other | ||
37 | + * end of the line. However occasionally a device model will want to | ||
38 | + * provide default behaviour if its output is left floating, and | ||
39 | + * it can use this function to identify when that is the case. | ||
40 | + */ | ||
41 | +static inline bool qemu_irq_is_connected(qemu_irq irq) | ||
27 | +{ | 42 | +{ |
28 | + /* The EA bit in syndromes and fault status registers is an | 43 | + return irq != NULL; |
29 | + * IMPDEF classification of external aborts. ARM implementations | ||
30 | + * usually use this to indicate AXI bus Decode error (0) or | ||
31 | + * Slave error (1); in QEMU we follow that. | ||
32 | + */ | ||
33 | + return result != MEMTX_DECODE_ERROR; | ||
34 | +} | 44 | +} |
35 | + | 45 | + |
36 | /* Do a page table walk and add page to TLB if possible */ | 46 | #endif |
37 | bool arm_tlb_fill(CPUState *cpu, vaddr address, | ||
38 | MMUAccessType access_type, int mmu_idx, | ||
39 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/helper.c | ||
42 | +++ b/target/arm/helper.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, | ||
44 | ret = get_phys_addr_lpae(env, addr, 0, ARMMMUIdx_S2NS, &s2pa, | ||
45 | &txattrs, &s2prot, &s2size, fi, NULL); | ||
46 | if (ret) { | ||
47 | + assert(fi->type != ARMFault_None); | ||
48 | fi->s2addr = addr; | ||
49 | fi->stage2 = true; | ||
50 | fi->s1ptw = true; | ||
51 | @@ -XXX,XX +XXX,XX @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure, | ||
52 | ARMCPU *cpu = ARM_CPU(cs); | ||
53 | CPUARMState *env = &cpu->env; | ||
54 | MemTxAttrs attrs = {}; | ||
55 | + MemTxResult result = MEMTX_OK; | ||
56 | AddressSpace *as; | ||
57 | + uint32_t data; | ||
58 | |||
59 | attrs.secure = is_secure; | ||
60 | as = arm_addressspace(cs, attrs); | ||
61 | @@ -XXX,XX +XXX,XX @@ static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure, | ||
62 | return 0; | ||
63 | } | ||
64 | if (regime_translation_big_endian(env, mmu_idx)) { | ||
65 | - return address_space_ldl_be(as, addr, attrs, NULL); | ||
66 | + data = address_space_ldl_be(as, addr, attrs, &result); | ||
67 | } else { | ||
68 | - return address_space_ldl_le(as, addr, attrs, NULL); | ||
69 | + data = address_space_ldl_le(as, addr, attrs, &result); | ||
70 | } | ||
71 | + if (result == MEMTX_OK) { | ||
72 | + return data; | ||
73 | + } | ||
74 | + fi->type = ARMFault_SyncExternalOnWalk; | ||
75 | + fi->ea = arm_extabort_type(result); | ||
76 | + return 0; | ||
77 | } | ||
78 | |||
79 | static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure, | ||
80 | @@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure, | ||
81 | ARMCPU *cpu = ARM_CPU(cs); | ||
82 | CPUARMState *env = &cpu->env; | ||
83 | MemTxAttrs attrs = {}; | ||
84 | + MemTxResult result = MEMTX_OK; | ||
85 | AddressSpace *as; | ||
86 | + uint32_t data; | ||
87 | |||
88 | attrs.secure = is_secure; | ||
89 | as = arm_addressspace(cs, attrs); | ||
90 | @@ -XXX,XX +XXX,XX @@ static uint64_t arm_ldq_ptw(CPUState *cs, hwaddr addr, bool is_secure, | ||
91 | return 0; | ||
92 | } | ||
93 | if (regime_translation_big_endian(env, mmu_idx)) { | ||
94 | - return address_space_ldq_be(as, addr, attrs, NULL); | ||
95 | + data = address_space_ldq_be(as, addr, attrs, &result); | ||
96 | } else { | ||
97 | - return address_space_ldq_le(as, addr, attrs, NULL); | ||
98 | + data = address_space_ldq_le(as, addr, attrs, &result); | ||
99 | + } | ||
100 | + if (result == MEMTX_OK) { | ||
101 | + return data; | ||
102 | } | ||
103 | + fi->type = ARMFault_SyncExternalOnWalk; | ||
104 | + fi->ea = arm_extabort_type(result); | ||
105 | + return 0; | ||
106 | } | ||
107 | |||
108 | static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
109 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
110 | } | ||
111 | desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), | ||
112 | mmu_idx, fi); | ||
113 | + if (fi->type != ARMFault_None) { | ||
114 | + goto do_fault; | ||
115 | + } | ||
116 | type = (desc & 3); | ||
117 | domain = (desc >> 5) & 0x0f; | ||
118 | if (regime_el(env, mmu_idx) == 1) { | ||
119 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, | ||
120 | } | ||
121 | desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), | ||
122 | mmu_idx, fi); | ||
123 | + if (fi->type != ARMFault_None) { | ||
124 | + goto do_fault; | ||
125 | + } | ||
126 | switch (desc & 3) { | ||
127 | case 0: /* Page translation fault. */ | ||
128 | fi->type = ARMFault_Translation; | ||
129 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | ||
130 | } | ||
131 | desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), | ||
132 | mmu_idx, fi); | ||
133 | + if (fi->type != ARMFault_None) { | ||
134 | + goto do_fault; | ||
135 | + } | ||
136 | type = (desc & 3); | ||
137 | if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) { | ||
138 | /* Section translation fault, or attempt to use the encoding | ||
139 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, | ||
140 | table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); | ||
141 | desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), | ||
142 | mmu_idx, fi); | ||
143 | + if (fi->type != ARMFault_None) { | ||
144 | + goto do_fault; | ||
145 | + } | ||
146 | ap = ((desc >> 4) & 3) | ((desc >> 7) & 4); | ||
147 | switch (desc & 3) { | ||
148 | case 0: /* Page translation fault. */ | ||
149 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | ||
150 | descaddr &= ~7ULL; | ||
151 | nstable = extract32(tableattrs, 4, 1); | ||
152 | descriptor = arm_ldq_ptw(cs, descaddr, !nstable, mmu_idx, fi); | ||
153 | - if (fi->s1ptw) { | ||
154 | + if (fi->type != ARMFault_None) { | ||
155 | goto do_fault; | ||
156 | } | ||
157 | |||
158 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/target/arm/op_helper.c | ||
161 | +++ b/target/arm/op_helper.c | ||
162 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, | ||
163 | /* now we have a real cpu fault */ | ||
164 | cpu_restore_state(cs, retaddr); | ||
165 | |||
166 | - /* The EA bit in syndromes and fault status registers is an | ||
167 | - * IMPDEF classification of external aborts. ARM implementations | ||
168 | - * usually use this to indicate AXI bus Decode error (0) or | ||
169 | - * Slave error (1); in QEMU we follow that. | ||
170 | - */ | ||
171 | - fi.ea = (response != MEMTX_DECODE_ERROR); | ||
172 | + fi.ea = arm_extabort_type(response); | ||
173 | fi.type = ARMFault_SyncExternal; | ||
174 | deliver_fault(cpu, addr, access_type, mmu_idx, &fi); | ||
175 | } | ||
176 | -- | 47 | -- |
177 | 2.7.4 | 48 | 2.20.1 |
178 | 49 | ||
179 | 50 | diff view generated by jsdifflib |
1 | The Configurable Fault Status Register for ARMv7M and v8M is | 1 | The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals |
---|---|---|---|
2 | supposed to be byte and halfword accessible, but we were only | 2 | when the guest sets the SYSRESETREQ bit in the AIRCR register. This |
3 | implementing word accesses. Add support for the other access | 3 | matches the hardware design (where the CPU has a signal of this name |
4 | sizes, which are used by the Zephyr RTOS. | 4 | and it is up to the SoC to connect that up to an actual reset |
5 | mechanism), but in QEMU it mostly results in duplicated code in SoC | ||
6 | objects and bugs where SoC model implementors forget to wire up the | ||
7 | SYSRESETREQ line. | ||
8 | |||
9 | Provide a default behaviour for the case where SYSRESETREQ is not | ||
10 | actually connected to anything: use qemu_system_reset_request() to | ||
11 | perform a system reset. This will allow us to remove the | ||
12 | implementations of SYSRESETREQ handling from the boards where that's | ||
13 | exactly what it does, and also fixes the bugs in the board models | ||
14 | which forgot to wire up the signal: | ||
15 | |||
16 | * microbit | ||
17 | * mps2-an385 | ||
18 | * mps2-an505 | ||
19 | * mps2-an511 | ||
20 | * mps2-an521 | ||
21 | * musca-a | ||
22 | * musca-b1 | ||
23 | * netduino | ||
24 | * netduinoplus2 | ||
25 | |||
26 | We still allow the board to wire up the signal if it needs to, in case | ||
27 | we need to model more complicated reset controller logic or to model | ||
28 | buggy SoC hardware which forgot to wire up the line itself. But | ||
29 | defaulting to "reset the system" is more often going to be correct | ||
30 | than defaulting to "do nothing". | ||
5 | 31 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 32 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reported-by: Andy Gross <andy.gross@linaro.org> | ||
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 33 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | Message-id: 1512742372-31517-1-git-send-email-peter.maydell@linaro.org | 34 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
35 | Message-id: 20200728103744.6909-3-peter.maydell@linaro.org | ||
10 | --- | 36 | --- |
11 | hw/intc/armv7m_nvic.c | 38 ++++++++++++++++++++++---------------- | 37 | include/hw/arm/armv7m.h | 4 +++- |
12 | 1 file changed, 22 insertions(+), 16 deletions(-) | 38 | hw/intc/armv7m_nvic.c | 17 ++++++++++++++++- |
39 | 2 files changed, 19 insertions(+), 2 deletions(-) | ||
13 | 40 | ||
41 | diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/include/hw/arm/armv7m.h | ||
44 | +++ b/include/hw/arm/armv7m.h | ||
45 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
46 | |||
47 | /* ARMv7M container object. | ||
48 | * + Unnamed GPIO input lines: external IRQ lines for the NVIC | ||
49 | - * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ | ||
50 | + * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ. | ||
51 | + * If this GPIO is not wired up then the NVIC will default to performing | ||
52 | + * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET). | ||
53 | * + Property "cpu-type": CPU type to instantiate | ||
54 | * + Property "num-irq": number of external IRQ lines | ||
55 | * + Property "memory": MemoryRegion defining the physical address space | ||
14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 56 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c |
15 | index XXXXXXX..XXXXXXX 100644 | 57 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/armv7m_nvic.c | 58 | --- a/hw/intc/armv7m_nvic.c |
17 | +++ b/hw/intc/armv7m_nvic.c | 59 | +++ b/hw/intc/armv7m_nvic.c |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | 60 | @@ -XXX,XX +XXX,XX @@ |
19 | val |= (1 << 8); | 61 | #include "hw/intc/armv7m_nvic.h" |
20 | } | 62 | #include "hw/irq.h" |
21 | return val; | 63 | #include "hw/qdev-properties.h" |
22 | - case 0xd28: /* Configurable Fault Status. */ | 64 | +#include "sysemu/runstate.h" |
23 | - /* The BFSR bits [15:8] are shared between security states | 65 | #include "target/arm/cpu.h" |
24 | - * and we store them in the NS copy | 66 | #include "exec/exec-all.h" |
25 | - */ | 67 | #include "exec/memop.h" |
26 | - val = cpu->env.v7m.cfsr[attrs.secure]; | 68 | @@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = { |
27 | - val |= cpu->env.v7m.cfsr[M_REG_NS] & R_V7M_CFSR_BFSR_MASK; | 69 | 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1 |
28 | - return val; | 70 | }; |
29 | case 0xd2c: /* Hard Fault Status. */ | 71 | |
30 | return cpu->env.v7m.hfsr; | 72 | +static void signal_sysresetreq(NVICState *s) |
31 | case 0xd30: /* Debug Fault Status. */ | 73 | +{ |
74 | + if (qemu_irq_is_connected(s->sysresetreq)) { | ||
75 | + qemu_irq_pulse(s->sysresetreq); | ||
76 | + } else { | ||
77 | + /* | ||
78 | + * Default behaviour if the SoC doesn't need to wire up | ||
79 | + * SYSRESETREQ (eg to a system reset controller of some kind): | ||
80 | + * perform a system reset via the usual QEMU API. | ||
81 | + */ | ||
82 | + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
83 | + } | ||
84 | +} | ||
85 | + | ||
86 | static int nvic_pending_prio(NVICState *s) | ||
87 | { | ||
88 | /* return the group priority of the current pending interrupt, | ||
32 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | 89 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, |
33 | s->vectors[ARMV7M_EXCP_DEBUG].active = (value & (1 << 8)) != 0; | 90 | if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) { |
34 | nvic_irq_update(s); | 91 | if (attrs.secure || |
35 | break; | 92 | !(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) { |
36 | - case 0xd28: /* Configurable Fault Status. */ | 93 | - qemu_irq_pulse(s->sysresetreq); |
37 | - cpu->env.v7m.cfsr[attrs.secure] &= ~value; /* W1C */ | 94 | + signal_sysresetreq(s); |
38 | - if (attrs.secure) { | 95 | } |
39 | - /* The BFSR bits [15:8] are shared between security states | 96 | } |
40 | - * and we store them in the NS copy. | 97 | if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) { |
41 | - */ | ||
42 | - cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); | ||
43 | - } | ||
44 | - break; | ||
45 | case 0xd2c: /* Hard Fault Status. */ | ||
46 | cpu->env.v7m.hfsr &= ~value; /* W1C */ | ||
47 | break; | ||
48 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_read(void *opaque, hwaddr addr, | ||
49 | val = deposit32(val, i * 8, 8, get_prio(s, hdlidx, sbank)); | ||
50 | } | ||
51 | break; | ||
52 | + case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */ | ||
53 | + /* The BFSR bits [15:8] are shared between security states | ||
54 | + * and we store them in the NS copy | ||
55 | + */ | ||
56 | + val = s->cpu->env.v7m.cfsr[attrs.secure]; | ||
57 | + val |= s->cpu->env.v7m.cfsr[M_REG_NS] & R_V7M_CFSR_BFSR_MASK; | ||
58 | + val = extract32(val, (offset - 0xd28) * 8, size * 8); | ||
59 | + break; | ||
60 | case 0xfe0 ... 0xfff: /* ID. */ | ||
61 | if (offset & 3) { | ||
62 | val = 0; | ||
63 | @@ -XXX,XX +XXX,XX @@ static MemTxResult nvic_sysreg_write(void *opaque, hwaddr addr, | ||
64 | } | ||
65 | nvic_irq_update(s); | ||
66 | return MEMTX_OK; | ||
67 | + case 0xd28 ... 0xd2b: /* Configurable Fault Status (CFSR) */ | ||
68 | + /* All bits are W1C, so construct 32 bit value with 0s in | ||
69 | + * the parts not written by the access size | ||
70 | + */ | ||
71 | + value <<= ((offset - 0xd28) * 8); | ||
72 | + | ||
73 | + s->cpu->env.v7m.cfsr[attrs.secure] &= ~value; | ||
74 | + if (attrs.secure) { | ||
75 | + /* The BFSR bits [15:8] are shared between security states | ||
76 | + * and we store them in the NS copy. | ||
77 | + */ | ||
78 | + s->cpu->env.v7m.cfsr[M_REG_NS] &= ~(value & R_V7M_CFSR_BFSR_MASK); | ||
79 | + } | ||
80 | + return MEMTX_OK; | ||
81 | } | ||
82 | if (size == 4) { | ||
83 | nvic_writel(s, offset, value, attrs); | ||
84 | -- | 98 | -- |
85 | 2.7.4 | 99 | 2.20.1 |
86 | 100 | ||
87 | 101 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For PMSAv7, the v7A/R Arm ARM defines that setting AP to 0b111 | ||
2 | is an UNPREDICTABLE reserved combination. However, for v7M | ||
3 | this value is documented as having the same behaviour as 0b110: | ||
4 | read-only for both privileged and unprivileged. Accept this | ||
5 | value on an M profile core rather than treating it as a guest | ||
6 | error and a no-access page. | ||
7 | 1 | ||
8 | Reported-by: Andy Gross <andy.gross@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Message-id: 1512742402-31669-1-git-send-email-peter.maydell@linaro.org | ||
12 | --- | ||
13 | target/arm/helper.c | 14 ++++++++++++++ | ||
14 | 1 file changed, 14 insertions(+) | ||
15 | |||
16 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/target/arm/helper.c | ||
19 | +++ b/target/arm/helper.c | ||
20 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
21 | case 6: | ||
22 | *prot |= PAGE_READ | PAGE_EXEC; | ||
23 | break; | ||
24 | + case 7: | ||
25 | + /* for v7M, same as 6; for R profile a reserved value */ | ||
26 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
27 | + *prot |= PAGE_READ | PAGE_EXEC; | ||
28 | + break; | ||
29 | + } | ||
30 | + /* fall through */ | ||
31 | default: | ||
32 | qemu_log_mask(LOG_GUEST_ERROR, | ||
33 | "DRACR[%d]: Bad value for AP bits: 0x%" | ||
34 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address, | ||
35 | case 6: | ||
36 | *prot |= PAGE_READ | PAGE_EXEC; | ||
37 | break; | ||
38 | + case 7: | ||
39 | + /* for v7M, same as 6; for R profile a reserved value */ | ||
40 | + if (arm_feature(env, ARM_FEATURE_M)) { | ||
41 | + *prot |= PAGE_READ | PAGE_EXEC; | ||
42 | + break; | ||
43 | + } | ||
44 | + /* fall through */ | ||
45 | default: | ||
46 | qemu_log_mask(LOG_GUEST_ERROR, | ||
47 | "DRACR[%d]: Bad value for AP bits: 0x%" | ||
48 | -- | ||
49 | 2.7.4 | ||
50 | |||
51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Add virt-2.12 machine type. | ||
2 | 1 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | --- | ||
5 | hw/arm/virt.c | 19 +++++++++++++++++-- | ||
6 | 1 file changed, 17 insertions(+), 2 deletions(-) | ||
7 | |||
8 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/hw/arm/virt.c | ||
11 | +++ b/hw/arm/virt.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void machvirt_machine_init(void) | ||
13 | } | ||
14 | type_init(machvirt_machine_init); | ||
15 | |||
16 | -static void virt_2_11_instance_init(Object *obj) | ||
17 | +static void virt_2_12_instance_init(Object *obj) | ||
18 | { | ||
19 | VirtMachineState *vms = VIRT_MACHINE(obj); | ||
20 | VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); | ||
21 | @@ -XXX,XX +XXX,XX @@ static void virt_2_11_instance_init(Object *obj) | ||
22 | vms->irqmap = a15irqmap; | ||
23 | } | ||
24 | |||
25 | +static void virt_machine_2_12_options(MachineClass *mc) | ||
26 | +{ | ||
27 | +} | ||
28 | +DEFINE_VIRT_MACHINE_AS_LATEST(2, 12) | ||
29 | + | ||
30 | +#define VIRT_COMPAT_2_11 \ | ||
31 | + HW_COMPAT_2_11 | ||
32 | + | ||
33 | +static void virt_2_11_instance_init(Object *obj) | ||
34 | +{ | ||
35 | + virt_2_12_instance_init(obj); | ||
36 | +} | ||
37 | + | ||
38 | static void virt_machine_2_11_options(MachineClass *mc) | ||
39 | { | ||
40 | + virt_machine_2_12_options(mc); | ||
41 | + SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_11); | ||
42 | } | ||
43 | -DEFINE_VIRT_MACHINE_AS_LATEST(2, 11) | ||
44 | +DEFINE_VIRT_MACHINE(2, 11) | ||
45 | |||
46 | #define VIRT_COMPAT_2_10 \ | ||
47 | HW_COMPAT_2_10 | ||
48 | -- | ||
49 | 2.7.4 | ||
50 | |||
51 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Since pl181 is still using the legacy SD card API, the SD | ||
2 | card created by sd_init() is not plugged into any bus. This | ||
3 | means that the controller has to reset it manually. | ||
4 | 1 | ||
5 | Failing to do this mostly didn't affect the guest since the | ||
6 | guest typically does a programmed SD card reset as part of | ||
7 | its SD controller driver initialization, but meant that | ||
8 | migration failed because it's only in sd_reset() that we | ||
9 | set up the wpgrps_size field. | ||
10 | |||
11 | Cc: qemu-stable@nongnu.org | ||
12 | Fixes: https://bugs.launchpad.net/qemu/+bug/1739378 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
16 | Message-id: 1515506513-31961-2-git-send-email-peter.maydell@linaro.org | ||
17 | --- | ||
18 | hw/sd/pl181.c | 4 ++++ | ||
19 | 1 file changed, 4 insertions(+) | ||
20 | |||
21 | diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/hw/sd/pl181.c | ||
24 | +++ b/hw/sd/pl181.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void pl181_reset(DeviceState *d) | ||
26 | |||
27 | /* We can assume our GPIO outputs have been wired up now */ | ||
28 | sd_set_cb(s->card, s->cardstatus[0], s->cardstatus[1]); | ||
29 | + /* Since we're still using the legacy SD API the card is not plugged | ||
30 | + * into any bus, and we must reset it manually. | ||
31 | + */ | ||
32 | + device_reset(DEVICE(s->card)); | ||
33 | } | ||
34 | |||
35 | static void pl181_init(Object *obj) | ||
36 | -- | ||
37 | 2.7.4 | ||
38 | |||
39 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Since milkymist-memcard is still using the legacy SD card API, | ||
2 | the SD card created by sd_init() is not plugged into any bus. | ||
3 | This means that the controller has to reset it manually. | ||
4 | 1 | ||
5 | Failing to do this mostly didn't affect the guest since the | ||
6 | guest typically does a programmed SD card reset as part of | ||
7 | its SD controller driver initialization, but meant that | ||
8 | migration failed because it's only in sd_reset() that we | ||
9 | set up the wpgrps_size field. | ||
10 | |||
11 | Cc: qemu-stable@nongnu.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 1515506513-31961-3-git-send-email-peter.maydell@linaro.org | ||
16 | --- | ||
17 | hw/sd/milkymist-memcard.c | 4 ++++ | ||
18 | 1 file changed, 4 insertions(+) | ||
19 | |||
20 | diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/hw/sd/milkymist-memcard.c | ||
23 | +++ b/hw/sd/milkymist-memcard.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void milkymist_memcard_reset(DeviceState *d) | ||
25 | for (i = 0; i < R_MAX; i++) { | ||
26 | s->regs[i] = 0; | ||
27 | } | ||
28 | + /* Since we're still using the legacy SD API the card is not plugged | ||
29 | + * into any bus, and we must reset it manually. | ||
30 | + */ | ||
31 | + device_reset(DEVICE(s->card)); | ||
32 | } | ||
33 | |||
34 | static int milkymist_memcard_init(SysBusDevice *dev) | ||
35 | -- | ||
36 | 2.7.4 | ||
37 | |||
38 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Since ssi-sd is still using the legacy SD card API, the SD | ||
2 | card created by sd_init() is not plugged into any bus. This | ||
3 | means that the controller has to reset it manually. | ||
4 | 1 | ||
5 | Failing to do this mostly didn't affect the guest since the | ||
6 | guest typically does a programmed SD card reset as part of | ||
7 | its SD controller driver initialization, but meant that | ||
8 | migration failed because it's only in sd_reset() that we | ||
9 | set up the wpgrps_size field. | ||
10 | |||
11 | In the case of sd-ssi, we have to implement an entire | ||
12 | reset function since there wasn't one previously, and | ||
13 | that requires a QOM cast macro that got omitted when this | ||
14 | device was QOMified. | ||
15 | |||
16 | Cc: qemu-stable@nongnu.org | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
19 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
20 | Message-id: 1515506513-31961-4-git-send-email-peter.maydell@linaro.org | ||
21 | --- | ||
22 | hw/sd/ssi-sd.c | 25 +++++++++++++++++++++++-- | ||
23 | 1 file changed, 23 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/sd/ssi-sd.c | ||
28 | +++ b/hw/sd/ssi-sd.c | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
30 | SDState *sd; | ||
31 | } ssi_sd_state; | ||
32 | |||
33 | +#define TYPE_SSI_SD "ssi-sd" | ||
34 | +#define SSI_SD(obj) OBJECT_CHECK(ssi_sd_state, (obj), TYPE_SSI_SD) | ||
35 | + | ||
36 | /* State word bits. */ | ||
37 | #define SSI_SDR_LOCKED 0x0001 | ||
38 | #define SSI_SDR_WP_ERASE 0x0002 | ||
39 | @@ -XXX,XX +XXX,XX @@ static void ssi_sd_realize(SSISlave *d, Error **errp) | ||
40 | ssi_sd_state *s = FROM_SSI_SLAVE(ssi_sd_state, d); | ||
41 | DriveInfo *dinfo; | ||
42 | |||
43 | - s->mode = SSI_SD_CMD; | ||
44 | /* FIXME use a qdev drive property instead of drive_get_next() */ | ||
45 | dinfo = drive_get_next(IF_SD); | ||
46 | s->sd = sd_init(dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, true); | ||
47 | @@ -XXX,XX +XXX,XX @@ static void ssi_sd_realize(SSISlave *d, Error **errp) | ||
48 | } | ||
49 | } | ||
50 | |||
51 | +static void ssi_sd_reset(DeviceState *dev) | ||
52 | +{ | ||
53 | + ssi_sd_state *s = SSI_SD(dev); | ||
54 | + | ||
55 | + s->mode = SSI_SD_CMD; | ||
56 | + s->cmd = 0; | ||
57 | + memset(s->cmdarg, 0, sizeof(s->cmdarg)); | ||
58 | + memset(s->response, 0, sizeof(s->response)); | ||
59 | + s->arglen = 0; | ||
60 | + s->response_pos = 0; | ||
61 | + s->stopping = 0; | ||
62 | + | ||
63 | + /* Since we're still using the legacy SD API the card is not plugged | ||
64 | + * into any bus, and we must reset it manually. | ||
65 | + */ | ||
66 | + device_reset(DEVICE(s->sd)); | ||
67 | +} | ||
68 | + | ||
69 | static void ssi_sd_class_init(ObjectClass *klass, void *data) | ||
70 | { | ||
71 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
72 | @@ -XXX,XX +XXX,XX @@ static void ssi_sd_class_init(ObjectClass *klass, void *data) | ||
73 | k->transfer = ssi_sd_transfer; | ||
74 | k->cs_polarity = SSI_CS_LOW; | ||
75 | dc->vmsd = &vmstate_ssi_sd; | ||
76 | + dc->reset = ssi_sd_reset; | ||
77 | } | ||
78 | |||
79 | static const TypeInfo ssi_sd_info = { | ||
80 | - .name = "ssi-sd", | ||
81 | + .name = TYPE_SSI_SD, | ||
82 | .parent = TYPE_SSI_SLAVE, | ||
83 | .instance_size = sizeof(ssi_sd_state), | ||
84 | .class_init = ssi_sd_class_init, | ||
85 | -- | ||
86 | 2.7.4 | ||
87 | |||
88 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The MSF2 SoC model and the Stellaris board code both wire |
---|---|---|---|
2 | SYSRESETREQ up to a function that just invokes | ||
3 | qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
4 | This is now the default action that the NVIC does if the line is | ||
5 | not connected, so we can delete the handling code. | ||
2 | 6 | ||
3 | zero-initialize ADMADescr 'dscr' in sdhci_do_adma() to avoid: | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-id: 20200728103744.6909-4-peter.maydell@linaro.org | ||
11 | --- | ||
12 | hw/arm/msf2-soc.c | 11 ----------- | ||
13 | hw/arm/stellaris.c | 12 ------------ | ||
14 | 2 files changed, 23 deletions(-) | ||
4 | 15 | ||
5 | hw/sd/sdhci.c: In function ‘sdhci_do_adma’: | 16 | diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c |
6 | hw/sd/sdhci.c:714:29: error: ‘dscr.addr’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
7 | trace_sdhci_adma("link", s->admasysaddr); | ||
8 | ^ | ||
9 | |||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Acked-by: Alistair Francis <alistair.francis@xilinx.com> | ||
12 | Message-id: 20180115182436.2066-9-f4bug@amsat.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | --- | ||
15 | hw/sd/sdhci.c | 89 ++++++++++++++++++------------------------------------ | ||
16 | hw/sd/trace-events | 14 +++++++++ | ||
17 | 2 files changed, 44 insertions(+), 59 deletions(-) | ||
18 | |||
19 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/sd/sdhci.c | 18 | --- a/hw/arm/msf2-soc.c |
22 | +++ b/hw/sd/sdhci.c | 19 | +++ b/hw/arm/msf2-soc.c |
23 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ |
24 | #include "sdhci-internal.h" | 21 | #include "hw/irq.h" |
25 | #include "qapi/error.h" | 22 | #include "hw/arm/msf2-soc.h" |
26 | #include "qemu/log.h" | 23 | #include "hw/misc/unimp.h" |
24 | -#include "sysemu/runstate.h" | ||
25 | #include "sysemu/sysemu.h" | ||
26 | |||
27 | #define MSF2_TIMER_BASE 0x40004000 | ||
28 | @@ -XXX,XX +XXX,XX @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 }; | ||
29 | static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 }; | ||
30 | static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 }; | ||
31 | |||
32 | -static void do_sys_reset(void *opaque, int n, int level) | ||
33 | -{ | ||
34 | - if (level) { | ||
35 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); | ||
36 | - } | ||
37 | -} | ||
27 | - | 38 | - |
28 | -/* host controller debug messages */ | 39 | static void m2sxxx_soc_initfn(Object *obj) |
29 | -#ifndef SDHC_DEBUG | ||
30 | -#define SDHC_DEBUG 0 | ||
31 | -#endif | ||
32 | - | ||
33 | -#define DPRINT_L1(fmt, args...) \ | ||
34 | - do { \ | ||
35 | - if (SDHC_DEBUG) { \ | ||
36 | - fprintf(stderr, "QEMU SDHC: " fmt, ## args); \ | ||
37 | - } \ | ||
38 | - } while (0) | ||
39 | -#define DPRINT_L2(fmt, args...) \ | ||
40 | - do { \ | ||
41 | - if (SDHC_DEBUG > 1) { \ | ||
42 | - fprintf(stderr, "QEMU SDHC: " fmt, ## args); \ | ||
43 | - } \ | ||
44 | - } while (0) | ||
45 | -#define ERRPRINT(fmt, args...) \ | ||
46 | - do { \ | ||
47 | - if (SDHC_DEBUG) { \ | ||
48 | - fprintf(stderr, "QEMU SDHC ERROR: " fmt, ## args); \ | ||
49 | - } \ | ||
50 | - } while (0) | ||
51 | +#include "trace.h" | ||
52 | |||
53 | #define TYPE_SDHCI_BUS "sdhci-bus" | ||
54 | #define SDHCI_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_SDHCI_BUS) | ||
55 | @@ -XXX,XX +XXX,XX @@ static void sdhci_raise_insertion_irq(void *opaque) | ||
56 | static void sdhci_set_inserted(DeviceState *dev, bool level) | ||
57 | { | 40 | { |
58 | SDHCIState *s = (SDHCIState *)dev; | 41 | MSF2State *s = MSF2_SOC(obj); |
59 | - DPRINT_L1("Card state changed: %s!\n", level ? "insert" : "eject"); | 42 | @@ -XXX,XX +XXX,XX @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp) |
60 | |||
61 | + trace_sdhci_set_inserted(level ? "insert" : "eject"); | ||
62 | if ((s->norintsts & SDHC_NIS_REMOVE) && level) { | ||
63 | /* Give target some time to notice card ejection */ | ||
64 | timer_mod(s->insert_timer, | ||
65 | @@ -XXX,XX +XXX,XX @@ static void sdhci_send_command(SDHCIState *s) | ||
66 | s->acmd12errsts = 0; | ||
67 | request.cmd = s->cmdreg >> 8; | ||
68 | request.arg = s->argument; | ||
69 | - DPRINT_L1("sending CMD%u ARG[0x%08x]\n", request.cmd, request.arg); | ||
70 | + | ||
71 | + trace_sdhci_send_command(request.cmd, request.arg); | ||
72 | rlen = sdbus_do_command(&s->sdbus, &request, response); | ||
73 | |||
74 | if (s->cmdreg & SDHC_CMD_RESPONSE) { | ||
75 | @@ -XXX,XX +XXX,XX @@ static void sdhci_send_command(SDHCIState *s) | ||
76 | s->rspreg[0] = (response[0] << 24) | (response[1] << 16) | | ||
77 | (response[2] << 8) | response[3]; | ||
78 | s->rspreg[1] = s->rspreg[2] = s->rspreg[3] = 0; | ||
79 | - DPRINT_L1("Response: RSPREG[31..0]=0x%08x\n", s->rspreg[0]); | ||
80 | + trace_sdhci_response4(s->rspreg[0]); | ||
81 | } else if (rlen == 16) { | ||
82 | s->rspreg[0] = (response[11] << 24) | (response[12] << 16) | | ||
83 | (response[13] << 8) | response[14]; | ||
84 | @@ -XXX,XX +XXX,XX @@ static void sdhci_send_command(SDHCIState *s) | ||
85 | (response[5] << 8) | response[6]; | ||
86 | s->rspreg[3] = (response[0] << 16) | (response[1] << 8) | | ||
87 | response[2]; | ||
88 | - DPRINT_L1("Response received:\n RSPREG[127..96]=0x%08x, RSPREG[95.." | ||
89 | - "64]=0x%08x,\n RSPREG[63..32]=0x%08x, RSPREG[31..0]=0x%08x\n", | ||
90 | - s->rspreg[3], s->rspreg[2], s->rspreg[1], s->rspreg[0]); | ||
91 | + trace_sdhci_response16(s->rspreg[3], s->rspreg[2], | ||
92 | + s->rspreg[1], s->rspreg[0]); | ||
93 | } else { | ||
94 | - ERRPRINT("Timeout waiting for command response\n"); | ||
95 | + trace_sdhci_error("timeout waiting for command response"); | ||
96 | if (s->errintstsen & SDHC_EISEN_CMDTIMEOUT) { | ||
97 | s->errintsts |= SDHC_EIS_CMDTIMEOUT; | ||
98 | s->norintsts |= SDHC_NIS_ERR; | ||
99 | @@ -XXX,XX +XXX,XX @@ static void sdhci_end_transfer(SDHCIState *s) | ||
100 | |||
101 | request.cmd = 0x0C; | ||
102 | request.arg = 0; | ||
103 | - DPRINT_L1("Automatically issue CMD%d %08x\n", request.cmd, request.arg); | ||
104 | + trace_sdhci_end_transfer(request.cmd, request.arg); | ||
105 | sdbus_do_command(&s->sdbus, &request, response); | ||
106 | /* Auto CMD12 response goes to the upper Response register */ | ||
107 | s->rspreg[3] = (response[0] << 24) | (response[1] << 16) | | ||
108 | @@ -XXX,XX +XXX,XX @@ static uint32_t sdhci_read_dataport(SDHCIState *s, unsigned size) | ||
109 | |||
110 | /* first check that a valid data exists in host controller input buffer */ | ||
111 | if ((s->prnsts & SDHC_DATA_AVAILABLE) == 0) { | ||
112 | - ERRPRINT("Trying to read from empty buffer\n"); | ||
113 | + trace_sdhci_error("read from empty buffer"); | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | @@ -XXX,XX +XXX,XX @@ static uint32_t sdhci_read_dataport(SDHCIState *s, unsigned size) | ||
118 | s->data_count++; | ||
119 | /* check if we've read all valid data (blksize bytes) from buffer */ | ||
120 | if ((s->data_count) >= (s->blksize & 0x0fff)) { | ||
121 | - DPRINT_L2("All %u bytes of data have been read from input buffer\n", | ||
122 | - s->data_count); | ||
123 | + trace_sdhci_read_dataport(s->data_count); | ||
124 | s->prnsts &= ~SDHC_DATA_AVAILABLE; /* no more data in a buffer */ | ||
125 | s->data_count = 0; /* next buff read must start at position [0] */ | ||
126 | |||
127 | @@ -XXX,XX +XXX,XX @@ static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size) | ||
128 | |||
129 | /* Check that there is free space left in a buffer */ | ||
130 | if (!(s->prnsts & SDHC_SPACE_AVAILABLE)) { | ||
131 | - ERRPRINT("Can't write to data buffer: buffer full\n"); | ||
132 | + trace_sdhci_error("Can't write to data buffer: buffer full"); | ||
133 | return; | 43 | return; |
134 | } | 44 | } |
135 | 45 | ||
136 | @@ -XXX,XX +XXX,XX @@ static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned size) | 46 | - qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0, |
137 | s->data_count++; | 47 | - qemu_allocate_irq(&do_sys_reset, NULL, 0)); |
138 | value >>= 8; | 48 | - |
139 | if (s->data_count >= (s->blksize & 0x0fff)) { | 49 | system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk; |
140 | - DPRINT_L2("write buffer filled with %u bytes of data\n", | 50 | |
141 | - s->data_count); | 51 | for (i = 0; i < MSF2_NUM_UARTS; i++) { |
142 | + trace_sdhci_write_dataport(s->data_count); | 52 | diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c |
143 | s->data_count = 0; | 53 | index XXXXXXX..XXXXXXX 100644 |
144 | s->prnsts &= ~SDHC_SPACE_AVAILABLE; | 54 | --- a/hw/arm/stellaris.c |
145 | if (s->prnsts & SDHC_DOING_WRITE) { | 55 | +++ b/hw/arm/stellaris.c |
146 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | 56 | @@ -XXX,XX +XXX,XX @@ |
147 | { | 57 | #include "hw/boards.h" |
148 | unsigned int n, begin, length; | 58 | #include "qemu/log.h" |
149 | const uint16_t block_size = s->blksize & 0x0fff; | 59 | #include "exec/address-spaces.h" |
150 | - ADMADescr dscr; | 60 | -#include "sysemu/runstate.h" |
151 | + ADMADescr dscr = {}; | 61 | #include "sysemu/sysemu.h" |
152 | int i; | 62 | #include "hw/arm/armv7m.h" |
153 | 63 | #include "hw/char/pl011.h" | |
154 | for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) { | 64 | @@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj) |
155 | s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH; | 65 | qdev_init_gpio_in(dev, stellaris_adc_trigger, 1); |
156 | |||
157 | get_adma_description(s, &dscr); | ||
158 | - DPRINT_L2("ADMA loop: addr=" TARGET_FMT_plx ", len=%d, attr=%x\n", | ||
159 | - dscr.addr, dscr.length, dscr.attr); | ||
160 | + trace_sdhci_adma_loop(dscr.addr, dscr.length, dscr.attr); | ||
161 | |||
162 | if ((dscr.attr & SDHC_ADMA_ATTR_VALID) == 0) { | ||
163 | /* Indicate that error occurred in ST_FDS state */ | ||
164 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | ||
165 | break; | ||
166 | case SDHC_ADMA_ATTR_ACT_LINK: /* link to next descriptor table */ | ||
167 | s->admasysaddr = dscr.addr; | ||
168 | - DPRINT_L1("ADMA link: admasysaddr=0x%" PRIx64 "\n", | ||
169 | - s->admasysaddr); | ||
170 | + trace_sdhci_adma("link", s->admasysaddr); | ||
171 | break; | ||
172 | default: | ||
173 | s->admasysaddr += dscr.incr; | ||
174 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | ||
175 | } | ||
176 | |||
177 | if (dscr.attr & SDHC_ADMA_ATTR_INT) { | ||
178 | - DPRINT_L1("ADMA interrupt: admasysaddr=0x%" PRIx64 "\n", | ||
179 | - s->admasysaddr); | ||
180 | + trace_sdhci_adma("interrupt", s->admasysaddr); | ||
181 | if (s->norintstsen & SDHC_NISEN_DMA) { | ||
182 | s->norintsts |= SDHC_NIS_DMA; | ||
183 | } | ||
184 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | ||
185 | /* ADMA transfer terminates if blkcnt == 0 or by END attribute */ | ||
186 | if (((s->trnmod & SDHC_TRNS_BLK_CNT_EN) && | ||
187 | (s->blkcnt == 0)) || (dscr.attr & SDHC_ADMA_ATTR_END)) { | ||
188 | - DPRINT_L2("ADMA transfer completed\n"); | ||
189 | + trace_sdhci_adma_transfer_completed(); | ||
190 | if (length || ((dscr.attr & SDHC_ADMA_ATTR_END) && | ||
191 | (s->trnmod & SDHC_TRNS_BLK_CNT_EN) && | ||
192 | s->blkcnt != 0)) { | ||
193 | - ERRPRINT("SD/MMC host ADMA length mismatch\n"); | ||
194 | + trace_sdhci_error("SD/MMC host ADMA length mismatch"); | ||
195 | s->admaerr |= SDHC_ADMAERR_LENGTH_MISMATCH | | ||
196 | SDHC_ADMAERR_STATE_ST_TFR; | ||
197 | if (s->errintstsen & SDHC_EISEN_ADMAERR) { | ||
198 | - ERRPRINT("Set ADMA error flag\n"); | ||
199 | + trace_sdhci_error("Set ADMA error flag"); | ||
200 | s->errintsts |= SDHC_EIS_ADMAERR; | ||
201 | s->norintsts |= SDHC_NIS_ERR; | ||
202 | } | ||
203 | @@ -XXX,XX +XXX,XX @@ static void sdhci_data_transfer(void *opaque) | ||
204 | break; | ||
205 | case SDHC_CTRL_ADMA1_32: | ||
206 | if (!(s->capareg & SDHC_CAN_DO_ADMA1)) { | ||
207 | - ERRPRINT("ADMA1 not supported\n"); | ||
208 | + trace_sdhci_error("ADMA1 not supported"); | ||
209 | break; | ||
210 | } | ||
211 | |||
212 | @@ -XXX,XX +XXX,XX @@ static void sdhci_data_transfer(void *opaque) | ||
213 | break; | ||
214 | case SDHC_CTRL_ADMA2_32: | ||
215 | if (!(s->capareg & SDHC_CAN_DO_ADMA2)) { | ||
216 | - ERRPRINT("ADMA2 not supported\n"); | ||
217 | + trace_sdhci_error("ADMA2 not supported"); | ||
218 | break; | ||
219 | } | ||
220 | |||
221 | @@ -XXX,XX +XXX,XX @@ static void sdhci_data_transfer(void *opaque) | ||
222 | case SDHC_CTRL_ADMA2_64: | ||
223 | if (!(s->capareg & SDHC_CAN_DO_ADMA2) || | ||
224 | !(s->capareg & SDHC_64_BIT_BUS_SUPPORT)) { | ||
225 | - ERRPRINT("64 bit ADMA not supported\n"); | ||
226 | + trace_sdhci_error("64 bit ADMA not supported"); | ||
227 | break; | ||
228 | } | ||
229 | |||
230 | sdhci_do_adma(s); | ||
231 | break; | ||
232 | default: | ||
233 | - ERRPRINT("Unsupported DMA type\n"); | ||
234 | + trace_sdhci_error("Unsupported DMA type"); | ||
235 | break; | ||
236 | } | ||
237 | } else { | ||
238 | @@ -XXX,XX +XXX,XX @@ static inline bool | ||
239 | sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num) | ||
240 | { | ||
241 | if ((s->data_count & 0x3) != byte_num) { | ||
242 | - ERRPRINT("Non-sequential access to Buffer Data Port register" | ||
243 | - "is prohibited\n"); | ||
244 | + trace_sdhci_error("Non-sequential access to Buffer Data Port register" | ||
245 | + "is prohibited\n"); | ||
246 | return false; | ||
247 | } | ||
248 | return true; | ||
249 | @@ -XXX,XX +XXX,XX @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) | ||
250 | case SDHC_BDATA: | ||
251 | if (sdhci_buff_access_is_sequential(s, offset - SDHC_BDATA)) { | ||
252 | ret = sdhci_read_dataport(s, size); | ||
253 | - DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, | ||
254 | - ret, ret); | ||
255 | + trace_sdhci_access("rd", size << 3, offset, "->", ret, ret); | ||
256 | return ret; | ||
257 | } | ||
258 | break; | ||
259 | @@ -XXX,XX +XXX,XX @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) | ||
260 | |||
261 | ret >>= (offset & 0x3) * 8; | ||
262 | ret &= (1ULL << (size * 8)) - 1; | ||
263 | - DPRINT_L2("read %ub: addr[0x%04x] -> %u(0x%x)\n", size, (int)offset, ret, ret); | ||
264 | + trace_sdhci_access("rd", size << 3, offset, "->", ret, ret); | ||
265 | return ret; | ||
266 | } | 66 | } |
267 | 67 | ||
268 | @@ -XXX,XX +XXX,XX @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | 68 | -static |
269 | "not implemented\n", size, offset, value >> shift); | 69 | -void do_sys_reset(void *opaque, int n, int level) |
270 | break; | 70 | -{ |
271 | } | 71 | - if (level) { |
272 | - DPRINT_L2("write %ub: addr[0x%04x] <- %u(0x%x)\n", | 72 | - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); |
273 | - size, (int)offset, value >> shift, value >> shift); | 73 | - } |
274 | + trace_sdhci_access("wr", size << 3, offset, "<-", | 74 | -} |
275 | + value >> shift, value >> shift); | 75 | - |
276 | } | 76 | /* Board init. */ |
277 | 77 | static stellaris_board_info stellaris_boards[] = { | |
278 | static const MemoryRegionOps sdhci_mmio_ops = { | 78 | { "LM3S811EVB", |
279 | diff --git a/hw/sd/trace-events b/hw/sd/trace-events | 79 | @@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) |
280 | index XXXXXXX..XXXXXXX 100644 | 80 | /* This will exit with an error if the user passed us a bad cpu_type */ |
281 | --- a/hw/sd/trace-events | 81 | sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal); |
282 | +++ b/hw/sd/trace-events | 82 | |
283 | @@ -XXX,XX +XXX,XX @@ | 83 | - qdev_connect_gpio_out_named(nvic, "SYSRESETREQ", 0, |
284 | # See docs/devel/tracing.txt for syntax documentation. | 84 | - qemu_allocate_irq(&do_sys_reset, NULL, 0)); |
285 | 85 | - | |
286 | +# hw/sd/sdhci.c | 86 | if (board->dc1 & (1 << 16)) { |
287 | +sdhci_set_inserted(const char *level) "card state changed: %s" | 87 | dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000, |
288 | +sdhci_send_command(uint8_t cmd, uint32_t arg) "CMD%02u ARG[0x%08x]" | 88 | qdev_get_gpio_in(nvic, 14), |
289 | +sdhci_error(const char *msg) "%s" | ||
290 | +sdhci_response4(uint32_t r0) "RSPREG[31..0]=0x%08x" | ||
291 | +sdhci_response16(uint32_t r3, uint32_t r2, uint32_t r1, uint32_t r0) "RSPREG[127..96]=0x%08x, RSPREG[95..64]=0x%08x, RSPREG[63..32]=0x%08x, RSPREG[31..0]=0x%08x" | ||
292 | +sdhci_end_transfer(uint8_t cmd, uint32_t arg) "Automatically issue CMD%02u 0x%08x" | ||
293 | +sdhci_adma(const char *desc, uint32_t sysad) "%s: admasysaddr=0x%" PRIx32 | ||
294 | +sdhci_adma_loop(uint64_t addr, uint16_t length, uint8_t attr) "addr=0x%08" PRIx64 ", len=%d, attr=0x%x" | ||
295 | +sdhci_adma_transfer_completed(void) "" | ||
296 | +sdhci_access(const char *access, unsigned int size, uint64_t offset, const char *dir, uint64_t val, uint64_t val2) "%s%u: addr[0x%04" PRIx64 "] %s 0x%08" PRIx64 " (%" PRIu64 ")" | ||
297 | +sdhci_read_dataport(uint16_t data_count) "all %u bytes of data have been read from input buffer" | ||
298 | +sdhci_write_dataport(uint16_t data_count) "write buffer filled with %u bytes of data" | ||
299 | + | ||
300 | # hw/sd/milkymist-memcard.c | ||
301 | milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" | ||
302 | milkymist_memcard_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x" | ||
303 | -- | 89 | -- |
304 | 2.7.4 | 90 | 2.20.1 |
305 | 91 | ||
306 | 92 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | The definition of top_bit used in this function is one higher | ||
4 | than that used in the Arm ARM psuedo-code, which put the error | ||
5 | indication at top_bit - 1 at the wrong place, which meant that | ||
6 | it wasn't visible to Auth. | ||
7 | |||
8 | Fixing the definition of top_bit requires more changes, because | ||
9 | its most common use is for the count of bits in top_bit:bot_bit, | ||
10 | which would then need to be computed as top_bit - bot_bit + 1. | ||
11 | |||
12 | For now, prefer the minimal fix to the error indication alone. | ||
13 | |||
14 | Fixes: 63ff0ca94cb | ||
15 | Reported-by: Derrick McKee <derrick.mckee@gmail.com> | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
17 | Message-id: 20200728195706.11087-1-richard.henderson@linaro.org | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20180110063337.21538-3-richard.henderson@linaro.org | 19 | [PMM: added comment about the divergence from the pseudocode] |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 21 | --- |
8 | target/arm/translate-a64.c | 5 +++++ | 22 | target/arm/pauth_helper.c | 6 +++++- |
9 | 1 file changed, 5 insertions(+) | 23 | tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++ |
24 | tests/tcg/aarch64/Makefile.target | 2 +- | ||
25 | 3 files changed, 39 insertions(+), 2 deletions(-) | ||
26 | create mode 100644 tests/tcg/aarch64/pauth-5.c | ||
10 | 27 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 28 | diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c |
12 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 30 | --- a/target/arm/pauth_helper.c |
14 | +++ b/target/arm/translate-a64.c | 31 | +++ b/target/arm/pauth_helper.c |
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t vfp_expand_imm(int size, uint8_t imm8) | 32 | @@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier, |
16 | (extract32(imm8, 0, 6) << 3); | 33 | */ |
17 | imm <<= 16; | 34 | test = sextract64(ptr, bot_bit, top_bit - bot_bit); |
18 | break; | 35 | if (test != 0 && test != -1) { |
19 | + case MO_16: | 36 | - pac ^= MAKE_64BIT_MASK(top_bit - 1, 1); |
20 | + imm = (extract32(imm8, 7, 1) ? 0x8000 : 0) | | 37 | + /* |
21 | + (extract32(imm8, 6, 1) ? 0x3000 : 0x4000) | | 38 | + * Note that our top_bit is one greater than the pseudocode's |
22 | + (extract32(imm8, 0, 6) << 6); | 39 | + * version, hence "- 2" here. |
23 | + break; | 40 | + */ |
24 | default: | 41 | + pac ^= MAKE_64BIT_MASK(top_bit - 2, 1); |
25 | g_assert_not_reached(); | ||
26 | } | 42 | } |
43 | |||
44 | /* | ||
45 | diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c | ||
46 | new file mode 100644 | ||
47 | index XXXXXXX..XXXXXXX | ||
48 | --- /dev/null | ||
49 | +++ b/tests/tcg/aarch64/pauth-5.c | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | +#include <assert.h> | ||
52 | + | ||
53 | +static int x; | ||
54 | + | ||
55 | +int main() | ||
56 | +{ | ||
57 | + int *p0 = &x, *p1, *p2, *p3; | ||
58 | + unsigned long salt = 0; | ||
59 | + | ||
60 | + /* | ||
61 | + * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so | ||
62 | + * a 1/128 chance of auth = pac(ptr,key,salt) producing zero. | ||
63 | + * Find a salt that creates auth != 0. | ||
64 | + */ | ||
65 | + do { | ||
66 | + salt++; | ||
67 | + asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0)); | ||
68 | + } while (p0 == p1); | ||
69 | + | ||
70 | + /* | ||
71 | + * This pac must fail, because the input pointer bears an encryption, | ||
72 | + * and so is not properly extended within bits [55:47]. This will | ||
73 | + * toggle bit 54 in the output... | ||
74 | + */ | ||
75 | + asm("pacda %0, %1" : "=r"(p2) : "r"(salt), "0"(p1)); | ||
76 | + | ||
77 | + /* ... so that the aut must fail, setting bit 53 in the output ... */ | ||
78 | + asm("autda %0, %1" : "=r"(p3) : "r"(salt), "0"(p2)); | ||
79 | + | ||
80 | + /* ... which means this equality must not hold. */ | ||
81 | + assert(p3 != p0); | ||
82 | + return 0; | ||
83 | +} | ||
84 | diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/tests/tcg/aarch64/Makefile.target | ||
87 | +++ b/tests/tcg/aarch64/Makefile.target | ||
88 | @@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt | ||
89 | |||
90 | # Pauth Tests | ||
91 | ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_3),) | ||
92 | -AARCH64_TESTS += pauth-1 pauth-2 pauth-4 | ||
93 | +AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5 | ||
94 | pauth-%: CFLAGS += -march=armv8.3-a | ||
95 | run-pauth-%: QEMU_OPTS += -cpu max | ||
96 | run-plugin-pauth-%: QEMU_OPTS += -cpu max | ||
27 | -- | 97 | -- |
28 | 2.7.4 | 98 | 2.20.1 |
29 | 99 | ||
30 | 100 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Kaige Li <likaige@loongson.cn> |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | GCC version 4.9.4 isn't clever enough to figure out that all |
4 | execution paths in disas_ldst() that use 'fn' will have initialized | ||
5 | it first, and so it warns: | ||
6 | |||
7 | /home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’: | ||
8 | /home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
9 | fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s), | ||
10 | ^ | ||
11 | /home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here | ||
12 | AtomicThreeOpFn *fn; | ||
13 | ^ | ||
14 | |||
15 | Make it happy by initializing the variable to NULL. | ||
16 | |||
17 | Signed-off-by: Kaige Li <likaige@loongson.cn> | ||
18 | Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Message-id: 20180110063337.21538-2-richard.henderson@linaro.org | 20 | [PMM: Clean up commit message and note which gcc version this was] |
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | --- | 22 | --- |
8 | target/arm/translate-a64.c | 44 ++++++++++++++++++++++++++++---------------- | 23 | target/arm/translate-a64.c | 2 +- |
9 | 1 file changed, 28 insertions(+), 16 deletions(-) | 24 | 1 file changed, 1 insertion(+), 1 deletion(-) |
10 | 25 | ||
11 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 26 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
12 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/target/arm/translate-a64.c | 28 | --- a/target/arm/translate-a64.c |
14 | +++ b/target/arm/translate-a64.c | 29 | +++ b/target/arm/translate-a64.c |
15 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_3src(DisasContext *s, uint32_t insn) | 30 | @@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn, |
16 | } | 31 | bool r = extract32(insn, 22, 1); |
17 | } | 32 | bool a = extract32(insn, 23, 1); |
18 | 33 | TCGv_i64 tcg_rs, clean_addr; | |
19 | +/* The imm8 encodes the sign bit, enough bits to represent an exponent in | 34 | - AtomicThreeOpFn *fn; |
20 | + * the range 01....1xx to 10....0xx, and the most significant 4 bits of | 35 | + AtomicThreeOpFn *fn = NULL; |
21 | + * the mantissa; see VFPExpandImm() in the v8 ARM ARM. | 36 | |
22 | + */ | 37 | if (is_vector || !dc_isar_feature(aa64_atomics, s)) { |
23 | +static uint64_t vfp_expand_imm(int size, uint8_t imm8) | 38 | unallocated_encoding(s); |
24 | +{ | ||
25 | + uint64_t imm; | ||
26 | + | ||
27 | + switch (size) { | ||
28 | + case MO_64: | ||
29 | + imm = (extract32(imm8, 7, 1) ? 0x8000 : 0) | | ||
30 | + (extract32(imm8, 6, 1) ? 0x3fc0 : 0x4000) | | ||
31 | + extract32(imm8, 0, 6); | ||
32 | + imm <<= 48; | ||
33 | + break; | ||
34 | + case MO_32: | ||
35 | + imm = (extract32(imm8, 7, 1) ? 0x8000 : 0) | | ||
36 | + (extract32(imm8, 6, 1) ? 0x3e00 : 0x4000) | | ||
37 | + (extract32(imm8, 0, 6) << 3); | ||
38 | + imm <<= 16; | ||
39 | + break; | ||
40 | + default: | ||
41 | + g_assert_not_reached(); | ||
42 | + } | ||
43 | + return imm; | ||
44 | +} | ||
45 | + | ||
46 | /* Floating point immediate | ||
47 | * 31 30 29 28 24 23 22 21 20 13 12 10 9 5 4 0 | ||
48 | * +---+---+---+-----------+------+---+------------+-------+------+------+ | ||
49 | @@ -XXX,XX +XXX,XX @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) | ||
50 | return; | ||
51 | } | ||
52 | |||
53 | - /* The imm8 encodes the sign bit, enough bits to represent | ||
54 | - * an exponent in the range 01....1xx to 10....0xx, | ||
55 | - * and the most significant 4 bits of the mantissa; see | ||
56 | - * VFPExpandImm() in the v8 ARM ARM. | ||
57 | - */ | ||
58 | - if (is_double) { | ||
59 | - imm = (extract32(imm8, 7, 1) ? 0x8000 : 0) | | ||
60 | - (extract32(imm8, 6, 1) ? 0x3fc0 : 0x4000) | | ||
61 | - extract32(imm8, 0, 6); | ||
62 | - imm <<= 48; | ||
63 | - } else { | ||
64 | - imm = (extract32(imm8, 7, 1) ? 0x8000 : 0) | | ||
65 | - (extract32(imm8, 6, 1) ? 0x3e00 : 0x4000) | | ||
66 | - (extract32(imm8, 0, 6) << 3); | ||
67 | - imm <<= 16; | ||
68 | - } | ||
69 | + imm = vfp_expand_imm(MO_32 + is_double, imm8); | ||
70 | |||
71 | tcg_res = tcg_const_i64(imm); | ||
72 | write_fp_dreg(s, rd, tcg_res); | ||
73 | -- | 39 | -- |
74 | 2.7.4 | 40 | 2.20.1 |
75 | 41 | ||
76 | 42 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | 1 | The nrf51 SoC model wasn't setting the system_clock_scale |
---|---|---|---|
2 | global.which meant that if guest code used the systick timer in "use | ||
3 | the processor clock" mode it would hang because time never advances. | ||
2 | 4 | ||
3 | While SysBus devices can use the get_system_memory() address space, | 5 | Set the global to match the documented CPU clock speed for this SoC. |
4 | PCI devices should use the bus master address space for DMA. | ||
5 | 6 | ||
6 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | 7 | This SoC in fact doesn't have a SysTick timer (which is the only thing |
7 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 8 | currently that cares about the system_clock_scale), because it's |
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | a configurable option in the Cortex-M0. However our Cortex-M0 and |
9 | Message-id: 20180115182436.2066-14-f4bug@amsat.org | 10 | thus our nrf51 and our micro:bit board do provide a SysTick, so |
11 | we ought to provide a functional one rather than a broken one. | ||
12 | |||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Message-id: 20200727193458.31250-1-peter.maydell@linaro.org | ||
11 | --- | 16 | --- |
12 | include/hw/sd/sdhci.h | 1 + | 17 | hw/arm/nrf51_soc.c | 5 +++++ |
13 | hw/sd/sdhci.c | 29 +++++++++++++++-------------- | 18 | 1 file changed, 5 insertions(+) |
14 | 2 files changed, 16 insertions(+), 14 deletions(-) | ||
15 | 19 | ||
16 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | 20 | diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c |
17 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/hw/sd/sdhci.h | 22 | --- a/hw/arm/nrf51_soc.c |
19 | +++ b/include/hw/sd/sdhci.h | 23 | +++ b/hw/arm/nrf51_soc.c |
20 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | 24 | @@ -XXX,XX +XXX,XX @@ |
21 | /*< public >*/ | 25 | |
22 | SDBus sdbus; | 26 | #define BASE_TO_IRQ(base) ((base >> 12) & 0x1F) |
23 | MemoryRegion iomem; | 27 | |
24 | + AddressSpace *dma_as; | 28 | +/* HCLK (the main CPU clock) on this SoC is always 16MHz */ |
25 | 29 | +#define HCLK_FRQ 16000000 | |
26 | QEMUTimer *insert_timer; /* timer for 'changing' sd card. */ | 30 | + |
27 | QEMUTimer *transfer_timer; | 31 | static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size) |
28 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | 32 | { |
29 | index XXXXXXX..XXXXXXX 100644 | 33 | qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n", |
30 | --- a/hw/sd/sdhci.c | 34 | @@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) |
31 | +++ b/hw/sd/sdhci.c | ||
32 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) | ||
33 | s->blkcnt--; | ||
34 | } | ||
35 | } | ||
36 | - dma_memory_write(&address_space_memory, s->sdmasysad, | ||
37 | + dma_memory_write(s->dma_as, s->sdmasysad, | ||
38 | &s->fifo_buffer[begin], s->data_count - begin); | ||
39 | s->sdmasysad += s->data_count - begin; | ||
40 | if (s->data_count == block_size) { | ||
41 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState *s) | ||
42 | s->data_count = block_size; | ||
43 | boundary_count -= block_size - begin; | ||
44 | } | ||
45 | - dma_memory_read(&address_space_memory, s->sdmasysad, | ||
46 | + dma_memory_read(s->dma_as, s->sdmasysad, | ||
47 | &s->fifo_buffer[begin], s->data_count - begin); | ||
48 | s->sdmasysad += s->data_count - begin; | ||
49 | if (s->data_count == block_size) { | ||
50 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sdma_transfer_single_block(SDHCIState *s) | ||
51 | for (n = 0; n < datacnt; n++) { | ||
52 | s->fifo_buffer[n] = sdbus_read_data(&s->sdbus); | ||
53 | } | ||
54 | - dma_memory_write(&address_space_memory, s->sdmasysad, s->fifo_buffer, | ||
55 | - datacnt); | ||
56 | + dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); | ||
57 | } else { | ||
58 | - dma_memory_read(&address_space_memory, s->sdmasysad, s->fifo_buffer, | ||
59 | - datacnt); | ||
60 | + dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); | ||
61 | for (n = 0; n < datacnt; n++) { | ||
62 | sdbus_write_data(&s->sdbus, s->fifo_buffer[n]); | ||
63 | } | ||
64 | @@ -XXX,XX +XXX,XX @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr) | ||
65 | hwaddr entry_addr = (hwaddr)s->admasysaddr; | ||
66 | switch (SDHC_DMA_TYPE(s->hostctl)) { | ||
67 | case SDHC_CTRL_ADMA2_32: | ||
68 | - dma_memory_read(&address_space_memory, entry_addr, (uint8_t *)&adma2, | ||
69 | + dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma2, | ||
70 | sizeof(adma2)); | ||
71 | adma2 = le64_to_cpu(adma2); | ||
72 | /* The spec does not specify endianness of descriptor table. | ||
73 | @@ -XXX,XX +XXX,XX @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr) | ||
74 | dscr->incr = 8; | ||
75 | break; | ||
76 | case SDHC_CTRL_ADMA1_32: | ||
77 | - dma_memory_read(&address_space_memory, entry_addr, (uint8_t *)&adma1, | ||
78 | + dma_memory_read(s->dma_as, entry_addr, (uint8_t *)&adma1, | ||
79 | sizeof(adma1)); | ||
80 | adma1 = le32_to_cpu(adma1); | ||
81 | dscr->addr = (hwaddr)(adma1 & 0xFFFFF000); | ||
82 | @@ -XXX,XX +XXX,XX @@ static void get_adma_description(SDHCIState *s, ADMADescr *dscr) | ||
83 | } | ||
84 | break; | ||
85 | case SDHC_CTRL_ADMA2_64: | ||
86 | - dma_memory_read(&address_space_memory, entry_addr, | ||
87 | + dma_memory_read(s->dma_as, entry_addr, | ||
88 | (uint8_t *)(&dscr->attr), 1); | ||
89 | - dma_memory_read(&address_space_memory, entry_addr + 2, | ||
90 | + dma_memory_read(s->dma_as, entry_addr + 2, | ||
91 | (uint8_t *)(&dscr->length), 2); | ||
92 | dscr->length = le16_to_cpu(dscr->length); | ||
93 | - dma_memory_read(&address_space_memory, entry_addr + 4, | ||
94 | + dma_memory_read(s->dma_as, entry_addr + 4, | ||
95 | (uint8_t *)(&dscr->addr), 8); | ||
96 | dscr->attr = le64_to_cpu(dscr->attr); | ||
97 | dscr->attr &= 0xfffffff8; | ||
98 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | ||
99 | s->data_count = block_size; | ||
100 | length -= block_size - begin; | ||
101 | } | ||
102 | - dma_memory_write(&address_space_memory, dscr.addr, | ||
103 | + dma_memory_write(s->dma_as, dscr.addr, | ||
104 | &s->fifo_buffer[begin], | ||
105 | s->data_count - begin); | ||
106 | dscr.addr += s->data_count - begin; | ||
107 | @@ -XXX,XX +XXX,XX @@ static void sdhci_do_adma(SDHCIState *s) | ||
108 | s->data_count = block_size; | ||
109 | length -= block_size - begin; | ||
110 | } | ||
111 | - dma_memory_read(&address_space_memory, dscr.addr, | ||
112 | + dma_memory_read(s->dma_as, dscr.addr, | ||
113 | &s->fifo_buffer[begin], | ||
114 | s->data_count - begin); | ||
115 | dscr.addr += s->data_count - begin; | ||
116 | @@ -XXX,XX +XXX,XX @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp) | ||
117 | dev->config[PCI_CLASS_PROG] = 0x01; /* Standard Host supported DMA */ | ||
118 | dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */ | ||
119 | s->irq = pci_allocate_irq(dev); | ||
120 | - pci_register_bar(dev, 0, 0, &s->iomem); | ||
121 | + s->dma_as = pci_get_address_space(dev); | ||
122 | + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->iomem); | ||
123 | } | ||
124 | |||
125 | static void sdhci_pci_exit(PCIDevice *dev) | ||
126 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) | ||
127 | return; | 35 | return; |
128 | } | 36 | } |
129 | 37 | ||
130 | + s->dma_as = &address_space_memory; | 38 | + system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ; |
131 | + | 39 | + |
132 | sysbus_init_irq(sbd, &s->irq); | 40 | object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container), |
133 | sysbus_init_mmio(sbd, &s->iomem); | 41 | &error_abort); |
134 | } | 42 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) { |
135 | -- | 43 | -- |
136 | 2.7.4 | 44 | 2.20.1 |
137 | 45 | ||
138 | 46 | diff view generated by jsdifflib |
1 | Since omap_mmc is still using the legacy SD card API, the SD | 1 | The imx_epit device has a software-controllable reset triggered by |
---|---|---|---|
2 | card created by sd_init() is not plugged into any bus. This | 2 | setting the SWR bit in the CR register. An error in commit cc2722ec83ad9 |
3 | means that the controller has to reset it manually. | 3 | means that we will end up assert()ing if the guest does this, because |
4 | the code in imx_epit_write() starts ptimer transactions, and then | ||
5 | imx_epit_reset() also starts ptimer transactions, triggering | ||
6 | "ptimer_transaction_begin: Assertion `!s->in_transaction' failed". | ||
4 | 7 | ||
5 | Failing to do this mostly didn't affect the guest since the | 8 | The cleanest way to avoid this double-transaction is to move the |
6 | guest typically does a programmed SD card reset as part of | 9 | start-transaction for the CR write handling down below the check of |
7 | its SD controller driver initialization, but would mean that | 10 | the SWR bit. |
8 | migration fails because it's only in sd_reset() that we | ||
9 | set up the wpgrps_size field. | ||
10 | 11 | ||
12 | Fixes: https://bugs.launchpad.net/qemu/+bug/1880424 | ||
13 | Fixes: cc2722ec83ad944505fe | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 15 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
13 | Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 16 | Message-id: 20200727154550.3409-1-peter.maydell@linaro.org |
14 | Message-id: 1515506513-31961-5-git-send-email-peter.maydell@linaro.org | ||
15 | --- | 17 | --- |
16 | hw/sd/omap_mmc.c | 14 ++++++++++---- | 18 | hw/timer/imx_epit.c | 13 ++++++++++--- |
17 | 1 file changed, 10 insertions(+), 4 deletions(-) | 19 | 1 file changed, 10 insertions(+), 3 deletions(-) |
18 | 20 | ||
19 | diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c | 21 | diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c |
20 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/hw/sd/omap_mmc.c | 23 | --- a/hw/timer/imx_epit.c |
22 | +++ b/hw/sd/omap_mmc.c | 24 | +++ b/hw/timer/imx_epit.c |
23 | @@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host) | 25 | @@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value, |
24 | host->cdet_enable = 0; | 26 | |
25 | qemu_set_irq(host->coverswitch, host->cdet_state); | 27 | switch (offset >> 2) { |
26 | host->clkdiv = 0; | 28 | case 0: /* CR */ |
29 | - ptimer_transaction_begin(s->timer_cmp); | ||
30 | - ptimer_transaction_begin(s->timer_reload); | ||
31 | |||
32 | oldcr = s->cr; | ||
33 | s->cr = value & 0x03ffffff; | ||
34 | if (s->cr & CR_SWR) { | ||
35 | /* handle the reset */ | ||
36 | imx_epit_reset(DEVICE(s)); | ||
37 | - } else { | ||
38 | + /* | ||
39 | + * TODO: could we 'break' here? following operations appear | ||
40 | + * to duplicate the work imx_epit_reset() already did. | ||
41 | + */ | ||
42 | + } | ||
27 | + | 43 | + |
28 | + /* Since we're still using the legacy SD API the card is not plugged | 44 | + ptimer_transaction_begin(s->timer_cmp); |
29 | + * into any bus, and we must reset it manually. When omap_mmc is | 45 | + ptimer_transaction_begin(s->timer_reload); |
30 | + * QOMified this must move into the QOM reset function. | ||
31 | + */ | ||
32 | + device_reset(DEVICE(host->card)); | ||
33 | } | ||
34 | |||
35 | static uint64_t omap_mmc_read(void *opaque, hwaddr offset, | ||
36 | @@ -XXX,XX +XXX,XX @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, | ||
37 | s->lines = 1; /* TODO: needs to be settable per-board */ | ||
38 | s->rev = 1; | ||
39 | |||
40 | - omap_mmc_reset(s); | ||
41 | - | ||
42 | memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", 0x800); | ||
43 | memory_region_add_subregion(sysmem, base, &s->iomem); | ||
44 | |||
45 | @@ -XXX,XX +XXX,XX @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, | ||
46 | exit(1); | ||
47 | } | ||
48 | |||
49 | + omap_mmc_reset(s); | ||
50 | + | 46 | + |
51 | return s; | 47 | + if (!(s->cr & CR_SWR)) { |
52 | } | 48 | imx_epit_set_freq(s); |
53 | 49 | } | |
54 | @@ -XXX,XX +XXX,XX @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, | ||
55 | s->lines = 4; | ||
56 | s->rev = 2; | ||
57 | |||
58 | - omap_mmc_reset(s); | ||
59 | - | ||
60 | memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc", | ||
61 | omap_l4_region_size(ta, 0)); | ||
62 | omap_l4_attach(ta, 0, &s->iomem); | ||
63 | @@ -XXX,XX +XXX,XX @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, | ||
64 | s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0); | ||
65 | sd_set_cb(s->card, NULL, s->cdet); | ||
66 | |||
67 | + omap_mmc_reset(s); | ||
68 | + | ||
69 | return s; | ||
70 | } | ||
71 | 50 | ||
72 | -- | 51 | -- |
73 | 2.7.4 | 52 | 2.20.1 |
74 | 53 | ||
75 | 54 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-2-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci-internal.h | 4 ---- | ||
9 | include/hw/sd/sdhci.h | 7 ++++++- | ||
10 | hw/sd/sdhci.c | 1 + | ||
11 | 3 files changed, 7 insertions(+), 5 deletions(-) | ||
12 | |||
13 | diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/sd/sdhci-internal.h | ||
16 | +++ b/hw/sd/sdhci-internal.h | ||
17 | @@ -XXX,XX +XXX,XX @@ | ||
18 | #ifndef SDHCI_INTERNAL_H | ||
19 | #define SDHCI_INTERNAL_H | ||
20 | |||
21 | -#include "hw/sd/sdhci.h" | ||
22 | - | ||
23 | /* R/W SDMA System Address register 0x0 */ | ||
24 | #define SDHC_SYSAD 0x00 | ||
25 | |||
26 | @@ -XXX,XX +XXX,XX @@ enum { | ||
27 | sdhc_gap_write = 2 /* SDHC stopped at block gap during write operation */ | ||
28 | }; | ||
29 | |||
30 | -extern const VMStateDescription sdhci_vmstate; | ||
31 | - | ||
32 | #endif | ||
33 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/include/hw/sd/sdhci.h | ||
36 | +++ b/include/hw/sd/sdhci.h | ||
37 | @@ -XXX,XX +XXX,XX @@ | ||
38 | #define SDHCI_H | ||
39 | |||
40 | #include "qemu-common.h" | ||
41 | -#include "hw/block/block.h" | ||
42 | #include "hw/pci/pci.h" | ||
43 | #include "hw/sysbus.h" | ||
44 | #include "hw/sd/sd.h" | ||
45 | |||
46 | /* SD/MMC host controller state */ | ||
47 | typedef struct SDHCIState { | ||
48 | + /*< private >*/ | ||
49 | union { | ||
50 | PCIDevice pcidev; | ||
51 | SysBusDevice busdev; | ||
52 | }; | ||
53 | + | ||
54 | + /*< public >*/ | ||
55 | SDBus sdbus; | ||
56 | MemoryRegion iomem; | ||
57 | |||
58 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | ||
59 | qemu_irq ro_cb; | ||
60 | qemu_irq irq; | ||
61 | |||
62 | + /* Registers cleared on reset */ | ||
63 | uint32_t sdmasysad; /* SDMA System Address register */ | ||
64 | uint16_t blksize; /* Host DMA Buff Boundary and Transfer BlkSize Reg */ | ||
65 | uint16_t blkcnt; /* Blocks count for current transfer */ | ||
66 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | ||
67 | uint16_t acmd12errsts; /* Auto CMD12 error status register */ | ||
68 | uint64_t admasysaddr; /* ADMA System Address Register */ | ||
69 | |||
70 | + /* Read-only registers */ | ||
71 | uint32_t capareg; /* Capabilities Register */ | ||
72 | uint32_t maxcurr; /* Maximum Current Capabilities Register */ | ||
73 | + | ||
74 | uint8_t *fifo_buffer; /* SD host i/o FIFO buffer */ | ||
75 | uint32_t buf_maxsz; | ||
76 | uint16_t data_count; /* current element in FIFO buffer */ | ||
77 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
78 | index XXXXXXX..XXXXXXX 100644 | ||
79 | --- a/hw/sd/sdhci.c | ||
80 | +++ b/hw/sd/sdhci.c | ||
81 | @@ -XXX,XX +XXX,XX @@ | ||
82 | #include "sysemu/dma.h" | ||
83 | #include "qemu/timer.h" | ||
84 | #include "qemu/bitops.h" | ||
85 | +#include "hw/sd/sdhci.h" | ||
86 | #include "sdhci-internal.h" | ||
87 | #include "qemu/log.h" | ||
88 | |||
89 | -- | ||
90 | 2.7.4 | ||
91 | |||
92 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-3-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | include/hw/sd/sdhci.h | 2 -- | ||
9 | hw/sd/sdhci.c | 2 -- | ||
10 | 2 files changed, 4 deletions(-) | ||
11 | |||
12 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/include/hw/sd/sdhci.h | ||
15 | +++ b/include/hw/sd/sdhci.h | ||
16 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | ||
17 | |||
18 | QEMUTimer *insert_timer; /* timer for 'changing' sd card. */ | ||
19 | QEMUTimer *transfer_timer; | ||
20 | - qemu_irq eject_cb; | ||
21 | - qemu_irq ro_cb; | ||
22 | qemu_irq irq; | ||
23 | |||
24 | /* Registers cleared on reset */ | ||
25 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/sd/sdhci.c | ||
28 | +++ b/hw/sd/sdhci.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static void sdhci_uninitfn(SDHCIState *s) | ||
30 | timer_free(s->insert_timer); | ||
31 | timer_del(s->transfer_timer); | ||
32 | timer_free(s->transfer_timer); | ||
33 | - qemu_free_irq(s->eject_cb); | ||
34 | - qemu_free_irq(s->ro_cb); | ||
35 | |||
36 | g_free(s->fifo_buffer); | ||
37 | s->fifo_buffer = NULL; | ||
38 | -- | ||
39 | 2.7.4 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Add common/sysbus/pci/sdbus comments to have clearer code blocks separation. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Message-id: 20180115182436.2066-4-f4bug@amsat.org | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | include/hw/sd/sdhci.h | 4 +++- | ||
11 | hw/sd/sdhci.c | 25 +++++++++++++++++-------- | ||
12 | 2 files changed, 20 insertions(+), 9 deletions(-) | ||
13 | |||
14 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/include/hw/sd/sdhci.h | ||
17 | +++ b/include/hw/sd/sdhci.h | ||
18 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | ||
19 | uint32_t buf_maxsz; | ||
20 | uint16_t data_count; /* current element in FIFO buffer */ | ||
21 | uint8_t stopped_state;/* Current SDHC state */ | ||
22 | - bool pending_insert_quirk;/* Quirk for Raspberry Pi card insert int */ | ||
23 | bool pending_insert_state; | ||
24 | /* Buffer Data Port Register - virtual access point to R and W buffers */ | ||
25 | /* Software Reset Register - always reads as 0 */ | ||
26 | /* Force Event Auto CMD12 Error Interrupt Reg - write only */ | ||
27 | /* Force Event Error Interrupt Register- write only */ | ||
28 | /* RO Host Controller Version Register always reads as 0x2401 */ | ||
29 | + | ||
30 | + /* Configurable properties */ | ||
31 | + bool pending_insert_quirk; /* Quirk for Raspberry Pi card insert int */ | ||
32 | } SDHCIState; | ||
33 | |||
34 | #define TYPE_PCI_SDHCI "sdhci-pci" | ||
35 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/hw/sd/sdhci.c | ||
38 | +++ b/hw/sd/sdhci.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | ||
40 | */ | ||
41 | |||
42 | #include "qemu/osdep.h" | ||
43 | +#include "qapi/error.h" | ||
44 | #include "hw/hw.h" | ||
45 | #include "sysemu/block-backend.h" | ||
46 | #include "sysemu/blockdev.h" | ||
47 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int sdhci_get_fifolen(SDHCIState *s) | ||
48 | } | ||
49 | } | ||
50 | |||
51 | +/* --- qdev common --- */ | ||
52 | + | ||
53 | +#define DEFINE_SDHCI_COMMON_PROPERTIES(_state) \ | ||
54 | + /* Capabilities registers provide information on supported features | ||
55 | + * of this specific host controller implementation */ \ | ||
56 | + DEFINE_PROP_UINT32("capareg", _state, capareg, SDHC_CAPAB_REG_DEFAULT), \ | ||
57 | + DEFINE_PROP_UINT32("maxcurr", _state, maxcurr, 0) | ||
58 | + | ||
59 | static void sdhci_initfn(SDHCIState *s) | ||
60 | { | ||
61 | qbus_create_inplace(&s->sdbus, sizeof(s->sdbus), | ||
62 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription sdhci_vmstate = { | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | -/* Capabilities registers provide information on supported features of this | ||
67 | - * specific host controller implementation */ | ||
68 | +/* --- qdev PCI --- */ | ||
69 | + | ||
70 | static Property sdhci_pci_properties[] = { | ||
71 | - DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, | ||
72 | - SDHC_CAPAB_REG_DEFAULT), | ||
73 | - DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), | ||
74 | + DEFINE_SDHCI_COMMON_PROPERTIES(SDHCIState), | ||
75 | DEFINE_PROP_END_OF_LIST(), | ||
76 | }; | ||
77 | |||
78 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo sdhci_pci_info = { | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | +/* --- qdev SysBus --- */ | ||
83 | + | ||
84 | static Property sdhci_sysbus_properties[] = { | ||
85 | - DEFINE_PROP_UINT32("capareg", SDHCIState, capareg, | ||
86 | - SDHC_CAPAB_REG_DEFAULT), | ||
87 | - DEFINE_PROP_UINT32("maxcurr", SDHCIState, maxcurr, 0), | ||
88 | + DEFINE_SDHCI_COMMON_PROPERTIES(SDHCIState), | ||
89 | DEFINE_PROP_BOOL("pending-insert-quirk", SDHCIState, pending_insert_quirk, | ||
90 | false), | ||
91 | DEFINE_PROP_END_OF_LIST(), | ||
92 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo sdhci_sysbus_info = { | ||
93 | .class_init = sdhci_sysbus_class_init, | ||
94 | }; | ||
95 | |||
96 | +/* --- qdev bus master --- */ | ||
97 | + | ||
98 | static void sdhci_bus_class_init(ObjectClass *klass, void *data) | ||
99 | { | ||
100 | SDBusClass *sbc = SD_BUS_CLASS(klass); | ||
101 | -- | ||
102 | 2.7.4 | ||
103 | |||
104 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Now both inherited classes appear as DEVICE_CATEGORY_STORAGE. | ||
4 | |||
5 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Message-id: 20180115182436.2066-5-f4bug@amsat.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/sd/sdhci.c | 18 +++++++++++++----- | ||
11 | 1 file changed, 13 insertions(+), 5 deletions(-) | ||
12 | |||
13 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/sd/sdhci.c | ||
16 | +++ b/hw/sd/sdhci.c | ||
17 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription sdhci_vmstate = { | ||
18 | }, | ||
19 | }; | ||
20 | |||
21 | +static void sdhci_common_class_init(ObjectClass *klass, void *data) | ||
22 | +{ | ||
23 | + DeviceClass *dc = DEVICE_CLASS(klass); | ||
24 | + | ||
25 | + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
26 | + dc->vmsd = &sdhci_vmstate; | ||
27 | + dc->reset = sdhci_poweron_reset; | ||
28 | +} | ||
29 | + | ||
30 | /* --- qdev PCI --- */ | ||
31 | |||
32 | static Property sdhci_pci_properties[] = { | ||
33 | @@ -XXX,XX +XXX,XX @@ static void sdhci_pci_class_init(ObjectClass *klass, void *data) | ||
34 | k->vendor_id = PCI_VENDOR_ID_REDHAT; | ||
35 | k->device_id = PCI_DEVICE_ID_REDHAT_SDHCI; | ||
36 | k->class_id = PCI_CLASS_SYSTEM_SDHCI; | ||
37 | - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
38 | - dc->vmsd = &sdhci_vmstate; | ||
39 | dc->props = sdhci_pci_properties; | ||
40 | - dc->reset = sdhci_poweron_reset; | ||
41 | + | ||
42 | + sdhci_common_class_init(klass, data); | ||
43 | } | ||
44 | |||
45 | static const TypeInfo sdhci_pci_info = { | ||
46 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) | ||
47 | { | ||
48 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
49 | |||
50 | - dc->vmsd = &sdhci_vmstate; | ||
51 | dc->props = sdhci_sysbus_properties; | ||
52 | dc->realize = sdhci_sysbus_realize; | ||
53 | - dc->reset = sdhci_poweron_reset; | ||
54 | + | ||
55 | + sdhci_common_class_init(klass, data); | ||
56 | } | ||
57 | |||
58 | static const TypeInfo sdhci_sysbus_info = { | ||
59 | -- | ||
60 | 2.7.4 | ||
61 | |||
62 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-6-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci.c | 30 +++++++++++++++++++++--------- | ||
9 | 1 file changed, 21 insertions(+), 9 deletions(-) | ||
10 | |||
11 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/hw/sd/sdhci.c | ||
14 | +++ b/hw/sd/sdhci.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void sdhci_uninitfn(SDHCIState *s) | ||
16 | s->fifo_buffer = NULL; | ||
17 | } | ||
18 | |||
19 | +static void sdhci_common_realize(SDHCIState *s, Error **errp) | ||
20 | +{ | ||
21 | + s->buf_maxsz = sdhci_get_fifolen(s); | ||
22 | + s->fifo_buffer = g_malloc0(s->buf_maxsz); | ||
23 | + | ||
24 | + memory_region_init_io(&s->iomem, OBJECT(s), &sdhci_mmio_ops, s, "sdhci", | ||
25 | + SDHC_REGISTERS_MAP_SIZE); | ||
26 | +} | ||
27 | + | ||
28 | static bool sdhci_pending_insert_vmstate_needed(void *opaque) | ||
29 | { | ||
30 | SDHCIState *s = opaque; | ||
31 | @@ -XXX,XX +XXX,XX @@ static Property sdhci_pci_properties[] = { | ||
32 | static void sdhci_pci_realize(PCIDevice *dev, Error **errp) | ||
33 | { | ||
34 | SDHCIState *s = PCI_SDHCI(dev); | ||
35 | + | ||
36 | + sdhci_initfn(s); | ||
37 | + sdhci_common_realize(s, errp); | ||
38 | + if (errp && *errp) { | ||
39 | + return; | ||
40 | + } | ||
41 | + | ||
42 | dev->config[PCI_CLASS_PROG] = 0x01; /* Standard Host supported DMA */ | ||
43 | dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */ | ||
44 | - sdhci_initfn(s); | ||
45 | - s->buf_maxsz = sdhci_get_fifolen(s); | ||
46 | - s->fifo_buffer = g_malloc0(s->buf_maxsz); | ||
47 | s->irq = pci_allocate_irq(dev); | ||
48 | - memory_region_init_io(&s->iomem, OBJECT(s), &sdhci_mmio_ops, s, "sdhci", | ||
49 | - SDHC_REGISTERS_MAP_SIZE); | ||
50 | pci_register_bar(dev, 0, 0, &s->iomem); | ||
51 | } | ||
52 | |||
53 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) | ||
54 | SDHCIState *s = SYSBUS_SDHCI(dev); | ||
55 | SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
56 | |||
57 | - s->buf_maxsz = sdhci_get_fifolen(s); | ||
58 | - s->fifo_buffer = g_malloc0(s->buf_maxsz); | ||
59 | + sdhci_common_realize(s, errp); | ||
60 | + if (errp && *errp) { | ||
61 | + return; | ||
62 | + } | ||
63 | + | ||
64 | sysbus_init_irq(sbd, &s->irq); | ||
65 | - memory_region_init_io(&s->iomem, OBJECT(s), &sdhci_mmio_ops, s, "sdhci", | ||
66 | - SDHC_REGISTERS_MAP_SIZE); | ||
67 | sysbus_init_mmio(sbd, &s->iomem); | ||
68 | } | ||
69 | |||
70 | -- | ||
71 | 2.7.4 | ||
72 | |||
73 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-7-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci.c | 22 ++++++++++++++++++++++ | ||
9 | 1 file changed, 22 insertions(+) | ||
10 | |||
11 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/hw/sd/sdhci.c | ||
14 | +++ b/hw/sd/sdhci.c | ||
15 | @@ -XXX,XX +XXX,XX @@ | ||
16 | #include "qemu/bitops.h" | ||
17 | #include "hw/sd/sdhci.h" | ||
18 | #include "sdhci-internal.h" | ||
19 | +#include "qapi/error.h" | ||
20 | #include "qemu/log.h" | ||
21 | |||
22 | /* host controller debug messages */ | ||
23 | @@ -XXX,XX +XXX,XX @@ static void sdhci_common_realize(SDHCIState *s, Error **errp) | ||
24 | SDHC_REGISTERS_MAP_SIZE); | ||
25 | } | ||
26 | |||
27 | +static void sdhci_common_unrealize(SDHCIState *s, Error **errp) | ||
28 | +{ | ||
29 | + /* This function is expected to be called only once for each class: | ||
30 | + * - SysBus: via DeviceClass->unrealize(), | ||
31 | + * - PCI: via PCIDeviceClass->exit(). | ||
32 | + * However to avoid double-free and/or use-after-free we still nullify | ||
33 | + * this variable (better safe than sorry!). */ | ||
34 | + g_free(s->fifo_buffer); | ||
35 | + s->fifo_buffer = NULL; | ||
36 | +} | ||
37 | + | ||
38 | static bool sdhci_pending_insert_vmstate_needed(void *opaque) | ||
39 | { | ||
40 | SDHCIState *s = opaque; | ||
41 | @@ -XXX,XX +XXX,XX @@ static void sdhci_pci_realize(PCIDevice *dev, Error **errp) | ||
42 | static void sdhci_pci_exit(PCIDevice *dev) | ||
43 | { | ||
44 | SDHCIState *s = PCI_SDHCI(dev); | ||
45 | + | ||
46 | + sdhci_common_unrealize(s, &error_abort); | ||
47 | sdhci_uninitfn(s); | ||
48 | } | ||
49 | |||
50 | @@ -XXX,XX +XXX,XX @@ static void sdhci_sysbus_realize(DeviceState *dev, Error ** errp) | ||
51 | sysbus_init_mmio(sbd, &s->iomem); | ||
52 | } | ||
53 | |||
54 | +static void sdhci_sysbus_unrealize(DeviceState *dev, Error **errp) | ||
55 | +{ | ||
56 | + SDHCIState *s = SYSBUS_SDHCI(dev); | ||
57 | + | ||
58 | + sdhci_common_unrealize(s, &error_abort); | ||
59 | +} | ||
60 | + | ||
61 | static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) | ||
62 | { | ||
63 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
64 | |||
65 | dc->props = sdhci_sysbus_properties; | ||
66 | dc->realize = sdhci_sysbus_realize; | ||
67 | + dc->unrealize = sdhci_sysbus_unrealize; | ||
68 | |||
69 | sdhci_common_class_init(klass, data); | ||
70 | } | ||
71 | -- | ||
72 | 2.7.4 | ||
73 | |||
74 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-8-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci.c | 7 ++++--- | ||
9 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
10 | |||
11 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/hw/sd/sdhci.c | ||
14 | +++ b/hw/sd/sdhci.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) | ||
16 | ret = (SD_HOST_SPECv2_VERS << 16) | sdhci_slotint(s); | ||
17 | break; | ||
18 | default: | ||
19 | - ERRPRINT("bad %ub read: addr[0x%04x]\n", size, (int)offset); | ||
20 | + qemu_log_mask(LOG_UNIMP, "SDHC rd_%ub @0x%02" HWADDR_PRIx " " | ||
21 | + "not implemented\n", size, offset); | ||
22 | break; | ||
23 | } | ||
24 | |||
25 | @@ -XXX,XX +XXX,XX @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | ||
26 | sdhci_update_irq(s); | ||
27 | break; | ||
28 | default: | ||
29 | - ERRPRINT("bad %ub write offset: addr[0x%04x] <- %u(0x%x)\n", | ||
30 | - size, (int)offset, value >> shift, value >> shift); | ||
31 | + qemu_log_mask(LOG_UNIMP, "SDHC wr_%ub @0x%02" HWADDR_PRIx " <- 0x%08x " | ||
32 | + "not implemented\n", size, offset, value >> shift); | ||
33 | break; | ||
34 | } | ||
35 | DPRINT_L2("write %ub: addr[0x%04x] <- %u(0x%x)\n", | ||
36 | -- | ||
37 | 2.7.4 | ||
38 | |||
39 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-10-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci-internal.h | 1 + | ||
9 | hw/sd/sdhci.c | 3 +-- | ||
10 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/hw/sd/sdhci-internal.h | ||
15 | +++ b/hw/sd/sdhci-internal.h | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | #define SDHC_TRNS_ACMD12 0x0004 | ||
18 | #define SDHC_TRNS_READ 0x0010 | ||
19 | #define SDHC_TRNS_MULTI 0x0020 | ||
20 | +#define SDHC_TRNMOD_MASK 0x0037 | ||
21 | |||
22 | /* R/W Command Register 0x0 */ | ||
23 | #define SDHC_CMDREG 0x0E | ||
24 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/hw/sd/sdhci.c | ||
27 | +++ b/hw/sd/sdhci.c | ||
28 | @@ -XXX,XX +XXX,XX @@ | ||
29 | (SDHC_CAPAB_BASECLKFREQ << 8) | (SDHC_CAPAB_TOUNIT << 7) | \ | ||
30 | (SDHC_CAPAB_TOCLKFREQ)) | ||
31 | |||
32 | -#define MASK_TRNMOD 0x0037 | ||
33 | #define MASKED_WRITE(reg, mask, val) (reg = (reg & (mask)) | (val)) | ||
34 | |||
35 | static uint8_t sdhci_slotint(SDHCIState *s) | ||
36 | @@ -XXX,XX +XXX,XX @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | ||
37 | if (!(s->capareg & SDHC_CAN_DO_DMA)) { | ||
38 | value &= ~SDHC_TRNS_DMA; | ||
39 | } | ||
40 | - MASKED_WRITE(s->trnmod, mask, value & MASK_TRNMOD); | ||
41 | + MASKED_WRITE(s->trnmod, mask, value & SDHC_TRNMOD_MASK); | ||
42 | MASKED_WRITE(s->cmdreg, mask >> 16, value >> 16); | ||
43 | |||
44 | /* Writing to the upper byte of CMDREG triggers SD command generation */ | ||
45 | -- | ||
46 | 2.7.4 | ||
47 | |||
48 | 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 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
5 | Message-id: 20180115182436.2066-11-f4bug@amsat.org | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | ||
8 | hw/sd/sdhci-internal.h | 2 +- | ||
9 | hw/sd/sdhci.c | 2 +- | ||
10 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/hw/sd/sdhci-internal.h | ||
15 | +++ b/hw/sd/sdhci-internal.h | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | #define SDHC_ACMD12ERRSTS 0x3C | ||
18 | |||
19 | /* HWInit Capabilities Register 0x05E80080 */ | ||
20 | -#define SDHC_CAPAREG 0x40 | ||
21 | +#define SDHC_CAPAB 0x40 | ||
22 | #define SDHC_CAN_DO_DMA 0x00400000 | ||
23 | #define SDHC_CAN_DO_ADMA2 0x00080000 | ||
24 | #define SDHC_CAN_DO_ADMA1 0x00100000 | ||
25 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/hw/sd/sdhci.c | ||
28 | +++ b/hw/sd/sdhci.c | ||
29 | @@ -XXX,XX +XXX,XX @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) | ||
30 | case SDHC_ACMD12ERRSTS: | ||
31 | ret = s->acmd12errsts; | ||
32 | break; | ||
33 | - case SDHC_CAPAREG: | ||
34 | + case SDHC_CAPAB: | ||
35 | ret = s->capareg; | ||
36 | break; | ||
37 | case SDHC_MAXCURR: | ||
38 | -- | ||
39 | 2.7.4 | ||
40 | |||
41 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | running qtests: | ||
4 | |||
5 | $ make check-qtest-arm | ||
6 | GTESTER check-qtest-arm | ||
7 | SDHC rd_4b @0x44 not implemented | ||
8 | SDHC wr_4b @0x40 <- 0x89abcdef not implemented | ||
9 | SDHC wr_4b @0x44 <- 0x01234567 not implemented | ||
10 | |||
11 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
13 | Message-id: 20180115182436.2066-12-f4bug@amsat.org | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | --- | ||
16 | include/hw/sd/sdhci.h | 4 ++-- | ||
17 | hw/sd/sdhci.c | 23 +++++++++++++++++++---- | ||
18 | 2 files changed, 21 insertions(+), 6 deletions(-) | ||
19 | |||
20 | diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/include/hw/sd/sdhci.h | ||
23 | +++ b/include/hw/sd/sdhci.h | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef struct SDHCIState { | ||
25 | uint64_t admasysaddr; /* ADMA System Address Register */ | ||
26 | |||
27 | /* Read-only registers */ | ||
28 | - uint32_t capareg; /* Capabilities Register */ | ||
29 | - uint32_t maxcurr; /* Maximum Current Capabilities Register */ | ||
30 | + uint64_t capareg; /* Capabilities Register */ | ||
31 | + uint64_t maxcurr; /* Maximum Current Capabilities Register */ | ||
32 | |||
33 | uint8_t *fifo_buffer; /* SD host i/o FIFO buffer */ | ||
34 | uint32_t buf_maxsz; | ||
35 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/hw/sd/sdhci.c | ||
38 | +++ b/hw/sd/sdhci.c | ||
39 | @@ -XXX,XX +XXX,XX @@ static uint64_t sdhci_read(void *opaque, hwaddr offset, unsigned size) | ||
40 | ret = s->acmd12errsts; | ||
41 | break; | ||
42 | case SDHC_CAPAB: | ||
43 | - ret = s->capareg; | ||
44 | + ret = (uint32_t)s->capareg; | ||
45 | + break; | ||
46 | + case SDHC_CAPAB + 4: | ||
47 | + ret = (uint32_t)(s->capareg >> 32); | ||
48 | break; | ||
49 | case SDHC_MAXCURR: | ||
50 | - ret = s->maxcurr; | ||
51 | + ret = (uint32_t)s->maxcurr; | ||
52 | + break; | ||
53 | + case SDHC_MAXCURR + 4: | ||
54 | + ret = (uint32_t)(s->maxcurr >> 32); | ||
55 | break; | ||
56 | case SDHC_ADMAERR: | ||
57 | ret = s->admaerr; | ||
58 | @@ -XXX,XX +XXX,XX @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | ||
59 | } | ||
60 | sdhci_update_irq(s); | ||
61 | break; | ||
62 | + | ||
63 | + case SDHC_CAPAB: | ||
64 | + case SDHC_CAPAB + 4: | ||
65 | + case SDHC_MAXCURR: | ||
66 | + case SDHC_MAXCURR + 4: | ||
67 | + qemu_log_mask(LOG_GUEST_ERROR, "SDHC wr_%ub @0x%02" HWADDR_PRIx | ||
68 | + " <- 0x%08x read-only\n", size, offset, value >> shift); | ||
69 | + break; | ||
70 | + | ||
71 | default: | ||
72 | qemu_log_mask(LOG_UNIMP, "SDHC wr_%ub @0x%02" HWADDR_PRIx " <- 0x%08x " | ||
73 | "not implemented\n", size, offset, value >> shift); | ||
74 | @@ -XXX,XX +XXX,XX @@ static inline unsigned int sdhci_get_fifolen(SDHCIState *s) | ||
75 | #define DEFINE_SDHCI_COMMON_PROPERTIES(_state) \ | ||
76 | /* Capabilities registers provide information on supported features | ||
77 | * of this specific host controller implementation */ \ | ||
78 | - DEFINE_PROP_UINT32("capareg", _state, capareg, SDHC_CAPAB_REG_DEFAULT), \ | ||
79 | - DEFINE_PROP_UINT32("maxcurr", _state, maxcurr, 0) | ||
80 | + DEFINE_PROP_UINT64("capareg", _state, capareg, SDHC_CAPAB_REG_DEFAULT), \ | ||
81 | + DEFINE_PROP_UINT64("maxcurr", _state, maxcurr, 0) | ||
82 | |||
83 | static void sdhci_initfn(SDHCIState *s) | ||
84 | { | ||
85 | -- | ||
86 | 2.7.4 | ||
87 | |||
88 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
2 | 1 | ||
3 | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> | ||
7 | Message-id: 20180115182436.2066-13-f4bug@amsat.org | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | --- | ||
10 | hw/sd/sdhci.c | 3 +++ | ||
11 | 1 file changed, 3 insertions(+) | ||
12 | |||
13 | diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/hw/sd/sdhci.c | ||
16 | +++ b/hw/sd/sdhci.c | ||
17 | @@ -XXX,XX +XXX,XX @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) | ||
18 | } | ||
19 | sdhci_update_irq(s); | ||
20 | break; | ||
21 | + case SDHC_ACMD12ERRSTS: | ||
22 | + MASKED_WRITE(s->acmd12errsts, mask, value); | ||
23 | + break; | ||
24 | |||
25 | case SDHC_CAPAB: | ||
26 | case SDHC_CAPAB + 4: | ||
27 | -- | ||
28 | 2.7.4 | ||
29 | |||
30 | diff view generated by jsdifflib |