[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 50/53] qemu/bswap: Add const_le64()
From: |
Michael S. Tsirkin |
Subject: |
[PULL 50/53] qemu/bswap: Add const_le64() |
Date: |
Thu, 2 Mar 2023 03:27:07 -0500 |
From: Ira Weiny <ira.weiny@intel.com>
Gcc requires constant versions of cpu_to_le* calls.
Add a 64 bit version.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gregory Price <gregory.price@memverge.com>
Tested-by: Gregory Price <gregory.price@memverge.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20230206172816.8201-9-Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/qemu/bswap.h | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index b1650daedf..15a78c0db5 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -125,11 +125,20 @@ CPU_CONVERT(le, 32, uint32_t)
CPU_CONVERT(le, 64, uint64_t)
/*
- * Same as cpu_to_le{16,32}, except that gcc will figure the result is
+ * Same as cpu_to_le{16,32,64}, except that gcc will figure the result is
* a compile-time constant if you pass in a constant. So this can be
* used to initialize static variables.
*/
#if HOST_BIG_ENDIAN
+# define const_le64(_x) \
+ ((((_x) & 0x00000000000000ffU) << 56) | \
+ (((_x) & 0x000000000000ff00U) << 40) | \
+ (((_x) & 0x0000000000ff0000U) << 24) | \
+ (((_x) & 0x00000000ff000000U) << 8) | \
+ (((_x) & 0x000000ff00000000U) >> 8) | \
+ (((_x) & 0x0000ff0000000000U) >> 24) | \
+ (((_x) & 0x00ff000000000000U) >> 40) | \
+ (((_x) & 0xff00000000000000U) >> 56))
# define const_le32(_x) \
((((_x) & 0x000000ffU) << 24) | \
(((_x) & 0x0000ff00U) << 8) | \
@@ -139,6 +148,7 @@ CPU_CONVERT(le, 64, uint64_t)
((((_x) & 0x00ff) << 8) | \
(((_x) & 0xff00) >> 8))
#else
+# define const_le64(_x) (_x)
# define const_le32(_x) (_x)
# define const_le16(_x) (_x)
#endif
--
MST
- [PULL 30/53] pcie: introduce pcie_sltctl_powered_off() helper, (continued)
- [PULL 30/53] pcie: introduce pcie_sltctl_powered_off() helper, Michael S. Tsirkin, 2023/03/02
- [PULL 35/53] chardev/char-socket: set s->listener = NULL in char_socket_finalize, Michael S. Tsirkin, 2023/03/02
- [PULL 38/53] intel-iommu: fail DEVIOTLB_UNMAP without dt mode, Michael S. Tsirkin, 2023/03/02
- [PULL 39/53] memory: introduce memory_region_unmap_iommu_notifier_range(), Michael S. Tsirkin, 2023/03/02
- [PULL 37/53] intel-iommu: fail MAP notifier without caching mode, Michael S. Tsirkin, 2023/03/02
- [PULL 42/53] MAINTAINERS: Add Fan Ni as Compute eXpress Link QEMU reviewer, Michael S. Tsirkin, 2023/03/02
- [PULL 43/53] hw/mem/cxl_type3: Improve error handling in realize(), Michael S. Tsirkin, 2023/03/02
- [PULL 48/53] hw/i386/acpi: Drop duplicate _UID entry for CXL root bridge, Michael S. Tsirkin, 2023/03/02
- [PULL 50/53] qemu/bswap: Add const_le64(),
Michael S. Tsirkin <=
- [PULL 40/53] smmu: switch to use memory_region_unmap_iommu_notifier_range(), Michael S. Tsirkin, 2023/03/02
- [PULL 41/53] intel-iommu: send UNMAP notifications for domain or global inv desc, Michael S. Tsirkin, 2023/03/02
- [PULL 46/53] hw/cxl: Add CXL_CAPACITY_MULTIPLIER definition, Michael S. Tsirkin, 2023/03/02
- [PULL 44/53] hw/pci-bridge/cxl_downstream: Fix type naming mismatch, Michael S. Tsirkin, 2023/03/02
- [PULL 36/53] memory: Optimize replay of guest mapping, Michael S. Tsirkin, 2023/03/02
- [PULL 45/53] hw/cxl: set cxl-type3 device type to PCI_CLASS_MEMORY_CXL, Michael S. Tsirkin, 2023/03/02
- [PULL 47/53] tests/acpi: Allow update of q35/DSDT.cxl, Michael S. Tsirkin, 2023/03/02
- [PULL 49/53] tests: acpi: Update q35/DSDT.cxl for removed duplicate UID, Michael S. Tsirkin, 2023/03/02
- [PULL 51/53] qemu/uuid: Add UUID static initializer, Michael S. Tsirkin, 2023/03/02
- [PULL 52/53] hw/cxl/mailbox: Use new UUID network order define for cel_uuid, Michael S. Tsirkin, 2023/03/02