linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ionela Voinescu <Ionela.Voinescu@arm.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Robert Moore <robert.moore@intel.com>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	"open list:ACPI COMPONENT ARCHITECTURE (ACPICA)"
	<devel@acpica.org>
Subject: Re: [PATCH v2 1/5] ACPI: CPPC: Check _OSC for flexible address space
Date: Thu, 19 May 2022 19:47:24 +0200	[thread overview]
Message-ID: <CAJZ5v0iHMuw7Ap5edok38TjaTCqE5sBn2GYVPz2_z_tc09t-hw@mail.gmail.com> (raw)
In-Reply-To: <20220518090901.2724518-1-pierre.gondois@arm.com>

On Wed, May 18, 2022 at 11:09 AM Pierre Gondois <pierre.gondois@arm.com> wrote:
>
> ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities':
>   Starting with ACPI Specification 6.2, all _CPC registers can be in
>   PCC, System Memory, System IO, or Functional Fixed Hardware address
>   spaces. OSPM support for this more flexible register space scheme is
>   indicated by the “Flexible Address Space for CPPC Registers” _OSC bit
>
> Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in:
> - PCC or Functional Fixed Hardware address space if defined
> - SystemMemory address space (NULL register) if not defined
>
> Add the corresponding _OSC bit and check it when parsing _CPC objects.
>
> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/acpi/bus.c       | 18 ++++++++++++++++++
>  drivers/acpi/cppc_acpi.c |  9 +++++++++
>  include/linux/acpi.h     |  2 ++
>  3 files changed, 29 insertions(+)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 3e58b613a2c4..9eca43d1d941 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -278,6 +278,20 @@ bool osc_sb_apei_support_acked;
>  bool osc_pc_lpi_support_confirmed;
>  EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed);
>
> +/*
> + * ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities':
> + *   Starting with ACPI Specification 6.2, all _CPC registers can be in
> + *   PCC, System Memory, System IO, or Functional Fixed Hardware address
> + *   spaces. OSPM support for this more flexible register space scheme is
> + *   indicated by the “Flexible Address Space for CPPC Registers” _OSC bit.
> + *
> + * Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in:
> + * - PCC or Functional Fixed Hardware address space if defined
> + * - SystemMemory address space (NULL register) if not defined
> + */
> +bool osc_cpc_flexible_adr_space_confirmed;
> +EXPORT_SYMBOL_GPL(osc_cpc_flexible_adr_space_confirmed);
> +
>  /*
>   * ACPI 6.4 Operating System Capabilities for USB.
>   */
> @@ -321,6 +335,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
>         }
>  #endif
>
> +       capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_FLEXIBLE_ADR_SPACE;
> +
>         if (IS_ENABLED(CONFIG_SCHED_MC_PRIO))
>                 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_DIVERSE_HIGH_SUPPORT;
>
> @@ -366,6 +382,8 @@ static void acpi_bus_osc_negotiate_platform_control(void)
>                         capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
>                 osc_sb_native_usb4_support_confirmed =
>                         capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
> +               osc_cpc_flexible_adr_space_confirmed =
> +                       capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPC_FLEXIBLE_ADR_SPACE;
>         }
>
>         kfree(context.ret.pointer);
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index bc1454789a06..6f09fe011544 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -736,6 +736,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
>                                 if (gas_t->address) {
>                                         void __iomem *addr;
>
> +                                       if (!osc_cpc_flexible_adr_space_confirmed) {
> +                                               pr_debug("Flexible address space capability not supported\n");
> +                                               goto out_free;
> +                                       }
> +
>                                         addr = ioremap(gas_t->address, gas_t->bit_width/8);
>                                         if (!addr)
>                                                 goto out_free;
> @@ -758,6 +763,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
>                                                  gas_t->address);
>                                         goto out_free;
>                                 }
> +                               if (!osc_cpc_flexible_adr_space_confirmed) {
> +                                       pr_debug("Flexible address space capability not supported\n");
> +                                       goto out_free;
> +                               }
>                         } else {
>                                 if (gas_t->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE || !cpc_ffh_supported()) {
>                                         /* Support only PCC, SystemMemory, SystemIO, and FFH type regs. */
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index d7136d13aa44..03465db16b68 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -574,6 +574,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
>  #define OSC_SB_OSLPI_SUPPORT                   0x00000100
>  #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT                0x00001000
>  #define OSC_SB_GENERIC_INITIATOR_SUPPORT       0x00002000
> +#define OSC_SB_CPC_FLEXIBLE_ADR_SPACE          0x00004000
>  #define OSC_SB_NATIVE_USB4_SUPPORT             0x00040000
>  #define OSC_SB_PRM_SUPPORT                     0x00200000
>
> @@ -581,6 +582,7 @@ extern bool osc_sb_apei_support_acked;
>  extern bool osc_pc_lpi_support_confirmed;
>  extern bool osc_sb_native_usb4_support_confirmed;
>  extern bool osc_sb_cppc_not_supported;
> +extern bool osc_cpc_flexible_adr_space_confirmed;
>
>  /* USB4 Capabilities */
>  #define OSC_USB_USB3_TUNNELING                 0x00000001
> --

Applied as 5.19 material along with the rest of the series, thanks!

      parent reply	other threads:[~2022-05-19 17:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:08 [PATCH v2 1/5] ACPI: CPPC: Check _OSC for flexible address space Pierre Gondois
2022-05-18  9:08 ` [PATCH v2 2/5] ACPI: bus: Set CPPC _OSC bits for all and when CPPC_LIB is supported Pierre Gondois
2022-05-18  9:08 ` [PATCH v2 3/5] ACPI: CPPC: Assume no transition latency if no PCCT Pierre Gondois
2022-05-18  9:09 ` [PATCH v2 4/5] cpufreq: CPPC: Enable fast_switch Pierre Gondois
2022-05-18  9:09 ` [PATCH v2 5/5] cpufreq: CPPC: Enable dvfs_possible_from_any_cpu Pierre Gondois
2022-05-18  9:42 ` [PATCH v2 1/5] ACPI: CPPC: Check _OSC for flexible address space Viresh Kumar
2022-05-18 10:34   ` Pierre Gondois
2022-05-18 12:28     ` Viresh Kumar
2022-05-19 17:47 ` Rafael J. Wysocki [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=CAJZ5v0iHMuw7Ap5edok38TjaTCqE5sBn2GYVPz2_z_tc09t-hw@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=Ionela.Voinescu@arm.com \
    --cc=devel@acpica.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pierre.gondois@arm.com \
    --cc=robert.moore@intel.com \
    --cc=sudeep.holla@arm.com \
    --cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).