From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7OTT-0005p3-Ap for qemu-devel@nongnu.org; Mon, 30 May 2016 10:47:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7OTO-0007MK-20 for qemu-devel@nongnu.org; Mon, 30 May 2016 10:47:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7OTN-0007M0-TC for qemu-devel@nongnu.org; Mon, 30 May 2016 10:47:17 -0400 Date: Mon, 30 May 2016 17:47:12 +0300 From: "Michael S. Tsirkin" Message-ID: <20160530144712.GA1702@redhat.com> References: <1464599682-14592-1-git-send-email-leonid.bloch@ravellosystems.com> <1464599682-14592-2-git-send-email-leonid.bloch@ravellosystems.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1464599682-14592-2-git-send-email-leonid.bloch@ravellosystems.com> Subject: Re: [Qemu-devel] [PATCH v6 01/17] pci: fix unaligned access in pci_xxx_quad() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leonid Bloch Cc: qemu-devel@nongnu.org, Jason Wang , Dmitry Fleytman , Leonid Bloch , Shmulik Ladkani On Mon, May 30, 2016 at 12:14:26PM +0300, Leonid Bloch wrote: > From: Dmitry Fleytman > > Replace legacy cpu_to_le64w()/le64_to_cpup() > calls with stq_le_p()/ldq_le_p(). > > Signed-off-by: Dmitry Fleytman > Signed-off-by: Leonid Bloch 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. 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. > --- > 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