qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] pci: last minute bugfixes
@ 2023-08-11 16:17 Michael S. Tsirkin
  2023-08-11 16:18 ` [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host Michael S. Tsirkin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2023-08-11 16:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

  cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

  pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak
in before the release.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

----------------------------------------------------------------
Guoyi Tu (1):
      pci: Fix the update of interrupt disable bit in PCI_COMMAND register

Jason Chien (1):
      hw/pci-host: Allow extended config space access for Designware PCIe host

 hw/pci-host/designware.c | 1 +
 hw/pci/pci.c             | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host
  2023-08-11 16:17 [PULL 0/2] pci: last minute bugfixes Michael S. Tsirkin
@ 2023-08-11 16:18 ` Michael S. Tsirkin
  2023-08-11 17:30   ` Philippe Mathieu-Daudé
  2023-08-11 16:18 ` [PULL 2/2] pci: Fix the update of interrupt disable bit in PCI_COMMAND register Michael S. Tsirkin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Michael S. Tsirkin @ 2023-08-11 16:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Jason Chien, Frank Chang, Jason Wang, Chien,
	&lt, Andrey Smirnov, qemu-arm

From: Jason Chien <jason.chien@sifive.com>

In pcie_bus_realize(), a root bus is realized as a PCIe bus and a non-root
bus is realized as a PCIe bus if its parent bus is a PCIe bus. However,
the child bus "dw-pcie" is realized before the parent bus "pcie" which is
the root PCIe bus. Thus, the extended configuration space is not accessible
on "dw-pcie". The issue can be resolved by adding the
PCI_BUS_EXTENDED_CONFIG_SPACE flag to "pcie" before "dw-pcie" is realized.

Signed-off-by: Jason Chien <jason.chien@sifive.com>
Message-Id: <20230809102257.25121-1-jason.chien@sifive.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Signed-off-by: Jason Chien &lt;<a href="mailto:jason.chien@sifive.com" target="_blank">jason.chien@sifive.com</a>&gt;<br>
---
 hw/pci-host/designware.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index 9e183caa48..388d252ee2 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -694,6 +694,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
                                      &s->pci.io,
                                      0, 4,
                                      TYPE_PCIE_BUS);
+    pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE;
 
     memory_region_init(&s->pci.address_space_root,
                        OBJECT(s),
-- 
MST



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 2/2] pci: Fix the update of interrupt disable bit in PCI_COMMAND register
  2023-08-11 16:17 [PULL 0/2] pci: last minute bugfixes Michael S. Tsirkin
  2023-08-11 16:18 ` [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host Michael S. Tsirkin
@ 2023-08-11 16:18 ` Michael S. Tsirkin
  2023-08-11 17:41 ` [PULL 0/2] pci: last minute bugfixes Peter Maydell
  2023-08-11 21:48 ` Richard Henderson
  3 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2023-08-11 16:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Guoyi Tu, yuanminghao, Marcel Apfelbaum

From: Guoyi Tu <tugy@chinatelecom.cn>

The PCI_COMMAND register is located at offset 4 within
the PCI configuration space and occupies 2 bytes. The
interrupt disable bit is at the 10th bit, which corresponds
to the byte at offset 5 in the PCI configuration space.

In our testing environment, the guest driver may directly
updates the byte at offset 5 in the PCI configuration space.
The backtrace looks like as following:
    at hw/pci/pci.c:1442
    at hw/virtio/virtio-pci.c:605
    val=5, len=1) at hw/pci/pci_host.c:81

In this situation, the range_covers_byte function called
by the pci_default_write_config function will return false,
resulting in the inability to handle the interrupt disable
update event.

