Message ID | 1350173065-35350-2-git-send-email-c.dall@virtualopensystems.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 14 October 2012 01:04, Christoffer Dall <c.dall@virtualopensystems.com> wrote: > Used to initialize the in-kernel interrupt controller. On ARM we need to > map the virtual generic interrupt controller (vGIC) into Hyp the guest's > physicall address space so the guest can access the virtual cpu > interface. This must be done after the IRQ chips is create and after a > base address has been provided for the emulated platform (patch is > following), but before the CPU is initally run. I've now written the code for that patch but don't have access to a machine with the ARM cross compile setup to build it until tomorrow. > > Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com> > --- > Documentation/virtual/kvm/api.txt | 16 ++++++++++++++++ > arch/arm/kvm/arm.c | 1 + > include/linux/kvm.h | 3 +++ > 3 files changed, 20 insertions(+) > > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt > index 25eacc6..26e953d 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -2102,6 +2102,22 @@ This ioctl returns the guest registers that are supported for the > KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. > > > +4.79 KVM_INIT_IRQCHIP > + > +Capability: KVM_CAP_INIT_IRQCHIP > +Architectures: arm > +Type: vm ioctl > +Parameters: none > +Returns: 0 on success, -1 on error > + > +Initialize the in-kernel interrupt controller. On ARM we need to map the > +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall Should that "Hyp" be deleted? "physical" > +address space so the guest can access the virtual cpu interface. This must be > +done after the IRQ chips is create and after a base address has been provided "chip". "created". > +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is > +initally run. "initially". (all these typos are also in your commit message) > + > + > 5. The kvm_run structure > ------------------------ > > diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c > index f8c377b..85c76e4 100644 > --- a/arch/arm/kvm/arm.c > +++ b/arch/arm/kvm/arm.c > @@ -195,6 +195,7 @@ int kvm_dev_ioctl_check_extension(long ext) > switch (ext) { > #ifdef CONFIG_KVM_ARM_VGIC > case KVM_CAP_IRQCHIP: > + case KVM_CAP_INIT_IRQCHIP: > r = vgic_present; > break; > #endif > diff --git a/include/linux/kvm.h b/include/linux/kvm.h > index 8091b1d..90ee023 100644 > --- a/include/linux/kvm.h > +++ b/include/linux/kvm.h > @@ -626,6 +626,7 @@ struct kvm_ppc_smmu_info { > #ifdef __KVM_HAVE_READONLY_MEM > #define KVM_CAP_READONLY_MEM 81 > #endif > +#define KVM_CAP_INIT_IRQCHIP 82 > > #ifdef KVM_CAP_IRQ_ROUTING > > @@ -839,6 +840,8 @@ struct kvm_s390_ucas_mapping { > #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) > /* Available with KVM_CAP_PPC_ALLOC_HTAB */ > #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) > +/* Available with KVM_CAP_INIT_IRQCHIP */ > +#define KVM_INIT_IRQCHIP _IO(KVMIO, 0xa8) > > /* > * ioctls for vcpu fds > -- > 1.7.9.5 > -- PMM -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Oct 17, 2012 at 4:21 PM, Peter Maydell <peter.maydell@linaro.org> wrote: > On 14 October 2012 01:04, Christoffer Dall > <c.dall@virtualopensystems.com> wrote: >> Used to initialize the in-kernel interrupt controller. On ARM we need to >> map the virtual generic interrupt controller (vGIC) into Hyp the guest's >> physicall address space so the guest can access the virtual cpu >> interface. This must be done after the IRQ chips is create and after a >> base address has been provided for the emulated platform (patch is >> following), but before the CPU is initally run. > > I've now written the code for that patch but don't have access to a machine > with the ARM cross compile setup to build it until tomorrow. > >> >> Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com> >> --- >> Documentation/virtual/kvm/api.txt | 16 ++++++++++++++++ >> arch/arm/kvm/arm.c | 1 + >> include/linux/kvm.h | 3 +++ >> 3 files changed, 20 insertions(+) >> >> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt >> index 25eacc6..26e953d 100644 >> --- a/Documentation/virtual/kvm/api.txt >> +++ b/Documentation/virtual/kvm/api.txt >> @@ -2102,6 +2102,22 @@ This ioctl returns the guest registers that are supported for the >> KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. >> >> >> +4.79 KVM_INIT_IRQCHIP >> + >> +Capability: KVM_CAP_INIT_IRQCHIP >> +Architectures: arm >> +Type: vm ioctl >> +Parameters: none >> +Returns: 0 on success, -1 on error >> + >> +Initialize the in-kernel interrupt controller. On ARM we need to map the >> +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall > > Should that "Hyp" be deleted? yup > > "physical" > >> +address space so the guest can access the virtual cpu interface. This must be >> +done after the IRQ chips is create and after a base address has been provided > > "chip". "created". > >> +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is >> +initally run. > > "initially". thanks a bunch for those, and sorry about the sloppyness. > > (all these typos are also in your commit message) > yeah, you caught my -ECUTANDPASTE there ;) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 17 October 2012 21:23, Christoffer Dall <c.dall@virtualopensystems.com> wrote: > On Wed, Oct 17, 2012 at 4:21 PM, Peter Maydell <peter.maydell@linaro.org> wrote: >>> +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is >>> +initally run. >> >> "initially". > > thanks a bunch for those, and sorry about the sloppyness. No problem. Also just noticed "platform" there :-) -- PMM -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Oct 17, 2012 at 4:31 PM, Peter Maydell <peter.maydell@linaro.org> wrote: > On 17 October 2012 21:23, Christoffer Dall > <c.dall@virtualopensystems.com> wrote: >> On Wed, Oct 17, 2012 at 4:21 PM, Peter Maydell <peter.maydell@linaro.org> wrote: >>>> +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is >>>> +initally run. >>> >>> "initially". >> >> thanks a bunch for those, and sorry about the sloppyness. > > No problem. Also just noticed "platform" there :-) > I'll spell check the diff just to be sure. :) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 10/14/2012 02:04 AM, Christoffer Dall wrote: > Used to initialize the in-kernel interrupt controller. On ARM we need to > map the virtual generic interrupt controller (vGIC) into Hyp the guest's > physicall address space so the guest can access the virtual cpu > interface. This must be done after the IRQ chips is create and after a > base address has been provided for the emulated platform (patch is > following), but before the CPU is initally run. > > > +4.79 KVM_INIT_IRQCHIP > + > +Capability: KVM_CAP_INIT_IRQCHIP > +Architectures: arm > +Type: vm ioctl > +Parameters: none > +Returns: 0 on success, -1 on error > + > +Initialize the in-kernel interrupt controller. On ARM we need to map the > +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall > +address space so the guest can access the virtual cpu interface. This must be > +done after the IRQ chips is create and after a base address has been provided > +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is > +initally run. > + What enforces this? Can it be done automatically? issue a kvm_make_request(KVM_REQ_INIT_IRQCHIP) on vcpu creation, and you'll automatically be notified before the first guest entry. Having an ioctl that must be called after point A but before point B seems pointless, when A and B are both known. > + > 5. The kvm_run structure > ------------------------ > > diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c > index f8c377b..85c76e4 100644 > --- a/arch/arm/kvm/arm.c > +++ b/arch/arm/kvm/arm.c > @@ -195,6 +195,7 @@ int kvm_dev_ioctl_check_extension(long ext) > switch (ext) { > #ifdef CONFIG_KVM_ARM_VGIC > case KVM_CAP_IRQCHIP: > + case KVM_CAP_INIT_IRQCHIP: This could be part of a baseline, if you don't envision ever taking it out.
On Thu, Oct 18, 2012 at 8:20 AM, Avi Kivity <avi@redhat.com> wrote: > On 10/14/2012 02:04 AM, Christoffer Dall wrote: >> Used to initialize the in-kernel interrupt controller. On ARM we need to >> map the virtual generic interrupt controller (vGIC) into Hyp the guest's >> physicall address space so the guest can access the virtual cpu >> interface. This must be done after the IRQ chips is create and after a >> base address has been provided for the emulated platform (patch is >> following), but before the CPU is initally run. >> >> >> +4.79 KVM_INIT_IRQCHIP >> + >> +Capability: KVM_CAP_INIT_IRQCHIP >> +Architectures: arm >> +Type: vm ioctl >> +Parameters: none >> +Returns: 0 on success, -1 on error >> + >> +Initialize the in-kernel interrupt controller. On ARM we need to map the >> +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall >> +address space so the guest can access the virtual cpu interface. This must be >> +done after the IRQ chips is create and after a base address has been provided >> +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is >> +initally run. >> + > > What enforces this? > > Can it be done automatically? issue a > kvm_make_request(KVM_REQ_INIT_IRQCHIP) on vcpu creation, and you'll > automatically be notified before the first guest entry. > > Having an ioctl that must be called after point A but before point B > seems pointless, when A and B are both known. > I reworked this according to your comments, patches on the way. thanks for the input. >> + >> 5. The kvm_run structure >> ------------------------ >> >> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c >> index f8c377b..85c76e4 100644 >> --- a/arch/arm/kvm/arm.c >> +++ b/arch/arm/kvm/arm.c >> @@ -195,6 +195,7 @@ int kvm_dev_ioctl_check_extension(long ext) >> switch (ext) { >> #ifdef CONFIG_KVM_ARM_VGIC >> case KVM_CAP_IRQCHIP: >> + case KVM_CAP_INIT_IRQCHIP: > > This could be part of a baseline, if you don't envision ever taking it out. > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt index 25eacc6..26e953d 100644 --- a/Documentation/virtual/kvm/api.txt +++ b/Documentation/virtual/kvm/api.txt @@ -2102,6 +2102,22 @@ This ioctl returns the guest registers that are supported for the KVM_GET_ONE_REG/KVM_SET_ONE_REG calls. +4.79 KVM_INIT_IRQCHIP + +Capability: KVM_CAP_INIT_IRQCHIP +Architectures: arm +Type: vm ioctl +Parameters: none +Returns: 0 on success, -1 on error + +Initialize the in-kernel interrupt controller. On ARM we need to map the +virtual generic interrupt controller (vGIC) into Hyp the guest's physicall +address space so the guest can access the virtual cpu interface. This must be +done after the IRQ chips is create and after a base address has been provided +for the emulated platofrm (see KVM_SET_DEVICE_ADDRESS), but before the CPU is +initally run. + + 5. The kvm_run structure ------------------------ diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index f8c377b..85c76e4 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -195,6 +195,7 @@ int kvm_dev_ioctl_check_extension(long ext) switch (ext) { #ifdef CONFIG_KVM_ARM_VGIC case KVM_CAP_IRQCHIP: + case KVM_CAP_INIT_IRQCHIP: r = vgic_present; break; #endif diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 8091b1d..90ee023 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -626,6 +626,7 @@ struct kvm_ppc_smmu_info { #ifdef __KVM_HAVE_READONLY_MEM #define KVM_CAP_READONLY_MEM 81 #endif +#define KVM_CAP_INIT_IRQCHIP 82 #ifdef KVM_CAP_IRQ_ROUTING @@ -839,6 +840,8 @@ struct kvm_s390_ucas_mapping { #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) /* Available with KVM_CAP_PPC_ALLOC_HTAB */ #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) +/* Available with KVM_CAP_INIT_IRQCHIP */ +#define KVM_INIT_IRQCHIP _IO(KVMIO, 0xa8) /* * ioctls for vcpu fds
Used to initialize the in-kernel interrupt controller. On ARM we need to map the virtual generic interrupt controller (vGIC) into Hyp the guest's physicall address space so the guest can access the virtual cpu interface. This must be done after the IRQ chips is create and after a base address has been provided for the emulated platform (patch is following), but before the CPU is initally run. Signed-off-by: Christoffer Dall <c.dall@virtualopensystems.com> --- Documentation/virtual/kvm/api.txt | 16 ++++++++++++++++ arch/arm/kvm/arm.c | 1 + include/linux/kvm.h | 3 +++ 3 files changed, 20 insertions(+)