From: "Michael S. Tsirkin" <mst@redhat.com>
To: Lev Kujawski <lkujaw@member.fsf.org>
Cc: qemu-trivial@nongnu.org, f4bug@amsat.org,
John Snow <jsnow@redhat.com>,
"open list:IDE" <qemu-block@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] hw/ide/piix: Ignore writes of hardwired PCI command register bits
Date: Thu, 22 Sep 2022 06:04:41 -0400 [thread overview]
Message-ID: <20220922060325-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20220906102155-mutt-send-email-mst@kernel.org>
On Tue, Sep 06, 2022 at 10:23:57AM -0400, Michael S. Tsirkin wrote:
> On Thu, Jun 02, 2022 at 08:47:31PM +0000, Lev Kujawski wrote:
> > One method to enable PCI bus mastering for IDE controllers, often used
> > by x86 firmware, is to write 0x7 to the PCI command register. Neither
> > the PIIX3 specification nor actual hardware (a Tyan S1686D system)
> > permit modification of the Memory Space Enable (MSE) bit, 1, and thus
> > the command register would be left in an unspecified state without
> > this patch.
> >
> > Signed-off-by: Lev Kujawski <lkujaw@member.fsf.org>
>
>
> I don't think this is appropriate in trivial at all.
>
>
>
> > ---
> > This revised patch uses QEMU's built-in PCI bit-masking support rather
> > than attempting to manually filter writes. Thanks to Philippe Mathieu-
> > Daude and Michael S. Tsirkin for review and the pointer.
>
> But pls note I wrote:
>
> Might need machine compat machinery
> for this.
>
> without said machinery, if guest set one of the other
> bits, migration will fail.
I assume v3 will be forthcoming, right?
>
> > hw/ide/piix.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
> > diff --git a/hw/ide/piix.c b/hw/ide/piix.c
> > index 76ea8fd9f6..bd3f397de8 100644
> > --- a/hw/ide/piix.c
> > +++ b/hw/ide/piix.c
> > @@ -25,6 +25,8 @@
> > * References:
> > * [1] 82371FB (PIIX) AND 82371SB (PIIX3) PCI ISA IDE XCELERATOR,
> > * 290550-002, Intel Corporation, April 1997.
> > + * [2] 82371AB PCI-TO-ISA / IDE XCELERATOR (PIIX4), 290562-001,
> > + * Intel Corporation, April 1997.
> > */
> >
> > #include "qemu/osdep.h"
> > @@ -160,6 +162,19 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
> > uint8_t *pci_conf = dev->config;
> > int rc;
> >
> > + /*
> > + * Mask all IDE PCI command register bits except for Bus Master
> > + * Function Enable (bit 2) and I/O Space Enable (bit 1), as the
> > + * remainder are hardwired to 0 [1, p.48] [2, p.89-90].
> > + *
> > + * NOTE: According to the PIIX3 datasheet [1], the Memory Space
> > + * Enable (MSE bit) is hardwired to 1, but this is contradicted by
> > + * actual PIIX3 hardware, the datasheet itself (viz., Default
> > + * Value: 0000h), and the PIIX4 datasheet [2].
> > + */
> > + pci_set_word(dev->wmask + PCI_COMMAND,
> > + PCI_COMMAND_MASTER | PCI_COMMAND_IO);
> > +
> > pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
> >
> > bmdma_setup_bar(d);
> > --
> > 2.34.1
> >
> >
> >
next prev parent reply other threads:[~2022-09-22 10:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 20:47 [PATCH v2] hw/ide/piix: Ignore writes of hardwired PCI command register bits Lev Kujawski
2022-09-06 14:16 ` Bernhard Beschow
2022-09-06 14:23 ` Michael S. Tsirkin
2022-09-22 10:04 ` Michael S. Tsirkin [this message]
2022-09-25 9:37 ` [PATCH v3 0/2] " Lev Kujawski
2022-09-25 9:37 ` [PATCH v3 1/2] qpci_device_enable: Allow for command bits hardwired to 0 Lev Kujawski
2022-10-07 13:52 ` Michael S. Tsirkin
2022-10-24 10:07 ` Lev Kujawski
2022-09-25 9:37 ` [PATCH v3 2/2] hw/ide/piix: Ignore writes of hardwired PCI command register bits Lev Kujawski
2022-10-07 13:54 ` Michael S. Tsirkin
2022-10-24 9:46 ` Lev Kujawski
2022-10-24 9:46 ` [PATCH 1/2] qpci_device_enable: Allow for command bits hardwired to 0 Lev Kujawski
2022-10-31 20:40 ` Michael S. Tsirkin
2022-10-24 9:46 ` [PATCH 2/2] hw/ide/piix: Ignore writes of hardwired PCI command register bits Lev Kujawski
2022-10-24 13:59 ` [PATCH v3 " Michael S. Tsirkin
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=20220922060325-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=f4bug@amsat.org \
--cc=jsnow@redhat.com \
--cc=lkujaw@member.fsf.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.