All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ben Widawsky <ben.widawsky@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/mbox: Do not allow immediate mode in SET_PARTITION_INFO
Date: Tue, 4 Jan 2022 15:11:37 -0800	[thread overview]
Message-ID: <20220104231137.GA789645@alison-desk> (raw)
In-Reply-To: <CAPcyv4j0wqvX82wPxgvLLu7DcSu4TRs5RE-jXg_YXz=y_7ucrQ@mail.gmail.com>

Thanks for the review...
On Tue, Jan 04, 2022 at 11:02:19AM -0800, Dan Williams wrote:
> On Mon, Jan 3, 2022 at 12:15 PM <alison.schofield@intel.com> wrote:
> >
> > From: Alison Schofield <alison.schofield@intel.com>
> >
> > User space may send the SET_PARTITION_INFO mailbox command using
> > the IOCTL interface. Inspect the input payload and fail if the
> > immediate flag is set.
> >
> > This is the first instance of the driver inspecting an input payload
> > from user space. Assume there will be more such cases and implement
> > with an extensible helper.
> >
> > Note: At this time immediate partitioning is not allowed because the
> > kernel will need to react immediately to this configuration change
> > and that support is not yet implemented.
> 
> I would say:
> 
> In order for the kernel to react to an immediate partition change it
> needs to assert that the change will not affect any active decode. At
> a minimum this requires validating that the device is using HDM
> decoders instead of the CXL DVSEC for decode, and that none of the
> active HDM decoders are affected by the partition change. For now,
> just fail until that support arrives.
> 
Got it! 
> >

snip

> > +static bool cxl_payload_from_user_allowed(u16 opcode, void *payload_in)
> > +{
> > +       switch (opcode) {
> > +       case CXL_MBOX_OP_SET_PARTITION_INFO: {
> > +               struct cxl_mbox_set_partition_info *pi;
> > +
> > +               pi = (struct cxl_mbox_set_partition_info *)payload_in;
> 
> No need for a cast since @payload_in is a 'void *'
> 
Got it!

> > +               if (pi->flags && CXL_SET_PARTITION_IMMEDIATE_FLAG)
> > +                       return false;
> > +               break;
> > +       }
> > +       default:
> > +               break;
> > +       }
> > +       return true;
> > +}
> > +

snip

> > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> > index 8d96d009ad90..e10b86f06c75 100644
> > --- a/drivers/cxl/cxlmem.h
> > +++ b/drivers/cxl/cxlmem.h
> > @@ -231,6 +231,13 @@ struct cxl_mbox_set_lsa {
> >         u8 data[];
> >  } __packed;
> >
> > +struct cxl_mbox_set_partition_info {
> > +       u64 volatile_capacity;
> 
> This should be __le64, and it looks like 'struct cxl_mbox_get_lsa' and
> 'struct cxl_mbox_set_lsa' need similar fixups.
> 

Got it and will do!


> > +       u8 flags;
> > +} __packed;
> > +
> > +#define  CXL_SET_PARTITION_IMMEDIATE_FLAG      BIT(0)
> > +
> >  /**
> >   * struct cxl_mem_command - Driver representation of a memory device command
> >   * @info: Command information as it exists for the UAPI
> >
> > base-commit: 53989fad1286e652ea3655ae3367ba698da8d2ff
> > --
> > 2.31.1
> >

  reply	other threads:[~2022-01-04 23:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03 20:21 [PATCH] cxl/mbox: Do not allow immediate mode in SET_PARTITION_INFO alison.schofield
2022-01-04 19:02 ` Dan Williams
2022-01-04 23:11   ` Alison Schofield [this message]
2022-01-04 23:21 ` Ben Widawsky
2022-01-05  0:59   ` Alison Schofield
2022-01-05  3:22     ` Dan Williams

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=20220104231137.GA789645@alison-desk \
    --to=alison.schofield@intel.com \
    --cc=ben.widawsky@intel.com \
    --cc=dan.j.williams@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 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.