All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	linux-pm@lists.linux-foundation.org, linux-pci@vger.kernel.org,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: Re: [linux-pm] [PATCH 7/8] ACPI / PCI: Do not preserve _OSC control bits returned by a query (v2)
Date: Wed, 4 Aug 2010 12:29:19 +0200	[thread overview]
Message-ID: <201008041229.19848.rjw@sisk.pl> (raw)
In-Reply-To: <4C5927CB.4070705@jp.fujitsu.com>

On Wednesday, August 04, 2010, Hidetoshi Seto wrote:
> (2010/08/04 14:46), Kenji Kaneshige wrote:
> > (2010/08/04 6:02), Rafael J. Wysocki wrote:
> >> On Tuesday, August 03, 2010, Rafael J. Wysocki wrote:
> >>> On Tuesday, August 03, 2010, Hidetoshi Seto wrote:
> >>>> (2010/08/03 13:52), Kenji Kaneshige wrote:
> >>>>> (2010/08/03 6:59), Rafael J. Wysocki wrote:
> >>>>>> @@ -434,19 +432,6 @@ acpi_status acpi_pci_osc_control_set(acp
> >>>>>>        if ((root->osc_control_set&   control_req) == control_req)
> >>>>>>            goto out;
> >>>>>>
> >>>>>> -    /* Need to query controls first before requesting them */
> >>>>>> -    if (!root->osc_queried) {
> >>>>>> -        status = acpi_pci_query_osc(root, root->osc_support_set, NULL);
> >>>>>> -        if (ACPI_FAILURE(status))
> >>>>>> -            goto out;
> >>>>>> -    }
> >>>>>> -    if ((root->osc_control_qry&   control_req) != control_req) {
> >>>>>> -        printk(KERN_DEBUG
> >>>>>> -               "Firmware did not grant requested _OSC control\n");
> >>>>>> -        status = AE_SUPPORT;
> >>>>>> -        goto out;
> >>>>>> -    }
> >>>>>
> >>>>> I think acpi_pci_osc_control_set() still need to query before commit
> >>>>> to ensure all the requested controls are granted to OS.
> >>>>>
> >>>>> So the code needs to be
> >>>>>
> >>>>>      status = acpi_pci_query_osc(root, root->osc_support_set,&control_req);
> >>>>>      if (ACPI_FAILURE(status))
> >>>>>          goto out;
> >>>>
> > 
> > Sorry, that should have been
> > 
> >     query = control_req;
> >     status = acpi_pci_query_osc(root, root->osc_support_set, &query);
> >     if (ACPI_FAILURE(status))
> >         goto out;
> >     if ((query & control_req) != control_req) {
> >         printk_(KERN_DEBUG
> >             "Firmware did not grant requested _OSC control\n");
> >         status = AE_SUPPORT;
> >         goto out;
> >     }
> > 
> > I know current pcie_port_acpi_setup() queries the requesting controls
> > before acpi_pci_osc_control_set() and only one control is requested
> > in the other code. However, I think acpi_pci_osc_control_set() still
> > need to query the requested controls to ensure all the requested
> > controls, in case someone calls this function without querying the
> > requesting controls. In other words, I think it must be ensured that
> > any controls are never granted to OS when acpi_pci_osc_control_set()
> > returns error.
> 
> I think the following patch is what you mean.
> 
> And... (Continue to next post)
> 
> Thanks,
> H.Seto

OK, I'll repalce my 7/8 with the patch below.

Thanks,
Rafael


> =====
> 
> From: Rafael J. Wysocki <rjw@sisk.pl>
> Subject: ACPI / PCI: Do not preserve _OSC control bits returned by a query (v3)
> 
> All of the remaining callers of acpi_pci_osc_control_set() either
> use acpi_pci_root_osc_query() right before it, like
> pcie_port_acpi_setup(), or ask for control of one feature only,
> like acpi_get_hp_hw_control_from_firmware().  Thus there is no
> reason to preserve the _OSC control bits returned by an _OSC query
> and the osc_control_qry and osc_queried fields of struct
> acpi_pci_root are not necessary any more.  Remove them and modify the
> code that uses them accordingly.
> 
> [v3: HS: keep query in acpi_pci_osc_control_set]
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
> ---
>  drivers/acpi/pci_root.c |   13 +++++--------
>  include/acpi/acpi_bus.h |    3 ---
>  2 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index d3110d6..ec03c19 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -248,10 +248,8 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
>  	status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
>  	if (ACPI_SUCCESS(status)) {
>  		root->osc_support_set = support;
> -		root->osc_control_qry = result;
>  		if (control)
>  			*control = result;
> -		root->osc_queried = 1;
>  	}
>  	return status;
>  }
> @@ -438,12 +436,11 @@ acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags)
>  		goto out;
>  
>  	/* Need to query controls first before requesting them */
> -	if (!root->osc_queried) {
> -		status = acpi_pci_query_osc(root, root->osc_support_set, NULL);
> -		if (ACPI_FAILURE(status))
> -			goto out;
> -	}
> -	if ((root->osc_control_qry & control_req) != control_req) {
> +	result = control_req;
> +	status = acpi_pci_query_osc(root, root->osc_support_set, &result);
> +	if (ACPI_FAILURE(status))
> +		goto out;
> +	if ((result & control_req) != control_req) {
>  		printk(KERN_DEBUG
>  		       "Firmware did not grant requested _OSC control\n");
>  		status = AE_SUPPORT;
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index baacd98..4de84ce 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -377,9 +377,6 @@ struct acpi_pci_root {
>  
>  	u32 osc_support_set;	/* _OSC state of support bits */
>  	u32 osc_control_set;	/* _OSC state of control bits */
> -	u32 osc_control_qry;	/* the latest _OSC query result */
> -
> -	u32 osc_queried:1;	/* has _OSC control been queried? */
>  };
>  
>  /* helper */
> 


  parent reply	other threads:[~2010-08-04 10:31 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 21:51 [PATCH 0/8] ACPI / PCI / PCIe: Rework _OSC handling (v2) Rafael J. Wysocki
2010-08-02 21:53 ` [PATCH 1/8] ACPI / PCI: Introduce acpi_pci_osc_control_query() Rafael J. Wysocki
2010-08-02 21:53 ` Rafael J. Wysocki
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  9:24     ` Rafael J. Wysocki
2010-08-03  9:24     ` Rafael J. Wysocki
2010-08-03  5:04   ` Kenji Kaneshige
2010-08-03  5:04   ` Kenji Kaneshige
2010-08-03  9:27     ` Rafael J. Wysocki
2010-08-03 20:58       ` Rafael J. Wysocki
2010-08-03 20:58       ` [linux-pm] " Rafael J. Wysocki
2010-08-04  4:28         ` Kenji Kaneshige
2010-08-04  4:28         ` [linux-pm] " Kenji Kaneshige
2010-08-04 23:37           ` Rafael J. Wysocki
2010-08-05 23:46             ` Rafael J. Wysocki
2010-08-05 23:46             ` [linux-pm] " Rafael J. Wysocki
2010-08-04 23:37           ` Rafael J. Wysocki
2010-08-03  9:27     ` Rafael J. Wysocki
2010-08-02 21:54 ` [PATCH 2/8] PCI / PCIe/ AER: Introduce pci_aer_available() Rafael J. Wysocki
2010-08-03  0:46   ` Hidetoshi Seto
2010-08-03  0:46   ` Hidetoshi Seto
2010-08-03  9:28     ` Rafael J. Wysocki
2010-08-03  9:28     ` Rafael J. Wysocki
2010-08-03 20:59       ` Rafael J. Wysocki
2010-08-03 20:59       ` [linux-pm] " Rafael J. Wysocki
2010-08-03  9:41   ` Jike Song
2010-08-03  9:41   ` Jike Song
2010-08-03 19:50     ` Rafael J. Wysocki
2010-08-03 19:50     ` Rafael J. Wysocki
2010-08-02 21:54 ` Rafael J. Wysocki
2010-08-02 21:55 ` [PATCH 3/8] PCI / PCIe: Introduce commad line switch for disabling port services Rafael J. Wysocki
2010-08-02 21:55 ` Rafael J. Wysocki
2010-08-02 21:56 ` [PATCH 4/8] PCI / PCIe: Ask BIOS for control of all native services at once (v6) Rafael J. Wysocki
2010-08-03  1:14   ` Hidetoshi Seto
2010-08-03  1:14   ` Hidetoshi Seto
2010-08-03 21:01     ` Rafael J. Wysocki
2010-08-03 21:01     ` Rafael J. Wysocki
2010-08-06  1:33   ` Hidetoshi Seto
2010-08-06  1:33   ` Hidetoshi Seto
2010-08-06 10:47     ` Rafael J. Wysocki
2010-08-02 21:56 ` Rafael J. Wysocki
2010-08-02 21:57 ` [PATCH 5/8] PCI / PCIe: Disable PCIe port services during port initialization Rafael J. Wysocki
2010-08-02 21:57 ` Rafael J. Wysocki
2010-08-02 21:58 ` [PATCH 6/8] PCI / PCIe: Remove the port driver module exit routine Rafael J. Wysocki
2010-08-02 21:58 ` Rafael J. Wysocki
2010-08-02 21:59 ` [PATCH 7/8] ACPI / PCI: Do not preserve _OSC control bits returned by a query (v2) Rafael J. Wysocki
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  4:52   ` Kenji Kaneshige
2010-08-03  7:13     ` Hidetoshi Seto
2010-08-03  9:33       ` Rafael J. Wysocki
2010-08-03 21:02         ` [linux-pm] " Rafael J. Wysocki
2010-08-04  5:46           ` Kenji Kaneshige
2010-08-04  8:41             ` Hidetoshi Seto
2010-08-04  8:41             ` [linux-pm] " Hidetoshi Seto
2010-08-04  9:23               ` Kenji Kaneshige
2010-08-04  9:23               ` Kenji Kaneshige
2010-08-04 10:29               ` Rafael J. Wysocki [this message]
2010-08-04 23:51                 ` [linux-pm] " Rafael J. Wysocki
2010-08-05  3:40                   ` Hidetoshi Seto
2010-08-05  3:40                   ` [linux-pm] " Hidetoshi Seto
2010-08-05 14:25                     ` Rafael J. Wysocki
2010-08-05 14:25                     ` [linux-pm] " Rafael J. Wysocki
2010-08-06  1:28                       ` Hidetoshi Seto
2010-08-06  1:28                       ` Hidetoshi Seto
2010-08-04 23:51                 ` Rafael J. Wysocki
2010-08-04 10:29               ` Rafael J. Wysocki
2010-08-04  8:43             ` [linux-pm] " Hidetoshi Seto
2010-08-04  9:39               ` Kenji Kaneshige
2010-08-04 12:15                 ` Rafael J. Wysocki
2010-08-05  3:38                   ` [linux-pm] " Hidetoshi Seto
2010-08-05  3:38                   ` Hidetoshi Seto
2010-08-04  9:39               ` Kenji Kaneshige
2010-08-04 10:38               ` [linux-pm] " Rafael J. Wysocki
2010-08-04 10:38               ` Rafael J. Wysocki
2010-08-04  8:43             ` Hidetoshi Seto
2010-08-04  5:46           ` Kenji Kaneshige
2010-08-03 21:02         ` Rafael J. Wysocki
2010-08-03  9:33       ` Rafael J. Wysocki
2010-08-03  7:13     ` Hidetoshi Seto
2010-08-02 21:59 ` Rafael J. Wysocki
2010-08-02 22:00 ` [PATCH 8/8] ACPI / PCI: Reorder checks in acpi_pci_osc_control_set() Rafael J. Wysocki
2010-08-02 22:00 ` Rafael J. Wysocki
2010-08-03  4:51 ` [PATCH 0/8] ACPI / PCI / PCIe: Rework _OSC handling (v2) Kenji Kaneshige
2010-08-03  4:51 ` Kenji Kaneshige

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=201008041229.19848.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=jbarnes@virtuousgeek.org \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=seto.hidetoshi@jp.fujitsu.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.