From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "Niklas Cassel" <cassel@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Damien Le Moal" <dlemoal@kernel.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH] misc: pci_endpoint_test: Use memcpy_toio()/memcpy_fromio() for BAR tests
Date: Tue, 19 Mar 2024 10:01:00 +0530 [thread overview]
Message-ID: <20240319043100.GB52500@thinkpad> (raw)
In-Reply-To: <8194c85c-cdc8-431a-a2fc-50569475b160@app.fastmail.com>
On Mon, Mar 18, 2024 at 09:02:21PM +0100, Arnd Bergmann wrote:
> On Mon, Mar 18, 2024, at 20:30, Niklas Cassel wrote:
> > diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> > index 705029ad8eb5..cb6c9ccf3a5f 100644
> > --- a/drivers/misc/pci_endpoint_test.c
> > +++ b/drivers/misc/pci_endpoint_test.c
> > @@ -272,31 +272,59 @@ static const u32 bar_test_pattern[] = {
> > 0xA5A5A5A5,
> > };
> >
> > +static int pci_endpoint_test_bar_memcmp(struct pci_endpoint_test *test,
> > + enum pci_barno barno, int offset,
> > + void *write_buf, void *read_buf,
> > + int size)
> > +{
> > + memset(write_buf, bar_test_pattern[barno], size);
> > + memcpy_toio(test->bar[barno] + offset, write_buf, size);
> > +
> > + /* Make sure that reads are performed after writes. */
> > + mb();
> > + memcpy_fromio(read_buf, test->bar[barno] + offset, size);
>
> Did you see actual bugs without the barrier? On normal PCI
> semantics, a read will always force a write to be flushed first.
>
Even for non-PCI cases, read/writes to the same region are not reordered, right?
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-03-19 4:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 19:30 [PATCH] misc: pci_endpoint_test: Use memcpy_toio()/memcpy_fromio() for BAR tests Niklas Cassel
2024-03-18 20:02 ` Arnd Bergmann
2024-03-19 4:31 ` Manivannan Sadhasivam [this message]
2024-03-19 6:41 ` Arnd Bergmann
2024-03-19 16:40 ` Niklas Cassel
2024-03-19 16:48 ` Manivannan Sadhasivam
2024-03-19 16:53 ` Niklas Cassel
2024-03-19 19:55 ` Arnd Bergmann
2024-03-19 21:36 ` Niklas Cassel
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=20240319043100.GB52500@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=arnd@arndb.de \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.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.