From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "rafael@kernel.org" <rafael@kernel.org>
Cc: lkp <lkp@intel.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
"Williams, Dan J" <dan.j.williams@intel.com>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Moore, Robert" <robert.moore@intel.com>,
"bhelgaas@google.com" <bhelgaas@google.com>
Subject: Re: [PATCH 2/2] acpi/pci_root: negotiate CXL _OSC
Date: Fri, 25 Mar 2022 23:11:50 +0000 [thread overview]
Message-ID: <dfcc7b9081fb3b6f15c04c500920709e0ed2cc8e.camel@intel.com> (raw)
In-Reply-To: <CAJZ5v0i5d+eYrW8afeC4xAN8rG54e=mOFVzMEMYLn0U63jhJAg@mail.gmail.com>
On Wed, 2022-03-23 at 20:25 +0100, Rafael J. Wysocki wrote:
> On Fri, Mar 18, 2022 at 10:30 PM Vishal Verma <vishal.l.verma@intel.com> wrote:
> >
> > @@ -385,20 +437,35 @@ static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 s
> > ctrl = *mask;
> > *mask |= root->osc_control_set;
> >
> > + if (is_cxl(root)) {
> > + cxl_ctrl = *cxl_mask;
> > + *mask |= root->osc_control_set;
>
> Is this correct?
>
> It appears redundant at least, because the same update has already
> happened above.
Oh good spot - this was a copy-paste error, it needs to be:
*cxl_mask |= root->cxl_osc_control_set;
I've fixed this up and all other comments too for v2.
Thanks for the review!
>
> > + }
> > +
> > /* Need to check the available controls bits before requesting them. */
> > do {
> > - status = acpi_pci_query_osc(root, support, mask);
> > + status = acpi_pci_query_osc(root, support, mask, cxl_support,
> > + cxl_mask);
> > if (ACPI_FAILURE(status))
> > return status;
> > - if (ctrl == *mask)
> > - break;
> > - decode_osc_control(root, "platform does not support",
> > - ctrl & ~(*mask));
> > + if (is_cxl(root)) {
> > + if ((ctrl == *mask) && (cxl_ctrl == *cxl_mask))
> > + break;
> > + decode_cxl_osc_control(root, "platform does not support",
> > + cxl_ctrl & ~(*cxl_mask));
> > + } else {
> > + if (ctrl == *mask)
> > + break;
> > + decode_osc_control(root, "platform does not support",
> > + ctrl & ~(*mask));
> > + }
> > ctrl = *mask;
> > - } while (*mask);
> > + cxl_ctrl = *cxl_mask;
> > + } while (*mask || *cxl_mask);
> >
> > /* No need to request _OSC if the control was already granted. */
> > - if ((root->osc_control_set & ctrl) == ctrl)
> > + if (((root->osc_control_set & ctrl) == ctrl) &&
> > + ((root->cxl_osc_control_set & cxl_ctrl) == cxl_ctrl))
> > return AE_OK;
> >
> > if ((ctrl & req) != req) {
> > @@ -410,11 +477,17 @@ static acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 s
> > capbuf[OSC_QUERY_DWORD] = 0;
> > capbuf[OSC_SUPPORT_DWORD] = root->osc_support_set;
> > capbuf[OSC_CONTROL_DWORD] = ctrl;
> > - status = acpi_pci_run_osc(root, capbuf, mask);
> > + if (is_cxl(root)) {
> > + capbuf[OSC_CXL_SUPPORT_DWORD] = root->cxl_osc_support_set;
> > + capbuf[OSC_CXL_CONTROL_DWORD] = cxl_ctrl;
> > + }
> > +
> > + status = acpi_pci_run_osc(root, capbuf, mask, cxl_mask);
> > if (ACPI_FAILURE(status))
> > return status;
> >
> > root->osc_control_set = *mask;
> > + root->cxl_osc_control_set = *cxl_mask;
> > return AE_OK;
> > }
> >
> > @@ -440,6 +513,19 @@ static u32 calculate_support(void)
> > return support;
> > }
> >
> > +static u32 calculate_cxl_support(void)
> > +{
> > + u32 support;
> > +
> > + support = OSC_CXL_2_0_PORT_DEV_REG_ACCESS_SUPPORT;
> > + if (pci_aer_available())
> > + support |= OSC_CXL_PROTOCOL_ERR_REPORTING_SUPPORT;
> > + if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
> > + support |= OSC_CXL_NATIVE_HP_SUPPORT;
> > +
> > + return support;
> > +}
> > +
> > static u32 calculate_control(void)
> > {
> > u32 control;
> > @@ -471,6 +557,16 @@ static u32 calculate_control(void)
> > return control;
> > }
> >
> > +static u32 calculate_cxl_control(void)
> > +{
> > + u32 control = 0;
> > +
> > + if (IS_ENABLED(CONFIG_MEMORY_FAILURE))
> > + control |= OSC_CXL_ERROR_REPORTING_CONTROL;
> > +
> > + return control;
> > +}
> > +
> > static bool os_control_query_checks(struct acpi_pci_root *root, u32 support)
> > {
> > struct acpi_device *device = root->device;
> > @@ -492,6 +588,7 @@ static bool os_control_query_checks(struct acpi_pci_root *root, u32 support)
> > static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
> > {
> > u32 support, control = 0, requested = 0;
> > + u32 cxl_support = 0, cxl_control = 0, cxl_requested = 0;
> > acpi_status status;
> > struct acpi_device *device = root->device;
> > acpi_handle handle = device->handle;
> > @@ -515,10 +612,20 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
> > if (os_control_query_checks(root, support))
> > requested = control = calculate_control();
> >
> > - status = acpi_pci_osc_control_set(handle, &control, support);
> > + if (is_cxl(root)) {
> > + cxl_support = calculate_cxl_support();
> > + decode_cxl_osc_support(root, "OS supports", cxl_support);
> > + cxl_requested = cxl_control = calculate_cxl_control();
> > + }
> > +
> > + status = acpi_pci_osc_control_set(handle, &control, support,
> > + &cxl_control, cxl_support);
> > if (ACPI_SUCCESS(status)) {
> > if (control)
> > decode_osc_control(root, "OS now controls", control);
> > + if (cxl_control)
> > + decode_cxl_osc_control(root, "OS now controls",
> > + cxl_control);
> >
> > if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
> > /*
> > @@ -547,6 +654,11 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm)
> > decode_osc_control(root, "OS requested", requested);
> > decode_osc_control(root, "platform willing to grant", control);
> > }
> > + if (cxl_control) {
> > + decode_cxl_osc_control(root, "OS requested", cxl_requested);
> > + decode_cxl_osc_control(root, "platform willing to grant",
> > + cxl_control);
> > + }
> >
> > dev_info(&device->dev, "_OSC: platform retains control of PCIe features (%s)\n",
> > acpi_format_exception(status));
> > --
> > 2.35.1
> >
next prev parent reply other threads:[~2022-03-25 23:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 21:30 [PATCH 0/2] acpi: add support for CXL _OSC Vishal Verma
2022-03-18 21:30 ` [PATCH 1/2] PCI/ACPI: Use CXL _OSC instead of PCIe _OSC Vishal Verma
2022-03-22 18:01 ` Rafael J. Wysocki
2022-03-22 18:08 ` Dan Williams
2022-03-23 19:23 ` Rafael J. Wysocki
2022-03-23 20:39 ` Dan Williams
2022-03-18 21:30 ` [PATCH 2/2] acpi/pci_root: negotiate CXL _OSC Vishal Verma
2022-03-22 18:22 ` Rafael J. Wysocki
2022-03-23 0:47 ` Davidlohr Bueso
2022-03-23 18:29 ` Verma, Vishal L
2022-03-23 19:02 ` Dan Williams
2022-03-23 19:25 ` Rafael J. Wysocki
2022-03-25 23:11 ` Verma, Vishal L [this message]
2022-03-18 21:34 ` [PATCH 0/2] acpi: add support for " Verma, Vishal L
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=dfcc7b9081fb3b6f15c04c500920709e0ed2cc8e.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=lkp@intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=robert.moore@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