qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ani Sinha <ani@anisinha.ca>
To: qemu-devel@nongnu.org
Cc: Ani Sinha <ani@anisinha.ca>, "Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH] Add a comment about endian-ness of capabilities recorded in pci config space
Date: Mon, 25 Oct 2021 15:47:36 +0530	[thread overview]
Message-ID: <20211025101736.404148-1-ani@anisinha.ca> (raw)

Values in PCI configuration space are written in little endian format. This
includes capability values recorded in pci config space for pci bridges etc.
Add comment to remind developers to make sure the values are written in little
endian for all platforms and that the code must be endian safe.
Please also see the following fix which resolves an issue related to code not
being endian safe for BE systems:

0e464f7d99311 ("pci: fix PCI resource reserve capability on BE")

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 include/hw/pci/pci_bridge.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index a94d350034..5fc6841833 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -143,6 +143,8 @@ typedef struct PCIBridgeQemuCap {
 /*
  * PCI BUS/IO/MEM/PREFMEM additional resources recorded as a
  * capability in PCI configuration space to reserve on firmware init.
+ * The values of these parameters must be in little-endian and
+ * the code assigning the values must be endian safe for all platforms.
  */
 typedef struct PCIResReserve {
     uint32_t bus;
-- 
2.25.1



             reply	other threads:[~2021-10-25 10:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 10:17 Ani Sinha [this message]
2021-10-25 12:08 ` [PATCH] Add a comment about endian-ness of capabilities recorded in pci config space 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=20211025101736.404148-1-ani@anisinha.ca \
    --to=ani@anisinha.ca \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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 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).