All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org,  Peter Maydell <peter.maydell@linaro.org>,
	 Francisco Iglesias <frasse.iglesias@gmail.com>,
	 Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	 "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	 Cedric Le Goater <clg@kaod.org>
Subject: Re: [PULL v2 75/86] include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZE_MAX
Date: Thu, 26 May 2022 18:43:25 +0200 (CEST)	[thread overview]
Message-ID: <28f2b859-7ca4-d779-d94b-c9dc3e21ed39@eik.bme.hu> (raw)
In-Reply-To: <de56b35-c77-e979-b8bd-17c439f4b56d@eik.bme.hu>

[-- Attachment #1: Type: text/plain, Size: 5975 bytes --]

On Thu, 26 May 2022, BALATON Zoltan wrote:
> Hello,
>
> On Thu, 26 May 2022, Daniel Henrique Barboza wrote:
>> Hi,
>> 
>> This patch broke the boot of the sam460ex ppc machine:
>> 
>> qemu-system-ppc -M sam460ex -kernel 
>> ./buildroot/qemu_ppc_sam460ex-latest/vmlinux \
>> -device virtio-net-pci,netdev=net0 -netdev user,id=net0 -serial mon:stdio \
>> -nographic -snapshot
>> qemu-system-ppc: ../hw/pci/pcie_host.c:97: pcie_host_mmcfg_init: Assertion 
>> `size <= PCIE_MMCFG_SIZE_MAX' failed.

With just qemu-system-ppc -M sam460ex the assert seems to happen when the 
guest (board firmware?) writes a value to CFGMSK reg:

(gdb) bt
#0  0x00007ffff68ff4a0 in raise () at /lib64/libc.so.6
#1  0x00007ffff68ea536 in abort () at /lib64/libc.so.6
#2  0x00007ffff68ea42f in _nl_load_domain.cold () at /lib64/libc.so.6
#3  0x00007ffff68f7ed2 in  () at /lib64/libc.so.6
#4  0x000055555596646f in pcie_host_mmcfg_init (e=e@entry=0x5555567942f0, size=size@entry=0x20000000) at ../hw/pci/pcie_host.c:97
#5  0x000055555596653b in pcie_host_mmcfg_map (size=0x20000000, addr=0xd20000000, e=0x5555567942f0) at ../hw/pci/pcie_host.c:105
#6  pcie_host_mmcfg_update (e=0x5555567942f0, enable=0x1, addr=0xd20000000, size=0x20000000) at ../hw/pci/pcie_host.c:118
#7  0x0000555555a70d7c in ppc_dcr_write (dcr_env=0x555556669c10, dcrn=0x122, val=0xe0000001) at ../hw/ppc/ppc.c:1418
#8  0x0000555555abdabb in helper_store_dcr (env=0x555556633360, dcrn=0x122, val=0xe0000001) at ../target/ppc/timebase_helper.c:188

This is done in the board firmware here:

https://git.qemu.org/?p=u-boot-sam460ex.git;a=blob;f=arch/powerpc/cpu/ppc4xx/4xx_pcie.c;h=13348be93dccc74c13ea043d6635a7f8ece4b5f0;hb=HEAD#l963

when trying to map config space. Here the size is calculated as 0x20000000 
which does not fit the assert. I'm not sure what this means though and 
where is the problem. Any ideas?

Regards,
BALATON Zoltan

> Thanks for noticing this. I usually only test it during the freeze. Wasn't 
> there a test patch submitted by Philippe before? Isn't that yet merged or 
> included in CI? That should catch these before breaking it.
>
>> The reason is that it changed commit 58d5b22bbd5 ("ppc4xx: Add device 
>> models found in PPC440 core SoCs")) in a way that it wasn't expected by the 
>> board. The code seems to believe that, for a reason that isn't stated in 
>> the 58d5b22bbd5 commit message, PCIE_MMCFG_SIZE_MAX must be set to 1 << 29.
>> 
>> I'm CCing BALATON Zoltan since he's the author of 58d5b22bbd5 and can 
>> provide context of his initial change and why the board seems to rely on 
>> it. qemu-ppc is being CCed for awareness of the sam460ex problem.
>
> I'm afraid I don't remember but maybe I did not have a definitive answer even 
> back then as the docs for this PCIe controller were not available so I've 
> mostly worked from docs for similar SoCs and U-Boot and Linux sources so 
> there were a lot of guessing. Maybe it's related to that the board maps 
> peripheral addresses above 4GB as the first 4GB is reserved for memory? Or 
> maybe there's some mixup between address spaces and the PCIe controller 
> should have a separate address space that's mapped in the system? I did not 
> have any knowledge about this back then and my understanding may still be 
> lacking on how this should work.
>
>> Zoltan, I wasn't able to amend to quickly amend the code in a way that I 
>> could preserve the current PCIE_MMCFG_SIZE_MAX setting and make sam460ex 
>> work again. Can you please take a look?
>
> The PCIe controllers of the 460EX are implemented at the end of 
> hw/ppc/ppc440_uc.c (a lot of these 4xx SoCs are sharing components and the 
> code organisation is a bit messy). As the comment near it says it's not 
> really fully tested and working. only good enough for firmware and OSes get 
> past testing it. I think trying to attach any device to it probably would 
> fail or I would be surprised if the OS could actually talk to it as there may 
> be some missing parts. So I'm happy with any solution that keeps the current 
> state of being able to boot the OSes running on it (some of which like 
> AmigaOS and MorphOS are closed source though so I don't know what their 
> drivers need; closest open source OS to them is AROS but not sure that's 
> working on real hardware). Some advice from somebody more knowledgeable about 
> PCIe emulation in QEMU would be welcome here.
>
> Regards,
> BALATON Zoltan
>
>> 
>> Thanks,
>> 
>> 
>> Daniel
>> 
>> 
>> 
>> On 5/16/22 17:55, Michael S. Tsirkin wrote:
>>> From: Francisco Iglesias <frasse.iglesias@gmail.com>
>>> 
>>> According to 7.2.2 in [1] bit 27 is the last bit that can be part of the
>>> bus number, this makes the ECAM max size equal to '1 << 28'. This patch
>>> restores back this value into the PCIE_MMCFG_SIZE_MAX define (which was
>>> changed in commit 58d5b22bbd5 ("ppc4xx: Add device models found in PPC440
>>> core SoCs")).
>>> 
>>> [1] PCI Express® Base Specification Revision 5.0 Version 1.0
>>> 
>>> Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com>
>>> Message-Id: <20220411221836.17699-3-frasse.iglesias@gmail.com>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> ---
>>>   include/hw/pci/pcie_host.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h
>>> index b3c8ce973c..82d92177da 100644
>>> --- a/include/hw/pci/pcie_host.h
>>> +++ b/include/hw/pci/pcie_host.h
>>> @@ -65,7 +65,7 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,
>>>    * bit 12 - 14: function number
>>>    * bit  0 - 11: offset in configuration space of a given device
>>>    */
>>> -#define PCIE_MMCFG_SIZE_MAX             (1ULL << 29)
>>> +#define PCIE_MMCFG_SIZE_MAX             (1ULL << 28)
>>>   #define PCIE_MMCFG_SIZE_MIN             (1ULL << 20)
>>>   #define PCIE_MMCFG_BUS_BIT              20
>>>   #define PCIE_MMCFG_BUS_MASK             0xff
>> 
>

  reply	other threads:[~2022-05-26 16:44 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 20:49 [PULL v2 00/86] virtio,pc,pci: fixes,cleanups,features Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 01/86] virtio: fix feature negotiation for ACCESS_PLATFORM Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 02/86] intel-iommu: correct the value used for error_setg_errno() Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 03/86] hw/pci/cxl: Add a CXL component type (interface) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 04/86] hw/cxl/component: Introduce CXL components (8.1.x, 8.2.5) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 05/86] MAINTAINERS: Add entry for Compute Express Link Emulation Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 06/86] hw/cxl/device: Introduce a CXL device (8.2.8) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 07/86] hw/cxl/device: Implement the CAP array (8.2.8.1-2) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 08/86] hw/cxl/device: Implement basic mailbox (8.2.8.4) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 09/86] hw/cxl/device: Add memory device utilities Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 10/86] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 11/86] hw/cxl/device: Timestamp implementation (8.2.9.3) Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 12/86] hw/cxl/device: Add log commands (8.2.9.4) + CEL Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 13/86] hw/pxb: Use a type for realizing expanders Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 14/86] hw/pci/cxl: Create a CXL bus type Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 15/86] cxl: Machine level control on whether CXL support is enabled Michael S. Tsirkin
2022-05-16 20:50 ` [PULL v2 16/86] hw/pxb: Allow creation of a CXL PXB (host bridge) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 17/86] qtest/cxl: Introduce initial test for pxb-cxl only Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 18/86] hw/cxl/rp: Add a root port Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 19/86] hw/cxl/device: Add a memory device (8.2.8.5) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 20/86] hw/cxl/device: Implement MMIO HDM decoding (8.2.5.12) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 21/86] hw/cxl/device: Add some trivial commands Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 22/86] hw/cxl/device: Plumb real Label Storage Area (LSA) sizing Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 23/86] hw/cxl/device: Implement get/set Label Storage Area (LSA) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 24/86] qtests/cxl: Add initial root port and CXL type3 tests Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 25/86] hw/cxl/component: Implement host bridge MMIO (8.2.5, table 142) Michael S. Tsirkin
2022-06-16 14:45   ` Igor Mammedov
2022-06-17 10:51     ` Jonathan Cameron via
2022-06-17 11:56       ` Igor Mammedov
2022-05-16 20:51 ` [PULL v2 26/86] acpi/cxl: Add _OSC implementation (9.14.2) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 27/86] acpi/cxl: Create the CEDT (9.14.1) Michael S. Tsirkin
2022-05-16 20:51 ` [PULL v2 28/86] hw/cxl/component: Add utils for interleave parameter encoding/decoding Michael S. Tsirkin
2022-06-27 13:29   ` Peter Maydell
2022-06-27 14:59     ` Jonathan Cameron via
2022-05-16 20:51 ` [PULL v2 29/86] hw/cxl/host: Add support for CXL Fixed Memory Windows Michael S. Tsirkin
2022-07-19 13:57   ` Peter Maydell
2022-05-16 20:51 ` [PULL v2 30/86] acpi/cxl: Introduce CFMWS structures in CEDT Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 31/86] hw/pci-host/gpex-acpi: Add support for dsdt construction for pxb-cxl Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 32/86] pci/pcie_port: Add pci_find_port_by_pn() Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 33/86] CXL/cxl_component: Add cxl_get_hb_cstate() Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 34/86] mem/cxl_type3: Add read and write functions for associated hostmem Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 35/86] cxl/cxl-host: Add memops for CFMWS region Michael S. Tsirkin
2022-07-20 12:23   ` Peter Maydell
2022-07-21 14:37     ` Jonathan Cameron via
2022-05-16 20:52 ` [PULL v2 36/86] hw/cxl/component Add a dumb HDM decoder handler Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 37/86] i386/pc: Enable CXL fixed memory windows Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 38/86] tests/acpi: q35: Allow addition of a CXL test Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 39/86] qtests/bios-tables-test: Add a test for CXL emulation Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 40/86] tests/acpi: Add tables " Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 41/86] qtest/cxl: Add more complex test cases with CFMWs Michael S. Tsirkin
2022-05-16 20:52 ` [PULL v2 42/86] docs/cxl: Add initial Compute eXpress Link (CXL) documentation Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 43/86] vhost: Track descriptor chain in private at SVQ Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 44/86] vhost: Fix device's used descriptor dequeue Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 45/86] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 46/86] vdpa: Fix index calculus at vhost_vdpa_svqs_start Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 47/86] hw/virtio: Replace g_memdup() by g_memdup2() Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 48/86] vhost: Fix element in vhost_svq_add failure Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 49/86] target/i386: Fix sanity check on max APIC ID / X2APIC enablement Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 50/86] intel_iommu: Support IR-only mode without DMA translation Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 51/86] intel_iommu: Only allow interrupt remapping to be enabled if it's supported Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 52/86] intel_iommu: Fix irqchip / X2APIC configuration checks Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 53/86] intel-iommu: remove VTD_FR_RESERVED_ERR Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 54/86] intel-iommu: block output address in interrupt address range Michael S. Tsirkin
2022-05-16 20:53 ` [PULL v2 55/86] intel-iommu: update root_scalable before switching as during post_load Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 56/86] intel-iommu: update iq_dw during post load Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 57/86] vhost_net: Print feature masks in hex Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 58/86] hw/virtio: move virtio-pci.h into shared include space Michael S. Tsirkin
2022-05-16 20:54   ` [Virtio-fs] " Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 59/86] virtio-pci: add notification trace points Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 60/86] hw/virtio: add vhost_user_[read|write] " Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 61/86] docs: vhost-user: clean up request/reply description Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 62/86] docs: vhost-user: rewrite section on ring state machine Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 63/86] docs: vhost-user: replace master/slave with front-end/back-end Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 64/86] vhost-user.rst: add clarifying language about protocol negotiation Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 65/86] libvhost-user: expose vu_request_to_string Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 66/86] docs/devel: start documenting writing VirtIO devices Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 67/86] include/hw: start documenting the vhost API Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 68/86] hw/virtio/vhost-user: don't suppress F_CONFIG when supported Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 69/86] virtio/vhost-user: dynamically assign VhostUserHostNotifiers Michael S. Tsirkin
2022-05-16 20:54 ` [PULL v2 70/86] virtio: drop name parameter for virtio_init() Michael S. Tsirkin
2022-05-16 20:54   ` [Virtio-fs] " Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 71/86] virtio: add vhost support for virtio devices Michael S. Tsirkin
2022-05-16 20:55   ` [Virtio-fs] " Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 72/86] vhost-user: more master/slave things Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 73/86] docs/vhost-user: Clarifications for VHOST_USER_ADD/REM_MEM_REG Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 74/86] include/hw/pci/pcie_host: Correct PCIE_MMCFG_BUS_MASK Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 75/86] include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZE_MAX Michael S. Tsirkin
2022-05-26 13:27   ` Daniel Henrique Barboza
2022-05-26 15:54     ` BALATON Zoltan
2022-05-26 16:43       ` BALATON Zoltan [this message]
2022-05-26 19:13         ` Michael S. Tsirkin
2022-05-26 19:34           ` BALATON Zoltan
2022-05-26 19:55             ` Michael S. Tsirkin
2022-05-26 20:51               ` BALATON Zoltan
2022-05-30  9:42       ` Thomas Huth
2022-05-30 10:09         ` Cédric Le Goater
2022-05-30 16:00         ` Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 76/86] hw/i386: Make pit a property of common x86 base machine type Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 77/86] hw/i386: Make pic " Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 78/86] hw/i386/amd_iommu: Fix IOMMU event log encoding errors Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 79/86] virtio-net: setup vhost_dev and notifiers for cvq only when feature is negotiated Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 80/86] virtio-net: align ctrl_vq index for non-mq guest for vhost_vdpa Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 81/86] vhost-vdpa: fix improper cleanup in net_init_vhost_vdpa Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 82/86] vhost-net: fix improper cleanup in vhost_net_start Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 83/86] vhost-vdpa: backend feature should set only once Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 84/86] vhost-vdpa: change name and polarity for vhost_vdpa_one_time_request() Michael S. Tsirkin
2022-05-16 20:55 ` [PULL v2 85/86] virtio-net: don't handle mq request in userspace handler for vhost-vdpa Michael S. Tsirkin
2022-05-16 20:56 ` [PULL v2 86/86] vhost-user-scsi: avoid unlink(NULL) with fd passing Michael S. Tsirkin
2022-05-17  3:01 ` [PULL v2 00/86] virtio,pc,pci: fixes,cleanups,features Richard Henderson

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=28f2b859-7ca4-d779-d94b-c9dc3e21ed39@eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=frasse.iglesias@gmail.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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.