From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
qemu-devel@nongnu.org, Michael Tsirkin <mst@redhat.com>,
Fan Ni <fan.ni@samsung.com>,
linux-cxl@vger.kernel.org
Cc: Dave Jiang <dave.jiang@intel.com>, linuxarm@huawei.com
Subject: Re: [PATCH 1/2] hw/cxl: Add utility functions decoder interleave ways and target count.
Date: Mon, 4 Sep 2023 20:26:59 +0200 [thread overview]
Message-ID: <89d5477c-ece0-b738-c64f-056242619d92@linaro.org> (raw)
In-Reply-To: <20230904164704.18739-2-Jonathan.Cameron@huawei.com>
On 4/9/23 18:47, Jonathan Cameron wrote:
> As an encoded version of these key configuration parameters is
> a register, provide functions to extract it again so as to avoid
> the need for duplicating the storage.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> include/hw/cxl/cxl_component.h | 14 ++++++++++++++
> hw/cxl/cxl-component-utils.c | 17 +++++++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h
> index 42c7e581a7..f0ad9cf7de 100644
> --- a/include/hw/cxl/cxl_component.h
> +++ b/include/hw/cxl/cxl_component.h
> @@ -238,7 +238,21 @@ static inline int cxl_decoder_count_enc(int count)
> return 0;
> }
>
> +static inline int cxl_decoder_count_dec(int enc_cnt)
> +{
> + switch (enc_cnt) {
> + case 0: return 1;
> + case 1: return 2;
> + case 2: return 4;
> + case 3: return 6;
> + case 4: return 8;
> + case 5: return 10;
> + }
> + return 0;
> +}
Why inline?
Alternatively:
unsigned cxl_decoder_count_dec(unsigned enc_cnt)
{
return enc_cnt <= 5 ? 2 * enc_cnt : 0;
}
next prev parent reply other threads:[~2023-09-04 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 16:47 [PATCH 0/2] hw/cxl: Support emulating 4 HDM decoders throughout topology Jonathan Cameron
2023-09-04 16:47 ` [PATCH 1/2] hw/cxl: Add utility functions decoder interleave ways and target count Jonathan Cameron
2023-09-04 18:26 ` Philippe Mathieu-Daudé [this message]
2023-09-05 14:56 ` Jonathan Cameron
2023-09-05 15:06 ` Jonathan Cameron
2023-09-05 16:55 ` Philippe Mathieu-Daudé
2023-09-07 11:27 ` Jonathan Cameron
2023-09-04 16:47 ` [PATCH 2/2] hw/cxl: Support 4 HDM decoders at all levels of topology Jonathan Cameron
2023-09-04 18:36 ` Philippe Mathieu-Daudé
2023-09-05 15:44 ` Jonathan Cameron
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=89d5477c-ece0-b738-c64f-056242619d92@linaro.org \
--to=philmd@linaro.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=dave.jiang@intel.com \
--cc=fan.ni@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linuxarm@huawei.com \
--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