summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJonathan Cameron2022-04-29 16:40:51 +0200
committerMichael S. Tsirkin2022-05-13 12:13:36 +0200
commit829de299d1a4dcac3cd6c494d1c974bdbc608611 (patch)
tree10ee4ca91c16548a4980a462f08e24743fcd844c /include
parentacpi/cxl: Create the CEDT (9.14.1) (diff)
downloadqemu-829de299d1a4dcac3cd6c494d1c974bdbc608611.tar.gz
qemu-829de299d1a4dcac3cd6c494d1c974bdbc608611.tar.xz
qemu-829de299d1a4dcac3cd6c494d1c974bdbc608611.zip
hw/cxl/component: Add utils for interleave parameter encoding/decoding
Both registers and the CFMWS entries in CDAT use simple encodings for the number of interleave ways and the interleave granularity. Introduce simple conversion functions to/from the unencoded number / size. So far the iw decode has not been needed so is it not implemented. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220429144110.25167-27-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/cxl/cxl_component.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 7d8f395cbe..4f69688c47 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -210,4 +210,12 @@ static inline int cxl_decoder_count_enc(int count)
return 0;
}
+uint8_t cxl_interleave_ways_enc(int iw, Error **errp);
+uint8_t cxl_interleave_granularity_enc(uint64_t gran, Error **errp);
+
+static inline hwaddr cxl_decode_ig(int ig)
+{
+ return 1 << (ig + 8);
+}
+
#endif