xen-140507-2
The following changes since commit 8d1dc5d188b84a2b2aeb9bd39fddb3d2c67be60c:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140507' into staging (2014-05-07 16:06:38 +0100)
are available in the git repository at:
git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen-140507-2
for you to fetch changes up to f31352041bdde436c3f6d07e1525a42e48dec215:
xen_disk: add discard support (2014-05-07 16:18:04 +0000)
----------------------------------------------------------------
Alexey Kardashevskiy (1):
exec: Limit translation limiting in address_space_translate to xen
Olaf Hering (1):
xen_disk: add discard support
Stefano Stabellini (1):
pass an inclusive address range to xc_domain_pin_memory_cacheattr
Wei Liu (3):
xen: move Xen PV machine files to hw/xenpv
xen: move Xen HVM files under hw/i386/xen
xen: factor out common functions
Zhenzhong Duan (1):
qemu-xen: free all the pirqs for msi/msix when driver unload
Makefile.target | 6 +-
exec.c | 2 +-
hw/block/xen_blkif.h | 12 ++++
hw/block/xen_disk.c | 33 +++++++++
hw/i386/Makefile.objs | 2 +-
hw/i386/xen/Makefile.objs | 1 +
hw/{ => i386}/xen/xen_apic.c | 0
hw/{ => i386}/xen/xen_platform.c | 0
hw/{ => i386}/xen/xen_pvdevice.c | 0
hw/xen/Makefile.objs | 1 -
hw/xen/xen_pt_config_init.c | 6 +-
hw/xen/xen_pt_msi.c | 6 +-
hw/xenpv/Makefile.objs | 2 +
hw/{i386 => xenpv}/xen_domainbuild.c | 0
hw/{i386 => xenpv}/xen_domainbuild.h | 0
hw/{i386 => xenpv}/xen_machine_pv.c | 0
include/hw/xen/xen_common.h | 7 ++
xen-common-stub.c | 19 ++++++
xen-common.c | 123 ++++++++++++++++++++++++++++++++++
xen-stub.c => xen-hvm-stub.c | 17 ++---
xen-all.c => xen-hvm.c | 123 ++++------------------------------
21 files changed, 227 insertions(+), 133 deletions(-)
create mode 100644 hw/i386/xen/Makefile.objs
rename hw/{ => i386}/xen/xen_apic.c (100%)
rename hw/{ => i386}/xen/xen_platform.c (100%)
rename hw/{ => i386}/xen/xen_pvdevice.c (100%)
create mode 100644 hw/xenpv/Makefile.objs
rename hw/{i386 => xenpv}/xen_domainbuild.c (100%)
rename hw/{i386 => xenpv}/xen_domainbuild.h (100%)
rename hw/{i386 => xenpv}/xen_machine_pv.c (100%)
create mode 100644 xen-common-stub.c
create mode 100644 xen-common.c
rename xen-stub.c => xen-hvm-stub.c (90%)
rename xen-all.c => xen-hvm.c (93%)[Qemu-devel] [PULL 1/7] exec: Limit translation limiting in address_space_translate to xen
From: Alexey Kardashevskiy <[email protected]>
The address_space_translate() function cuts the returned plen (page size) to hardcoded TARGET_PAGE_SIZE. This function can be used on pages bigger than that so this limiting should not be used on such pages.
Since originally the limiting was introduced for XEN, we can safely limit this piece of code to XEN. So does the patch.
--- exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
exec.c +1 -1
@@ -380,7 +380,7 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, as = iotlb.target_as; } -if (memory_access_is_direct (mr, is_write)) { +if (xen_enabled () &&memory_access_is_direct (mr, is_write)) {hwaddr page = ((addr &TARGET_PAGE_MASK ) +TARGET_PAGE_SIZE ) - addr; len =MIN (page, len); }
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 2/7] qemu-xen: free all the pirqs for msi/msix when driver unload
In reply to Stefano StabelliniFrom: Zhenzhong Duan <[email protected]>
Pirqs are not freed when driver unload, then new pirqs are allocated when driver reload. This could exhaust pirqs if do it in a loop.
This patch fixes the bug by freeing pirqs when ENABLE bit is cleared in msi/msix control reg.
There is also other way of fixing it such as reuse pirqs between driver reload, but this way is better.
Xen-devel: http://marc.info/?l=xen-devel&m=136800120304275&w=2
--- hw/xen/xen_pt_config_init.c | 6 ++++-- hw/xen/xen_pt_msi.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
hw/xen/xen_pt_config_init.c +4 -2
@@ -1123,8 +1123,8 @@ static int xen_pt_msgctrl_reg_write(XenPCIPassthroughState *s, msi->mapped = true; } msi->flags |=PCI_MSI_FLAGS_ENABLE ; - }else { - msi->flags &= ~PCI_MSI_FLAGS_ENABLE ; + }else if (msi->mapped) { +xen_pt_msi_disable (s); }/* pass through MSI_ENABLE bit */
@@ -1397,6 +1397,8 @@ static int xen_pt_msixctrl_reg_write(XenPCIPassthroughState *s,if ((*val &PCI_MSIX_FLAGS_ENABLE ) && !(*val &PCI_MSIX_FLAGS_MASKALL )) {xen_pt_msix_update (s); + }else if (!(*val &PCI_MSIX_FLAGS_ENABLE ) && s->msix->enabled) { +xen_pt_msix_disable (s); } debug_msix_enabled_old = s->msix->enabled;
hw/xen/xen_pt_msi.c +4 -2
@@ -282,7 +282,8 @@ void xen_pt_msi_disable(XenPCIPassthroughState *s) msi->initialized);/* clear msi info */ - msi->flags =0 ; + msi->flags &= ~PCI_MSI_FLAGS_ENABLE ; + msi->initialized = false; msi->mapped = false; msi->pirq =XEN_PT_UNASSIGNED_PIRQ ; }
@@ -446,7 +447,8 @@ static void pci_msix_write(void *opaque, hwaddr addr,if (offset !=PCI_MSIX_ENTRY_VECTOR_CTRL ) {const volatile uint32_t *vec_ctrl; -if (get_entry_value (entry, offset) == val) { +if (get_entry_value (entry, offset) == val + && entry->pirq !=XEN_PT_UNASSIGNED_PIRQ ) {return ; }
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 3/7] xen: move Xen PV machine files to hw/xenpv
In reply to Stefano StabelliniFrom: Wei Liu <[email protected]>
--- hw/i386/Makefile.objs | 2 +- hw/i386/xen_domainbuild.c | 299 -------------------------------------------- hw/i386/xen_domainbuild.h | 13 -- hw/i386/xen_machine_pv.c | 109 ---------------- hw/xenpv/Makefile.objs | 2 + hw/xenpv/xen_domainbuild.c | 299 ++++++++++++++++++++++++++++++++++++++++++++ hw/xenpv/xen_domainbuild.h | 13 ++ hw/xenpv/xen_machine_pv.c | 109 ++++++++++++++++ 8 files changed, 424 insertions(+), 422 deletions(-) delete mode 100644 hw/i386/xen_domainbuild.c delete mode 100644 hw/i386/xen_domainbuild.h delete mode 100644 hw/i386/xen_machine_pv.c create mode 100644 hw/xenpv/Makefile.objs create mode 100644 hw/xenpv/xen_domainbuild.c create mode 100644 hw/xenpv/xen_domainbuild.h create mode 100644 hw/xenpv/xen_machine_pv.c
hw/i386/Makefile.objs +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += multiboot.o smbios.o obj-y += pc.o pc_piix.o pc_q35.o obj-y += pc_sysfw.o -obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o +obj-$(CONFIG_XEN) += ../xenpv/ obj-y += kvmvapic.o obj-y += acpi-build.o
hw/i386/xen_domainbuild.c deleted +0 -299
299 lines not on this page · raw message
hw/i386/xen_domainbuild.h deleted +0 -13
@@ -1,13 +0,0 @@ -#ifndef QEMU_HW_XEN_DOMAINBUILD_H -#define QEMU_HW_XEN_DOMAINBUILD_H 1 - -#include "hw/xen/xen_common.h" - -int xenstore_domain_init1 (const char *kernel,const char *ramdisk, -const char *cmdline); -int xenstore_domain_init2 (int xenstore_port,int xenstore_mfn, -int console_port,int console_mfn); -int xen_domain_build_pv (const char *kernel,const char *ramdisk, -const char *cmdline); - -#endif /* QEMU_HW_XEN_DOMAINBUILD_H */
hw/i386/xen_machine_pv.c deleted +0 -109
109 lines not on this page · raw message
hw/xenpv/Makefile.objs new file +2 -0
@@ -0,0 +1,2 @@ +# Xen PV machine support +obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
hw/xenpv/xen_domainbuild.c new file +299 -0
299 lines not on this page · raw message
hw/xenpv/xen_domainbuild.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef QEMU_HW_XEN_DOMAINBUILD_H +#define QEMU_HW_XEN_DOMAINBUILD_H 1 + +#include "hw/xen/xen_common.h" + +int xenstore_domain_init1 (const char *kernel,const char *ramdisk, +const char *cmdline); +int xenstore_domain_init2 (int xenstore_port,int xenstore_mfn, +int console_port,int console_mfn); +int xen_domain_build_pv (const char *kernel,const char *ramdisk, +const char *cmdline); + +#endif /* QEMU_HW_XEN_DOMAINBUILD_H */
hw/xenpv/xen_machine_pv.c new file +109 -0
109 lines not on this page · raw message
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 4/7] xen: move Xen HVM files under hw/i386/xen
In reply to Stefano StabelliniFrom: Wei Liu <[email protected]>
--- hw/i386/Makefile.objs | 2 +- hw/i386/xen/Makefile.objs | 1 + hw/i386/xen/xen_apic.c | 97 ++++++++++ hw/i386/xen/xen_platform.c | 450 ++++++++++++++++++++++++++++++++++++++++++++ hw/i386/xen/xen_pvdevice.c | 135 +++++++++++++ hw/xen/Makefile.objs | 1 - hw/xen/xen_apic.c | 97 ---------- hw/xen/xen_platform.c | 450 -------------------------------------------- hw/xen/xen_pvdevice.c | 135 ------------- 9 files changed, 684 insertions(+), 684 deletions(-) create mode 100644 hw/i386/xen/Makefile.objs create mode 100644 hw/i386/xen/xen_apic.c create mode 100644 hw/i386/xen/xen_platform.c create mode 100644 hw/i386/xen/xen_pvdevice.c delete mode 100644 hw/xen/xen_apic.c delete mode 100644 hw/xen/xen_platform.c delete mode 100644 hw/xen/xen_pvdevice.c
hw/i386/Makefile.objs +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += multiboot.o smbios.o obj-y += pc.o pc_piix.o pc_q35.o obj-y += pc_sysfw.o -obj-$(CONFIG_XEN) += ../xenpv/ +obj-$(CONFIG_XEN) += ../xenpv/ xen/ obj-y += kvmvapic.o obj-y += acpi-build.o
hw/i386/xen/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-y += xen_platform.o xen_apic.o xen_pvdevice.o
hw/i386/xen/xen_apic.c new file +97 -0
97 lines not on this page · raw message
hw/i386/xen/xen_platform.c new file +450 -0
450 lines not on this page · raw message
hw/i386/xen/xen_pvdevice.c new file +135 -0
135 lines not on this page · raw message
hw/xen/Makefile.objs +0 -1
@@ -1,6 +1,5 @@ # xen backend driver support common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o -obj-$(CONFIG_XEN_I386) += xen_platform.o xen_apic.o xen_pvdevice.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
hw/xen/xen_apic.c deleted +0 -97
97 lines not on this page · raw message
hw/xen/xen_platform.c deleted +0 -450
450 lines not on this page · raw message
hw/xen/xen_pvdevice.c deleted +0 -135
135 lines not on this page · raw message
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 5/7] xen: factor out common functions
In reply to Stefano StabelliniFrom: Wei Liu <[email protected]>
So common functions used by both HVM and PV are factored out from xen-all.c to xen-common.c.
Finally rename xen-all.c to xen-hvm.c, as those functions are only useful to HVM guest.
Create *-stub files and modify Makefile.target to reflect the changes.
--- Makefile.target | 6 +- xen-all.c | 1228 ----------------------------------------------------- xen-common-stub.c | 19 + xen-common.c | 123 ++++++ xen-hvm-stub.c | 61 +++ xen-hvm.c | 1129 ++++++++++++++++++++++++++++++++++++++++++++++++ xen-stub.c | 70 --- 7 files changed, 1336 insertions(+), 1300 deletions(-) delete mode 100644 xen-all.c create mode 100644 xen-common-stub.c create mode 100644 xen-common.c create mode 100644 xen-hvm-stub.c create mode 100644 xen-hvm.c delete mode 100644 xen-stub.c
Makefile.target +4 -2
@@ -120,8 +120,10 @@ obj-y += dump.o LIBS+=$(libs_softmmu) # xen support -obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o -obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o +obj-$(CONFIG_XEN) += xen-common.o +obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o +obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o +obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o # Hardware support ifeq ($(TARGET_NAME), sparc64)
xen-all.c deleted +0 -1228
1,228 lines not on this page · raw message
xen-common-stub.c new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2014 Citrix Systems UK Ltd. +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#include "qemu-common.h" +#include "hw/xen/xen.h" + +void xenstore_store_pv_console_info (int i,CharDriverState *chr) +{ +} + +int xen_init (MachineClass *mc) +{ +return -ENOSYS ; +} +
xen-common.c new file +123 -0
123 lines not on this page · raw message
xen-hvm-stub.c new file +61 -0
61 lines not on this page · raw message
xen-hvm.c new file +1129 -0
1,129 lines not on this page · raw message
xen-stub.c deleted +0 -70
70 lines not on this page · raw message
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 6/7] pass an inclusive address range to xc_domain_pin_memory_cacheattr
In reply to Stefano Stabellinixc_domain_pin_memory_cacheattr expects an inclusive address range:
adjust the parameters.
--- xen-hvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen-hvm.c +1 -1
@@ -323,7 +323,7 @@ go_physmap:xc_domain_pin_memory_cacheattr (xen_xc, xen_domid, start_addr >>TARGET_PAGE_BITS , - (start_addr + size) >>TARGET_PAGE_BITS , + (start_addr + size -1 ) >>TARGET_PAGE_BITS ,XEN_DOMCTL_MEM_CACHEATTR_WB ); snprintf(path, sizeof(path),
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 7/7] xen_disk: add discard support
In reply to Stefano StabelliniFrom: Olaf Hering <[email protected]>
Implement discard support for xen_disk. It makes use of the existing discard code in qemu.
The discard support is enabled unconditionally. The tool stack may provide a property "discard-enable" in the backend node to optionally disable discard support. This is helpful in case the backing file was intentionally created non-sparse to avoid fragmentation.
--- hw/block/xen_blkif.h | 12 ++++++++++++ hw/block/xen_disk.c | 33 +++++++++++++++++++++++++++++++++ include/hw/xen/xen_common.h | 7 +++++++ 3 files changed, 52 insertions(+)
hw/block/xen_blkif.h +12 -0
@@ -79,6 +79,12 @@ static inline void blkif_get_x86_32_req(blkif_request_t *dst, blkif_x86_32_reque dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; +if (src->operation ==BLKIF_OP_DISCARD ) { +struct blkif_request_discard *s = (void *)src; +struct blkif_request_discard *d = (void *)dst; + d->nr_sectors = s->nr_sectors; +return ; + }if (n > src->nr_segments) n = src->nr_segments;for (i =0 ; i < n; i++)
@@ -94,6 +100,12 @@ static inline void blkif_get_x86_64_req(blkif_request_t *dst, blkif_x86_64_reque dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; +if (src->operation ==BLKIF_OP_DISCARD ) { +struct blkif_request_discard *s = (void *)src; +struct blkif_request_discard *d = (void *)dst; + d->nr_sectors = s->nr_sectors; +return ; + }if (n > src->nr_segments) n = src->nr_segments;for (i =0 ; i < n; i++)
hw/block/xen_disk.c +33 -0
@@ -114,6 +114,7 @@ struct XenBlkDev {int requests_finished;/* Persistent grants extension */ +gboolean feature_discard;gboolean feature_persistent;GTree *persistent_gnts;unsigned int persistent_gnt_count;
@@ -253,6 +254,8 @@ static int ioreq_parse(struct ioreq *ioreq)case BLKIF_OP_WRITE : ioreq->prot =PROT_READ ;/* from memory */ break ; +case BLKIF_OP_DISCARD : +return 0 ;default :xen_be_printf (&blkdev->xendev,0 ,"error: unknown operation (%d)\n" , ioreq->req.operation);
@@ -492,6 +495,7 @@ static void qemu_aio_complete(void *opaque, int ret)case BLKIF_OP_READ :bdrv_acct_done (ioreq->blkdev->bs, &ioreq->acct);break ; +case BLKIF_OP_DISCARD :default :break ; }
@@ -532,6 +536,15 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) &ioreq->v, ioreq->v.size /BLOCK_SIZE , qemu_aio_complete, ioreq);break ; +case BLKIF_OP_DISCARD : + { +struct blkif_request_discard *discard_req = (void *)&ioreq->req; + ioreq->aio_inflight++; +bdrv_aio_discard (blkdev->bs, + discard_req->sector_number, discard_req->nr_sectors, + qemu_aio_complete, ioreq); +break ; + }default :/* unknown operation (shouldn't happen -- parse catches this) */ goto err;
@@ -710,6 +723,21 @@ static void blk_alloc(struct XenDevice *xendev) } } +static void blk_parse_discard (struct XenBlkDev *blkdev) +{ +int enable; + + blkdev->feature_discard = true; + +if (xenstore_read_be_int (&blkdev->xendev,"discard-enable" , &enable) ==0 ) { + blkdev->feature_discard = !!enable; + } + +if (blkdev->feature_discard) { +xenstore_write_be_int (&blkdev->xendev,"feature-discard" ,1 ); + } +} +static int blk_init (struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
@@ -777,6 +805,8 @@ static int blk_init(struct XenDevice *xendev)xenstore_write_be_int (&blkdev->xendev,"feature-persistent" ,1 );xenstore_write_be_int (&blkdev->xendev,"info" , info); +blk_parse_discard (blkdev); +g_free (directiosafe);return 0 ;
@@ -812,6 +842,9 @@ static int blk_connect(struct XenDevice *xendev) qflags |=BDRV_O_RDWR ; readonly = false; } +if (blkdev->feature_discard) { + qflags |=BDRV_O_UNMAP ; + }/* init qemu block driver */ index = (blkdev->xendev.dev -202 *256 ) /16 ;
include/hw/xen/xen_common.h +7 -0
@@ -144,6 +144,13 @@ static inline int xen_xc_hvm_inject_msi(XenXC xen_xc, domid_t dom, {return -ENOSYS ; } +/* The followings are only to compile op_discard related code on older +* Xen releases. */ +#define BLKIF_OP_DISCARD 5 +struct blkif_request_discard { +uint64_t nr_sectors; +uint64_t sector_number; +};#else static inline int xen_xc_hvm_inject_msi (XenXC xen_xc,domid_t dom,uint64_t addr,uint32_t data)
Signature · 1 line
1.7.10.4
Peter Maydell
AppliedQuoted 4 lines · Stefano Stabellini
The following changes since commit
8d1dc5d188b84a2b2aeb9bd39fddb3d2c67be60c:Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140507' into staging (2014-05-07 16:06:38 +0100)
Quoted 8 lines
are available in the git repository at:
git://xenbits.xen.org/people/sstabellini/qemu-dm.gitxen-140507-2for you to fetch changes up to
f31352041bdde436c3f6d07e1525a42e48dec215:
xen_disk: add discard support (2014-05-07 16:18:04 +0000)
Applied, thanks.
-- PMM