qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Olaf Hering <olaf@aepfle.de>, John Snow <jsnow@redhat.com>
Cc: xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v2] piix: fix regression during unplug in Xen HVM domUs
Date: Tue, 27 Jun 2023 10:12:50 +0000	[thread overview]
Message-ID: <5DB37FA5-41DF-4ED6-8C8A-CDDD6F276F42@gmail.com> (raw)
In-Reply-To: <c939b695-2b68-085a-0f19-108ecdcc1a05@redhat.com>



Am 27. Juni 2023 07:11:33 UTC schrieb Paolo Bonzini <pbonzini@redhat.com>:
>On 6/26/23 23:19, Olaf Hering wrote:
>> I need advice on how to debug this.
>> 
>> One thing that stands out is uhci_irq().
>> It reads a u16 from the USBSTS register.
>> 
>> On the qemu side, this read is served from bmdma_read. Since the read
>> size is 2, the result is ~0, and uhci_irq() turns the controller off.
>> In other words, memory_region_ops_read from addr=0xc102 is served from "piix-bmdma"
>> 
>> If the pci_set_word calls in piix_ide_reset are skipped, the read is
>> served from uhci_port_write. This is the expected behavior.
>> In other words, memory_region_ops_read from addr=0xc102 is served from "uhci".
>
>I think what's happening is that
>
>    pci_set_byte(pci_conf + 0x20, 0x01);  /* BMIBA: 20-23h */
>
>is setting the BAR to 0xC100, therefore overlapping the UHCI device's region.  In principle this line shouldn't be necessary at all though; it's enough to clear the COMMAND register.

Interesting. The BAR is a 32 bit register whose default value is 0x00000001. I think what's supposed to happen here is a pci_set_long() rather than a pci_set_byte().

Bits 4..15 represent the BAR address, and pci_set_byte() only clears bits 4..7, leaving bits 8..15 unchanged. Perhaps this causes the BAR to be moved into the UHCI region? Does changing the call to pci_set_long() fix the problem?

Best regards,
Bernhard

>
>Can you check the value of the COMMAND register (pci_conf + 0x04, 16 bits, little endian)?  Something might be causing the register to be set back to a nonzero value, therefore re-enabling the I/O at the address that overlaps the UHCI device.
>
>Paolo
>
>


  reply	other threads:[~2023-06-27 11:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17  7:00 [PATCH v2] piix: fix regression during unplug in Xen HVM domUs Olaf Hering
2021-03-22 22:09 ` John Snow
2021-03-25 11:12   ` Olaf Hering
2021-03-25 16:49     ` Paolo Bonzini
2023-05-09 22:58       ` Olaf Hering
2023-05-10  7:47         ` Olaf Hering
2023-05-12 21:12           ` Stefano Stabellini
2023-05-16 17:38             ` John Snow
2023-05-16 20:00               ` Olaf Hering
2023-06-26 21:19         ` Olaf Hering
2023-06-27  7:11           ` Paolo Bonzini
2023-06-27 10:12             ` Bernhard Beschow [this message]
2023-06-27 11:40               ` Olaf Hering
2023-06-27 12:07               ` Olaf Hering
2023-06-28  9:27                 ` Bernhard Beschow
2023-06-30  7:29                   ` Olaf Hering
2023-06-30  8:05                     ` Bernhard Beschow
2023-06-30 11:32                       ` Olaf Hering
2023-06-30 22:15                         ` Bernhard Beschow
2023-06-30  8:48                   ` Paolo Bonzini
2023-07-01  9:53                     ` Bernhard Beschow
2023-07-01 11:58                       ` Mark Cave-Ayland
2023-07-02 22:25                         ` Bernhard Beschow
2023-06-27 11:32           ` Olaf Hering

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=5DB37FA5-41DF-4ED6-8C8A-CDDD6F276F42@gmail.com \
    --to=shentey@gmail.com \
    --cc=jsnow@redhat.com \
    --cc=olaf@aepfle.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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).