Skip to content

Commit 0250c59

Browse files
committed
Merge remote-tracking branch 'remotes/armbru/tags/pull-qdev-2020-06-23' into staging
Qdev patches for 2020-06-23 # gpg: Signature made Tue 23 Jun 2020 15:08:28 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "[email protected]" # gpg: Good signature from "Markus Armbruster <[email protected]>" [full] # gpg: aka "Markus Armbruster <[email protected]>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qdev-2020-06-23: sd/milkymist-memcard: Fix error API violation sd/pxa2xx_mmci: Don't crash on pxa2xx_mmci_init() error arm/aspeed: Drop aspeed_board_init_flashes() parameter @errp qdev: Make qdev_prop_set_drive() match the other helpers qdev: Reject chardev property override qdev: Reject drive property override qdev: Improve netdev property override error a bit qdev: Eliminate get_pointer(), set_pointer() blockdev: Deprecate -drive with bogus interface type docs/qdev-device-use.txt: Update section "Default Devices" fdc: Deprecate configuring floppies with -global isa-fdc fdc: Open-code fdctrl_init_isa() fdc: Reject clash between -drive if=floppy and -global isa-fdc iotests/172: Cover -global floppy.drive=... iotests/172: Cover empty filename and multiple use of drives iotests/172: Include "info block" in test output Signed-off-by: Peter Maydell <[email protected]>
2 parents 27c77b1 + 953cd66 commit 0250c59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+921
-263
lines changed

blockdev.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,19 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit)
239239
return NULL;
240240
}
241241

