Re: [RFC PATCH] vfio/pci: Use kernel VPD access functions

2015-09-11 Thread Rustad, Mark D
Alex, > On Sep 11, 2015, at 11:16 AM, Alex Williamson > wrote: > > RFC - Is this something we should do? Superficially this looks pretty good. I need to think harder to be sure of the details. > Should we consider providing > similar emulation through PCI sysfs to allow lspci to also make us

[PATCH] vfio: Whitelist PCI bridges

2015-09-11 Thread Alex Williamson
When determining whether a group is viable, we already allow devices bound to pcieport. Generalize this to include any PCI bridge device. Signed-off-by: Alex Williamson --- drivers/vfio/vfio.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a

[RFC PATCH] vfio/pci: Use kernel VPD access functions

2015-09-11 Thread Alex Williamson
The PCI VPD capability operates on a set of window registers in PCI config space. Writing to the address register triggers either a read or write, depending on the setting of the PCI_VPD_ADDR_F bit within the address register. The data register provides either the source for writes or the target

[PATCH v2 kvmtool] Make static libc and guest-init functionality optional.

2015-09-11 Thread Dimitri John Ledkov
If one typically only boots full disk-images, one wouldn't necessaraly want to statically link glibc, for the guest-init feature of the kvmtool. As statically linked glibc triggers haevy security maintainance. Signed-off-by: Dimitri John Ledkov --- Changes since v1: - rename CONFIG_HAS_LIBC to

Re: [PATCH v2 08/22] KVM: ARM64: PMU: Add perf event map and introduce perf event creating function

2015-09-11 Thread Marc Zyngier
On 11/09/15 14:35, Shannon Zhao wrote: > > > On 2015/9/11 19:04, Marc Zyngier wrote: [...] >> Having had a chat with Will, it appears that a much better solution >> would be to ask perf to use raw events instead of trying to map things >> to perf events (which the guest has already done). >> >>

Re: [PATCH kvmtool] Make static libc and guest-init functionality optional.

2015-09-11 Thread Dimitri John Ledkov
On 11 September 2015 at 13:47, Andre Przywara wrote: > Hi Dimitri, > > thanks for sharing this patch and sorry for the delay. No worries, I have a few more patches to send, polishing them for release. > > (CC:ing Will) > > On 04/09/15 13:04, Dimitri John Ledkov wrote: >> If one typically only bo

Re: [PATCH v2 08/22] KVM: ARM64: PMU: Add perf event map and introduce perf event creating function

2015-09-11 Thread Shannon Zhao
On 2015/9/11 19:04, Marc Zyngier wrote: On 11/09/15 09:55, Shannon Zhao wrote: From: Shannon Zhao When we use tools like perf on host, perf passes the event type and the id of this event type category to kernel, then kernel will map them to hardware event number and write this number to PMU

Re: [PATCH v4 3/4] irqchip: GIC: Convert to EOImode == 1

2015-09-11 Thread Julien Grall
On 11/09/15 12:09, Marc Zyngier wrote: > On 11/09/15 11:59, Julien Grall wrote: >> >> >> On 11/09/2015 11:54, Ian Campbell wrote: >>> On Thu, 2015-09-10 at 17:23 +0100, Julien Grall wrote: I applied the two patches on top of linus/master and I'm able to boot correctly on X-gene. Thank you

Re: [PATCH kvmtool] Make static libc and guest-init functionality optional.

2015-09-11 Thread Andre Przywara
Hi Dimitri, thanks for sharing this patch and sorry for the delay. (CC:ing Will) On 04/09/15 13:04, Dimitri John Ledkov wrote: > If one typically only boots full disk-images, one wouldn't necessaraly > want to statically link glibc, for the guest-init feature of the > kvmtool. As statically link

Re: [PATCH v7 15/17] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is blocked. > > pre-block: > - Add the vCPU to the blocked per-CPU list > - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR > > post-block: > - Remove the vCPU from the per-CPU list > > Signed-off-by: F

