From: Cao jin <caoj.fnst@cn.fujitsu.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: izumi.taku@jp.fujitsu.com, qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v6 2/2] enable multi-function hot-add
Date: Wed, 28 Oct 2015 11:33:30 +0800 [thread overview]
Message-ID: <5630420A.2060105@cn.fujitsu.com> (raw)
In-Reply-To: <1445955689.8018.223.camel@redhat.com>
Hi Alex
On 10/27/2015 10:21 PM, Alex Williamson wrote:
> On Tue, 2015-10-27 at 20:51 +0800, Cao jin wrote:
>> Enable PCIe device multi-function hot-add, just ensure function 0 is added
>> last, then driver will got the notification to scan the slot.
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>> hw/pci/pci.c | 40 +++++++++++++++++++++++++++++++++++++++-
>> hw/pci/pci_host.c | 13 +++++++++++--
>> hw/pci/pcie.c | 18 +++++++++---------
>> include/hw/pci/pci.h | 1 +
>> 4 files changed, 60 insertions(+), 12 deletions(-)
>
>> diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
>> index 3e26f92..63d7d2f 100644
>> --- a/hw/pci/pci_host.c
>> +++ b/hw/pci/pci_host.c
>> @@ -20,6 +20,7 @@
>>
>> #include "hw/pci/pci.h"
>> #include "hw/pci/pci_host.h"
>> +#include "hw/pci/pci_bus.h"
>> #include "trace.h"
>>
>> /* debug PCI */
>> @@ -75,7 +76,11 @@ void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len)
>> PCIDevice *pci_dev = pci_dev_find_by_addr(s, addr);
>> uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
>>
>> - if (!pci_dev) {
>> + /* non-zero functions are only exposed when function 0 is present,
>> + * allowing direct removal of unexposed functions.
>> + */
>> + if (!pci_dev ||
>> + (pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev))) {
>> return;
>> }
>>
>> @@ -91,7 +96,11 @@ uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len)
>> uint32_t config_addr = addr & (PCI_CONFIG_SPACE_SIZE - 1);
>> uint32_t val;
>>
>> - if (!pci_dev) {
>> + /* non-zero functions are only exposed when function 0 is present,
>> + * allowing direct removal of unexposed functions.
>> + */
>> + if (!pci_dev ||
>> + (pci_dev->qdev.hotplugged && !pci_get_function_0(pci_dev))) {
>> return ~0x0;
>> }
>
>
> Don't we need to do this in pci_host_config_read_common() and
> pci_host_config_write_common() instead? Otherwise I don't think we
> catch config access via mmcfg. Thanks,
>
Yup...my carelessness, will fix it. Thanks for reminding:)
> Alex
>
> .
>
--
Yours Sincerely,
Cao Jin
prev parent reply other threads:[~2015-10-28 3:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 12:51 [Qemu-devel] [PATCH v6 0/2] PCI-e device multi-function hot-add support Cao jin
2015-10-27 12:51 ` [Qemu-devel] [PATCH v6 1/2] remove function during multi-function hot-add Cao jin
2015-10-27 12:51 ` [Qemu-devel] [PATCH v6 2/2] enable " Cao jin
2015-10-27 14:21 ` Alex Williamson
2015-10-28 3:33 ` Cao jin [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=5630420A.2060105@cn.fujitsu.com \
--to=caoj.fnst@cn.fujitsu.com \
--cc=alex.williamson@redhat.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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 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.