From: Alex Williamson <alex.williamson@redhat.com>
To: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] device-assignment: move irqs update to piix emulation
Date: Sun, 27 Mar 2011 15:17:49 -0600 [thread overview]
Message-ID: <1301260670.14532.145.camel@x201> (raw)
In-Reply-To: <20110327192254.20098.21743.stgit@localhost6>
On Sun, 2011-03-27 at 23:22 +0400, Konstantin Khlebnikov wrote:
> Move assigned devices irq reroute hook from generic pci code to piix emulation.
>
> Actually without this patch this hook had never worked, because pci.c not
> include config.h and CONFIG_KVM_DEVICE_ASSIGNMENT there always undefined.
Actually it's worked fine until very recently. I've got a patch on the
list to move pci.c back to a target object so the right config gets
included.
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
> ---
> hw/pc.h | 4 ----
> hw/pci.c | 8 --------
> hw/piix_pci.c | 14 ++++++++++++++
> 3 files changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/hw/pc.h b/hw/pc.h
> index 1291e2d..34f32ee 100644
> --- a/hw/pc.h
> +++ b/hw/pc.h
> @@ -172,10 +172,6 @@ extern int no_hpet;
> void pcspk_init(ISADevice *pit);
> int pcspk_audio_init(qemu_irq *pic);
>
> -/* piix_pci.c */
> -/* config space register for IRQ routing */
> -#define PIIX_CONFIG_IRQ_ROUTE 0x60
> -
> struct PCII440FXState;
> typedef struct PCII440FXState PCII440FXState;
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 730df5f..27af9fe 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -31,7 +31,6 @@
> #include "loader.h"
> #include "hw/pc.h"
> #include "kvm.h"
> -#include "device-assignment.h"
> #include "qemu-objects.h"
> #include "range.h"
>
> @@ -1165,13 +1164,6 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l)
> d->config[addr + i] &= ~(val & w1cmask); /* W1C: Write 1 to Clear */
> }
>
> -#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
> - if (kvm_enabled() && kvm_irqchip_in_kernel() &&
> - addr >= PIIX_CONFIG_IRQ_ROUTE &&
> - addr < PIIX_CONFIG_IRQ_ROUTE + 4)
> - assigned_dev_update_irqs();
> -#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
> -
> if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) ||
> ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) ||
> ranges_overlap(addr, l, PCI_ROM_ADDRESS1, 4) ||
> diff --git a/hw/piix_pci.c b/hw/piix_pci.c
> index 24bfe8e..d1fcdcd 100644
> --- a/hw/piix_pci.c
> +++ b/hw/piix_pci.c
> @@ -30,6 +30,7 @@
> #include "sysbus.h"
> #include "range.h"
> #include "kvm.h"
> +#include "device-assignment.h"
>
> /*
> * I440FX chipset data sheet.
> @@ -353,6 +354,18 @@ static int piix3_initfn(PCIDevice *dev)
> return 0;
> }
>
> +static void piix3_write_config(PCIDevice *dev,
> + uint32_t addr, uint32_t val, int len)
> +{
> + pci_default_write_config(dev, addr, val, len);
> +
> +#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
> + if (kvm_enabled() && kvm_irqchip_in_kernel() &&
> + ranges_overlap(addr, len, 0x60, 4))
I think this should still have a #define somewhere, or else 0x60 becomes
an unsearchable magic number. Otherwise, this looks fine to me. I've
actually sent out RFC patches making a similar change to try to make
this device assignment hook more generic.
Alex
> + assigned_dev_update_irqs();
> +#endif /* CONFIG_KVM_DEVICE_ASSIGNMENT */
> +}
> +
> static PCIDeviceInfo i440fx_info[] = {
> {
> .qdev.name = "i440FX",
> @@ -371,6 +384,7 @@ static PCIDeviceInfo i440fx_info[] = {
> .qdev.no_user = 1,
> .no_hotplug = 1,
> .init = piix3_initfn,
> + .config_write = piix3_write_config,
> },{
> /* end of list */
> }
>
next prev parent reply other threads:[~2011-03-27 21:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-27 19:22 [PATCH] device-assignment: move irqs update to piix emulation Konstantin Khlebnikov
2011-03-27 21:17 ` Alex Williamson [this message]
2011-03-28 8:27 ` Konstantin Khlebnikov
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=1301260670.14532.145.camel@x201 \
--to=alex.williamson@redhat.com \
--cc=khlebnikov@openvz.org \
--cc=kvm@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 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.