Re: [PATCH v2 6/8] arm/arm64: KVM: Add forwarded physical interrupts documentation

2015-09-11 Thread Andre Przywara
Hi Christoffer, (actually you are not supposed to reply during your holidays!) On 09/09/15 09:49, Christoffer Dall wrote: > On Tue, Sep 8, 2015 at 6:57 PM, Andre Przywara wrote: >> Hi Eric, >> >> thanks for you answer. >> >> On 08/09/15 09:43, Eric Auger wrote: >>> Hi Andre, >>> On 09/07/2015 01

Re: [PATCH v4 3/4] irqchip: GIC: Convert to EOImode == 1

2015-09-11 Thread Marc Zyngier
On 11/09/15 11:59, Julien Grall wrote: > > > On 11/09/2015 11:54, Ian Campbell wrote: >> On Thu, 2015-09-10 at 17:23 +0100, Julien Grall wrote: >>> I applied the two patches on top of linus/master and I'm able to boot >>> correctly on X-gene. Thank you! >> >> Perhaps we should replicate this appr

Re: [PATCH v7 17/17] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Enable VT-d Posted-Interrtups and add a command line > parameter for it. > > Signed-off-by: Feng Wu > --- > Documentation/kernel-parameters.txt | 1 + > drivers/iommu/irq_remapping.c | 12 > 2 files changed, 9 insertions(+), 4 deletions

Re: [PATCH v2 08/22] KVM: ARM64: PMU: Add perf event map and introduce perf event creating function

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:55, Shannon Zhao wrote: > From: Shannon Zhao > > When we use tools like perf on host, perf passes the event type and the > id of this event type category to kernel, then kernel will map them to > hardware event number and write this number to PMU PMEVTYPER_EL0 > register. While we'

Re: [PATCH v7 16/17] KVM: Warn if 'SN' is set during posting interrupts by software

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Currently, we don't support urgent interrupt, all interrupts > are recognized as non-urgent interrupt, so we cannot post > interrupts when 'SN' is set. > > If the vcpu is in guest mode, it cannot have been scheduled out, > and that's the only case when SN is

Re: [PATCH v4 3/4] irqchip: GIC: Convert to EOImode == 1

2015-09-11 Thread Julien Grall
On 11/09/2015 11:54, Ian Campbell wrote: On Thu, 2015-09-10 at 17:23 +0100, Julien Grall wrote: I applied the two patches on top of linus/master and I'm able to boot correctly on X-gene. Thank you! Perhaps we should replicate this approach in Xen and get rid of PLATFORM_QUIRK_GIC_64K_STRID

Re: [PATCH v7 14/17] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > This patch updates the Posted-Interrupts Descriptor when vCPU > is preempted. > > sched out: > - Set 'SN' to suppress furture non-urgent interrupts posted for > the vCPU. > > sched in: > - Clear 'SN' > - Change NDST if vCPU is scheduled to a different CPU >

Re: [PATCH v4 3/4] irqchip: GIC: Convert to EOImode == 1

2015-09-11 Thread Ian Campbell
On Thu, 2015-09-10 at 17:23 +0100, Julien Grall wrote: > I applied the two patches on top of linus/master and I'm able to boot > correctly on X-gene. Thank you! Perhaps we should replicate this approach in Xen and get rid of PLATFORM_QUIRK_GIC_64K_STRIDE? Ian. -- To unsubscribe from this list: s

Re: [PATCH v7 08/17] vfio: Select IRQ_BYPASS_MANAGER for vfio PCI devices

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Enable irq bypass manager for vfio PCI devices. > > Signed-off-by: Feng Wu > --- > drivers/vfio/pci/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig > index 579d83b..02912f1 100644 > ---

Re: [PATCH v7 07/17] KVM: make kvm_set_msi_irq() public

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Make kvm_set_msi_irq() public, we can use this function outside. > > Signed-off-by: Feng Wu > --- > arch/x86/include/asm/kvm_host.h | 4 > arch/x86/kvm/irq_comm.c | 4 ++-- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/a

