From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <dan.j.williams@intel.com>,
<ira.weiny@intel.com>, <vishal.l.verma@intel.com>,
<alison.schofield@intel.com>
Subject: Re: [PATCH v2 7/8] cxl: Add emulation when HDM decoders are not committed
Date: Wed, 18 Jan 2023 10:12:31 +0000 [thread overview]
Message-ID: <20230118101231.00001d81@Huawei.com> (raw)
In-Reply-To: <25e66916-f05a-d97a-2879-13f08a0a43de@intel.com>
On Tue, 17 Jan 2023 16:19:39 -0700
Dave Jiang <dave.jiang@intel.com> wrote:
> On 1/13/23 7:07 AM, Jonathan Cameron wrote:
> > On Mon, 09 Jan 2023 14:44:03 -0700
> > Dave Jiang <dave.jiang@intel.com> wrote:
> >
> >> For the case where DVSEC range register(s) are active and HDM decoders are
> >> not committed, use RR to provide emulation. A first pass is done to note
> >> whether any decoders are committed. If there are no committed endpoint
> >> decoders, then DVSEC ranges will be used for emulation.
> >>
> >> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> > Hi Dave
> >
> > One trivial suggestion inline. With that tidied up
> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> >> ---
> >> drivers/cxl/core/hdm.c | 39 ++++++++++++++++++++++++++++++++-------
> >> drivers/cxl/cxl.h | 1 +
> >> 2 files changed, 33 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> >> index ed5e9ef3aa9b..40844ff2fe52 100644
> >> --- a/drivers/cxl/core/hdm.c
> >> +++ b/drivers/cxl/core/hdm.c
> >> @@ -729,6 +729,33 @@ static int cxl_setup_hdm_decoder_from_dvsec(struct cxl_port *port,
> >> return 0;
> >> }
> >>
> >> +static bool should_emulate_decoders(struct cxl_hdm *cxlhdm)
> >> +{
> >> + void __iomem *hdm = cxlhdm->regs.hdm_decoder;
> >> + bool committed;
> >> + u32 ctrl;
> >> + int i;
> >> +
> >> + if (!is_cxl_endpoint(cxlhdm->port))
> >> + return false;
> >> +
> >> + if (!hdm)
> >> + return true;
> >> +
> >> + /*
> >> + * If any decoders are committed already, there should not be any
> >> + * emulated DVSEC decoders.
> >> + */
> >> + for (i = 0; i < cxlhdm->decoder_count; i++) {
> >> + ctrl = readl(hdm + CXL_HDM_DECODER0_CTRL_OFFSET(i));
> >> + committed = !!(ctrl & CXL_HDM_DECODER0_CTRL_COMMITTED);
> >
> > FIELD_GET() is nicer than !! I think.
> >
> > Also, local variable isn't useful so I'd get rid of it.
> >
> > if (FIELD_GET(ctrl, CXL_HDM_DECODER0_CTRL_COMMITTED))
> > return false;
>
> Compiler does not seem to like single bit mask. How about
That's strange - number of bits shouldn't matter.
hough I got parameters backwards above which doesn't help.
FIELD_GET(CXL_HDM_DECODER0_CTRL_COMMITTED, ctrl)
> if (ctrl & CXL_HDM_DECODER0_CTRL_COMMITTED)
> return false;
> >
> >
> >> + if (committed)
> >> + return false;
> >> + }
> >> +
> >> + return true;
> >> +}
> >> +
> >
> >>
> >
next prev parent reply other threads:[~2023-01-18 11:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 21:43 [PATCH v2 0/8] cxl: Introduce HDM decoder emulation from DVSEC range registers Dave Jiang
2023-01-09 21:43 ` [PATCH v2 1/8] cxl: break out range register decoding from cxl_hdm_decode_init() Dave Jiang
2023-01-13 13:36 ` Jonathan Cameron
2023-01-17 20:12 ` Dave Jiang
2023-01-09 21:43 ` [PATCH v2 2/8] cxl: export cxl_dvsec_rr_decode() to cxl_port Dave Jiang
2023-01-13 13:43 ` Jonathan Cameron
2023-01-09 21:43 ` [PATCH v2 3/8] cxl: refactor cxl_hdm_decode_init() Dave Jiang
2023-01-13 13:46 ` Jonathan Cameron
2023-01-09 21:43 ` [PATCH v2 4/8] cxl: emulate HDM decoder from DVSEC range registers Dave Jiang
2023-01-13 13:51 ` Jonathan Cameron
2023-01-09 21:43 ` [PATCH v2 5/8] cxl: create emulated cxl_hdm for devices that do not have HDM decoders Dave Jiang
2023-01-13 13:54 ` Jonathan Cameron
2023-01-13 14:01 ` Jonathan Cameron
2023-01-09 21:43 ` [PATCH v2 6/8] cxl: create emulated decoders for devices without " Dave Jiang
2023-01-13 14:02 ` Jonathan Cameron
2023-01-09 21:44 ` [PATCH v2 7/8] cxl: Add emulation when HDM decoders are not committed Dave Jiang
2023-01-13 14:07 ` Jonathan Cameron
2023-01-17 23:19 ` Dave Jiang
2023-01-18 10:12 ` Jonathan Cameron [this message]
2023-01-18 15:22 ` Dave Jiang
2023-01-09 21:44 ` [PATCH v2 8/8] cxl: remove locked check for dvsec_range_allowed() Dave Jiang
2023-01-13 14:08 ` 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=20230118101231.00001d81@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/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