To fix this issue, we can use the ranges_overlap function
instead of range_covers_byte to determine whether the interrupt
bit has been updated.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Signed-off-by: yuanminghao <yuanmh12@chinatelecom.cn>
Message-Id: <ce2d0437-8faa-4d61-b536-4668f645a959@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: b6981cb57be5 ("pci: interrupt disable bit support")
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index b8d22e2e74..881d774fb6 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1613,7 +1613,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, int
         range_covers_byte(addr, l, PCI_COMMAND))
         pci_update_mappings(d);
 
-    if (range_covers_byte(addr, l, PCI_COMMAND)) {
+    if (ranges_overlap(addr, l, PCI_COMMAND, 2)) {
         pci_update_irq_disabled(d, was_irq_disabled);
         memory_region_set_enabled(&d->bus_master_enable_region,
                                   (pci_get_word(d->config + PCI_COMMAND)
-- 
MST



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host
  2023-08-11 16:18 ` [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host Michael S. Tsirkin
@ 2023-08-11 17:30   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-08-11 17:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel
  Cc: Peter Maydell, Jason Chien, Frank Chang, Jason Wang, Chien,
	&lt, Andrey Smirnov, qemu-arm

On 11/8/23 18:18, Michael S. Tsirkin wrote:
> From: Jason Chien <jason.chien@sifive.com>
> 
> In pcie_bus_realize(), a root bus is realized as a PCIe bus and a non-root
> bus is realized as a PCIe bus if its parent bus is a PCIe bus. However,
> the child bus "dw-pcie" is realized before the parent bus "pcie" which is
> the root PCIe bus. Thus, the extended configuration space is not accessible
> on "dw-pcie". The issue can be resolved by adding the
> PCI_BUS_EXTENDED_CONFIG_SPACE flag to "pcie" before "dw-pcie" is realized.
> 
> Signed-off-by: Jason Chien <jason.chien@sifive.com>
> Message-Id: <20230809102257.25121-1-jason.chien@sifive.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Frank Chang <frank.chang@sifive.com>
> Signed-off-by: Jason Chien &lt;<a href="mailto:jason.chien@sifive.com" target="_blank">jason.chien@sifive.com</a>&gt;<br>

<8^)

> ---
>   hw/pci-host/designware.c | 1 +
>   1 file changed, 1 insertion(+)




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PULL 0/2] pci: last minute bugfixes
  2023-08-11 16:17 [PULL 0/2] pci: last minute bugfixes Michael S. Tsirkin
  2023-08-11 16:18 ` [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host Michael S. Tsirkin
  2023-08-11 16:18 ` [PULL 2/2] pci: Fix the update of interrupt disable bit in PCI_COMMAND register Michael S. Tsirkin
@ 2023-08-11 17:41 ` Peter Maydell
  2023-08-11 21:50   ` Richard Henderson
  2023-08-12 18:06   ` Michael S. Tsirkin
  2023-08-11 21:48 ` Richard Henderson
  3 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2023-08-11 17:41 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On Fri, 11 Aug 2023 at 17:18, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:
>
>   cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)
>
> are available in the Git repository at:
>
>   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:
>
>   pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)
>
> ----------------------------------------------------------------
> pci: last minute bugfixes
>
> two fixes that seem very safe and important enough to sneak
> in before the release.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----------------------------------------------------------------
> Guoyi Tu (1):
>       pci: Fix the update of interrupt disable bit in PCI_COMMAND register
>
> Jason Chien (1):
>       hw/pci-host: Allow extended config space access for Designware PCIe host

Could you respin to get rid of the malformed Signed-off-by
line in patch 1 which has an HTML mailto link in it, please?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PULL 0/2] pci: last minute bugfixes
  2023-08-11 16:17 [PULL 0/2] pci: last minute bugfixes Michael S. Tsirkin
                   ` (2 preceding siblings ...)
  2023-08-11 17:41 ` [PULL 0/2] pci: last minute bugfixes Peter Maydell
@ 2023-08-11 21:48 ` Richard Henderson
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2023-08-11 21:48 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Peter Maydell

On 8/11/23 09:17, Michael S. Tsirkin wrote:
> The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:
> 
>    cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)
> 
> are available in the Git repository at:
> 
>    https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git  tags/for_upstream
> 
> for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:
> 
>    pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)
> 
> ----------------------------------------------------------------
> pci: last minute bugfixes
> 
> two fixes that seem very safe and important enough to sneak
> in before the release.
> 
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.


r~



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PULL 0/2] pci: last minute bugfixes
  2023-08-11 17:41 ` [PULL 0/2] pci: last minute bugfixes Peter Maydell
@ 2023-08-11 21:50   ` Richard Henderson
  2023-08-12 18:06   ` Michael S. Tsirkin
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2023-08-11 21:50 UTC (permalink / raw)
  To: Peter Maydell, Michael S. Tsirkin; +Cc: qemu-devel

On 8/11/23 10:41, Peter Maydell wrote:
> On Fri, 11 Aug 2023 at 17:18, Michael S. Tsirkin <mst@redhat.com> wrote:
>>
>> The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:
>>
>>    cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)
>>
>> are available in the Git repository at:
>>
>>    https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>>
>> for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:
>>
>>    pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)
>>
>> ----------------------------------------------------------------
>> pci: last minute bugfixes
>>
>> two fixes that seem very safe and important enough to sneak
>> in before the release.
>>
>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>
>> ----------------------------------------------------------------
>> Guoyi Tu (1):
>>        pci: Fix the update of interrupt disable bit in PCI_COMMAND register
>>
>> Jason Chien (1):
>>        hw/pci-host: Allow extended config space access for Designware PCIe host
> 
> Could you respin to get rid of the malformed Signed-off-by
> line in patch 1 which has an HTML mailto link in it, please?

Oops.  I lost my train of thought over the course of the day.
I mean to not push the pr to master and wait for v2, but then
I forgot and did it anyway hours later.

Sorry about that.

r~


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PULL 0/2] pci: last minute bugfixes
  2023-08-11 17:41 ` [PULL 0/2] pci: last minute bugfixes Peter Maydell
  2023-08-11 21:50   ` Richard Henderson
@ 2023-08-12 18:06   ` Michael S. Tsirkin
  1 sibling, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2023-08-12 18:06 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

On Fri, Aug 11, 2023 at 06:41:53PM +0100, Peter Maydell wrote:
> On Fri, 11 Aug 2023 at 17:18, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:
> >
> >   cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)
> >
> > are available in the Git repository at:
> >
> >   https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
> >
> > for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:
> >
> >   pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)
> >
> > ----------------------------------------------------------------
> > pci: last minute bugfixes
> >
> > two fixes that seem very safe and important enough to sneak
> > in before the release.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> >
> > ----------------------------------------------------------------
> > Guoyi Tu (1):
> >       pci: Fix the update of interrupt disable bit in PCI_COMMAND register
> >
> > Jason Chien (1):
> >       hw/pci-host: Allow extended config space access for Designware PCIe host
> 
> Could you respin to get rid of the malformed Signed-off-by
> line in patch 1 which has an HTML mailto link in it, please?
> 
> thanks
> -- PMM

Pushed as c4e775652a1043b21e6228e8a4d73abe943637b0, sorry I didn't
notice.

-- 
MST



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-12 18:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 16:17 [PULL 0/2] pci: last minute bugfixes Michael S. Tsirkin
2023-08-11 16:18 ` [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host Michael S. Tsirkin
2023-08-11 17:30   ` Philippe Mathieu-Daudé
2023-08-11 16:18 ` [PULL 2/2] pci: Fix the update of interrupt disable bit in PCI_COMMAND register Michael S. Tsirkin
2023-08-11 17:41 ` [PULL 0/2] pci: last minute bugfixes Peter Maydell
2023-08-11 21:50   ` Richard Henderson
2023-08-12 18:06   ` Michael S. Tsirkin
2023-08-11 21:48 ` Richard Henderson

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).