From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Andrey Smirnov" <andrew.smirnov@gmail.com>,
"Jason Wang" <jasowang@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@zoho.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>,
"Andrey Yurovsky" <yurovsky@gmail.com>
Subject: Re: [Qemu-arm] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* accessors
Date: Thu, 8 Feb 2018 19:34:20 +0200 [thread overview]
Message-ID: <20180208193033-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA-=-+1A6toXM-ddP+iKBgHKh28Xq3VeGXfSLJ08xMRijA@mail.gmail.com>
On Thu, Feb 08, 2018 at 05:20:53PM +0000, Peter Maydell wrote:
> On 7 February 2018 at 04:24, Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> > Use pci_config_size (as opposed to PCI_CONFIG_SPACE_SIZE) in
> > pci_data_read() and pci_data_write(), so this function would work for
> > both classic PCI and PCIe use-cases.
> >
> > Cc: Peter Maydell <peter.maydell@linaro.org>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > Cc: Marcel Apfelbaum <marcel.apfelbaum@zoho.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: qemu-devel@nongnu.org
> > Cc: qemu-arm@nongnu.org
> > Cc: yurovsky@gmail.com
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> > hw/pci/pci_host.c | 13 +++++++++----
> > 1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> > index 5eaa935cb5..ea52ea07cd 100644
> > --- a/hw/pci/pci_host.c
> > +++ b/hw/pci/pci_host.c
> > @@ -89,30 +89,35 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
> > void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> > {
> > PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> > - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> > + uint32_t config_addr;
> >
> > if (!pci_dev) {
> > return;
> > }
> >
> > + config_addr = addr & (pci_config_size(pci_dev) - 1);
> > +
> > PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n",
> > __func__, pci_dev->name, config_addr, val, len);
> > - pci_host_config_write_common(pci_dev, config_addr, PCI_CONFIG_SPACE_SIZE,
> > + pci_host_config_write_common(pci_dev, config_addr,
> > + pci_config_size(pci_dev),
> > val, len);
> > }
> >
> > uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
> > {
> > PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> > - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> > + uint32_t config_addr;
> > uint32_t val;
> >
> > if (!pci_dev) {
> > return ~0x0;
> > }
> >
> > + config_addr = addr & (pci_config_size(pci_dev) - 1);
> > +
> > val = pci_host_config_read_common(pci_dev, config_addr,
> > - PCI_CONFIG_SPACE_SIZE, len);
> > + pci_config_size(pci_dev), len);
> > PCI_DPRINTF("%s: %s: addr=%02"PRIx32" val=%08"PRIx32" len=%d\n",
> > __func__, pci_dev->name, config_addr, val, len);
> >
>
> I've just discovered that this breaks the e1000e-test:
>
> $ (cd build/clang; QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
> ./tests/e1000e-test)
> /x86_64/e1000e/init: **
> ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/e1000e-test.c:118:e1000e_device_find:
> 'e1000e_dev' should not be NULL
>
> Any idea what's going on here?
>
> thanks
> -- PMM
I'm yet to review these patches, but IIRC pci_data_read and friends
aren't designed with pcie in mind - they implement the classic pci
config space.
I'd like to see more justification about how these are now going
to be used.
--
MST
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Andrey Smirnov" <andrew.smirnov@gmail.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Jason Wang" <jasowang@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@zoho.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Andrey Yurovsky" <yurovsky@gmail.com>
Subject: Re: [Qemu-devel] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* accessors
Date: Thu, 8 Feb 2018 19:34:20 +0200 [thread overview]
Message-ID: <20180208193033-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA-=-+1A6toXM-ddP+iKBgHKh28Xq3VeGXfSLJ08xMRijA@mail.gmail.com>
On Thu, Feb 08, 2018 at 05:20:53PM +0000, Peter Maydell wrote:
> On 7 February 2018 at 04:24, Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> > Use pci_config_size (as opposed to PCI_CONFIG_SPACE_SIZE) in
> > pci_data_read() and pci_data_write(), so this function would work for
> > both classic PCI and PCIe use-cases.
> >
> > Cc: Peter Maydell <peter.maydell@linaro.org>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > Cc: Marcel Apfelbaum <marcel.apfelbaum@zoho.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: qemu-devel@nongnu.org
> > Cc: qemu-arm@nongnu.org
> > Cc: yurovsky@gmail.com
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> > hw/pci/pci_host.c | 13 +++++++++----
> > 1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
> > index 5eaa935cb5..ea52ea07cd 100644
> > --- a/hw/pci/pci_host.c
> > +++ b/hw/pci/pci_host.c
> > @@ -89,30 +89,35 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
> > void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
> > {
> > PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> > - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> > + uint32_t config_addr;
> >
> > if (!pci_dev) {
> > return;
> > }
> >
> > + config_addr = addr & (pci_config_size(pci_dev) - 1);
> > +
> > PCI_DPRINTF("%s: %s: addr=%02" PRIx32 " val=%08" PRIx32 " len=%d\n",
> > __func__, pci_dev->name, config_addr, val, len);
> > - pci_host_config_write_common(pci_dev, config_addr, PCI_CONFIG_SPACE_SIZE,
> > + pci_host_config_write_common(pci_dev, config_addr,
> > + pci_config_size(pci_dev),
> > val, len);
> > }
> >
> > uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
> > {
> > PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
> > - uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
> > + uint32_t config_addr;
> > uint32_t val;
> >
> > if (!pci_dev) {
> > return ~0x0;
> > }
> >
> > + config_addr = addr & (pci_config_size(pci_dev) - 1);
> > +
> > val = pci_host_config_read_common(pci_dev, config_addr,
> > - PCI_CONFIG_SPACE_SIZE, len);
> > + pci_config_size(pci_dev), len);
> > PCI_DPRINTF("%s: %s: addr=%02"PRIx32" val=%08"PRIx32" len=%d\n",
> > __func__, pci_dev->name, config_addr, val, len);
> >
>
> I've just discovered that this breaks the e1000e-test:
>
> $ (cd build/clang; QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64
> ./tests/e1000e-test)
> /x86_64/e1000e/init: **
> ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/tests/e1000e-test.c:118:e1000e_device_find:
> 'e1000e_dev' should not be NULL
>
> Any idea what's going on here?
>
> thanks
> -- PMM
I'm yet to review these patches, but IIRC pci_data_read and friends
aren't designed with pcie in mind - they implement the classic pci
config space.
I'd like to see more justification about how these are now going
to be used.
--
MST
next prev parent reply other threads:[~2018-02-08 17:47 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 4:24 [Qemu-arm] [PATCH v5 00/14] Initial i.MX7 support Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 01/14] sdhci: Add i.MX specific subtype of SDHCI Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 14:41 ` [Qemu-arm] " Philippe Mathieu-Daudé
2018-02-07 14:41 ` [Qemu-devel] " Philippe Mathieu-Daudé
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 02/14] hw: i.MX: Convert i.MX6 to use TYPE_IMX_USDHC Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 03/14] i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 04/14] i.MX: Add code to emulate i.MX2 watchdog IP block Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 14:26 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 05/14] i.MX: Add code to emulate i.MX7 SNVS IP-block Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 06/14] i.MX: Add code to emulate GPCv2 IP block Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 07/14] i.MX: Add i.MX7 GPT variant Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 08/14] i.MX: Add implementation of i.MX7 GPR IP block Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 09/14] pci: Use pci_config_size in pci_data_* accessors Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 14:29 ` Philippe Mathieu-Daudé
2018-02-07 14:29 ` Philippe Mathieu-Daudé
2018-02-08 17:20 ` Peter Maydell
2018-02-08 17:20 ` Peter Maydell
2018-02-08 17:34 ` Michael S. Tsirkin [this message]
2018-02-08 17:34 ` Michael S. Tsirkin
2018-02-08 17:43 ` Andrey Smirnov
2018-02-08 17:43 ` Andrey Smirnov
2018-02-08 17:50 ` [Qemu-arm] " Michael S. Tsirkin
2018-02-08 17:50 ` [Qemu-devel] " Michael S. Tsirkin
2018-02-08 18:08 ` Peter Maydell
2018-02-08 18:08 ` Peter Maydell
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 10/14] pci: Add support for Designware IP block Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-08 17:45 ` Michael S. Tsirkin
2018-02-08 17:45 ` Michael S. Tsirkin
2018-02-08 20:03 ` [Qemu-arm] " Andrey Smirnov
2018-02-08 20:03 ` [Qemu-devel] " Andrey Smirnov
2018-02-08 20:11 ` [Qemu-arm] " Michael S. Tsirkin
2018-02-08 20:11 ` [Qemu-devel] " Michael S. Tsirkin
2018-02-08 20:22 ` Andrey Smirnov
2018-02-08 20:22 ` Andrey Smirnov
2018-02-08 20:33 ` [Qemu-arm] " Michael S. Tsirkin
2018-02-08 20:33 ` [Qemu-devel] " Michael S. Tsirkin
2018-02-08 20:43 ` [Qemu-arm] " Andrey Smirnov
2018-02-08 20:43 ` [Qemu-devel] " Andrey Smirnov
2018-02-09 0:08 ` [Qemu-arm] " Michael S. Tsirkin
2018-02-09 0:08 ` [Qemu-devel] " Michael S. Tsirkin
2018-02-07 4:24 ` [Qemu-devel] [PATCH v5 11/14] usb: Add basic code to emulate Chipidea USB IP Andrey Smirnov
2018-02-07 4:24 ` Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 12/14] i.MX: Add i.MX7 SOC implementation Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-08 13:26 ` [Qemu-arm] " Peter Maydell
2018-02-08 13:26 ` [Qemu-devel] " Peter Maydell
2018-02-08 16:49 ` [Qemu-arm] " Andrey Smirnov
2018-02-08 16:49 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 4:24 ` [Qemu-arm] [PATCH v5 13/14] hw/arm: Move virt's PSCI DT fixup code to arm/boot.c Andrey Smirnov
2018-02-07 4:24 ` [Qemu-devel] " Andrey Smirnov
2018-02-07 14:27 ` Philippe Mathieu-Daudé
2018-02-07 14:27 ` Philippe Mathieu-Daudé
2018-02-08 13:49 ` [Qemu-devel] [PATCH v5 00/14] Initial i.MX7 support Peter Maydell
2018-02-08 13:49 ` Peter Maydell
2018-02-08 16:50 ` Andrey Smirnov
2018-02-08 16:50 ` Andrey Smirnov
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=20180208193033-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew.smirnov@gmail.com \
--cc=f4bug@amsat.org \
--cc=jasowang@redhat.com \
--cc=marcel.apfelbaum@zoho.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=yurovsky@gmail.com \
/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.