qemu-e2k/hw/ppc
Kevin Wolf 86b1cf3227 block: Separate blk_is_writable() and blk_supports_write_perm()
Currently, blk_is_read_only() tells whether a given BlockBackend can
only be used in read-only mode because its root node is read-only. Some
callers actually try to answer a slightly different question: Is the
BlockBackend configured to be writable, by taking write permissions on
the root node?

This can differ, for example, for CD-ROM devices which don't take write
permissions, but may be backed by a writable image file. scsi-cd allows
write requests to the drive if blk_is_read_only() returns false.
However, the write request will immediately run into an assertion
failure because the write permission is missing.

This patch introduces separate functions for both questions.
blk_supports_write_perm() answers the question whether the block
node/image file can support writable devices, whereas blk_is_writable()
tells whether the BlockBackend is currently configured to be writable.

All calls of blk_is_read_only() are converted to one of the two new
functions.

Fixes: https://bugs.launchpad.net/bugs/1906693
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210118123448.307825-2-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-01-27 20:45:20 +01:00
..
Kconfig Revert "ppc4xx: Move common dependency on serial to common option" 2021-01-19 10:20:29 +11:00
e500-ccsr.h
e500.c vl: make qemu_get_machine_opts static 2020-12-15 12:51:55 -05:00
e500.h
e500plat.c
fdt.c
fw_cfg.c
mac.h
mac_newworld.c macio: move OpenPIC inside macio-newworld device 2021-01-13 12:21:10 +00:00
mac_oldworld.c macio: move heathrow PIC inside macio-oldworld device 2021-01-13 12:20:37 +00:00
meson.build
mpc8544_guts.c
mpc8544ds.c
pnv.c vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
pnv_bmc.c
pnv_core.c non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_homer.c
pnv_lpc.c non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_occ.c
pnv_pnor.c block: Separate blk_is_writable() and blk_supports_write_perm() 2021-01-27 20:45:20 +01:00
pnv_psi.c non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
pnv_xscom.c non-virt: Fix Lesser GPL version number 2020-11-15 16:38:24 +01:00
ppc.c hw/ppc: Do not re-read the clock on pre_save if doing savevm 2020-12-14 15:54:12 +11:00
ppc4xx_devs.c hw/ppc: Remove unused ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc4xx_pci.c hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
ppc405.h hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc405_boards.c hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc405_uc.c hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc440.h
ppc440_bamboo.c hw/ppc/ppc440_bamboo: Drop use of ppcuic_init() 2021-01-06 11:09:59 +11:00
ppc440_pcix.c ppc440_pcix: Fix up pci config access 2021-01-06 11:09:59 +11:00
ppc440_uc.c
ppc_booke.c
ppce500_spin.c powerpc tcg: Fix Lesser GPL version number 2020-11-15 16:38:50 +01:00
prep.c ppc: do not use ram_size global 2020-12-10 12:15:09 -05:00
prep_systemio.c
rs6000_mc.c
sam460ex.c sam460ex: Use type cast macro instead of simple cast 2021-01-19 10:20:29 +11:00
spapr.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_caps.c
spapr_cpu_core.c spapr_cpu_core.c: use g_auto* in spapr_create_vcpu() 2021-01-19 10:20:29 +11:00
spapr_drc.c spapr: Add drc_ prefix to the DRC realize and unrealize functions 2021-01-06 11:09:59 +11:00
spapr_events.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_hcall.c spapr_hcall.c: make do_client_architecture_support static 2021-01-19 10:20:29 +11:00
spapr_iommu.c memory: Add IOMMUTLBEvent 2020-12-08 13:48:57 -05:00
spapr_irq.c spapr/xics: Drop unused argument to xics_kvm_has_broken_disconnect() 2020-12-14 15:50:55 +11:00
spapr_numa.c
spapr_nvdimm.c ppc/spapr: cleanup -machine pseries,nvdimm=X handling 2020-12-15 12:51:53 -05:00
spapr_ovec.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_pci.c spapr: Don't use qdev_get_machine() in spapr_msi_write() 2020-12-14 15:54:12 +11:00
spapr_pci_nvlink2.c
spapr_pci_vfio.c
spapr_rng.c
spapr_rtas.c spapr_rtas.c: fix identation of rtas_ibm_suspend_me() args 2021-01-19 10:20:29 +11:00
spapr_rtas_ddw.c
spapr_rtc.c
spapr_tpm_proxy.c
spapr_vio.c ppc: do not use ram_size global 2020-12-10 12:15:09 -05:00
trace-events ppc440_pcix: Fix register write trace event 2021-01-06 11:09:59 +11:00
trace.h
virtex_ml507.c hw/ppc/virtex_ml507: Drop use of ppcuic_init() 2021-01-06 11:09:59 +11:00