Skip to content

Commit 5c65b1f

Browse files
committed
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200713' into staging
target-arm queue: * hw/arm/bcm2836: Remove unused 'cpu_type' field * target/arm: Fix mtedesc for do_mem_zpz * Add the ability to change the FEC PHY MDIO device number on i.MX25/i.MX6/i.MX7 * target/arm: Don't do raw writes for PMINTENCLR * virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() * build: Fix various issues with building on Haiku * target/nios2: fix wrctl behaviour when using icount * hw/arm/tosa: Encapsulate misc GPIO handling in a device * hw/arm/palm.c: Encapsulate misc GPIO handling in a device * hw/arm/aspeed: Do not create and attach empty SD cards by default # gpg: Signature made Mon 13 Jul 2020 15:08:16 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "[email protected]" # gpg: Good signature from "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # gpg: aka "Peter Maydell <[email protected]>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20200713: (25 commits) hw/arm/aspeed: Do not create and attach empty SD cards by default hw/arm/palm.c: Encapsulate misc GPIO handling in a device hw/arm/palm.c: Detabify hw/arm/tosa: Encapsulate misc GPIO handling in a device hw/arm/tosa.c: Detabify hw/nios2: exit to main CPU loop only when unmasking interrupts target/nios2: Use gen_io_start around wrctl instruction target/nios2: in line the semantics of DISAS_UPDATE with other targets target/nios2: add DISAS_NORETURN case for nothing more to generate util/drm: make portable by avoiding struct dirent d_type util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD bswap.h: Include <endian.h> on Haiku for bswap operations osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL osdep.h: Always include <sys/signal.h> if it exists build: Check that mlockall() exists util/qemu-openpty.c: Don't assume pty.h is glibc-only build: Enable BSD symbols for Haiku virtio-iommu: Fix coverity issue in virtio_iommu_handle_command() target/arm: Don't do raw writes for PMINTENCLR ... Signed-off-by: Peter Maydell <[email protected]>
2 parents 00ce6c3 + 756f739 commit 5c65b1f

24 files changed

+296
-107
lines changed

configure

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,8 @@ SunOS)
904904
;;
905905
Haiku)
906906
haiku="yes"
907-
QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
908-
LIBS="-lposix_error_mapper -lnetwork $LIBS"
907+
QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS"
908+
LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS"
909909
;;
910910
Linux)
911911
audio_drv_list="try-pa oss"
@@ -2402,6 +2402,24 @@ else
24022402
l2tpv3=no
24032403
fi
24042404

2405+
if check_include "pty.h" ; then
2406+
pty_h=yes
2407+
else
2408+
pty_h=no
2409+
fi
2410+
2411+
cat > $TMPC <<EOF
2412+
#include <sys/mman.h>
2413+
int main(int argc, char *argv[]) {
2414+
return mlockall(MCL_FUTURE);
2415+
}
2416+
EOF
2417+
if compile_prog "" "" ; then
2418+
have_mlockall=yes
2419+
else
2420+
have_mlockall=no
2421+
fi
2422+
24052423
#########################################
24062424
# vhost interdependencies and host support
24072425

@@ -3226,6 +3244,13 @@ if check_include "libdrm/drm.h" ; then
32263244
have_drm_h=yes
32273245
fi
32283246

3247+
#########################################
3248+
# sys/signal.h check
3249+
have_sys_signal_h=no
3250+
if check_include "sys/signal.h" ; then
3251+
have_sys_signal_h=yes
3252+
fi
3253+
32293254
##########################################
32303255
# VTE probe
32313256

@@ -7415,6 +7440,9 @@ fi
74157440
if test "$have_openpty" = "yes" ; then
74167441
echo "HAVE_OPENPTY=y" >> $config_host_mak
74177442
fi
7443+
if test "$have_sys_signal_h" = "yes" ; then
7444+
echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak
7445+
fi
74187446

