From: Alexander Graf <agraf@suse.de>
To: alvise rigo <a.rigo@virtualopensystems.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Rob Herring <rob.herring@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Claudio Fontana <claudio.fontana@huawei.com>,
"stuart.yoder@freescale.com" <stuart.yoder@freescale.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/4] pci: Add generic PCIe host bridge
Date: Mon, 12 Jan 2015 18:38:26 +0100 [thread overview]
Message-ID: <54B40692.9040909@suse.de> (raw)
In-Reply-To: <CAH47eN2KJOeVbPjJdX0OOGhYo5PSr-Typ0yf=hmJ5XXqQo1hWg@mail.gmail.com>
On 12.01.15 18:36, alvise rigo wrote:
> Hi Alexander,
>
> Just a comment below.
>
> On Tue, Jan 6, 2015 at 5:03 PM, Alexander Graf <agraf@suse.de> wrote:
>> With simple exposure of MMFG, ioport window, mmio window and an IRQ line we
>> can successfully create a workable PCIe host bridge that can be mapped anywhere
>> and only needs to get described to the OS using whatever means it likes.
>>
>> This patch implements such a "generic" host bridge. It only supports a single
>> legacy IRQ line so far. MSIs need to be handled external to the host bridge.
>>
>> This device is particularly useful for the "pci-host-ecam-generic" driver in
>> Linux.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> hw/pci-host/Makefile.objs | 1 +
>> hw/pci-host/gpex.c | 156 +++++++++++++++++++++++++++++++++++++++++++++
>> include/hw/pci-host/gpex.h | 56 ++++++++++++++++
>> 3 files changed, 213 insertions(+)
>> create mode 100644 hw/pci-host/gpex.c
>> create mode 100644 include/hw/pci-host/gpex.h
>>
>> diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
>> index bb65f9c..45f1f0e 100644
>> --- a/hw/pci-host/Makefile.objs
>> +++ b/hw/pci-host/Makefile.objs
>> @@ -15,3 +15,4 @@ common-obj-$(CONFIG_PCI_APB) += apb.o
>> common-obj-$(CONFIG_FULONG) += bonito.o
>> common-obj-$(CONFIG_PCI_PIIX) += piix.o
>> common-obj-$(CONFIG_PCI_Q35) += q35.o
>> +common-obj-$(CONFIG_PCI_GENERIC) += gpex.o
>> diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
>> new file mode 100644
>> index 0000000..bd62a3c
>> --- /dev/null
>> +++ b/hw/pci-host/gpex.c
>> @@ -0,0 +1,156 @@
>> +/*
>> + * QEMU Generic PCI Express Bridge Emulation
>> + *
>> + * Copyright (C) 2015 Alexander Graf <agraf@suse.de>
>> + *
>> + * Code loosely based on q35.c.
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a copy
>> + * of this software and associated documentation files (the "Software"), to deal
>> + * in the Software without restriction, including without limitation the rights
>> + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>> + * copies of the Software, and to permit persons to whom the Software is
>> + * furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice shall be included in
>> + * all copies or substantial portions of the Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>> + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
>> + * THE SOFTWARE.
>> + */
>> +#include "hw/hw.h"
>> +#include "hw/pci-host/gpex.h"
>> +
>> +/****************************************************************************
>> + * GPEX host
>> + */
>> +
>> +static void gpex_set_irq(void *opaque, int irq_num, int level)
>> +{
>> + GPEXHost *s = opaque;
>> +
>> + qemu_set_irq(s->irq, level);
>> +}
>> +
>> +static int gpex_map_irq(PCIDevice *pci_dev, int irq_num)
>> +{
>> + /* We only support one IRQ line so far */
>> + return 0;
>> +}
>
> Regarding the request from Claudio to have one system interrupt for
> each PCI device, we could address this by swizzling four (or more)
> system interrupts for all the PCI devices. In this case a slightly
> different interrupt-map and interrupt-map-mask is required as well as
> a new map_irq callback (the legacy pci_swizzle_map_irq_fn is fine for
> 4 IRQs).
> This of course would work as far as we have less PCI devices than the
> number of swizzled IRQs.
I'd prefer to keep things as easy as we humanly can for now. Then add
MSI. And if we then realize that we still need 4 rather than 1 shared
interrupt lines we can still change it :).
Alex
next prev parent reply other threads:[~2015-01-12 17:38 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 16:03 [Qemu-devel] [PATCH 0/4] ARM: Add support for a generic PCI Express host bridge Alexander Graf
2015-01-06 16:03 ` [Qemu-devel] [PATCH 1/4] pci: Split pcie_host_mmcfg_map() Alexander Graf
2015-01-12 16:28 ` Claudio Fontana
2015-01-06 16:03 ` [Qemu-devel] [PATCH 2/4] pci: Add generic PCIe host bridge Alexander Graf
2015-01-12 16:29 ` Claudio Fontana
2015-01-12 17:36 ` alvise rigo
2015-01-12 17:38 ` Alexander Graf [this message]
2015-01-12 20:08 ` Peter Maydell
2015-01-12 21:06 ` Alexander Graf
2015-01-12 21:20 ` Peter Maydell
2015-01-13 0:13 ` Alexander Graf
2015-01-13 10:07 ` Peter Maydell
2015-01-13 9:09 ` Claudio Fontana
2015-01-06 16:03 ` [Qemu-devel] [PATCH 3/4] arm: Add PCIe host bridge in virt machine Alexander Graf
2015-01-07 15:52 ` Claudio Fontana
2015-01-07 21:47 ` Alexander Graf
2015-01-08 12:55 ` Claudio Fontana
2015-01-08 13:26 ` Alexander Graf
2015-01-08 15:01 ` Claudio Fontana
2015-01-12 16:23 ` Claudio Fontana
2015-01-12 16:35 ` Alexander Graf
2015-01-08 13:36 ` alvise rigo
2015-01-08 10:31 ` Peter Maydell
2015-01-08 12:30 ` Claudio Fontana
2015-01-12 16:20 ` Claudio Fontana
2015-01-12 16:36 ` Alexander Graf
2015-01-12 16:49 ` alvise rigo
2015-01-12 16:57 ` Alexander Graf
2015-01-06 16:03 ` [Qemu-devel] [PATCH 4/4] arm: enable Bochs PCI VGA Alexander Graf
2015-01-06 16:16 ` Peter Maydell
2015-01-06 21:08 ` Alexander Graf
2015-01-06 21:28 ` Peter Maydell
2015-01-06 21:42 ` Alexander Graf
2015-01-07 6:22 ` Paolo Bonzini
2015-01-07 13:52 ` [Qemu-devel] [PATCH 0/4] ARM: Add support for a generic PCI Express host bridge Claudio Fontana
2015-01-07 14:07 ` Alexander Graf
2015-01-07 14:26 ` Claudio Fontana
2015-01-07 14:36 ` Alexander Graf
2015-01-07 15:16 ` Claudio Fontana
2015-01-07 16:31 ` Peter Maydell
2015-01-12 16:24 ` Claudio Fontana
2015-01-21 12:59 ` Claudio Fontana
2015-01-21 13:01 ` Alexander Graf
2015-01-21 13:02 ` Peter Maydell
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=54B40692.9040909@suse.de \
--to=agraf@suse.de \
--cc=a.rigo@virtualopensystems.com \
--cc=ard.biesheuvel@linaro.org \
--cc=claudio.fontana@huawei.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rob.herring@linaro.org \
--cc=stuart.yoder@freescale.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;
as well as URLs for NNTP newsgroup(s).