All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: Leonid Bloch <leonid.bloch@ravellosystems.com>, qemu-devel@nongnu.org
Cc: Dmitry Fleytman <dmitry@daynix.com>,
	Jason Wang <jasowang@redhat.com>,
	Leonid Bloch <leonid@daynix.com>,
	Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v2 02/10] pci: Introduce function for PCI PM capability creation
Date: Tue, 19 Jan 2016 12:36:24 +0200	[thread overview]
Message-ID: <569E11A8.7050200@gmail.com> (raw)
In-Reply-To: <1453138550-1096-3-git-send-email-leonid.bloch@ravellosystems.com>

On 01/18/2016 07:35 PM, Leonid Bloch wrote:
> From: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
>
> Signed-off-by: Dmitry Fleytman <dmitry.fleytman@ravellosystems.com>
> Signed-off-by: Leonid Bloch <leonid.bloch@ravellosystems.com>
> ---
>   hw/pci/pci.c              | 21 +++++++++++++++++++++
>   include/hw/pci/pci.h      |  2 ++
>   include/hw/pci/pci_regs.h |  1 +
>   3 files changed, 24 insertions(+)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index b3d5100..3aaf86c 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2050,6 +2050,27 @@ static void pci_del_option_rom(PCIDevice *pdev)
>       pdev->has_rom = false;
>   }
>
> +int pci_add_pm_capability(PCIDevice *pdev, uint8_t offset, uint16_t pmc)
> +{
> +    int ret = pci_add_capability(pdev, PCI_CAP_ID_PM, offset, PCI_PM_SIZEOF);
> +
> +    if (ret >= 0) {
> +        pci_set_word(pdev->config + offset + PCI_PM_PMC,
> +                     PCI_PM_CAP_VER_1_1 |

Hi,

Why not ver 1.2 ? just wondering

> +                     pmc);
> +
> +        pci_set_word(pdev->wmask + offset + PCI_PM_CTRL,
> +                     PCI_PM_CTRL_STATE_MASK |
> +                     PCI_PM_CTRL_PME_ENABLE |

PME_ENABLE and PME_STATUS are writable only if the function supports PME# generation from D3cold


> +                     PCI_PM_CTRL_DATA_SEL_MASK

And Data_Select is writable only if the data register is implemented.

My point is this seems to be a standard capability function, but it depends
on optional function features.

Thanks,
Marcel

);
> +
> +        pci_set_word(pdev->w1cmask + offset + PCI_PM_CTRL,
> +                     PCI_PM_CTRL_PME_STATUS);
> +    }
> +
> +    return ret;
> +}
> +
>   /*
>    * if !offset
>    * Reserve space and add capability to the linked list in pci config space
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index b97c295..cec7234 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -319,6 +319,8 @@ int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
>                          uint8_t offset, uint8_t size,
>                          Error **errp);
>
> +int pci_add_pm_capability(PCIDevice *pdev, uint8_t offset, uint16_t pmc);
> +
>   void pci_del_capability(PCIDevice *pci_dev, uint8_t cap_id, uint8_t cap_size);
>
>   uint8_t pci_find_capability(PCIDevice *pci_dev, uint8_t cap_id);
> diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h
> index 56a404b..2bd3ac9 100644
> --- a/include/hw/pci/pci_regs.h
> +++ b/include/hw/pci/pci_regs.h
> @@ -221,6 +221,7 @@
>
>   #define PCI_PM_PMC		2	/* PM Capabilities Register */
>   #define  PCI_PM_CAP_VER_MASK	0x0007	/* Version */
> +#define  PCI_PM_CAP_VER_1_1     0x0002  /* PCI PM spec ver. 1.1 */
>   #define  PCI_PM_CAP_PME_CLOCK	0x0008	/* PME clock required */
>   #define  PCI_PM_CAP_RESERVED    0x0010  /* Reserved field */
>   #define  PCI_PM_CAP_DSI		0x0020	/* Device specific initialization */
>

  reply	other threads:[~2016-01-19 10:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 17:35 [Qemu-devel] [RFC PATCH v2 00/10] Introduce Intel 82574 GbE Controller Emulation (e1000e) Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 01/10] msix: make msix_clr_pending() visible for clients Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 02/10] pci: Introduce function for PCI PM capability creation Leonid Bloch
2016-01-19 10:36   ` Marcel Apfelbaum [this message]
2016-01-19 13:45     ` Dmitry Fleytman
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 03/10] pcie: Add support for PCIe CAP v1 Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 04/10] pcie: Introduce function for DSN capability creation Leonid Bloch
2016-01-19 14:26   ` Marcel Apfelbaum
2016-01-19 15:02     ` Shmulik Ladkani
2016-01-19 15:06     ` Dmitry Fleytman
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 05/10] net: Introduce Toeplitz hash calculator Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 06/10] net: Add macros for ETH address tracing Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 07/10] net_pkt: Name vmxnet3 packet abstractions more generic Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 08/10] net_pkt: Extend packet abstraction as requied by e1000e functionality Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 09/10] e1000_regs: Add definitions for Intel 82574-specific bits Leonid Bloch
2016-01-18 17:35 ` [Qemu-devel] [RFC PATCH v2 10/10] net: Introduce e1000e device emulation Leonid Bloch
2016-01-19  3:48 ` [Qemu-devel] [RFC PATCH v2 00/10] Introduce Intel 82574 GbE Controller Emulation (e1000e) Jason Wang
2016-01-19  8:25   ` Dmitry Fleytman

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=569E11A8.7050200@gmail.com \
    --to=marcel.apfelbaum@gmail.com \
    --cc=dmitry@daynix.com \
    --cc=jasowang@redhat.com \
    --cc=leonid.bloch@ravellosystems.com \
    --cc=leonid@daynix.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shmulik.ladkani@ravellosystems.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.