1 | This series fixes some runtime overhead when handling interrupts in AHCIState. | 1 | This series fixes some runtime overhead when handling interrupts in AHCIState. |
---|---|---|---|
2 | It then extracts the SysBus implementation into a dedicated file for separation | 2 | It then extracts the SysBus implementation into a dedicated file for separation |
3 | of concerns. | 3 | of concerns. |
4 | |||
5 | v4: | ||
6 | * Port away from qemu_allocate_irq() while at it | ||
4 | 7 | ||
5 | v3: | 8 | v3: |
6 | * Remove extra PCI include in ahci-internal.h | 9 | * Remove extra PCI include in ahci-internal.h |
7 | * Extract SysBus implementation into dedicated file | 10 | * Extract SysBus implementation into dedicated file |
8 | 11 | ||
9 | Supersedes: 20241205114453.1848-1-shentey@gmail.com | 12 | Supersedes: 20241205114453.1848-1-shentey@gmail.com |
10 | 13 | ||
11 | Bernhard Beschow (2): | 14 | Bernhard Beschow (2): |
12 | hw/ide/ahci: Decouple from PCI | 15 | hw/ide/ahci: Decouple from PCI |
13 | hw/ide/ahci: Extract TYPE_SYSBUS_AHCI into dedicated file | 16 | hw/ide/ahci: Extract TYPE_SYSBUS_AHCI into dedicated file |
14 | 17 | ||
15 | hw/ide/ahci-internal.h | 1 - | 18 | hw/ide/ahci-internal.h | 1 - |
16 | include/hw/ide/ahci.h | 2 - | 19 | include/hw/ide/ahci-pci.h | 2 + |
17 | hw/ide/ahci-sysbus.c | 91 +++++++++++++++++++++++++++++++++++ | 20 | include/hw/ide/ahci.h | 2 - |
18 | hw/ide/ahci.c | 106 ++--------------------------------------- | 21 | hw/ide/ahci-sysbus.c | 91 ++++++++++++++++++++++++++++++++ |
19 | hw/ide/ich.c | 17 ++++++- | 22 | hw/ide/ahci.c | 106 ++------------------------------------ |
20 | hw/arm/Kconfig | 10 ++-- | 23 | hw/ide/ich.c | 19 +++++-- |
21 | hw/ide/Kconfig | 4 ++ | 24 | hw/arm/Kconfig | 10 ++-- |
22 | hw/ide/meson.build | 1 + | 25 | hw/ide/Kconfig | 4 ++ |
23 | 8 files changed, 121 insertions(+), 111 deletions(-) | 26 | hw/ide/meson.build | 1 + |
27 | 9 files changed, 122 insertions(+), 114 deletions(-) | ||
24 | create mode 100644 hw/ide/ahci-sysbus.c | 28 | create mode 100644 hw/ide/ahci-sysbus.c |
25 | 29 | ||
26 | -- | 30 | -- |
27 | 2.47.1 | 31 | 2.47.1 |
28 | 32 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
9 | reflected in Kconfig. | 9 | reflected in Kconfig. |
10 | 10 | ||
11 | Reported-by: Peter Xu <peterx@redhat.com> | 11 | Reported-by: Peter Xu <peterx@redhat.com> |
12 | Inspired-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 12 | Inspired-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
13 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | 13 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> |
14 | |||
15 | -- | ||
16 | Supersedes: 20241121100152.65476-1-philmd@linaro.org | ||
17 | --- | 14 | --- |
18 | hw/ide/ahci-internal.h | 1 - | 15 | hw/ide/ahci-internal.h | 1 - |
19 | include/hw/ide/ahci.h | 2 -- | 16 | include/hw/ide/ahci-pci.h | 2 ++ |
20 | hw/ide/ahci.c | 39 ++++----------------------------------- | 17 | include/hw/ide/ahci.h | 2 -- |
21 | hw/ide/ich.c | 17 ++++++++++++++++- | 18 | hw/ide/ahci.c | 39 ++++----------------------------------- |
22 | 4 files changed, 20 insertions(+), 39 deletions(-) | 19 | hw/ide/ich.c | 19 +++++++++++++++---- |
20 | 5 files changed, 21 insertions(+), 42 deletions(-) | ||
23 | 21 | ||
24 | diff --git a/hw/ide/ahci-internal.h b/hw/ide/ahci-internal.h | 22 | diff --git a/hw/ide/ahci-internal.h b/hw/ide/ahci-internal.h |
25 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/ide/ahci-internal.h | 24 | --- a/hw/ide/ahci-internal.h |
27 | +++ b/hw/ide/ahci-internal.h | 25 | +++ b/hw/ide/ahci-internal.h |
... | ... | ||
31 | #include "hw/ide/ahci.h" | 29 | #include "hw/ide/ahci.h" |
32 | -#include "hw/pci/pci_device.h" | 30 | -#include "hw/pci/pci_device.h" |
33 | #include "ide-internal.h" | 31 | #include "ide-internal.h" |
34 | 32 | ||
35 | #define AHCI_MEM_BAR_SIZE 0x1000 | 33 | #define AHCI_MEM_BAR_SIZE 0x1000 |
34 | diff --git a/include/hw/ide/ahci-pci.h b/include/hw/ide/ahci-pci.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/hw/ide/ahci-pci.h | ||
37 | +++ b/include/hw/ide/ahci-pci.h | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | #include "qom/object.h" | ||
40 | #include "hw/ide/ahci.h" | ||
41 | #include "hw/pci/pci_device.h" | ||
42 | +#include "hw/irq.h" | ||
43 | |||
44 | #define TYPE_ICH9_AHCI "ich9-ahci" | ||
45 | OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI) | ||
46 | @@ -XXX,XX +XXX,XX @@ struct AHCIPCIState { | ||
47 | PCIDevice parent_obj; | ||
48 | |||
49 | AHCIState ahci; | ||
50 | + IRQState irq; | ||
51 | }; | ||
52 | |||
53 | #endif | ||
36 | diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h | 54 | diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h |
37 | index XXXXXXX..XXXXXXX 100644 | 55 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/include/hw/ide/ahci.h | 56 | --- a/include/hw/ide/ahci.h |
39 | +++ b/include/hw/ide/ahci.h | 57 | +++ b/include/hw/ide/ahci.h |
40 | @@ -XXX,XX +XXX,XX @@ typedef struct AHCIControlRegs { | 58 | @@ -XXX,XX +XXX,XX @@ typedef struct AHCIControlRegs { |
... | ... | ||
127 | "ahci", AHCI_MEM_BAR_SIZE); | 145 | "ahci", AHCI_MEM_BAR_SIZE); |
128 | diff --git a/hw/ide/ich.c b/hw/ide/ich.c | 146 | diff --git a/hw/ide/ich.c b/hw/ide/ich.c |
129 | index XXXXXXX..XXXXXXX 100644 | 147 | index XXXXXXX..XXXXXXX 100644 |
130 | --- a/hw/ide/ich.c | 148 | --- a/hw/ide/ich.c |
131 | +++ b/hw/ide/ich.c | 149 | +++ b/hw/ide/ich.c |
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | */ | ||
152 | |||
153 | #include "qemu/osdep.h" | ||
154 | -#include "hw/irq.h" | ||
155 | #include "hw/pci/msi.h" | ||
156 | #include "hw/pci/pci.h" | ||
157 | #include "migration/vmstate.h" | ||
132 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_ich9_ahci = { | 158 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_ich9_ahci = { |
133 | }, | 159 | }, |
134 | }; | 160 | }; |
135 | 161 | ||
136 | +static void pci_ich9_ahci_update_irq(void *opaque, int irq_num, int level) | 162 | +static void pci_ich9_ahci_update_irq(void *opaque, int irq_num, int level) |
137 | +{ | 163 | +{ |
138 | + PCIDevice *pci_dev = opaque; | 164 | + PCIDevice *pci_dev = opaque; |
139 | + | ||
140 | + assert(irq_num == 0); | ||
141 | + | 165 | + |
142 | + if (msi_enabled(pci_dev)) { | 166 | + if (msi_enabled(pci_dev)) { |
143 | + if (level) { | 167 | + if (level) { |
144 | + msi_notify(pci_dev, 0); | 168 | + msi_notify(pci_dev, 0); |
145 | + } | 169 | + } |
... | ... | ||
149 | +} | 173 | +} |
150 | + | 174 | + |
151 | static void pci_ich9_reset(DeviceState *dev) | 175 | static void pci_ich9_reset(DeviceState *dev) |
152 | { | 176 | { |
153 | AHCIPCIState *d = ICH9_AHCI(dev); | 177 | AHCIPCIState *d = ICH9_AHCI(dev); |
178 | @@ -XXX,XX +XXX,XX @@ static void pci_ich9_ahci_init(Object *obj) | ||
179 | { | ||
180 | AHCIPCIState *d = ICH9_AHCI(obj); | ||
181 | |||
182 | + qemu_init_irq(&d->irq, pci_ich9_ahci_update_irq, d, 0); | ||
183 | ahci_init(&d->ahci, DEVICE(obj)); | ||
184 | + d->ahci.irq = &d->irq; | ||
185 | } | ||
186 | |||
187 | static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp) | ||
154 | @@ -XXX,XX +XXX,XX @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp) | 188 | @@ -XXX,XX +XXX,XX @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp) |
155 | /* XXX Software should program this register */ | 189 | /* XXX Software should program this register */ |
156 | dev->config[0x90] = 1 << 6; /* Address Map Register - AHCI mode */ | 190 | dev->config[0x90] = 1 << 6; /* Address Map Register - AHCI mode */ |
157 | 191 | ||
158 | - d->ahci.irq = pci_allocate_irq(dev); | 192 | - d->ahci.irq = pci_allocate_irq(dev); |
159 | + d->ahci.irq = qemu_allocate_irq(pci_ich9_ahci_update_irq, d, 0); | 193 | - |
160 | |||
161 | pci_register_bar(dev, ICH9_IDP_BAR, PCI_BASE_ADDRESS_SPACE_IO, | 194 | pci_register_bar(dev, ICH9_IDP_BAR, PCI_BASE_ADDRESS_SPACE_IO, |
162 | &d->ahci.idp); | 195 | &d->ahci.idp); |
196 | pci_register_bar(dev, ICH9_MEM_BAR, PCI_BASE_ADDRESS_SPACE_MEMORY, | ||
197 | @@ -XXX,XX +XXX,XX @@ static void pci_ich9_uninit(PCIDevice *dev) | ||
198 | |||
199 | msi_uninit(dev); | ||
200 | ahci_uninit(&d->ahci); | ||
201 | - qemu_free_irq(d->ahci.irq); | ||
202 | } | ||
203 | |||
204 | static void ich_ahci_class_init(ObjectClass *klass, void *data) | ||
163 | -- | 205 | -- |
164 | 2.47.1 | 206 | 2.47.1 |
165 | 207 | ||
166 | 208 | diff view generated by jsdifflib |
1 | Implement in dedicated file, just like TYPE_ICH9_AHCI. | 1 | Implement in dedicated file, just like TYPE_ICH9_AHCI. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | 3 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> |
4 | --- | 4 | --- |
5 | hw/ide/ahci-sysbus.c | 91 ++++++++++++++++++++++++++++++++++++++++++++ | 5 | hw/ide/ahci-sysbus.c | 91 ++++++++++++++++++++++++++++++++++++++++++++ |
6 | hw/ide/ahci.c | 67 -------------------------------- | 6 | hw/ide/ahci.c | 67 -------------------------------- |
7 | hw/arm/Kconfig | 10 ++--- | 7 | hw/arm/Kconfig | 10 ++--- |
8 | hw/ide/Kconfig | 4 ++ | 8 | hw/ide/Kconfig | 4 ++ |
9 | hw/ide/meson.build | 1 + | 9 | hw/ide/meson.build | 1 + |
10 | 5 files changed, 101 insertions(+), 72 deletions(-) | 10 | 5 files changed, 101 insertions(+), 72 deletions(-) |
11 | create mode 100644 hw/ide/ahci-sysbus.c | 11 | create mode 100644 hw/ide/ahci-sysbus.c |
12 | 12 | ||
13 | diff --git a/hw/ide/ahci-sysbus.c b/hw/ide/ahci-sysbus.c | 13 | diff --git a/hw/ide/ahci-sysbus.c b/hw/ide/ahci-sysbus.c |
14 | new file mode 100644 | 14 | new file mode 100644 |
15 | index XXXXXXX..XXXXXXX | 15 | index XXXXXXX..XXXXXXX |
16 | --- /dev/null | 16 | --- /dev/null |
17 | +++ b/hw/ide/ahci-sysbus.c | 17 | +++ b/hw/ide/ahci-sysbus.c |
18 | @@ -XXX,XX +XXX,XX @@ | 18 | @@ -XXX,XX +XXX,XX @@ |
19 | +/* | 19 | +/* |
20 | + * QEMU AHCI Emulation (MMIO-mapped devices) | 20 | + * QEMU AHCI Emulation (MMIO-mapped devices) |
21 | + * | 21 | + * |
22 | + * Copyright (c) 2010 qiaochong@loongson.cn | 22 | + * Copyright (c) 2010 qiaochong@loongson.cn |
23 | + * Copyright (c) 2010 Roland Elek <elek.roland@gmail.com> | 23 | + * Copyright (c) 2010 Roland Elek <elek.roland@gmail.com> |
24 | + * Copyright (c) 2010 Sebastian Herbszt <herbszt@gmx.de> | 24 | + * Copyright (c) 2010 Sebastian Herbszt <herbszt@gmx.de> |
25 | + * Copyright (c) 2010 Alexander Graf <agraf@suse.de> | 25 | + * Copyright (c) 2010 Alexander Graf <agraf@suse.de> |
26 | + * | 26 | + * |
27 | + * This library is free software; you can redistribute it and/or | 27 | + * This library is free software; you can redistribute it and/or |
28 | + * modify it under the terms of the GNU Lesser General Public | 28 | + * modify it under the terms of the GNU Lesser General Public |
29 | + * License as published by the Free Software Foundation; either | 29 | + * License as published by the Free Software Foundation; either |
30 | + * version 2.1 of the License, or (at your option) any later version. | 30 | + * version 2.1 of the License, or (at your option) any later version. |
31 | + * | 31 | + * |
32 | + * This library is distributed in the hope that it will be useful, | 32 | + * This library is distributed in the hope that it will be useful, |
33 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | 33 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
34 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 34 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
35 | + * Lesser General Public License for more details. | 35 | + * Lesser General Public License for more details. |
36 | + * | 36 | + * |
37 | + * You should have received a copy of the GNU Lesser General Public | 37 | + * You should have received a copy of the GNU Lesser General Public |
38 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. | 38 | + * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
39 | + * | 39 | + * |
40 | + */ | 40 | + */ |
41 | + | 41 | + |
42 | +#include "qemu/osdep.h" | 42 | +#include "qemu/osdep.h" |
43 | +#include "exec/address-spaces.h" | 43 | +#include "exec/address-spaces.h" |
44 | +#include "hw/qdev-properties.h" | 44 | +#include "hw/qdev-properties.h" |
45 | +#include "migration/vmstate.h" | 45 | +#include "migration/vmstate.h" |
46 | + | 46 | + |
47 | +#include "hw/ide/ahci-sysbus.h" | 47 | +#include "hw/ide/ahci-sysbus.h" |
48 | +#include "ahci-internal.h" | 48 | +#include "ahci-internal.h" |
49 | + | 49 | + |
50 | +static const VMStateDescription vmstate_sysbus_ahci = { | 50 | +static const VMStateDescription vmstate_sysbus_ahci = { |
51 | + .name = "sysbus-ahci", | 51 | + .name = "sysbus-ahci", |
52 | + .fields = (const VMStateField[]) { | 52 | + .fields = (const VMStateField[]) { |
53 | + VMSTATE_AHCI(ahci, SysbusAHCIState), | 53 | + VMSTATE_AHCI(ahci, SysbusAHCIState), |
54 | + VMSTATE_END_OF_LIST() | 54 | + VMSTATE_END_OF_LIST() |
55 | + }, | 55 | + }, |
56 | +}; | 56 | +}; |
57 | + | 57 | + |
58 | +static void sysbus_ahci_reset(DeviceState *dev) | 58 | +static void sysbus_ahci_reset(DeviceState *dev) |
59 | +{ | 59 | +{ |
60 | + SysbusAHCIState *s = SYSBUS_AHCI(dev); | 60 | + SysbusAHCIState *s = SYSBUS_AHCI(dev); |
61 | + | 61 | + |
62 | + ahci_reset(&s->ahci); | 62 | + ahci_reset(&s->ahci); |
63 | +} | 63 | +} |
64 | + | 64 | + |
65 | +static void sysbus_ahci_init(Object *obj) | 65 | +static void sysbus_ahci_init(Object *obj) |
66 | +{ | 66 | +{ |
67 | + SysbusAHCIState *s = SYSBUS_AHCI(obj); | 67 | + SysbusAHCIState *s = SYSBUS_AHCI(obj); |
68 | + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 68 | + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); |
69 | + | 69 | + |
70 | + ahci_init(&s->ahci, DEVICE(obj)); | 70 | + ahci_init(&s->ahci, DEVICE(obj)); |
71 | + | 71 | + |
72 | + sysbus_init_mmio(sbd, &s->ahci.mem); | 72 | + sysbus_init_mmio(sbd, &s->ahci.mem); |
73 | + sysbus_init_irq(sbd, &s->ahci.irq); | 73 | + sysbus_init_irq(sbd, &s->ahci.irq); |
74 | +} | 74 | +} |
75 | + | 75 | + |
76 | +static void sysbus_ahci_realize(DeviceState *dev, Error **errp) | 76 | +static void sysbus_ahci_realize(DeviceState *dev, Error **errp) |
77 | +{ | 77 | +{ |
78 | + SysbusAHCIState *s = SYSBUS_AHCI(dev); | 78 | + SysbusAHCIState *s = SYSBUS_AHCI(dev); |
79 | + | 79 | + |
80 | + ahci_realize(&s->ahci, dev, &address_space_memory); | 80 | + ahci_realize(&s->ahci, dev, &address_space_memory); |
81 | +} | 81 | +} |
82 | + | 82 | + |
83 | +static Property sysbus_ahci_properties[] = { | 83 | +static Property sysbus_ahci_properties[] = { |
84 | + DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1), | 84 | + DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1), |
85 | + DEFINE_PROP_END_OF_LIST(), | 85 | + DEFINE_PROP_END_OF_LIST(), |
86 | +}; | 86 | +}; |
87 | + | 87 | + |
88 | +static void sysbus_ahci_class_init(ObjectClass *klass, void *data) | 88 | +static void sysbus_ahci_class_init(ObjectClass *klass, void *data) |
89 | +{ | 89 | +{ |
90 | + DeviceClass *dc = DEVICE_CLASS(klass); | 90 | + DeviceClass *dc = DEVICE_CLASS(klass); |
91 | + | 91 | + |
92 | + dc->realize = sysbus_ahci_realize; | 92 | + dc->realize = sysbus_ahci_realize; |
93 | + dc->vmsd = &vmstate_sysbus_ahci; | 93 | + dc->vmsd = &vmstate_sysbus_ahci; |
94 | + device_class_set_props(dc, sysbus_ahci_properties); | 94 | + device_class_set_props(dc, sysbus_ahci_properties); |
95 | + device_class_set_legacy_reset(dc, sysbus_ahci_reset); | 95 | + device_class_set_legacy_reset(dc, sysbus_ahci_reset); |
96 | + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | 96 | + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); |
97 | +} | 97 | +} |
98 | + | 98 | + |
99 | +static const TypeInfo sysbus_ahci_types[] = { | 99 | +static const TypeInfo sysbus_ahci_types[] = { |
100 | + { | 100 | + { |
101 | + .name = TYPE_SYSBUS_AHCI, | 101 | + .name = TYPE_SYSBUS_AHCI, |
102 | + .parent = TYPE_SYS_BUS_DEVICE, | 102 | + .parent = TYPE_SYS_BUS_DEVICE, |
103 | + .instance_size = sizeof(SysbusAHCIState), | 103 | + .instance_size = sizeof(SysbusAHCIState), |
104 | + .instance_init = sysbus_ahci_init, | 104 | + .instance_init = sysbus_ahci_init, |
105 | + .class_init = sysbus_ahci_class_init, | 105 | + .class_init = sysbus_ahci_class_init, |
106 | + }, | 106 | + }, |
107 | +}; | 107 | +}; |
108 | + | 108 | + |
109 | +DEFINE_TYPES(sysbus_ahci_types) | 109 | +DEFINE_TYPES(sysbus_ahci_types) |
110 | diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c | 110 | diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c |
111 | index XXXXXXX..XXXXXXX 100644 | 111 | index XXXXXXX..XXXXXXX 100644 |
112 | --- a/hw/ide/ahci.c | 112 | --- a/hw/ide/ahci.c |
113 | +++ b/hw/ide/ahci.c | 113 | +++ b/hw/ide/ahci.c |
114 | @@ -XXX,XX +XXX,XX @@ | 114 | @@ -XXX,XX +XXX,XX @@ |
115 | 115 | ||
116 | #include "qemu/osdep.h" | 116 | #include "qemu/osdep.h" |
117 | #include "hw/irq.h" | 117 | #include "hw/irq.h" |
118 | -#include "hw/qdev-properties.h" | 118 | -#include "hw/qdev-properties.h" |
119 | #include "migration/vmstate.h" | 119 | #include "migration/vmstate.h" |
120 | 120 | ||
121 | #include "qemu/error-report.h" | 121 | #include "qemu/error-report.h" |
122 | #include "qemu/log.h" | 122 | #include "qemu/log.h" |
123 | #include "qemu/main-loop.h" | 123 | #include "qemu/main-loop.h" |
124 | -#include "qemu/module.h" | 124 | -#include "qemu/module.h" |
125 | #include "sysemu/block-backend.h" | 125 | #include "sysemu/block-backend.h" |
126 | #include "sysemu/dma.h" | 126 | #include "sysemu/dma.h" |
127 | -#include "hw/ide/ahci-sysbus.h" | 127 | -#include "hw/ide/ahci-sysbus.h" |
128 | #include "ahci-internal.h" | 128 | #include "ahci-internal.h" |
129 | #include "ide-internal.h" | 129 | #include "ide-internal.h" |
130 | 130 | ||
131 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_ahci = { | 131 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_ahci = { |
132 | }, | 132 | }, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | -static const VMStateDescription vmstate_sysbus_ahci = { | 135 | -static const VMStateDescription vmstate_sysbus_ahci = { |
136 | - .name = "sysbus-ahci", | 136 | - .name = "sysbus-ahci", |
137 | - .fields = (const VMStateField[]) { | 137 | - .fields = (const VMStateField[]) { |
138 | - VMSTATE_AHCI(ahci, SysbusAHCIState), | 138 | - VMSTATE_AHCI(ahci, SysbusAHCIState), |
139 | - VMSTATE_END_OF_LIST() | 139 | - VMSTATE_END_OF_LIST() |
140 | - }, | 140 | - }, |
141 | -}; | 141 | -}; |
142 | - | 142 | - |
143 | -static void sysbus_ahci_reset(DeviceState *dev) | 143 | -static void sysbus_ahci_reset(DeviceState *dev) |
144 | -{ | 144 | -{ |
145 | - SysbusAHCIState *s = SYSBUS_AHCI(dev); | 145 | - SysbusAHCIState *s = SYSBUS_AHCI(dev); |
146 | - | 146 | - |
147 | - ahci_reset(&s->ahci); | 147 | - ahci_reset(&s->ahci); |
148 | -} | 148 | -} |
149 | - | 149 | - |
150 | -static void sysbus_ahci_init(Object *obj) | 150 | -static void sysbus_ahci_init(Object *obj) |
151 | -{ | 151 | -{ |
152 | - SysbusAHCIState *s = SYSBUS_AHCI(obj); | 152 | - SysbusAHCIState *s = SYSBUS_AHCI(obj); |
153 | - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); | 153 | - SysBusDevice *sbd = SYS_BUS_DEVICE(obj); |
154 | - | 154 | - |
155 | - ahci_init(&s->ahci, DEVICE(obj)); | 155 | - ahci_init(&s->ahci, DEVICE(obj)); |
156 | - | 156 | - |
157 | - sysbus_init_mmio(sbd, &s->ahci.mem); | 157 | - sysbus_init_mmio(sbd, &s->ahci.mem); |
158 | - sysbus_init_irq(sbd, &s->ahci.irq); | 158 | - sysbus_init_irq(sbd, &s->ahci.irq); |
159 | -} | 159 | -} |
160 | - | 160 | - |
161 | -static void sysbus_ahci_realize(DeviceState *dev, Error **errp) | 161 | -static void sysbus_ahci_realize(DeviceState *dev, Error **errp) |
162 | -{ | 162 | -{ |
163 | - SysbusAHCIState *s = SYSBUS_AHCI(dev); | 163 | - SysbusAHCIState *s = SYSBUS_AHCI(dev); |
164 | - | 164 | - |
165 | - ahci_realize(&s->ahci, dev, &address_space_memory); | 165 | - ahci_realize(&s->ahci, dev, &address_space_memory); |
166 | -} | 166 | -} |
167 | - | 167 | - |
168 | -static Property sysbus_ahci_properties[] = { | 168 | -static Property sysbus_ahci_properties[] = { |
169 | - DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1), | 169 | - DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1), |
170 | - DEFINE_PROP_END_OF_LIST(), | 170 | - DEFINE_PROP_END_OF_LIST(), |
171 | -}; | 171 | -}; |
172 | - | 172 | - |
173 | -static void sysbus_ahci_class_init(ObjectClass *klass, void *data) | 173 | -static void sysbus_ahci_class_init(ObjectClass *klass, void *data) |
174 | -{ | 174 | -{ |
175 | - DeviceClass *dc = DEVICE_CLASS(klass); | 175 | - DeviceClass *dc = DEVICE_CLASS(klass); |
176 | - | 176 | - |
177 | - dc->realize = sysbus_ahci_realize; | 177 | - dc->realize = sysbus_ahci_realize; |
178 | - dc->vmsd = &vmstate_sysbus_ahci; | 178 | - dc->vmsd = &vmstate_sysbus_ahci; |
179 | - device_class_set_props(dc, sysbus_ahci_properties); | 179 | - device_class_set_props(dc, sysbus_ahci_properties); |
180 | - device_class_set_legacy_reset(dc, sysbus_ahci_reset); | 180 | - device_class_set_legacy_reset(dc, sysbus_ahci_reset); |
181 | - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | 181 | - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); |
182 | -} | 182 | -} |
183 | - | 183 | - |
184 | -static const TypeInfo sysbus_ahci_info = { | 184 | -static const TypeInfo sysbus_ahci_info = { |
185 | - .name = TYPE_SYSBUS_AHCI, | 185 | - .name = TYPE_SYSBUS_AHCI, |
186 | - .parent = TYPE_SYS_BUS_DEVICE, | 186 | - .parent = TYPE_SYS_BUS_DEVICE, |
187 | - .instance_size = sizeof(SysbusAHCIState), | 187 | - .instance_size = sizeof(SysbusAHCIState), |
188 | - .instance_init = sysbus_ahci_init, | 188 | - .instance_init = sysbus_ahci_init, |
189 | - .class_init = sysbus_ahci_class_init, | 189 | - .class_init = sysbus_ahci_class_init, |
190 | -}; | 190 | -}; |
191 | - | 191 | - |
192 | -static void sysbus_ahci_register_types(void) | 192 | -static void sysbus_ahci_register_types(void) |
193 | -{ | 193 | -{ |
194 | - type_register_static(&sysbus_ahci_info); | 194 | - type_register_static(&sysbus_ahci_info); |
195 | -} | 195 | -} |
196 | - | 196 | - |
197 | -type_init(sysbus_ahci_register_types) | 197 | -type_init(sysbus_ahci_register_types) |
198 | - | 198 | - |
199 | void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd) | 199 | void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd) |
200 | { | 200 | { |
201 | int i; | 201 | int i; |
202 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 202 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
203 | index XXXXXXX..XXXXXXX 100644 | 203 | index XXXXXXX..XXXXXXX 100644 |
204 | --- a/hw/arm/Kconfig | 204 | --- a/hw/arm/Kconfig |
205 | +++ b/hw/arm/Kconfig | 205 | +++ b/hw/arm/Kconfig |
206 | @@ -XXX,XX +XXX,XX @@ config HIGHBANK | 206 | @@ -XXX,XX +XXX,XX @@ config HIGHBANK |
207 | depends on TCG && ARM | 207 | depends on TCG && ARM |
208 | select A9MPCORE | 208 | select A9MPCORE |
209 | select A15MPCORE | 209 | select A15MPCORE |
210 | - select AHCI | 210 | - select AHCI |
211 | + select AHCI_SYSBUS | 211 | + select AHCI_SYSBUS |
212 | select ARM_TIMER # sp804 | 212 | select ARM_TIMER # sp804 |
213 | select ARM_V7M | 213 | select ARM_V7M |
214 | select PL011 if !HAVE_RUST # UART | 214 | select PL011 if !HAVE_RUST # UART |
215 | @@ -XXX,XX +XXX,XX @@ config SBSA_REF | 215 | @@ -XXX,XX +XXX,XX @@ config SBSA_REF |
216 | depends on TCG && AARCH64 | 216 | depends on TCG && AARCH64 |
217 | imply PCI_DEVICES | 217 | imply PCI_DEVICES |
218 | select DEVICE_TREE | 218 | select DEVICE_TREE |
219 | - select AHCI | 219 | - select AHCI |
220 | + select AHCI_SYSBUS | 220 | + select AHCI_SYSBUS |
221 | select ARM_SMMUV3 | 221 | select ARM_SMMUV3 |
222 | select GPIO_KEY | 222 | select GPIO_KEY |
223 | select PCI_EXPRESS | 223 | select PCI_EXPRESS |
224 | @@ -XXX,XX +XXX,XX @@ config ARM_V7M | 224 | @@ -XXX,XX +XXX,XX @@ config ARM_V7M |
225 | 225 | ||
226 | config ALLWINNER_A10 | 226 | config ALLWINNER_A10 |
227 | bool | 227 | bool |
228 | - select AHCI | 228 | - select AHCI |
229 | + select AHCI_SYSBUS | 229 | + select AHCI_SYSBUS |
230 | select ALLWINNER_A10_PIT | 230 | select ALLWINNER_A10_PIT |
231 | select ALLWINNER_A10_PIC | 231 | select ALLWINNER_A10_PIC |
232 | select ALLWINNER_A10_CCM | 232 | select ALLWINNER_A10_CCM |
233 | @@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3 | 233 | @@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3 |
234 | config ALLWINNER_R40 | 234 | config ALLWINNER_R40 |
235 | bool | 235 | bool |
236 | default y if TCG && ARM | 236 | default y if TCG && ARM |
237 | - select AHCI | 237 | - select AHCI |
238 | + select AHCI_SYSBUS | 238 | + select AHCI_SYSBUS |
239 | select ALLWINNER_SRAMC | 239 | select ALLWINNER_SRAMC |
240 | select ALLWINNER_A10_PIT | 240 | select ALLWINNER_A10_PIT |
241 | select ALLWINNER_WDT | 241 | select ALLWINNER_WDT |
242 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM | 242 | @@ -XXX,XX +XXX,XX @@ config XLNX_ZYNQMP_ARM |
243 | bool | 243 | bool |
244 | default y if PIXMAN | 244 | default y if PIXMAN |
245 | depends on TCG && AARCH64 | 245 | depends on TCG && AARCH64 |
246 | - select AHCI | 246 | - select AHCI |
247 | + select AHCI_SYSBUS | 247 | + select AHCI_SYSBUS |
248 | select ARM_GIC | 248 | select ARM_GIC |
249 | select CADENCE | 249 | select CADENCE |
250 | select CPU_CLUSTER | 250 | select CPU_CLUSTER |
251 | diff --git a/hw/ide/Kconfig b/hw/ide/Kconfig | 251 | diff --git a/hw/ide/Kconfig b/hw/ide/Kconfig |
252 | index XXXXXXX..XXXXXXX 100644 | 252 | index XXXXXXX..XXXXXXX 100644 |
253 | --- a/hw/ide/Kconfig | 253 | --- a/hw/ide/Kconfig |
254 | +++ b/hw/ide/Kconfig | 254 | +++ b/hw/ide/Kconfig |
255 | @@ -XXX,XX +XXX,XX @@ config AHCI_ICH9 | 255 | @@ -XXX,XX +XXX,XX @@ config AHCI_ICH9 |
256 | depends on PCI | 256 | depends on PCI |
257 | select AHCI | 257 | select AHCI |
258 | 258 | ||
259 | +config AHCI_SYSBUS | 259 | +config AHCI_SYSBUS |
260 | + bool | 260 | + bool |
261 | + select AHCI | 261 | + select AHCI |
262 | + | 262 | + |
263 | config IDE_SII3112 | 263 | config IDE_SII3112 |
264 | bool | 264 | bool |
265 | select IDE_PCI | 265 | select IDE_PCI |
266 | diff --git a/hw/ide/meson.build b/hw/ide/meson.build | 266 | diff --git a/hw/ide/meson.build b/hw/ide/meson.build |
267 | index XXXXXXX..XXXXXXX 100644 | 267 | index XXXXXXX..XXXXXXX 100644 |
268 | --- a/hw/ide/meson.build | 268 | --- a/hw/ide/meson.build |
269 | +++ b/hw/ide/meson.build | 269 | +++ b/hw/ide/meson.build |
270 | @@ -XXX,XX +XXX,XX @@ | 270 | @@ -XXX,XX +XXX,XX @@ |
271 | system_ss.add(when: 'CONFIG_AHCI', if_true: files('ahci.c')) | 271 | system_ss.add(when: 'CONFIG_AHCI', if_true: files('ahci.c')) |
272 | system_ss.add(when: 'CONFIG_AHCI_ICH9', if_true: files('ich.c')) | 272 | system_ss.add(when: 'CONFIG_AHCI_ICH9', if_true: files('ich.c')) |
273 | +system_ss.add(when: 'CONFIG_AHCI_SYSBUS', if_true: files('ahci-sysbus.c')) | 273 | +system_ss.add(when: 'CONFIG_AHCI_SYSBUS', if_true: files('ahci-sysbus.c')) |
274 | system_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('ahci-allwinner.c')) | 274 | system_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('ahci-allwinner.c')) |
275 | system_ss.add(when: 'CONFIG_IDE_BUS', if_true: files('ide-bus.c')) | 275 | system_ss.add(when: 'CONFIG_IDE_BUS', if_true: files('ide-bus.c')) |
276 | system_ss.add(when: 'CONFIG_IDE_CF', if_true: files('cf.c')) | 276 | system_ss.add(when: 'CONFIG_IDE_CF', if_true: files('cf.c')) |
277 | -- | 277 | -- |
278 | 2.47.1 | 278 | 2.47.1 | diff view generated by jsdifflib |