All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: anthony.perard@citrix.com
Cc: Xen Devel <xen-devel@lists.xensource.com>,
	QEMU-devel <qemu-devel@nongnu.org>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Steven Smith <ssmith@xensource.com>
Subject: Re: [Qemu-devel] [PATCH V10 06/15] xen: Add the Xen platform pci device
Date: Thu, 24 Feb 2011 11:33:03 -0600	[thread overview]
Message-ID: <4D66964F.3040605@codemonkey.ws> (raw)
In-Reply-To: <1296658172-16609-7-git-send-email-anthony.perard@citrix.com>

On 02/02/2011 08:49 AM, anthony.perard@citrix.com wrote:
> From: Steven Smith<ssmith@xensource.com>
>
> Introduce a new emulated PCI device, specific to fully virtualized Xen
> guests.  The device is necessary for PV on HVM drivers to work.
>
> Signed-off-by: Steven Smith<ssmith@xensource.com>
> Signed-off-by: Anthony PERARD<anthony.perard@citrix.com>
> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
> ---
>   Makefile.target   |    1 +
>   hw/hw.h           |    3 +
>   hw/pc_piix.c      |    4 +
>   hw/pci_ids.h      |    2 +
>   hw/xen.h          |    2 +
>   hw/xen_platform.c |  348 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   xen-stub.c        |    4 +
>   7 files changed, 364 insertions(+), 0 deletions(-)
>   create mode 100644 hw/xen_platform.c
>
> diff --git a/Makefile.target b/Makefile.target
> index 00bb690..7a4fd72 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -215,6 +215,7 @@ obj-$(CONFIG_NO_XEN) += xen-stub.o
>   obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
>   obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
>   obj-i386-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
> +obj-i386-$(CONFIG_XEN) += xen_platform.o
>
>   # Inter-VM PCI shared memory
>   obj-$(CONFIG_KVM) += ivshmem.o
> diff --git a/hw/hw.h b/hw/hw.h
> index dd993de..298df31 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -672,6 +672,9 @@ extern const VMStateDescription vmstate_i2c_slave;
>   #define VMSTATE_INT32_LE(_f, _s)                                   \
>       VMSTATE_SINGLE(_f, _s, 0, vmstate_info_int32_le, int32_t)
>
> +#define VMSTATE_UINT8_TEST(_f, _s, _t)                               \
> +    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint8, uint8_t)
> +
>   #define VMSTATE_UINT16_TEST(_f, _s, _t)                               \
>       VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_info_uint16, uint16_t)
>
> diff --git a/hw/pc_piix.c b/hw/pc_piix.c
> index 0ab8907..765877c 100644
> --- a/hw/pc_piix.c
> +++ b/hw/pc_piix.c
> @@ -120,6 +120,10 @@ static void pc_init1(ram_addr_t ram_size,
>
>       pc_vga_init(pci_enabled? pci_bus: NULL);
>
> +    if (xen_enabled()) {
> +        pci_xen_platform_init(pci_bus);
> +    }
> +
>       /* init basic PC hardware */
>       pc_basic_device_init(isa_irq,&floppy_controller,&rtc_state);
>
> diff --git a/hw/pci_ids.h b/hw/pci_ids.h
> index ea3418c..6e9eabc 100644
> --- a/hw/pci_ids.h
> +++ b/hw/pci_ids.h
> @@ -108,3 +108,5 @@
>   #define PCI_DEVICE_ID_INTEL_82371AB      0x7111
>   #define PCI_DEVICE_ID_INTEL_82371AB_2    0x7112
>   #define PCI_DEVICE_ID_INTEL_82371AB_3    0x7113
> +
> +#define PCI_VENDOR_ID_XENSOURCE          0x5853
> diff --git a/hw/xen.h b/hw/xen.h
> index 3984069..53a2ca4 100644
> --- a/hw/xen.h
> +++ b/hw/xen.h
> @@ -29,6 +29,8 @@ static inline int xen_enabled(void)
>   #endif
>   }
>
> +void pci_xen_platform_init(PCIBus *bus);
> +
>   int xen_init(int smp_cpus);
>
>   #if defined(CONFIG_XEN)&&  CONFIG_XEN_CTRL_INTERFACE_VERSION<  400
> diff --git a/hw/xen_platform.c b/hw/xen_platform.c
> new file mode 100644
> index 0000000..383cfcf
> --- /dev/null
> +++ b/hw/xen_platform.c
> @@ -0,0 +1,348 @@
> +/*
> + * XEN platform pci device, formerly known as the event channel device
> + *
> + * Copyright (c) 2003-2004 Intel Corp.
> + * Copyright (c) 2006 XenSource
> + *
> + * 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.h"
> +#include "pc.h"
> +#include "pci.h"
> +#include "irq.h"
> +#include "xen_common.h"
> +#include "net.h"
> +#include "xen_backend.h"
> +#include "qemu-log.h"
> +#include "rwhandler.h"
> +
> +#include<assert.h>
> +#include<xenguest.h>
> +
> +//#define DEBUG_PLATFORM
> +
> +#ifdef DEBUG_PLATFORM
> +#define DPRINTF(fmt, ...) do { \
> +    fprintf(stderr, "xen_platform: " fmt, ## __VA_ARGS__); \
> +} while (0)
> +#else
> +#define DPRINTF(fmt, ...) do { } while (0)
> +#endif
> +
> +#define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
> +
> +typedef struct PCIXenPlatformState {
> +    PCIDevice  pci_dev;
> +    uint8_t flags; /* used only for version_id == 2 */
> +    int drivers_blacklisted;
> +    uint16_t driver_product_version;
> +
> +    /* Log from guest drivers */
> +    char log_buffer[4096];
> +    int log_buffer_off;
> +} PCIXenPlatformState;
> +
> +#define XEN_PLATFORM_IOPORT 0x10
> +
> +/* Send bytes to syslog */
> +static void log_writeb(PCIXenPlatformState *s, char val)
> +{
> +    if (val == '\n' || s->log_buffer_off == sizeof(s->log_buffer) - 1) {
> +        /* Flush buffer */
> +        s->log_buffer[s->log_buffer_off] = 0;
> +        DPRINTF("%s\n", s->log_buffer);
>    

This should go to a chardev.

Regards,

Anthony Liguori

  reply	other threads:[~2011-02-24 17:32 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 14:49 [Qemu-devel] [PATCH V10 00/15] Xen device model support anthony.perard
2011-02-02 14:49 ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 01/15] xen: Replace some tab-indents with spaces (clean-up) anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 16:06   ` [Qemu-devel] " Anthony Liguori
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 02/15] xen: Make xen build only on x86 target anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 16:11   ` [Qemu-devel] " Anthony Liguori
2011-02-24 16:25     ` [Xen-devel] " Anthony PERARD
2011-02-24 16:25       ` Anthony PERARD
2011-02-24 17:27       ` [Xen-devel] " Anthony Liguori
2011-02-24 17:27         ` Anthony Liguori
2011-02-24 17:46         ` [Xen-devel] " Jan Kiszka
2011-02-24 17:46           ` Jan Kiszka
2011-02-24 17:59           ` [Xen-devel] " Anthony Liguori
2011-02-24 17:59             ` Anthony Liguori
2011-03-11  6:20             ` [Xen-devel] " Alexander Graf
2011-03-11  6:20               ` Alexander Graf
2011-03-11 11:15               ` [Xen-devel] " Stefano Stabellini
2011-03-11 11:15                 ` Stefano Stabellini
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 03/15] xen: Support new libxc calls from xen unstable anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 17:29   ` [Qemu-devel] " Anthony Liguori
2011-02-25 14:06     ` [Xen-devel] " Anthony PERARD
2011-02-25 14:06       ` Anthony PERARD
2011-02-25 14:11       ` [Xen-devel] " Anthony Liguori
2011-02-25 14:11         ` Anthony Liguori
2011-02-25 16:01         ` [Xen-devel] " Anthony PERARD
2011-02-25 16:01           ` Anthony PERARD
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 04/15] xen: Add initialisation of Xen anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 05/15] xen: Add xenfv machine anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 17:31   ` [Qemu-devel] " Anthony Liguori
2011-02-25 13:55     ` Anthony PERARD
2011-02-25 14:09       ` Anthony Liguori
2011-02-25 14:28         ` [Xen-devel] " Anthony PERARD
2011-02-25 14:28           ` Anthony PERARD
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 06/15] xen: Add the Xen platform pci device anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 17:33   ` Anthony Liguori [this message]
2011-02-24 17:36     ` [Qemu-devel] " Paolo Bonzini
2011-02-25  9:58       ` [Xen-devel] " Ian Campbell
2011-02-25  9:58         ` Ian Campbell
2011-02-25 10:54         ` Paolo Bonzini
2011-02-25 10:54           ` Paolo Bonzini
2011-02-25 14:18           ` [Xen-devel] " Anthony PERARD
2011-02-25 14:18             ` Anthony PERARD
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 07/15] piix_pci: Introduces Xen specific call for irq anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 17:34   ` [Qemu-devel] " Anthony Liguori
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 08/15] xen: Introduce Xen Interrupt Controller anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 09/15] xen: Introduce the Xen mapcache anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 10/15] configure: Always use 64bits target physical addresses with xen enabled anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 11/15] Introduce qemu_put_ram_ptr anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 12/15] vl.c: Introduce getter for shutdown_requested and reset_requested anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 13/15] xen: Initialize event channels and io rings anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 14/15] xen: Set running state in xenstore anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-02 14:49 ` [Qemu-devel] [PATCH V10 15/15] xen: Add Xen hypercall for sleep state in the cmos_s3 callback anthony.perard
2011-02-02 14:49   ` anthony.perard
2011-02-24 17:38 ` [Qemu-devel] [PATCH V10 00/15] Xen device model support Anthony Liguori

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=4D66964F.3040605@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=anthony.perard@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ssmith@xensource.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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 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.