Linux CXL
 help / color / mirror / Atom feed
From: Ben Cheatham <benjamin.cheatham@amd.com>
To: Dan Williams <dan.j.williams@intel.com>,
	<alejandro.lucero-palau@amd.com>
Cc: Alejandro Lucero <alucerop@amd.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [RFC 0/2] type2 cxl initialization
Date: Mon, 3 Mar 2025 15:26:20 -0600	[thread overview]
Message-ID: <e1af2fcf-339e-4cda-8c0b-88f540499518@amd.com> (raw)
In-Reply-To: <67c615da5dd98_1a772947d@dwillia2-xfh.jf.intel.com.notmuch>



On 3/3/25 2:49 PM, Dan Williams wrote:
> Ben Cheatham wrote:
>> On 2/20/25 2:00 PM, alejandro.lucero-palau@amd.com wrote:
>>> From: Alejandro Lucero <alucerop@amd.com>
>>>
>>> Avoiding to send the full type2 support patchset until there is an
>>> agreement about how to do the cxl initialization from accel drivers.
>>>
>>> Using the idea from fwctl for embedding cxl_dev_state in a private
>>> accel driver struct and a macro helping for the allocation and
>>> initialization of such struct.
>>>
>>> The main problem is the amount of internal cxl structs which need to be
>>> public for accel drivers which we tried to avoid since v1 of the type2
>>> patchset history.
>>
>> I have a suggestion or two in the next patch, but in my opinion the only
>> potentially problematic exports are the cxl register structs. I'm assuming
>> allowing accelerator drivers access to those may cause stale values in the
>> CXL driver, but I haven't looked. The only suggestion I have there is to
>> use pointers to the struct instead, but I imagine achieving could be a
>> non-trivial amount of effort.
> 
> Hmm, say more about why you think those are a problem. Those are
> "write-once at init" things, why would an accelerator driver have any
> reason to play with those post init?
> 

I could see a scenario where an accelerator driver tries to do some concurrent
setup with the CXL driver and may cause an issue. For example if a type 2 driver
tried to do something with HDM during setup, but I think a driver touching
any of these registers when the CXL driver already does this stuff is pretty
unlikely.

So that leads me to think it's better to not expose this at all, but I think
that would require more work than it's worth.

>> The only other member that may be a problem is the DPA partition info,
>> but I don't know enough about that to comment.
> 
> I think it is sufficient to mark the bulk of 'struct cxl_dev_state' as
> private and then move things into the public space as needed, something
> like:
> 
> struct cxl_dev_state {
> /* public */
>         struct device *dev;
>         struct cxl_memdev *cxlmd;
> /* private */
>         struct cxl_register_map reg_map;
>         struct cxl_regs regs;
>         int cxl_dvsec;
>         bool rcd;
>         bool media_ready;
>         struct resource dpa_res;
>         struct cxl_dpa_partition part[CXL_NR_PARTITIONS_MAX];
>         unsigned int nr_partitions;
>         u64 serial;
>         enum cxl_devtype type;
>         struct cxl_mailbox cxl_mbox;
> };
> 
> ...but otherwise let accelerator drivers see the full definition of that
> struct for constainer_of() operations.
That's fine by me.

      reply	other threads:[~2025-03-03 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20 20:00 [RFC 0/2] type2 cxl initialization alejandro.lucero-palau
2025-02-20 20:00 ` [RFC type cxl initialization 1/2] cxl: add type2 device basic support alejandro.lucero-palau
2025-03-03 20:15   ` Dan Williams
2025-03-04 14:21     ` Alejandro Lucero Palau
2025-03-03 20:39   ` Ben Cheatham
2025-03-03 20:51     ` Dan Williams
2025-03-03 21:26       ` Ben Cheatham
2025-02-20 20:00 ` [RFC type cxl initialization 2/2] sfc: add cxl support alejandro.lucero-palau
2025-03-03 20:26   ` Dan Williams
2025-03-03 20:38 ` [RFC 0/2] type2 cxl initialization Ben Cheatham
2025-03-03 20:49   ` Dan Williams
2025-03-03 21:26     ` Ben Cheatham [this message]

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=e1af2fcf-339e-4cda-8c0b-88f540499518@amd.com \
    --to=benjamin.cheatham@amd.com \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=alucerop@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.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