From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
qemu-block@nongnu.org,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"John Snow" <jsnow@redhat.com>
Subject: Re: [PATCH for-7.1] hw/block/fdc-sysbus: Always mark sysbus floppy controllers as not having DMA
Date: Thu, 14 Apr 2022 18:03:35 +0100 [thread overview]
Message-ID: <CAFEAcA8+aLOoOkyTVR+=_p9x=V6RQCjdu0b-LijC0FvTSAhpyA@mail.gmail.com> (raw)
In-Reply-To: <20220412164921.1685453-1-peter.maydell@linaro.org>
On Tue, 12 Apr 2022 at 17:49, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The sysbus floppy controllers (devices sysbus-fdc and sun-fdtwo)
> don't support DMA. The core floppy controller code expects this to
> be indicated by setting FDCtrl::dma_chann to -1. This used to be
> done in the device instance_init functions sysbus_fdc_initfn() and
> sun4m_fdc_initfn(), but in commit 1430759ec3e we refactored this code
> and accidentally lost the setting of dma_chann.
>
> For sysbus-fdc this has no ill effects because we were redundantly
> also setting dma_chann in fdctrl_init_sysbus(), but for sun-fdtwo
> this means that guests which try to enable DMA on the floppy
> controller will cause QEMU to crash because FDCtrl::dma is NULL.
>
> Set dma_chann to -1 in the common instance init, and remove the
> redundant code in fdctrl_init_sysbus() that is also setting it.
>
> There is a six-year-old FIXME comment in the jazz board code to the
> effect that in theory it should support doing DMA via a custom DMA
> controller. If anybody ever chooses to fix that they can do it by
> adding support for setting both FDCtrl::dma_chann and FDCtrl::dma.
> (A QOM link property 'dma-controller' on the sysbus device which can
> be set to an instance of IsaDmaClass is probably the way to go.)
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/958
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> -void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
> - hwaddr mmio_base, DriveInfo **fds)
> +void fdctrl_init_sysbus(qemu_irq irq, hwaddr mmio_base, DriveInfo **fds)
> {
> FDCtrl *fdctrl;
> DeviceState *dev;
> @@ -105,7 +104,6 @@ void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
> dev = qdev_new("sysbus-fdc");
> sys = SYSBUS_FDC(dev);
> fdctrl = &sys->state;
> - fdctrl->dma_chann = dma_chann; /* FIXME */
> sbd = SYS_BUS_DEVICE(dev);
> sysbus_realize_and_unref(sbd, &error_fatal);
> sysbus_connect_irq(sbd, 0, irq);
Just noticed that deleting this line removes the only use
of the 'fdctrl' local in this function, which then means
we can delete it. I'll send a v2 that does that.
-- PMM
next prev parent reply other threads:[~2022-04-14 17:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 16:49 [PATCH for-7.1] hw/block/fdc-sysbus: Always mark sysbus floppy controllers as not having DMA Peter Maydell
2022-04-14 16:33 ` Philippe Mathieu-Daudé
2022-04-14 17:03 ` Peter Maydell [this message]
2022-04-18 8:12 ` Mark Cave-Ayland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFEAcA8+aLOoOkyTVR+=_p9x=V6RQCjdu0b-LijC0FvTSAhpyA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=f4bug@amsat.org \
--cc=hpoussin@reactos.org \
--cc=jsnow@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).