74197447
# Work around a system header bug with some kernel/XFS header
74207448
# versions where they both try to define 'struct fsxattr':
@@ -7893,6 +7921,12 @@ fi
78937921
if test "$sheepdog" = "yes" ; then
78947922
echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
78957923
fi
7924+
if test "$pty_h" = "yes" ; then
7925+
echo "HAVE_PTY_H=y" >> $config_host_mak
7926+
fi
7927+
if test "$have_mlockall" = "yes" ; then
7928+
echo "HAVE_MLOCKALL=y" >> $config_host_mak
7929+
fi
78967930
if test "$fuzzing" = "yes" ; then
78977931
if test "$have_fuzzer" = "yes"; then
78987932
FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"

hw/arm/aspeed.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
246246
{
247247
DeviceState *card;
248248

249-
card = qdev_new(TYPE_SD_CARD);
250-
if (dinfo) {
251-
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
252-
&error_fatal);
249+
if (!dinfo) {
250+
return;
253251
}
252+
card = qdev_new(TYPE_SD_CARD);
253+
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
254+
&error_fatal);
254255
qdev_realize_and_unref(card,
255256
qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
256257
&error_fatal);

hw/arm/fsl-imx25.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
171171
epit_table[i].irq));
172172
}
173173

174+
object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err);
174175
qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]);
175176

176177
if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) {
@@ -315,10 +316,16 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
315316
&s->iram_alias);
316317
}
317318

319+
static Property fsl_imx25_properties[] = {
320+
DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0),
321+
DEFINE_PROP_END_OF_LIST(),
322+
};
323+
318324
static void fsl_imx25_class_init(ObjectClass *oc, void *data)
319325
{
320326
DeviceClass *dc = DEVICE_CLASS(oc);
321327

328+
device_class_set_props(dc, fsl_imx25_properties);
322329
dc->realize = fsl_imx25_realize;
323330
dc->desc = "i.MX25 SOC";
324331
/*

hw/arm/fsl-imx6.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
377377
spi_table[i].irq));
378378
}
379379

380+
object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err);
380381
qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]);
381382
if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) {
382383
return;
@@ -449,10 +450,16 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
449450
&s->ocram_alias);
450451
}
451452

453+
static Property fsl_imx6_properties[] = {
454+
DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0),
455+
DEFINE_PROP_END_OF_LIST(),
456+
};
457+
452458
static void fsl_imx6_class_init(ObjectClass *oc, void *data)
453459
{
454460
DeviceClass *dc = DEVICE_CLASS(oc);
455461

462+
device_class_set_props(dc, fsl_imx6_properties);
456463
dc->realize = fsl_imx6_realize;
457464
dc->desc = "i.MX6 SOC";
458465
/* Reason: Uses serial_hd() in the realize() function */

hw/arm/fsl-imx7.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
363363
FSL_IMX7_ENET2_ADDR,
364364
};
365365

366+
object_property_set_uint(OBJECT(&s->eth[i]), "phy-num",
367+
s->phy_num[i], &error_abort);
366368
object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
367369
FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort);
368370
qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
@@ -550,10 +552,17 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
550552
FSL_IMX7_PCIE_PHY_SIZE);
551553
}
552554

