qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Dmitry Fleytman <dmitry@daynix.com>
Cc: Leonid Bloch <leonid.bloch@ravellosystems.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Jason Wang <jasowang@redhat.com>,
	Leonid Bloch <leonid@daynix.com>,
	Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Subject: Re: [Qemu-devel] [PATCH v6 01/17] pci: fix unaligned access in pci_xxx_quad()
Date: Mon, 30 May 2016 18:11:11 +0300	[thread overview]
Message-ID: <20160530181036-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <D324DD4C-6E11-45A0-931C-AF6FD4BFF6A9@daynix.com>

On Mon, May 30, 2016 at 06:05:57PM +0300, Dmitry Fleytman wrote:
> 
> > On 30 May 2016, at 17:47 PM, Michael S. Tsirkin <mst@redhat.com> wrote:
> > 
> > On Mon, May 30, 2016 at 12:14:26PM +0300, Leonid Bloch wrote:
> >> From: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
> >> 
> >> Replace legacy cpu_to_le64w()/le64_to_cpup()
> >> calls with stq_le_p()/ldq_le_p().
> >> 
> >> Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
> >> Signed-off-by: Leonid Bloch <leonid.bloch@ravellosystems.com>
> > 
> 
> Hi Michael,
> 
> > Could you please add a code comment to clarify what's going on a bit more?
> > Something to the point that capabilities are guaranteed to
> > be dword-aligned only.
> > 
> 
> Just to clarify, do you want to add these comments to 
> pci_set/get_quad functions or to the new DSN-generation function?

pci_set/get_quad

> > Also, this isn't a dependency of this patchset I think -
> > as far as I could say the only user of this is
> > 	pcie: Introduce function for DSN capability creation
> > but that merely accesses a capability, and all callers pass in
> > an aligned offset.
> 
> Right, this issue appeared after introduction of DSN generation function.

Does DSN generation function pass unaligned offsets?
It does not look like it does...

> All other callers pass aligned offsets so far.
> 
> Thanks,
> Dmitry
> 
> > 
> >> ---
> >> include/hw/pci/pci.h | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> >> index ef6ba51..ee238ad 100644
> >> --- a/include/hw/pci/pci.h
> >> +++ b/include/hw/pci/pci.h
> >> @@ -468,13 +468,13 @@ pci_get_long(const uint8_t *config)
> >> static inline void
> >> pci_set_quad(uint8_t *config, uint64_t val)
> >> {
> >> -    cpu_to_le64w((uint64_t *)config, val);
> >> +    stq_le_p(config, val);
> >> }
> >> 
> >> static inline uint64_t
> >> pci_get_quad(const uint8_t *config)
> >> {
> >> -    return le64_to_cpup((const uint64_t *)config);
> >> +    return ldq_le_p(config);
> >> }
> >> 
> >> static inline void
> >> -- 
> >> 2.5.5

  reply	other threads:[~2016-05-30 15:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  9:14 [Qemu-devel] [PATCH v6 00/17] Introduce Intel 82574 GbE Controller Emulation (e1000e) Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 01/17] pci: fix unaligned access in pci_xxx_quad() Leonid Bloch
2016-05-30 14:47   ` Michael S. Tsirkin
2016-05-30 15:05     ` Dmitry Fleytman
2016-05-30 15:11       ` Michael S. Tsirkin [this message]
2016-05-30 15:14         ` Dmitry Fleytman
2016-05-30 15:19           ` Michael S. Tsirkin
2016-05-30 15:22             ` Dmitry Fleytman
2016-05-30 15:26               ` Michael S. Tsirkin
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 02/17] msix: make msix_clr_pending() visible for clients Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 03/17] pci: Introduce define for PM capability version 1.1 Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 04/17] pcie: Add support for PCIe CAP v1 Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 05/17] pcie: Introduce function for DSN capability creation Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 06/17] vmxnet3: Use generic function for DSN capability definition Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 07/17] net: Introduce Toeplitz hash calculator Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 08/17] net: Add macros for MAC address tracing Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 09/17] vmxnet3: Use common MAC address tracing macros Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 10/17] net_pkt: Name vmxnet3 packet abstractions more generic Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 11/17] rtl8139: Move more TCP definitions to common header Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 12/17] net_pkt: Extend packet abstraction as required by e1000e functionality Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 13/17] vmxnet3: Use pci_dma_* API instead of cpu_physical_memory_* Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 14/17] e1000_regs: Add definitions for Intel 82574-specific bits Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 15/17] e1000: Move out code that will be reused in e1000e Leonid Bloch
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 16/17] net: Introduce e1000e device emulation Leonid Bloch
2016-05-30 15:10   ` Michael S. Tsirkin
2016-05-31  6:08     ` Dmitry Fleytman
2016-05-31  7:10       ` Dmitry Fleytman
2016-05-30  9:14 ` [Qemu-devel] [PATCH v6 17/17] e1000e: Introduce qtest for e1000e device Leonid Bloch
2016-05-30 14:50 ` [Qemu-devel] [PATCH v6 00/17] Introduce Intel 82574 GbE Controller Emulation (e1000e) Michael S. Tsirkin

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=20160530181036-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=leonid.bloch@ravellosystems.com \
    --cc=leonid@daynix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shmulik.ladkani@ravellosystems.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 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).