From: mani <mani@kernel.org>
To: Li Chen <me@linux.beauty>
Cc: linux-pci <linux-pci@vger.kernel.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Kishon Vijay Abraham I <kishon@ti.com>,
Bjorn Helgaas <helgaas@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [RFC] add __iomem cookie for EPF BAR
Date: Tue, 8 Aug 2023 12:33:57 +0530 [thread overview]
Message-ID: <20230808070357.GC4990@thinkpad> (raw)
In-Reply-To: <189cff865f3.fc7e71c96186.1411633612292556520@linux.beauty>
On Mon, Aug 07, 2023 at 08:28:30PM +0800, Li Chen wrote:
> Hi All
>
> Currently, the EPF's bar is allocated by pci_epf_alloc_space, which internally uses dma_alloc_coherent and the caching behavior of dma_alloc_coherent may vary depending on platforms.
>
> The bar space is exported to RC, which means that RC may modify it without EP being aware of it, so EP still read from the cache and get stalled data. To address this issue, the bar space should be treated as iomem instead and forced to use io read/write APIs, which enforces volatile.
>
We already had a similar discussion on using volatile for BAR space and settled
with {WRITE/READ}_ONCE macros in EPF Test driver [1].
Since the BAR space allocated in endpoint is not a MMIO, I don't think it should
be forced as iomem. Rather EPF drivers should use _ONCE macros to access the
fields to avoid coherency issues as suggested by Arnd earlier.
- Mani
[1] https://lore.kernel.org/linux-pci/c49df2f9-9848-45aa-9d64-9e4e9841440f@app.fastmail.com/
> If you agree, I would create patches for existing EPF and EPF/EPC core and submit them for review.
>
> Regards,
> Li
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-08-08 19:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 12:28 [RFC] add __iomem cookie for EPF BAR Li Chen
2023-08-08 7:03 ` mani [this message]
2023-08-08 7:44 ` Arnd Bergmann
2023-08-09 1:09 ` Li Chen
2023-08-09 7:10 ` Arnd Bergmann
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=20230808070357.GC4990@thinkpad \
--to=mani@kernel.org \
--cc=arnd@arndb.de \
--cc=helgaas@kernel.org \
--cc=kishon@ti.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=me@linux.beauty \
/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.