555+
static Property fsl_imx7_properties[] = {
556+
DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0),
557+
DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1),
558+
DEFINE_PROP_END_OF_LIST(),
559+
};
560+
553561
static void fsl_imx7_class_init(ObjectClass *oc, void *data)
554562
{
555563
DeviceClass *dc = DEVICE_CLASS(oc);
556564

565+
device_class_set_props(dc, fsl_imx7_properties);
557566
dc->realize = fsl_imx7_realize;
558567

559568
/* Reason: Uses serial_hds and nd_table in realize() directly */

hw/arm/palm.c

Lines changed: 77 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ static const MemoryRegionOps static_ops = {
6161
/* Palm Tunsgten|E support */
6262

6363
/* Shared GPIOs */
64-
#define PALMTE_USBDETECT_GPIO 0
65-
#define PALMTE_USB_OR_DC_GPIO 1
66-
#define PALMTE_TSC_GPIO 4
67-
#define PALMTE_PINTDAV_GPIO 6
68-
#define PALMTE_MMC_WP_GPIO 8
69-
#define PALMTE_MMC_POWER_GPIO 9
70-
#define PALMTE_HDQ_GPIO 11
71-
#define PALMTE_HEADPHONES_GPIO 14
72-
#define PALMTE_SPEAKER_GPIO 15
64+
#define PALMTE_USBDETECT_GPIO 0
65+
#define PALMTE_USB_OR_DC_GPIO 1
66+
#define PALMTE_TSC_GPIO 4
67+
#define PALMTE_PINTDAV_GPIO 6
68+
#define PALMTE_MMC_WP_GPIO 8
69+
#define PALMTE_MMC_POWER_GPIO 9
70+
#define PALMTE_HDQ_GPIO 11
71+
#define PALMTE_HEADPHONES_GPIO 14
72+
#define PALMTE_SPEAKER_GPIO 15
7373
/* MPU private GPIOs */
74-
#define PALMTE_DC_GPIO 2
75-
#define PALMTE_MMC_SWITCH_GPIO 4
76-
#define PALMTE_MMC1_GPIO 6
77-
#define PALMTE_MMC2_GPIO 7
78-
#define PALMTE_MMC3_GPIO 11
74+
#define PALMTE_DC_GPIO 2
75+
#define PALMTE_MMC_SWITCH_GPIO 4
76+
#define PALMTE_MMC1_GPIO 6
77+
#define PALMTE_MMC2_GPIO 7
78+
#define PALMTE_MMC3_GPIO 11
7979

8080
static MouseTransformInfo palmte_pointercal = {
8181
.x = 320,
@@ -100,17 +100,17 @@ static struct {
100100
int column;
101101
} palmte_keymap[0x80] = {
102102
[0 ... 0x7f] = { -1, -1 },
103-
[0x3b] = { 0, 0 }, /* F1 -> Calendar */
104-
[0x3c] = { 1, 0 }, /* F2 -> Contacts */
105-
[0x3d] = { 2, 0 }, /* F3 -> Tasks List */
106-
[0x3e] = { 3, 0 }, /* F4 -> Note Pad */
107-
[0x01] = { 4, 0 }, /* Esc -> Power */
108-
[0x4b] = { 0, 1 }, /* Left */
109-
[0x50] = { 1, 1 }, /* Down */
110-
[0x48] = { 2, 1 }, /* Up */
111-
[0x4d] = { 3, 1 }, /* Right */
112-
[0x4c] = { 4, 1 }, /* Centre */
113-
[0x39] = { 4, 1 }, /* Spc -> Centre */
103+
[0x3b] = { 0, 0 }, /* F1 -> Calendar */
104+
[0x3c] = { 1, 0 }, /* F2 -> Contacts */
105+
[0x3d] = { 2, 0 }, /* F3 -> Tasks List */
106+
[0x3e] = { 3, 0 }, /* F4 -> Note Pad */
107+
[0x01] = { 4, 0 }, /* Esc -> Power */
108+
[0x4b] = { 0, 1 }, /* Left */
109+
[0x50] = { 1, 1 }, /* Down */
110+
[0x48] = { 2, 1 }, /* Up */
111+
[0x4d] = { 3, 1 }, /* Right */
112+
[0x4c] = { 4, 1 }, /* Centre */
113+
[0x39] = { 4, 1 }, /* Spc -> Centre */
114114
};
115115

116116
static void palmte_button_event(void *opaque, int keycode)
@@ -124,6 +124,21 @@ static void palmte_button_event(void *opaque, int keycode)
124124
!(keycode & 0x80));
125125
}
126126

127+
/*
128+
* Encapsulation of some GPIO line behaviour for the Palm board
129+
*
130+
* QEMU interface:
131+
* + unnamed GPIO inputs 0..6: for the various miscellaneous input lines
132+
*/
133+
134+
#define TYPE_PALM_MISC_GPIO "palm-misc-gpio"
135+
#define PALM_MISC_GPIO(obj) \
136+
OBJECT_CHECK(PalmMiscGPIOState, (obj), TYPE_PALM_MISC_GPIO)
137+
138+
typedef struct PalmMiscGPIOState {
139+
SysBusDevice parent_obj;
140+
} PalmMiscGPIOState;
141+
127142
static void palmte_onoff_gpios(void *opaque, int line, int level)
128143
{
129144
switch (line) {
@@ -151,23 +166,44 @@ static void palmte_onoff_gpios(void *opaque, int line, int level)
151166
}
152167
}
153168

169+
static void palm_misc_gpio_init(Object *obj)
170+
{
171+
DeviceState *dev = DEVICE(obj);
172+
173+
qdev_init_gpio_in(dev, palmte_onoff_gpios, 7);
174+
}
175+
176+
static const TypeInfo palm_misc_gpio_info = {
177+
.name = TYPE_PALM_MISC_GPIO,
178+
.parent = TYPE_SYS_BUS_DEVICE,
179+
.instance_size = sizeof(PalmMiscGPIOState),
180+
.instance_init = palm_misc_gpio_init,
181+
/*
182+
* No class init required: device has no internal state so does not
183+
* need to set up reset or vmstate, and has no realize method.
184+
*/
185+
};
186+
154187
static void palmte_gpio_setup(struct omap_mpu_state_s *cpu)
155188
{
156-
qemu_irq *misc_gpio;
189+
DeviceState *misc_gpio;
190+
191+
misc_gpio = sysbus_create_simple(TYPE_PALM_MISC_GPIO, -1, NULL);
157192

158193
omap_mmc_handlers(cpu->mmc,
159194
qdev_get_gpio_in(cpu->gpio, PALMTE_MMC_WP_GPIO),
160195
qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
161196
[PALMTE_MMC_SWITCH_GPIO]));
162197

163-
misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7);
164-
qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]);
165-
qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]);
166-
qdev_connect_gpio_out(cpu->gpio, 11, misc_gpio[2]);
167-
qdev_connect_gpio_out(cpu->gpio, 12, misc_gpio[3]);
168-
qdev_connect_gpio_out(cpu->gpio, 13, misc_gpio[4]);
169-
omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]);
170-
omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]);
198+
qdev_connect_gpio_out(cpu->gpio, PALMTE_MMC_POWER_GPIO,
199+
qdev_get_gpio_in(misc_gpio, 0));
200+
qdev_connect_gpio_out(cpu->gpio, PALMTE_SPEAKER_GPIO,
201+
qdev_get_gpio_in(misc_gpio, 1));
202+
qdev_connect_gpio_out(cpu->gpio, 11, qdev_get_gpio_in(misc_gpio, 2));
203+
qdev_connect_gpio_out(cpu->gpio, 12, qdev_get_gpio_in(misc_gpio, 3));
204+
qdev_connect_gpio_out(cpu->gpio, 13, qdev_get_gpio_in(misc_gpio, 4));
205+
omap_mpuio_out_set(cpu->mpuio, 1, qdev_get_gpio_in(misc_gpio, 5));
206+
omap_mpuio_out_set(cpu->mpuio, 3, qdev_get_gpio_in(misc_gpio, 6));
171207

172208
/* Reset some inputs to initial state. */
173209
qemu_irq_lower(qdev_get_gpio_in(cpu->gpio, PALMTE_USBDETECT_GPIO));
@@ -276,3 +312,10 @@ static void palmte_machine_init(MachineClass *mc)
276312
}
277313

278314
DEFINE_MACHINE("cheetah", palmte_machine_init)
315+
316+
static void palm_register_types(void)
317+
{
318+
type_register_static(&palm_misc_gpio_info);
319+
}
320+
321+
type_init(palm_register_types)

0 commit comments

Comments
 (0)