kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-pci@vger.kernel.org, kvm@vger.kernel.org, avi@redhat.com,
	linux-kernel@vger.kernel.org, jan.kiszka@siemens.com
Subject: Re: [PATCH v4 1/3] PCI: Track the size of each saved capability data area
Date: Sat, 21 May 2011 09:10:37 -0700	[thread overview]
Message-ID: <20110521091037.6d2d78a9@jbarnes-e6510> (raw)
In-Reply-To: <20110510160204.3490.81034.stgit@s20.home>

On Tue, 10 May 2011 10:02:11 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:

> This will allow us to store and load it later.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  drivers/pci/pci.c   |   12 +++++++-----
>  include/linux/pci.h |   11 ++++++++---
>  2 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 2472e71..416930a 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -830,7 +830,7 @@ static int pci_save_pcie_state(struct pci_dev
> *dev) dev_err(&dev->dev, "buffer not found in %s\n", __func__);
>  		return -ENOMEM;
>  	}
> -	cap = (u16 *)&save_state->data[0];
> +	cap = (u16 *)&save_state->cap.data[0];
>  
>  	pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
>  
> @@ -863,7 +863,7 @@ static void pci_restore_pcie_state(struct pci_dev
> *dev) pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
>  	if (!save_state || pos <= 0)
>  		return;
> -	cap = (u16 *)&save_state->data[0];
> +	cap = (u16 *)&save_state->cap.data[0];
>  
>  	pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &flags);
>  
> @@ -899,7 +899,8 @@ static int pci_save_pcix_state(struct pci_dev
> *dev) return -ENOMEM;
>  	}
>  
> -	pci_read_config_word(dev, pos + PCI_X_CMD, (u16
> *)save_state->data);
> +	pci_read_config_word(dev, pos + PCI_X_CMD,
> +			     (u16 *)save_state->cap.data);
>  
>  	return 0;
>  }
> @@ -914,7 +915,7 @@ static void pci_restore_pcix_state(struct pci_dev
> *dev) pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
>  	if (!save_state || pos <= 0)
>  		return;
> -	cap = (u16 *)&save_state->data[0];
> +	cap = (u16 *)&save_state->cap.data[0];
>  
>  	pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]);
>  }
> @@ -1771,7 +1772,8 @@ static int pci_add_cap_save_buffer(
>  	if (!save_state)
>  		return -ENOMEM;
>  
> -	save_state->cap_nr = cap;
> +	save_state->cap.cap_nr = cap;
> +	save_state->cap.size = size;
>  	pci_add_saved_cap(dev, save_state);
>  
>  	return 0;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 96f70d7..4dcb429 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -214,12 +214,17 @@ enum pci_bus_speed {
>  	PCI_SPEED_UNKNOWN		= 0xff,
>  };
>  
> -struct pci_cap_saved_state {
> -	struct hlist_node next;
> +struct pci_cap_saved_data {
>  	char cap_nr;
> +	unsigned int size;
>  	u32 data[0];
>  };
>  
> +struct pci_cap_saved_state {
> +	struct hlist_node next;
> +	struct pci_cap_saved_data cap;
> +};
> +
>  struct pcie_link_state;
>  struct pci_vpd;
>  struct pci_sriov;
> @@ -366,7 +371,7 @@ static inline struct pci_cap_saved_state
> *pci_find_saved_cap( struct hlist_node *pos;
>  
>  	hlist_for_each_entry(tmp, pos, &pci_dev->saved_cap_space,
> next) {
> -		if (tmp->cap_nr == cap)
> +		if (tmp->cap.cap_nr == cap)
>  			return tmp;
>  	}
>  	return NULL;

Applied these, thanks.

  reply	other threads:[~2011-05-21 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 16:01 [PATCH v4 0/3] Store and load PCI device saved state across function resets Alex Williamson
2011-05-10 16:02 ` [PATCH v4 1/3] PCI: Track the size of each saved capability data area Alex Williamson
2011-05-21 16:10   ` Jesse Barnes [this message]
2011-05-10 16:02 ` [PATCH v4 2/3] PCI: Add interfaces to store and load the device saved state Alex Williamson
2011-05-10 16:02 ` [PATCH v4 3/3] KVM: Use pci_store/load_saved_state() around VM device usage Alex Williamson

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=20110521091037.6d2d78a9@jbarnes-e6510 \
    --to=jbarnes@virtuousgeek.org \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@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;
as well as URLs for NNTP newsgroup(s).