From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: qemu-devel@nongnu.org, "Michael Tsirkin" <mst@redhat.com>,
"Fan Ni" <fan.ni@samsung.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
linux-cxl@vger.kernel.org
Cc: <linuxarm@huawei.com>
Subject: [PATCH v3 1/4] hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c
Date: Mon, 11 Sep 2023 12:43:10 +0100 [thread overview]
Message-ID: <20230911114313.6144-2-Jonathan.Cameron@huawei.com> (raw)
In-Reply-To: <20230911114313.6144-1-Jonathan.Cameron@huawei.com>
There is no strong justification for keeping these in the header
so push them down into the associated cxl-component-utils.c file.
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
include/hw/cxl/cxl_component.h | 18 ++----------------
hw/cxl/cxl-component-utils.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 42c7e581a7..bdb3881a6b 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -225,26 +225,12 @@ void cxl_component_create_dvsec(CXLComponentState *cxl_cstate,
enum reg_type cxl_dev_type, uint16_t length,
uint16_t type, uint8_t rev, uint8_t *body);
-static inline int cxl_decoder_count_enc(int count)
-{
- switch (count) {
- case 1: return 0;
- case 2: return 1;
- case 4: return 2;
- case 6: return 3;
- case 8: return 4;
- case 10: return 5;
- }
- return 0;
-}
+int cxl_decoder_count_enc(int count);
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 1ULL << (ig + 8);
-}
+hwaddr cxl_decode_ig(int ig);
CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb);
bool cxl_get_hb_passthrough(PCIHostState *hb);
diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c
index 378f1082ce..ea2d4770ec 100644
--- a/hw/cxl/cxl-component-utils.c
+++ b/hw/cxl/cxl-component-utils.c
@@ -13,6 +13,24 @@
#include "hw/pci/pci.h"
#include "hw/cxl/cxl.h"
+int cxl_decoder_count_enc(int count)
+{
+ switch (count) {
+ case 1: return 0;
+ case 2: return 1;
+ case 4: return 2;
+ case 6: return 3;
+ case 8: return 4;
+ case 10: return 5;
+ }
+ return 0;
+}
+
+hwaddr cxl_decode_ig(int ig)
+{
+ return 1ULL << (ig + 8);
+}
+
static uint64_t cxl_cache_mem_read_reg(void *opaque, hwaddr offset,
unsigned size)
{
--
2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org, "Michael Tsirkin" <mst@redhat.com>,
"Fan Ni" <fan.ni@samsung.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
linux-cxl@vger.kernel.org
Cc: <linuxarm@huawei.com>
Subject: [PATCH v3 1/4] hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c
Date: Mon, 11 Sep 2023 12:43:10 +0100 [thread overview]
Message-ID: <20230911114313.6144-2-Jonathan.Cameron@huawei.com> (raw)
In-Reply-To: <20230911114313.6144-1-Jonathan.Cameron@huawei.com>
There is no strong justification for keeping these in the header
so push them down into the associated cxl-component-utils.c file.
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
include/hw/cxl/cxl_component.h | 18 ++----------------
hw/cxl/cxl-component-utils.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
index 42c7e581a7..bdb3881a6b 100644
--- a/include/hw/cxl/cxl_component.h
+++ b/include/hw/cxl/cxl_component.h
@@ -225,26 +225,12 @@ void cxl_component_create_dvsec(CXLComponentState *cxl_cstate,
enum reg_type cxl_dev_type, uint16_t length,
uint16_t type, uint8_t rev, uint8_t *body);
-static inline int cxl_decoder_count_enc(int count)
-{
- switch (count) {
- case 1: return 0;
- case 2: return 1;
- case 4: return 2;
- case 6: return 3;
- case 8: return 4;
- case 10: return 5;
- }
- return 0;
-}
+int cxl_decoder_count_enc(int count);
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 1ULL << (ig + 8);
-}
+hwaddr cxl_decode_ig(int ig);
CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb);
bool cxl_get_hb_passthrough(PCIHostState *hb);
diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c
index 378f1082ce..ea2d4770ec 100644
--- a/hw/cxl/cxl-component-utils.c
+++ b/hw/cxl/cxl-component-utils.c
@@ -13,6 +13,24 @@
#include "hw/pci/pci.h"
#include "hw/cxl/cxl.h"
+int cxl_decoder_count_enc(int count)
+{
+ switch (count) {
+ case 1: return 0;
+ case 2: return 1;
+ case 4: return 2;
+ case 6: return 3;
+ case 8: return 4;
+ case 10: return 5;
+ }
+ return 0;
+}
+
+hwaddr cxl_decode_ig(int ig)
+{
+ return 1ULL << (ig + 8);
+}
+
static uint64_t cxl_cache_mem_read_reg(void *opaque, hwaddr offset,
unsigned size)
{
--
2.39.2
next prev parent reply other threads:[~2023-09-11 22:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-11 11:43 [PATCH v3 0/4] hw/cxl: Support emulating 4 HDM decoders throughout topology Jonathan Cameron
2023-09-11 11:43 ` Jonathan Cameron via
2023-09-11 11:43 ` Jonathan Cameron [this message]
2023-09-11 11:43 ` [PATCH v3 1/4] hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c Jonathan Cameron via
2023-09-12 16:14 ` Fan Ni
2023-09-11 11:43 ` [PATCH v3 2/4] hw/cxl: Add utility functions decoder interleave ways and target count Jonathan Cameron
2023-09-11 11:43 ` Jonathan Cameron via
2023-09-12 17:20 ` Fan Ni
2023-09-13 8:58 ` Jonathan Cameron
2023-09-13 8:58 ` Jonathan Cameron via
2023-09-11 11:43 ` [PATCH v3 3/4] hw/cxl: Fix and use same calculation for HDM decoder block size everywhere Jonathan Cameron
2023-09-11 11:43 ` Jonathan Cameron via
2023-09-12 17:43 ` Fan Ni
2023-09-13 6:53 ` Philippe Mathieu-Daudé
2023-09-13 9:01 ` Jonathan Cameron
2023-09-13 9:01 ` Jonathan Cameron via
2023-09-11 11:43 ` [PATCH v3 4/4] hw/cxl: Support 4 HDM decoders at all levels of topology Jonathan Cameron
2023-09-11 11:43 ` Jonathan Cameron via
2023-09-12 18:08 ` Fan Ni
2023-09-13 9:03 ` Jonathan Cameron
2023-09-13 9:03 ` Jonathan Cameron via
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=20230911114313.6144-2-Jonathan.Cameron@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=fan.ni@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.