242+
void drive_mark_claimed_by_board(void)
243+
{
244+
BlockBackend *blk;
245+
DriveInfo *dinfo;
246+
247+
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
248+
dinfo = blk_legacy_dinfo(blk);
249+
if (dinfo && blk_get_attached_dev(blk)) {
250+
dinfo->claimed_by_board = true;
251+
}
252+
}
253+
}
254+
242255
void drive_check_orphaned(void)
243256
{
244257
BlockBackend *blk;
@@ -248,15 +261,25 @@ void drive_check_orphaned(void)
248261

249262
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
250263
dinfo = blk_legacy_dinfo(blk);
251-
if (!blk_get_attached_dev(blk) && !dinfo->is_default &&
252-
dinfo->type != IF_NONE) {
264+
if (dinfo->is_default || dinfo->type == IF_NONE) {
265+
continue;
266+
}
267+
if (!blk_get_attached_dev(blk)) {
253268
loc_push_none(&loc);
254269
qemu_opts_loc_restore(dinfo->opts);
255270
error_report("machine type does not support"
256271
" if=%s,bus=%d,unit=%d",
257272
if_name[dinfo->type], dinfo->bus, dinfo->unit);
258273
loc_pop(&loc);
259274
orphans = true;
275+
continue;
276+
}
277+
if (!dinfo->claimed_by_board && dinfo->type != IF_VIRTIO) {
278+
loc_push_none(&loc);
279+
qemu_opts_loc_restore(dinfo->opts);
280+
warn_report("bogus if=%s is deprecated, use if=none",
281+
if_name[dinfo->type]);
282+
loc_pop(&loc);
260283
}
261284
}
262285

docs/qdev-device-use.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,10 @@ The -device argument differs in detail for each type of drive:
104104

105105
* if=floppy
106106

107-
-global isa-fdc.driveA=DRIVE-ID
108-
-global isa-fdc.driveB=DRIVE-ID
107+
-device floppy,unit=UNIT,drive=DRIVE-ID
109108

110-
This is -global instead of -device, because the floppy controller is
111-
created automatically, and we want to configure that one, not create
112-
a second one (which isn't possible anyway).
113-
114-
Without any -global isa-fdc,... you get an empty driveA and no
115-
driveB. You can use -nodefaults to suppress the default driveA, see
109+
Without any -device floppy,... you get an empty unit 0 and no unit
110+
1. You can use -nodefaults to suppress the default unit 0, see
116111
"Default Devices".
117112

118113
* if=virtio
@@ -385,12 +380,12 @@ some DEVNAMEs:
385380

386381
default device suppressing DEVNAMEs
387382
CD-ROM ide-cd, ide-drive, ide-hd, scsi-cd, scsi-hd
388-
isa-fdc's driveA floppy, isa-fdc
383+
floppy floppy, isa-fdc
389384
parallel isa-parallel
390385
serial isa-serial
391386
VGA VGA, cirrus-vga, isa-vga, isa-cirrus-vga,
392-
vmware-svga, qxl-vga, virtio-vga
393-
virtioconsole virtio-serial-pci, virtio-serial
387+
vmware-svga, qxl-vga, virtio-vga, ati-vga,
388+
vhost-user-vga
394389

395390
The default NIC is connected to a default part created along with it.
396391
It is *not* suppressed by configuring a NIC with -device (you may call

docs/system/deprecated.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,40 @@ previously available ``-tb-size`` option.
164164
Use ``-display sdl,show-cursor=on`` or
165165
``-display gtk,show-cursor=on`` instead.
166166

167+
``Configuring floppies with ``-global``
168+
'''''''''''''''''''''''''''''''''''''''
169+
170+
Use ``-device floppy,...`` instead:
171+
::
172+
173+
-global isa-fdc.driveA=...
174+
-global sysbus-fdc.driveA=...
175+
-global SUNW,fdtwo.drive=...
176+
177+
become
178+
::
179+
180+
-device floppy,unit=0,drive=...
181+
182+
and
183+
::
184+
185+
-global isa-fdc.driveB=...
186+
-global sysbus-fdc.driveB=...
187+
188+
become
189+
::
190+
191+
-device floppy,unit=1,drive=...
192+
193+
``-drive`` with bogus interface type
194+
''''''''''''''''''''''''''''''''''''
195+
196+
Drives with interface types other than ``if=none`` are for onboard
197+
devices. It is possible to use drives the board doesn't pick up with
198+
-device. This usage is now deprecated. Use ``if=none`` instead.
199+
200+
167201
QEMU Machine Protocol (QMP) commands
168202
------------------------------------
169203

hw/arm/aspeed.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
215215
g_free(storage);
216216
}
217217

218-
static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
219-
Error **errp)
218+
static void aspeed_board_init_flashes(AspeedSMCState *s,
219+
const char *flashtype)
220220
{
221221
int i ;
222222

@@ -227,8 +227,8 @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
227227

228228
fl->flash = qdev_new(flashtype);
229229
if (dinfo) {
230-
qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo),
231-
errp);
230+
qdev_prop_set_drive(fl->flash, "drive",
231+
blk_by_legacy_dinfo(dinfo));
232232
}
233233
qdev_realize_and_unref(fl->flash, BUS(s->spi), &error_fatal);
234234

@@ -243,8 +243,8 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
243243

244244
card = qdev_new(TYPE_SD_CARD);
245245
if (dinfo) {
246-
qdev_prop_set_drive(card, "drive", blk_by_legacy_dinfo(dinfo),
247-
&error_fatal);
246+
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
247+
&error_fatal);
248248
}
249249
qdev_realize_and_unref(card,
250250
qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
@@ -314,8 +314,8 @@ static void aspeed_machine_init(MachineState *machine)
314314
"max_ram", max_ram_size - ram_size);
315315
memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
316316

317-
aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model, &error_abort);
318-
aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model, &error_abort);
317+
aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model);
318+
aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model);
319319

320320
/* Install first FMC flash content as a boot rom. */
321321
if (drive0) {

hw/arm/cubieboard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static void cubieboard_init(MachineState *machine)
9393

9494
/* Plug in SD card */
9595
carddev = qdev_new(TYPE_SD_CARD);
96-
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
96+
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
9797
qdev_realize_and_unref(carddev, bus, &error_fatal);
9898

9999
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,

hw/arm/exynos4210.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
434434
di = drive_get(IF_SD, 0, n);
435435
blk = di ? blk_by_legacy_dinfo(di) : NULL;
436436
carddev = qdev_new(TYPE_SD_CARD);
437-
qdev_prop_set_drive(carddev, "drive", blk, &error_abort);
437+
qdev_prop_set_drive(carddev, "drive", blk);
438438
qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"),
439439
&error_fatal);
440440
}

hw/arm/imx25_pdk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void imx25_pdk_init(MachineState *machine)
130130
blk = di ? blk_by_legacy_dinfo(di) : NULL;
131131
bus = qdev_get_child_bus(DEVICE(&s->soc.esdhc[i]), "sd-bus");
132132
carddev = qdev_new(TYPE_SD_CARD);
133-
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
133+
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
134134
qdev_realize_and_unref(carddev, bus, &error_fatal);
135135
}
136136

hw/arm/mcimx6ul-evk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
5555
blk = di ? blk_by_legacy_dinfo(di) : NULL;
5656
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
5757
carddev = qdev_new(TYPE_SD_CARD);
58-
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
58+
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
5959
qdev_realize_and_unref(carddev, bus, &error_fatal);
6060
}
6161

hw/arm/mcimx7d-sabre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
5757
blk = di ? blk_by_legacy_dinfo(di) : NULL;
5858
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
5959
carddev = qdev_new(TYPE_SD_CARD);
60-
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
60+
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
6161
qdev_realize_and_unref(carddev, bus, &error_fatal);
6262
}
6363

hw/arm/msf2-som.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
8686
spi_flash = qdev_new("s25sl12801");
8787
qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
8888
if (dinfo) {
89-
qdev_prop_set_drive(spi_flash, "drive", blk_by_legacy_dinfo(dinfo),
90-
&error_fatal);
89+
qdev_prop_set_drive_err(spi_flash, "drive",
90+
blk_by_legacy_dinfo(dinfo), &error_fatal);
9191
}
9292
qdev_realize_and_unref(spi_flash, spi_bus, &error_fatal);
9393
cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);

0 commit comments

Comments
 (0)