Re: [PATCH v7 06/17] KVM: Make struct kvm_irq_routing_table accessible

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Move struct kvm_irq_routing_table from irqchip.c to kvm_host.h, > so we can use it outside of irqchip.c. > > Signed-off-by: Feng Wu > --- > include/linux/kvm_host.h | 14 ++ > virt/kvm/irqchip.c | 10 -- > 2 files changed, 14 inse

Re: [PATCH v7 04/17] KVM: Get Posted-Interrupts descriptor address from 'struct kvm_vcpu'

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Define an interface to get PI descriptor address from the vCPU structure. > > Signed-off-by: Feng Wu See the later review, this interface and the one in patch 5 is too low-level. Paolo > --- > arch/x86/include/asm/kvm_host.h | 2 ++ > arch/x86/kvm/vmx.

Re: [PATCH v7 11/17] KVM: Define two weak arch callbacks for irq bypass manager

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > Define two weak arch callbacks so that archs that don't need > them don't need define them. > > Signed-off-by: Feng Wu > --- > virt/kvm/eventfd.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c

Re: [PATCH v7 13/17] KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd'

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > +void kvm_arch_irqfd_init(struct kvm_kernel_irqfd *irqfd) > +{ > + irqfd->arch_update = kvm_arch_update_pi_irte; > +} > + > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_exit); > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_inj_virq); > EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_page_fa

Re: [PATCH v7 12/17] KVM: Implement IRQ bypass consumer callbacks for x86

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > + struct kvm_kernel_irqfd *irqfd = > + container_of(cons, struct kvm_kernel_irqfd, consumer); > + > + irqfd->producer = prod; This assignment should be under "if (kvm_x86_ops->update_pi_irte)". > + return kvm_arch_update_pi_irte(irqf

Re: [PATCH v7 10/17] KVM: x86: Update IRTE for posted-interrupts

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > +int kvm_arch_update_pi_irte(struct kvm *kvm, unsigned int host_irq, > + uint32_t guest_irq, bool set) Please move all of this code to a vmx.c callback instead of adding get_pi_desc_addr. Check if this makes the pi_set_sn and pi_clear

Re: [PATCH v2 07/22] KVM: ARM64: Add reset and access handlers for PMCEID0 and PMCEID1 register

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:55, Shannon Zhao wrote: > From: Shannon Zhao > > Add reset handler which gets host value of PMCEID0 or PMCEID1. Since > write action to PMCEID0 or PMCEID1 is ignored, add a new case for this. > > Signed-off-by: Shannon Zhao > --- > arch/arm64/kvm/sys_regs.c | 36

Re: [PATCH v7 03/17] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > This patch defines a new interface kvm_intr_is_single_vcpu(), > which can returns whether the interrupt is for single-CPU or not. > > It is used by VT-d PI, since now we only support single-CPU > interrupts, For lowest-priority interrupts, if user configures

Re: [PATCH V4 2/4] kvm: fix double free for fast mmio eventfd

2015-09-11 Thread Cornelia Huck
On Fri, 11 Sep 2015 17:25:45 +0800 Jason Wang wrote: > On 09/11/2015 03:46 PM, Cornelia Huck wrote: > > On Fri, 11 Sep 2015 11:17:35 +0800 > > Jason Wang wrote: > >> + > >> + /* When length is ignored, MMIO is also put on a separate bus, for > >> + * faster lookups. > >> + */ > >> + if (!

Re: [PATCH v2 05/22] KVM: ARM64: Add a helper for CP15 registers reset to UNKNOWN

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:54, Shannon Zhao wrote: > From: Shannon Zhao > > Signed-off-by: Shannon Zhao > --- > arch/arm64/kvm/sys_regs.h | 8 > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h > index d411e25..a0b3811 100644 > --- a/arch/arm6

Re: [PATCH v7 02/17] KVM: Add some helper functions for Posted-Interrupts

2015-09-11 Thread Paolo Bonzini
On 25/08/2015 10:50, Feng Wu wrote: > This patch adds some helper functions to manipulate the > Posted-Interrupts Descriptor. > > Signed-off-by: Feng Wu > --- > arch/x86/kvm/vmx.c | 26 ++ > 1 file changed, 26 insertions(+) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x8

Re: [PATCH v2 05/22] KVM: ARM64: Add a helper for CP15 registers reset to UNKNOWN

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:54, Shannon Zhao wrote: > From: Shannon Zhao > > Signed-off-by: Shannon Zhao > --- > arch/arm64/kvm/sys_regs.h | 8 > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h > index d411e25..a0b3811 100644 > --- a/arch/arm6

Re: [PATCH v2 04/22] KVM: ARM64: Add reset and access handlers for PMCR_EL0 register

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:54, Shannon Zhao wrote: > From: Shannon Zhao > > Add reset handler which gets host value of PMCR_EL0 and make writable > bits architecturally UNKNOWN. Add a common access handler for PMU > registers which emulates writing and reading register and add emulation > for PMCR. > > Sign

Re: [PATCH v2 02/22] KVM: ARM64: Define PMU data structure for each vcpu

2015-09-11 Thread Shannon Zhao
On 2015/9/11 17:10, Marc Zyngier wrote: > On 11/09/15 09:54, Shannon Zhao wrote: >> From: Shannon Zhao >> >> Here we plan to support virtual PMU for guest by full software >> emulation, so define some basic structs and functions preparing for >> futher steps. Define struct kvm_pmc for performanc

[Bug 104271] Boot crashes on Lenovo W520 with KVM and Discrete Graphic enabled in BIOS

2015-09-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=104271 Hans Streibel changed: What|Removed |Added Component|kvm |PCI Version|unspecified

Re: [PATCH V4 0/4] Fast MMIO eventfd fixes

2015-09-11 Thread Jason Wang
On 09/11/2015 04:33 PM, Paolo Bonzini wrote: > > On 11/09/2015 10:15, Michael S. Tsirkin wrote: >> I think we should add a capability for fast mmio. >> This way, userspace can avoid crashing buggy kernels. > I agree. > > Paolo Right, then qemu will use datamatch eventfd if kenrel dost not have t

Re: [PATCH V4 3/4] kvm: fix zero length mmio searching

2015-09-11 Thread Jason Wang
On 09/11/2015 04:31 PM, Cornelia Huck wrote: > On Fri, 11 Sep 2015 10:26:41 +0200 > Paolo Bonzini wrote: > >> On 11/09/2015 05:17, Jason Wang wrote: >>> + int len = r2->len ? r1->len : 0; >>> + >>> if (r1->addr < r2->addr) >>> return -1; >>> - if (r1->addr + r1->len > r2->add

Re: [PATCH V4 2/4] kvm: fix double free for fast mmio eventfd

2015-09-11 Thread Jason Wang
On 09/11/2015 03:46 PM, Cornelia Huck wrote: > On Fri, 11 Sep 2015 11:17:35 +0800 > Jason Wang wrote: > >> We register wildcard mmio eventfd on two buses, one for KVM_MMIO_BUS >> and another is KVM_FAST_MMIO_BUS but with a single iodev >> instance. This will lead an issue: kvm_io_bus_destroy() k

[Bug 104271] Boot crashes on Lenovo W520 with KVM and Discrete Graphic enabled in BIOS

2015-09-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=104271 --- Comment #4 from Hans Streibel --- Created attachment 187321 --> https://bugzilla.kernel.org/attachment.cgi?id=187321&action=edit Output of lspci -vvv -- You are receiving this mail because: You are watching the assignee of the bug. -- To

Re: [PATCH V4 1/4] kvm: factor out core eventfd assign/deassign logic

2015-09-11 Thread Jason Wang
On 09/11/2015 03:39 PM, Cornelia Huck wrote: > On Fri, 11 Sep 2015 11:17:34 +0800 > Jason Wang wrote: > >> This patch factors out core eventfd assign/deassign logic and leave >> the argument checking and bus index selection to callers. >> >> Cc: Gleb Natapov >> Cc: Paolo Bonzini >> Signed-off-

Re: [PATCH v2 02/22] KVM: ARM64: Define PMU data structure for each vcpu

2015-09-11 Thread Marc Zyngier
On 11/09/15 09:54, Shannon Zhao wrote: > From: Shannon Zhao > > Here we plan to support virtual PMU for guest by full software > emulation, so define some basic structs and functions preparing for > futher steps. Define struct kvm_pmc for performance monitor counter and > struct kvm_pmu for perfo

[PATCH v2 05/22] KVM: ARM64: Add a helper for CP15 registers reset to UNKNOWN

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.h | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h index d411e25..a0b3811 100644 --- a/arch/arm64/kvm/sys_regs.h +++ b/arch/arm64/kvm/sys_regs.h @@ -104,6

[PATCH v2 10/22] KVM: ARM64: Add reset and access handlers for PMXEVCNTR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMXEVCNTR is UNKNOWN, use reset_unknown for its reset handler. Add access handler which emulates writing and reading PMXEVCNTR register. When reading PMXEVCNTR, call perf_event_read_value to get the count value of the perf event. Signed-off-by: Shannon

[PATCH v2 08/22] KVM: ARM64: PMU: Add perf event map and introduce perf event creating function

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao When we use tools like perf on host, perf passes the event type and the id of this event type category to kernel, then kernel will map them to hardware event number and write this number to PMU PMEVTYPER_EL0 register. While we're trapping and emulating guest accesses to PMU reg

[PATCH v2 12/22] KVM: ARM64: Add reset and access handlers for PMCNTENSET and PMCNTENCLR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMCNTENSET and PMCNTENCLR is UNKNOWN, use reset_unknown for its reset handler. Add a new case to emulate writing PMCNTENSET or PMCNTENCLR register. When writing to PMCNTENSET, call perf_event_enable to enable the perf event. When writing to PMCNTENCLR,

[PATCH v2 14/22] KVM: ARM64: Add reset and access handlers for PMOVSSET and PMOVSCLR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMOVSSET and PMOVSCLR is UNKNOWN, use reset_unknown for its reset handler. Add a new case to emulate writing PMOVSSET or PMOVSCLR register. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 33 ++--- 1 file chang

[PATCH v2 06/22] KVM: ARM64: Add reset and access handlers for PMSELR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMSELR_EL0 is UNKNOWN, use reset_unknown for its reset handler. As it doesn't need to deal with the acsessing action specially, it uses default case to emulate writing and reading PMSELR register. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_re

[PATCH v2 21/22] KVM: ARM64: Free perf event of PMU when destroying vcpu

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao When KVM frees VCPU, it needs to free the perf_event of PMU. Signed-off-by: Shannon Zhao --- arch/arm/kvm/arm.c| 1 + include/kvm/arm_pmu.h | 2 ++ virt/kvm/arm/pmu.c| 21 + 3 files changed, 24 insertions(+) diff --git a/arch/arm/kvm/arm.c b/ar

[PATCH v2 00/22] KVM: ARM64: Add guest PMU support

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao This patchset adds guest PMU support for KVM on ARM64. It takes trap-and-emulate approach. When guest wants to monitor one event, it will be trapped by KVM and KVM will call perf_event API to create a perf event and call relevant perf_event APIs to get the count value of event.

[PATCH v2 11/22] KVM: ARM64: Add reset and access handlers for PMCCNTR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMCCNTR is UNKNOWN, use reset_unknown for its reset handler. Add a new case to emulate reading to PMCCNTR register. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) di

[PATCH v2 16/22] KVM: ARM64: Add reset and access handlers for PMUSERENR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMUSERENR is zero, use reset_val(_cp15) with zero for its reset handler. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys

[PATCH v2 02/22] KVM: ARM64: Define PMU data structure for each vcpu

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Here we plan to support virtual PMU for guest by full software emulation, so define some basic structs and functions preparing for futher steps. Define struct kvm_pmc for performance monitor counter and struct kvm_pmu for performance monitor unit for each vcpu. According to ARM

[PATCH v2 07/22] KVM: ARM64: Add reset and access handlers for PMCEID0 and PMCEID1 register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Add reset handler which gets host value of PMCEID0 or PMCEID1. Since write action to PMCEID0 or PMCEID1 is ignored, add a new case for this. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 36 1 file changed, 32 insertions(+),

[PATCH v2 15/22] KVM: ARM64: Add a helper for CP15 registers reset to specified value

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.h | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h index a0b3811..a476b1b 100644 --- a/arch/arm64/kvm/sys_regs.h +++ b/arch/arm64/kvm/sys_regs.h @@ -119,6

[PATCH v2 03/22] KVM: ARM64: Add offset defines for PMU registers

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao We are about to trap and emulate acccesses to each PMU register individually. This adds the context offsets for the AArch64 PMU registers and their AArch32 counterparts. Signed-off-by: Shannon Zhao --- arch/arm64/include/asm/kvm_asm.h | 59 +++

[PATCH v2 04/22] KVM: ARM64: Add reset and access handlers for PMCR_EL0 register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Add reset handler which gets host value of PMCR_EL0 and make writable bits architecturally UNKNOWN. Add a common access handler for PMU registers which emulates writing and reading register and add emulation for PMCR. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c

[PATCH v2 01/22] ARM64: Move PMU register related defines to asm/pmu.h

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao To use the ARMv8 PMU related register defines from the KVM code, we move the relevant definitions to asm/pmu.h header file. Signed-off-by: Anup Patel Signed-off-by: Shannon Zhao --- arch/arm64/include/asm/pmu.h | 45 ++ arch/arm64/k

[PATCH v2 17/22] KVM: ARM64: Add reset and access handlers for PMSWINC register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Add access handler which emulates writing and reading PMSWINC register and add support for creating software increment event. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 18 +- include/kvm/arm_pmu.h | 2 ++ virt/kvm/arm/pmu.c| 33

[PATCH v2 18/22] KVM: ARM64: Add access handlers for PMEVCNTRn and PMEVTYPERn register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Add access handler which emulates writing and reading PMEVCNTRn and PMEVTYPERn. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 164 ++ 1 file changed, 164 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/ar

[PATCH v2 09/22] KVM: ARM64: Add reset and access handlers for PMXEVTYPER register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMXEVTYPER is UNKNOWN, use reset_unknown or reset_unknown_cp15 for its reset handler. Add access handler which emulates writing and reading PMXEVTYPER register. When writing to PMXEVTYPER, call kvm_pmu_set_counter_event_type to create a perf_event for t

[PATCH v2 22/22] KVM: ARM64: Add a new kvm ARM PMU device

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Add a new kvm device type KVM_DEV_TYPE_ARM_PMU_V3 for ARM PMU. Implement the kvm_device_ops for it. Signed-off-by: Shannon Zhao --- Documentation/virtual/kvm/devices/arm-pmu.txt | 15 + arch/arm64/include/uapi/asm/kvm.h | 3 + include/linux/kvm_host.h

[PATCH v2 20/22] KVM: ARM64: Reset PMU state when resetting vcpu

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Signed-off-by: Shannon Zhao --- arch/arm64/kvm/reset.c | 3 +++ include/kvm/arm_pmu.h | 2 ++ virt/kvm/arm/pmu.c | 18 ++ 3 files changed, 23 insertions(+) diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index 0b43265..ee2c2e9 100644 --- a

[PATCH v2 19/22] KVM: ARM64: Add PMU overflow interrupt routing

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao When calling perf_event_create_kernel_counter to create perf_event, assign a overflow handler. Then when perf event overflows, set irq_pending and call kvm_vcpu_kick() to sync the interrupt. Signed-off-by: Shannon Zhao --- arch/arm/kvm/arm.c| 3 +++ include/kvm/arm_pmu.

[PATCH v2 13/22] KVM: ARM64: Add reset and access handlers for PMINTENSET and PMINTENCLR register

2015-09-11 Thread Shannon Zhao
From: Shannon Zhao Since the reset value of PMINTENSET and PMINTENCLR is UNKNOWN, use reset_unknown for its reset handler. Add a new case to emulate writing PMINTENSET or PMINTENCLR register. Signed-off-by: Shannon Zhao --- arch/arm64/kvm/sys_regs.c | 34 ++ 1 f

Re: [PATCH 01/23] userfaultfd: linux/Documentation/vm/userfaultfd.txt

2015-09-11 Thread Michael Kerrisk (man-pages)
On 05/14/2015 07:30 PM, Andrea Arcangeli wrote: > Add documentation. Hi Andrea, I do not recall... Did you write a man page also for this new system call? Thanks, Michael > Signed-off-by: Andrea Arcangeli > --- > Documentation/vm/userfaultfd.txt | 140 >

Re: [PATCH V4 3/4] kvm: fix zero length mmio searching

2015-09-11 Thread Cornelia Huck
On Fri, 11 Sep 2015 10:26:41 +0200 Paolo Bonzini wrote: > On 11/09/2015 05:17, Jason Wang wrote: > > + int len = r2->len ? r1->len : 0; > > + > > if (r1->addr < r2->addr) > > return -1; > > - if (r1->addr + r1->len > r2->addr + r2->len) > > + if (r1->addr + len > r2->addr +

Re: [PATCH V4 0/4] Fast MMIO eventfd fixes

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 10:15, Michael S. Tsirkin wrote: > I think we should add a capability for fast mmio. > This way, userspace can avoid crashing buggy kernels. I agree. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More

Re: [PATCH V4 3/4] kvm: fix zero length mmio searching

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 05:17, Jason Wang wrote: > + int len = r2->len ? r1->len : 0; > + > if (r1->addr < r2->addr) > return -1; > - if (r1->addr + r1->len > r2->addr + r2->len) > + if (r1->addr + len > r2->addr + r2->len) > return 1; Perhaps better:

Re: [PATCH V4 1/4] kvm: factor out core eventfd assign/deassign logic

2015-09-11 Thread Paolo Bonzini
On 11/09/2015 09:39, Cornelia Huck wrote: > > +static int > > +kvm_deassign_ioeventfd_idx(struct kvm *kvm, enum kvm_bus bus_idx, > > + struct kvm_ioeventfd *args) > > While this file uses newline before function name quite often, putting > it on the same line seems more comm

Re: [PATCH V4 0/4] Fast MMIO eventfd fixes

2015-09-11 Thread Michael S. Tsirkin
On Fri, Sep 11, 2015 at 11:17:33AM +0800, Jason Wang wrote: > Hi: > > This series fixes two issues of fast mmio eventfd: > > 1) A single iodev instance were registerd on two buses: KVM_MMIO_BUS >and KVM_FAST_MMIO_BUS. This will cause double in >ioeventfd_destructor() > 2) A zero length io

Re: [PATCH V4 2/4] kvm: fix double free for fast mmio eventfd

2015-09-11 Thread Cornelia Huck
On Fri, 11 Sep 2015 11:17:35 +0800 Jason Wang wrote: > We register wildcard mmio eventfd on two buses, one for KVM_MMIO_BUS > and another is KVM_FAST_MMIO_BUS but with a single iodev > instance. This will lead an issue: kvm_io_bus_destroy() knows nothing > about the devices on two buses points to

Re: [PATCH V4 1/4] kvm: factor out core eventfd assign/deassign logic

2015-09-11 Thread Cornelia Huck
On Fri, 11 Sep 2015 11:17:34 +0800 Jason Wang wrote: > This patch factors out core eventfd assign/deassign logic and leave > the argument checking and bus index selection to callers. > > Cc: Gleb Natapov > Cc: Paolo Bonzini > Signed-off-by: Jason Wang > --- > virt/kvm/eventfd.c | 83 > +