From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v3 2/3] pci-assign: Use PCI-2.3-based shared legacy interrupts
Date: Wed, 07 Mar 2012 19:48:03 +0100 [thread overview]
Message-ID: <4F57AD63.9070303@siemens.com> (raw)
In-Reply-To: <4F57AC29.7060204@siemens.com>
On 2012-03-07 19:42, Jan Kiszka wrote:
> On 2012-03-07 19:32, Alex Williamson wrote:
>> On Wed, 2012-03-07 at 19:18 +0100, Jan Kiszka wrote:
>>> Enable the new KVM feature that allows legacy interrupt sharing for
>>> PCI-2.3-compliant devices. This requires to synchronize any guest
>>> change of the INTx mask bit to the kernel.
>>>
>>> The feature is controlled by the property 'share_intx' and is off by
>>> default for now.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>> ---
>>>
>>> Changes in v3:
>>> - fixed nit :)
>>>
>>> hw/device-assignment.c | 24 ++++++++++++++++++++++++
>>> hw/device-assignment.h | 10 ++++++----
>>> qemu-kvm.c | 9 +++++++++
>>> qemu-kvm.h | 2 ++
>>> 4 files changed, 41 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
>>> index a5f1abb..e2a8479 100644
>>> --- a/hw/device-assignment.c
>>> +++ b/hw/device-assignment.c
>>> @@ -782,6 +782,13 @@ static int assign_device(AssignedDevice *dev)
>>> "cause host memory corruption if the device issues DMA write "
>>> "requests!\n");
>>> }
>>> + if (dev->features & ASSIGNED_DEVICE_SHARE_INTX_MASK) {
>>> + assigned_dev_data.flags |= KVM_DEV_ASSIGN_PCI_2_3;
>>> +
>>> + /* hide host-side INTx masking from the guest */
>>> + dev->emulate_config_read[PCI_COMMAND + 1] |=
>>> + PCI_COMMAND_INTX_DISABLE >> 8;
>>> + }
>>>
>>> r = kvm_assign_pci_device(kvm_state, &assigned_dev_data);
>>> if (r < 0) {
>>> @@ -1121,10 +1128,25 @@ static void assigned_dev_pci_write_config(PCIDevice *pci_dev, uint32_t address,
>>> uint32_t val, int len)
>>> {
>>> AssignedDevice *assigned_dev = DO_UPCAST(AssignedDevice, dev, pci_dev);
>>> + uint16_t old_cmd = pci_get_word(pci_dev->config + PCI_COMMAND);
>>> uint32_t emulate_mask, full_emulation_mask;
>>> + int ret;
>>>
>>> pci_default_write_config(pci_dev, address, val, len);
>>>
>>> + if (range_covers_byte(address, len, PCI_COMMAND + 1)) {
>>
>> Hmm, now that I've acked this... shouldn't we have a feature check here
>> to avoid the ioctl when share_intx=false or when the host kernel doesn't
>> support this? Thanks,
>
> Hmm, I thought I handled this, somehow. But it's not there. v4 follows...
To be precise: We only need to worry about false positive error messages
in the absence of KVM_CAP_PCI_2_3. Devices not supporting INTx sharing
will either refuse to work due to IRQ conflicts, or we will map INTx
masking on IRQ line masking.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-03-07 18:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-07 17:19 [PATCH 0/3] qemu-kvm: pci-assign: Host IRQ sharing suppport Jan Kiszka
2012-03-07 17:19 ` [PATCH 1/3] kvm: Update kernel headers against kvm.git Jan Kiszka
2012-03-07 17:19 ` [PATCH 2/3] pci-assign: Use PCI-2.3-based shared legacy interrupts Jan Kiszka
2012-03-07 17:46 ` Alex Williamson
2012-03-07 18:05 ` [PATCH v2 " Jan Kiszka
2012-03-07 18:14 ` Alex Williamson
2012-03-07 18:18 ` [PATCH v3 " Jan Kiszka
2012-03-07 18:32 ` Alex Williamson
2012-03-07 18:42 ` Jan Kiszka
2012-03-07 18:48 ` Jan Kiszka [this message]
2012-03-07 17:19 ` [PATCH 3/3] pci_assign: Flip defaults of prefer_msi and share_intx Jan Kiszka
2012-03-07 18:20 ` [PATCH 0/3] qemu-kvm: pci-assign: Host IRQ sharing suppport 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=4F57AD63.9070303@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=alex.williamson@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox